From 5fe3fbdb5d39ff3cf5f1b7a7e45f26c6a5a1f609 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Thu, 30 Jan 2014 11:10:18 +0100 Subject: [PATCH] Fix nfc_target_is_present() when removing a ISO14443-4A target from a PN532-based device --- libnfc/chips/pn53x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index cd9d2c6..36a4720 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1780,6 +1780,8 @@ pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "target_is_present(): Ping -4A"); if ((CHIP_DATA(pnd)->type == PN532) || (CHIP_DATA(pnd)->type == PN533)) { ret = pn53x_Diagnose06(pnd); + // When pn53x_Diagnose06() fails with a timeout (0x01) chip error, it means the target is not reacheable anymore + if ((ret == NFC_ERFTRANS) && (CHIP_DATA(pnd)->last_status_byte == 0x01)) ret = NFC_ETGRELEASED; } else { ret = NFC_EDEVNOTSUPP; }