From ddde2dd8f2749e2c2a9302f60e9dd747f0da46e9 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 11 Mar 2014 00:13:26 +0100 Subject: [PATCH] initiator_select_passive_target(): now supports all speeds for ISO14443-4A tags --- libnfc/chips/pn53x.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 31c6da7..d85c7d0 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1143,7 +1143,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd, } else { const pn53x_modulation pm = pn53x_nm_to_pm(nm); - if (PM_UNDEFINED == pm) { + if ((PM_UNDEFINED == pm)||(NBR_UNDEFINED == nm.nbr)) { pnd->last_error = NFC_EINVARG; return pnd->last_error; } @@ -1158,6 +1158,14 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd, if ((res = pn53x_decode_target_data(abtTargetsData + 1, szTargetsData - 1, CHIP_DATA(pnd)->type, nm.nmt, &(nttmp.nti))) < 0) { return res; } + if (nm.nbr != NBR_106) { + uint8_t pncmd_inpsl[4] = { InPSL, 0x01 }; + pncmd_inpsl[2] = nm.nbr - 1; + pncmd_inpsl[3] = nm.nbr - 1; + if ((res = pn53x_transceive(pnd, pncmd_inpsl, sizeof(pncmd_inpsl), NULL, 0, 0)) < 0) { + return res; + } + } } if (pn53x_current_target_new(pnd, &nttmp) == NULL) { pnd->last_error = NFC_ESOFT;