nfc_properties replace now nfc_options and nfc_configure is replaced by nfc_device_set_property_bool which returns error code.

This commit is contained in:
Audrey Diacre 2011-12-14 16:01:00 +00:00
parent c181cb35ec
commit a615d969fd
20 changed files with 292 additions and 298 deletions

View file

@ -160,18 +160,18 @@ main (int argc, char *argv[])
nfc_initiator_init (pnd);
// Configure the CRC
if (!nfc_configure (pnd, NDO_HANDLE_CRC, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Use raw send/receive methods
if (!nfc_configure (pnd, NDO_EASY_FRAMING, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Disable 14443-4 autoswitching
if (!nfc_configure (pnd, NDO_AUTO_ISO14443_4, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_AUTO_ISO14443_4, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}

View file

@ -155,7 +155,7 @@ nfc_target_emulate_tag(nfc_device *pnd, nfc_target *pnt)
}
if ( loop ) {
if ( init_mfc_auth ) {
nfc_configure (pnd, NDO_HANDLE_CRC, false);
nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false);
init_mfc_auth = false;
}
if (!nfc_target_receive_bytes(pnd, abtRx, &szRx, 0)) {
@ -257,8 +257,8 @@ main (int argc, char *argv[])
printf ("%s will emulate this ISO14443-A tag:\n", argv[0]);
print_nfc_iso14443a_info (nt.nti.nai, true);
// Switch off NDO_EASY_FRAMING if target is not ISO14443-4
nfc_configure (pnd, NDO_EASY_FRAMING, (nt.nti.nai.btSak & SAK_ISO14443_4_COMPLIANT));
// Switch off NP_EASY_FRAMING if target is not ISO14443-4
nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, (nt.nti.nai.btSak & SAK_ISO14443_4_COMPLIANT));
printf ("NFC device (configured as target) is now emulating the tag, please touch it with a second NFC device (initiator)\n");
if (!nfc_target_emulate_tag (pnd, &nt)) {
nfc_perror (pnd, "nfc_target_emulate_tag");

View file

@ -163,8 +163,8 @@ main (int argc, char *argv[])
printf ("[+] Received initiator command: ");
print_hex_bits (abtRecv, szRecvBits);
printf ("[+] Configuring communication\n");
if (!nfc_configure (pnd, NDO_HANDLE_CRC, false) || !nfc_configure (pnd, NDO_HANDLE_PARITY, true)) {
nfc_perror (pnd, "nfc_configure");
if ((nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) || (nfc_device_set_property_bool (pnd, NP_HANDLE_PARITY, true) < 0)) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
printf ("[+] Done, the emulated tag is initialized with UID: %02X%02X%02X%02X\n\n", abtUidBcc[0], abtUidBcc[1],

View file

@ -152,9 +152,9 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
printf ("%s", "Configuring emulator settings...");
if (!nfc_configure (pndTag, NDO_HANDLE_CRC, false) ||
!nfc_configure (pndTag, NDO_HANDLE_PARITY, false) || !nfc_configure (pndTag, NDO_ACCEPT_INVALID_FRAMES, true)) {
nfc_perror (pndTag, "nfc_configure");
if ((nfc_device_set_property_bool (pndTag, NP_HANDLE_CRC, false) < 0) ||
(nfc_device_set_property_bool (pndTag, NP_HANDLE_PARITY, false) < 0) || (nfc_device_set_property_bool (pndTag, NP_ACCEPT_INVALID_FRAMES, true)) < 0) {
nfc_perror (pndTag, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
printf ("%s", "Done, emulated tag is initialized");
@ -165,10 +165,10 @@ main (int argc, char *argv[])
printf ("Connected to the NFC reader device: %s", pndReader->acName);
printf ("%s", "Configuring NFC reader settings...");
nfc_initiator_init (pndReader);
if (!nfc_configure (pndReader, NDO_HANDLE_CRC, false) ||
!nfc_configure (pndReader, NDO_HANDLE_PARITY, false) ||
!nfc_configure (pndReader, NDO_ACCEPT_INVALID_FRAMES, true)) {
nfc_perror (pndReader, "nfc_configure");
if ((nfc_device_set_property_bool (pndReader, NP_HANDLE_CRC, false) < 0) ||
(nfc_device_set_property_bool (pndReader, NP_HANDLE_PARITY, false) < 0) ||
(nfc_device_set_property_bool (pndReader, NP_ACCEPT_INVALID_FRAMES, true)) < 0) {
nfc_perror (pndReader, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
printf ("%s", "Done, relaying frames now!");
@ -179,14 +179,14 @@ main (int argc, char *argv[])
// Drop down the field before sending a REQA command and start a new session
if (szReaderRxBits == 7 && abtReaderRx[0] == 0x26) {
// Drop down field for a very short time (original tag will reboot)
if (!nfc_configure (pndReader, NDO_ACTIVATE_FIELD, false)) {
nfc_perror (pndReader, "nfc_configure");
if (nfc_device_set_property_bool (pndReader, NP_ACTIVATE_FIELD, false) < 0) {
nfc_perror (pndReader, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
if (!quiet_output)
printf ("\n");
if (!nfc_configure (pndReader, NDO_ACTIVATE_FIELD, true)) {
nfc_perror (pndReader, "nfc_configure");
if (nfc_device_set_property_bool (pndReader, NP_ACTIVATE_FIELD, true) < 0) {
nfc_perror (pndReader, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
}

View file

@ -131,8 +131,8 @@ main (int argc, const char *argv[])
nfc_initiator_init (pnd);
// Let the reader only try once to find a tag
if (!nfc_configure (pnd, NDO_INFINITE_SELECT, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Read the SAM's info