From 8dd8d25ef72e6e52424403e931f6c6eb96a256b9 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 5 May 2011 12:45:56 +0000 Subject: [PATCH] LoGO progressive field: remove hacks, unneeded with revised initializations --- libnfc/drivers/pn53x_usb.c | 38 +++++++------------------------------- libnfc/nfc.c | 7 ------- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 6a1cb85..7b4c7ce 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -571,39 +571,14 @@ On ASK LoGO hardware: field by switching off the field on PN533 then set P34 to '0'. */ - /* Set P30, P31, P33, P35, P34 to logic 1 and P32 to 0 logic */ - /* ie. Switch LED1 on and turn on progressive field */ - pn53x_write_register (pnd, SFR_P3, 0xFF, _BV (P30) | _BV (P31) | _BV (P33) | _BV (P34) | _BV (P35)); + /* Set P30, P31, P33, P35 to logic 1 and P32, P34 to 0 logic */ + /* ie. Switch LED1 on and turn off progressive field */ + pn53x_write_register (pnd, SFR_P3, 0xFF, _BV (P30) | _BV (P31) | _BV (P33) | _BV (P35)); } return true; } -bool -pn53x_usb_initiator_select_passive_target (nfc_device_t * pnd, - const nfc_modulation_t nm, - const byte_t * pbtInitData, const size_t szInitData, - nfc_target_t * pnt) -{ - if (nm.nmt == NMT_ISO14443B) { - if (DRIVER_DATA (pnd)->model == ASK_LOGO) { - /* Switch RF field off, progressive field off and LED2 off */ - byte_t abtCmd[] = { RFConfiguration, RFCI_FIELD, 0x00 }; - if (!pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL)) - return false; - if (!pn53x_write_register (pnd, SFR_P3, _BV(P34) | _BV(P31), _BV(P31))) - return false; - /* Switch RF field on, progressive field on and LED2 on */ - abtCmd[2] = 0x01; - if (!pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL)) - return false; - if (!pn53x_write_register (pnd, SFR_P3, _BV(P34) | _BV(P31), _BV(P34))) - return false; - } - } - return (pn53x_initiator_select_passive_target (pnd, nm, pbtInitData, szInitData, pnt)); -} - bool pn53x_usb_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable) { @@ -613,8 +588,9 @@ pn53x_usb_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bo switch (DRIVER_DATA (pnd)->model) { case ASK_LOGO: if (NDO_ACTIVATE_FIELD == ndo) { - /* Switch on/off LED2 according to ACTIVATE_FIELD option */ - if (!pn53x_write_register (pnd, SFR_P3, _BV(P31), bEnable ? 0 : _BV (P31))) + /* Switch on/off LED2 and Progressive Field GPIO according to ACTIVATE_FIELD option */ + DBG ("Switch progressive field %s", bEnable ? "On" : "Off"); + if (!pn53x_write_register (pnd, SFR_P3, _BV(P31) | _BV(P34), bEnable ? _BV (P34) : _BV (P31))) return false; } break; @@ -651,7 +627,7 @@ const struct nfc_driver_t pn53x_usb_driver = { .strerror = pn53x_strerror, .initiator_init = pn53x_initiator_init, - .initiator_select_passive_target = pn53x_usb_initiator_select_passive_target, + .initiator_select_passive_target = pn53x_initiator_select_passive_target, .initiator_poll_targets = pn53x_initiator_poll_targets, .initiator_select_dep_target = pn53x_initiator_select_dep_target, .initiator_deselect_target = pn53x_initiator_deselect_target, diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 521cabc..cc519eb 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -389,13 +389,6 @@ 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 {