less structs and defines publicly exposed
- nfc_device is now an opaque type; - PN53x specific errors are not public anymore; - nfc_device_name() renamed to nfc_device_get_name() for the sake of consistency; - examples/*, utils/* uses the new nfc_device_get_name() function instead of access directly to struct's content; - new error defined: NFC_ERFTRANS for notifying about RF transmission error, its used by mifare.c to detect permissions error on mifare; - drivers initiator_transceive_bytes() function now returns libnfc's error code on failure (<0), and received bytes count on success (>=0); - remove some unused errors.
This commit is contained in:
parent
9bdc20353c
commit
bf7c36d9bb
29 changed files with 162 additions and 178 deletions
|
|
@ -175,7 +175,7 @@ main (int argc, char *argv[])
|
|||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf ("Connected to NFC reader: %s\n\n", pnd->acName);
|
||||
printf ("Connected to NFC reader: %s\n\n", nfc_device_get_name (pnd));
|
||||
|
||||
// Send the 7 bits request command specified in ISO 14443A (0x26)
|
||||
if (!transmit_bits (abtReqa, 7)) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ main (int argc, const char *argv[])
|
|||
printf("Unable to connect to NFC device.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf ("Connected to NFC device: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
|
||||
signal (SIGINT, stop_dep_communication);
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ main (int argc, const char *argv[])
|
|||
printf("Unable to connect to NFC device.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf ("Connected to NFC device: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
|
||||
signal (SIGINT, stop_dep_communication);
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ main(int argc, char *argv[])
|
|||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf ("Connected to NFC device: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
|
||||
|
||||
if (nfc_emulate_target (pnd, &emulator) < 0) {
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ main (int argc, char *argv[])
|
|||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf ("Connected to NFC device: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
|
||||
// Notes for ISO14443-A emulated tags:
|
||||
// * Only short UIDs are supported
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
printf ("\n");
|
||||
printf ("Connected to NFC device: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
printf ("[+] Try to break out the auto-emulation, this requires a second NFC device!\n");
|
||||
printf ("[+] To do this, please send any command after the anti-collision\n");
|
||||
printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" or \"nfc-list\" tool.\n");
|
||||
|
|
|
|||
|
|
@ -101,19 +101,18 @@ main (int argc, const char *argv[])
|
|||
|
||||
nfc_initiator_init (pnd);
|
||||
|
||||
printf ("Connected to NFC reader: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
|
||||
printf ("NFC device will poll during %ld ms (%u pollings of %lu ms for %zd modulations)\n", (unsigned long) uiPollNr * szModulations * uiPeriod * 150, uiPollNr, (unsigned long) uiPeriod * 150, szModulations);
|
||||
res = nfc_initiator_poll_target (pnd, nmModulations, szModulations, uiPollNr, uiPeriod, &nt);
|
||||
if (res) {
|
||||
if ((res = nfc_initiator_poll_target (pnd, nmModulations, szModulations, uiPollNr, uiPeriod, &nt)) < 0) {
|
||||
nfc_perror (pnd, "nfc_initiator_poll_targets");
|
||||
nfc_disconnect (pnd);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (res > 0) {
|
||||
print_nfc_target ( nt, verbose );
|
||||
} else {
|
||||
if (pnd->iLastError) {
|
||||
nfc_perror (pnd, "nfc_initiator_poll_targets");
|
||||
nfc_disconnect (pnd);
|
||||
exit (EXIT_FAILURE);
|
||||
} else {
|
||||
printf ("No target found.\n");
|
||||
}
|
||||
printf ("No target found.\n");
|
||||
}
|
||||
nfc_disconnect (pnd);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ main (int argc, char *argv[])
|
|||
|
||||
printf ("Hint: tag <---> initiator (relay) <---> target (relay) <---> original reader\n\n");
|
||||
|
||||
printf ("Connected to the NFC emulator device: %s\n", pndTag->acName);
|
||||
printf ("Connected to the NFC emulator device: %s\n", nfc_device_get_name (pndTag));
|
||||
printf ("[+] Try to break out the auto-emulation, this requires a second reader!\n");
|
||||
printf ("[+] To do this, please send any command after the anti-collision\n");
|
||||
printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n");
|
||||
|
|
@ -162,7 +162,7 @@ main (int argc, char *argv[])
|
|||
// Try to open the NFC reader
|
||||
pndReader = nfc_connect (connstrings[1]);
|
||||
|
||||
printf ("Connected to the NFC reader device: %s", pndReader->acName);
|
||||
printf ("Connected to the NFC reader device: %s", nfc_device_get_name (pndReader));
|
||||
printf ("%s", "Configuring NFC reader settings...");
|
||||
nfc_initiator_init (pndReader);
|
||||
if ((nfc_device_set_property_bool (pndReader, NP_HANDLE_CRC, false) < 0) ||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ main (int argc, const char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf ("NFC device [%s] connected.\n", pnd->acName);
|
||||
printf ("NFC device [%s] connected.\n", nfc_device_get_name (pnd));
|
||||
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx, 0);
|
||||
if (result) {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ main (int argc, const char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf ("Connected to NFC device: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
|
||||
// Print the example's menu
|
||||
printf ("\nSelect the communication mode:\n");
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ int main(int argc, const char* argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf ("Connected to NFC reader: %s\n", pnd->acName);
|
||||
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
|
||||
nfc_initiator_init(pnd);
|
||||
|
||||
char *cmd;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue