From f2cb0eaa6e14377ce6791e5b47f29d119075cb68 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 3 May 2011 19:22:28 +0000 Subject: [PATCH] list_passive_targets: fixed for TypeB on LoGO --- libnfc/nfc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libnfc/nfc.c b/libnfc/nfc.c index b55e241..1e95e09 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -390,6 +390,12 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, while (nfc_initiator_select_passive_target (pnd, nm, pbtInitData, szInitDataLen, &nt)) { nfc_initiator_deselect_target (pnd); + // some readers have to reset the RF field (e.g. LoGO) so we stop if we see more than once the same tag + if (nm.nmt == NMT_ISO14443B && szTargetFound >= 1) { + if (0 == memcmp(nt.nti.nbi.abtPupi, ant[0].nti.nbi.abtPupi, sizeof (nt.nti.nbi.abtPupi))) { + break; + } + } if (szTargets > szTargetFound) { memcpy (&(ant[szTargetFound]), &nt, sizeof (nfc_target_t)); } else { @@ -398,7 +404,7 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, szTargetFound++; // deselect has no effect on FeliCa and Jewel cards so we'll stop after one... if ((nm.nmt == NMT_FELICA) || (nm.nmt == NMT_JEWEL)) { - break; + break; } } *pszTargetFound = szTargetFound;