nfc_initiator_select_passive_target() function returns now libnfc error code.
This commit is contained in:
parent
ba2a7cfe2e
commit
103485518c
11 changed files with 42 additions and 41 deletions
|
|
@ -280,7 +280,7 @@ read_card (int read_unlocked)
|
|||
// Show if the readout went well
|
||||
if (bFailure) {
|
||||
// When a failure occured we need to redo the anti-collision
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt)) {
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
printf ("!\nError: tag was removed\n");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ write_card (int write_block_zero)
|
|||
// Show if the readout went well
|
||||
if (bFailure) {
|
||||
// When a failure occured we need to redo the anti-collision
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt)) {
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
printf ("!\nError: tag was removed\n");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -557,7 +557,7 @@ main (int argc, const char *argv[])
|
|||
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
|
||||
|
||||
// Try to find a MIFARE Classic tag
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt)) {
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
printf ("Error: no tag was found\n");
|
||||
nfc_disconnect (pnd);
|
||||
exit (EXIT_FAILURE);
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ write_card (void)
|
|||
// Show if the readout went well
|
||||
if (bFailure) {
|
||||
// When a failure occured we need to redo the anti-collision
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt)) {
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
ERR ("tag was removed");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ main (int argc, const char *argv[])
|
|||
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
|
||||
|
||||
// Try to find a MIFARE Ultralight tag
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt)) {
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
ERR ("no tag was found\n");
|
||||
nfc_disconnect (pnd);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ main(int argc, char *argv[])
|
|||
int error = EXIT_SUCCESS;
|
||||
// Polling payload (SENSF_REQ) must be present (see NFC Digital Protol)
|
||||
const uint8_t *pbtSensfReq = (uint8_t*)"\x00\xff\xff\x01\x00";
|
||||
if (!nfc_initiator_select_passive_target(pnd, nm, pbtSensfReq, 5, &nt)) {
|
||||
if (nfc_initiator_select_passive_target(pnd, nm, pbtSensfReq, 5, &nt) < 0) {
|
||||
nfc_perror (pnd, "nfc_initiator_select_passive_target");
|
||||
error = EXIT_FAILURE;
|
||||
goto error;
|
||||
|
|
@ -230,7 +230,7 @@ main(int argc, char *argv[])
|
|||
if (0 != memcmp (nt.nti.nfi.abtSysCode, abtNfcForumSysCode, 2)) {
|
||||
// Retry with special polling
|
||||
const uint8_t *pbtSensfReqNfcForum = (uint8_t*)"\x00\x12\xfc\x01\x00";
|
||||
if (!nfc_initiator_select_passive_target(pnd, nm, pbtSensfReqNfcForum, 5, &nt)) {
|
||||
if (nfc_initiator_select_passive_target(pnd, nm, pbtSensfReqNfcForum, 5, &nt) < 0) {
|
||||
nfc_perror (pnd, "nfc_initiator_select_passive_target");
|
||||
error = EXIT_FAILURE;
|
||||
goto error;
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ main (int argc, char *argv[])
|
|||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
};
|
||||
if (!nfc_initiator_select_passive_target (pndInitiator, nm, NULL, 0, &ntRealTarget)) {
|
||||
if (nfc_initiator_select_passive_target (pndInitiator, nm, NULL, 0, &ntRealTarget) < 0) {
|
||||
printf ("Error: no tag was found\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
exit (EXIT_FAILURE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue