Topic: Reading data from ISO14443B Card
Hello
I have a ISO14443B card and ACR122U, how can I dump the whole card data to a file? I have Ubuntu and the latest version of libnfc installed. Thank you.
nfc-tools developers community
Public platform independent Near Field Communication (NFC) library
You are not logged in. Please login or register.
nfc-tools developers community → ISO 14443-4 Type A/B (proximity) → Reading data from ISO14443B Card
Hello
I have a ISO14443B card and ACR122U, how can I dump the whole card data to a file? I have Ubuntu and the latest version of libnfc installed. Thank you.
Hello! I'm also trying to read/write datas from an ISO14443B Card. I'm quite busy right now and I don't have so much time to spend on this so my discoveries are just limited:-)
Looking inside libnfc examples and a troubleshoot in this forum I wrote this simple code that prints on console UID of the card. As you can see, you have to call "nfc_initiator_list_passive_targets" twice since there's a known bug in the library. Obviously you have to change the second "nfc_modulation nm2" settings with your card modulation. Actually I'm reading an ISO14443B-2 SR card so my modulation is "NMT_ISO14443B2SR"
Right know I'll look forward for get card datas and write inside blocks. If anyone of you have suggestions or can point me to some examples/manual it will be very appreciated:-)
// To compile this simple example:
// $ gcc -o quick_start_example1 quick_start_example1.c -lnfc
#include <stdlib.h>
#include <nfc/nfc.h>
void print_nfc_target(const nfc_target *pnt, bool verbose)
{
char *s;
str_nfc_target(&s, pnt, verbose);
printf("%s", s);
nfc_free(s);
}
int main(int argc, const char *argv[])
{
nfc_device *pnd;
nfc_target nt;
// Allocate only a pointer to nfc_context
nfc_context *context;
// Initialize libnfc and set the nfc_context
nfc_init(&context);
if (context == NULL) {
printf("Unable to init libnfc (malloc)\n");
exit(EXIT_FAILURE);
}
// Display libnfc version
const char *acLibnfcVersion = nfc_version();
(void)argc;
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
// Open, using the first available NFC device
pnd = nfc_open(context, NULL);
if (pnd == NULL) {
printf("ERROR: %s\n", "Unable to open NFC device.");
exit(EXIT_FAILURE);
}
// Set opened NFC device to initiator mode
if (nfc_initiator_init(pnd) < 0) {
nfc_perror(pnd, "nfc_initiator_init");
exit(EXIT_FAILURE);
}
printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));
nfc_target ant[1];
nfc_modulation nm;
nm.nmt = NMT_ISO14443B;
nm.nbr = NBR_106;
nfc_initiator_list_passive_targets(pnd,nm,ant,1);
printf("%s\n",nfc_strerror(pnd)); // print Success
nfc_target ant2[1];
nfc_modulation nm2;
nm2.nmt = NMT_ISO14443B2SR;
nm2.nbr = NBR_106;
int res = 0;
int n = 0;
res = nfc_initiator_list_passive_targets(pnd, nm2, ant2, 1);
printf("%s\n",nfc_strerror(pnd)); // print Success
// printf("Cart identifier: %s\n", nt.nti.nsi.abtUID);
for (n = 0; n < res; n++) {
print_nfc_target(&ant2[n], true);
printf("\n");
}
// Close NFC device
nfc_close(pnd);
// Release the context
nfc_exit(context);
exit(EXIT_SUCCESS);
}
nfc-tools developers community → ISO 14443-4 Type A/B (proximity) → Reading data from ISO14443B Card
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.