diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index e233c96..3192095 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -166,7 +166,12 @@ nfc_target_emulate_tag(nfc_device *dev, nfc_target *pnt) } if (loop) { if (init_mfc_auth) { - nfc_device_set_property_bool(dev, NP_HANDLE_CRC, false); + if (nfc_device_set_property_bool(dev, NP_HANDLE_CRC, false) < 0) { + nfc_perror(pnd, "nfc_target_emulate_tag"); + nfc_close(pnd); + nfc_exit(context); + exit(EXIT_FAILURE); + } init_mfc_auth = false; } if ((szRx = nfc_target_receive_bytes(dev, abtRx, sizeof(abtRx), 0)) < 0) { @@ -276,7 +281,12 @@ main(int argc, char *argv[]) print_nfc_target(&nt, true); // 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)); + if (nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, (nt.nti.nai.btSak & SAK_ISO14443_4_COMPLIANT)) < 0) { + nfc_perror(pnd, "nfc_target_emulate_tag"); + nfc_close(pnd); + nfc_exit(context); + exit(EXIT_FAILURE); + } 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"); diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index 90312de..f012d97 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -280,8 +280,14 @@ get_rats(void) res = nfc_initiator_transceive_bytes(pnd, abtRats, sizeof(abtRats), abtRx, sizeof(abtRx), 0); if (res > 0) { // ISO14443-4 card, turn RF field off/on to access ISO14443-3 again - nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, false); - nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, true); + if (nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, false) < 0) { + nfc_perror(pnd, "nfc_configure"); + return -1; + } + if (nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, true) < 0) { + nfc_perror(pnd, "nfc_configure"); + return -1; + } } // Reselect tag if (nfc_initiator_select_passive_target(pnd, nmMifare, NULL, 0, &nt) <= 0) {