Merge pull request #739 from gentilkiwi/master
Fix `nfc_initiator_select_passive_target` target count on PN53x when not using `InListPassiveTarget`
This commit is contained in:
commit
0bfcd9cdd6
2 changed files with 7 additions and 2 deletions
|
@ -205,7 +205,8 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
printf("Reader : %s - via %s\n ...wait for card...\n", nfc_device_get_name(pnd), nfc_device_get_connstring(pnd));
|
||||
|
||||
if (nfc_initiator_select_passive_target(pnd, nm, NULL, 0, &nt) > 0)
|
||||
res = nfc_initiator_select_passive_target(pnd, nm, NULL, 0, &nt);
|
||||
if (res > 0)
|
||||
{
|
||||
stcurrent = get_info(&nt, true);
|
||||
if(stcurrent)
|
||||
|
@ -234,6 +235,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
}
|
||||
else printf("ERROR - nfc_initiator_select_passive_target: %i\n", res);
|
||||
}
|
||||
else printf("ERROR - nfc_initiator_init: %i\n", res);
|
||||
|
||||
|
|
|
@ -1267,6 +1267,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
|
|||
szTargetsData = (size_t)res;
|
||||
}
|
||||
found = true;
|
||||
res = 1; // TargetCount to 1 as only one target is supported here
|
||||
break;
|
||||
} while (pnd->bInfiniteSelect);
|
||||
if (! found)
|
||||
|
@ -1347,6 +1348,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
|
|||
return res;
|
||||
}
|
||||
found = true;
|
||||
res = 1; // TargetCount to 1 as only one target is supported here
|
||||
break;
|
||||
} while (pnd->bInfiniteSelect);
|
||||
if (! found) {
|
||||
|
@ -1377,6 +1379,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
|
|||
return res;
|
||||
}
|
||||
}
|
||||
res = abtTargetsData[0]; // TargetCount to abtTargetsData[0] (Tg from InListPassiveTarget answer)
|
||||
}
|
||||
if (pn53x_current_target_new(pnd, &nttmp) == NULL) {
|
||||
pnd->last_error = NFC_ESOFT;
|
||||
|
@ -1386,7 +1389,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
|
|||
if (pnt) {
|
||||
memcpy(pnt, &nttmp, sizeof(nfc_target));
|
||||
}
|
||||
return abtTargetsData[0];
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in a new issue