diff --git a/examples/nfc-st25tb.c b/examples/nfc-st25tb.c index 7eb5dee..178b57c 100644 --- a/examples/nfc-st25tb.c +++ b/examples/nfc-st25tb.c @@ -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); diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index e5d9d94..fdfa600 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -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