From b7f590acc8f322066d9e02d8c74b299e8f576f52 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 28 Jan 2014 10:40:18 +0100 Subject: [PATCH] Set correctly last_error when running pn53x_initiator_target_is_present() --- libnfc/chips/pn53x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 56679ea..0631322 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1730,12 +1730,12 @@ pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) { // Check if there is a saved target if (CHIP_DATA(pnd)->current_target == NULL) { - return NFC_ETGRELEASED; + return pnd->last_error = NFC_ETGRELEASED; } // Check if the argument target nt is equals to current saved target if ((pnt != NULL) && (!pn53x_current_target_is(pnd, pnt))) { - return NFC_ETGRELEASED; + return pnd->last_error = NFC_ETGRELEASED; } // Send Card Presence command @@ -1749,12 +1749,12 @@ pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) if ((res = pn53x_transceive(pnd, abtCmd, sizeof(abtCmd), abtRx, sizeof(abtRx), 700)) < 0) return res; if (res == 1) { - return NFC_SUCCESS; + return pnd->last_error = NFC_SUCCESS; } // Target is not reachable anymore pn53x_current_target_free(pnd); - return NFC_ETGRELEASED; + return pnd->last_error = NFC_ETGRELEASED; } #define SAK_ISO14443_4_COMPLIANT 0x20