diff --git a/NEWS b/NEWS index 09b0635..f43a899 100644 --- a/NEWS +++ b/NEWS @@ -16,7 +16,7 @@ API Changes: take a constant size for Rx buffer - New nfc_initiator_target_is_present() to test is the previously selected target is available in the field - - nfc_initiator_transceive_bytes() returns NFC_ETGRELEASED when AUTH + - nfc_initiator_transceive_bytes() returns NFC_EMFCAUTHFAIL when AUTH command failed on a Mifare Classic - New nfc_initiator_init_secure_element() to initiate a connection with secure element (Only supported with a PN532 with SAM equipped) diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index fe78f84..a5f40a6 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -181,6 +181,11 @@ extern "C" { * Error while RF transmission */ #define NFC_ERFTRANS -20 + /** @ingroup error + * @hideinitializer + * MIFARE Classic: authentication failed + */ +#define NFC_EMFCAUTHFAIL -30 /** @ingroup error * @hideinitializer * Software error (allocation, file/pipe creation, etc.) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 717824d..3b89252 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -285,15 +285,12 @@ pn53x_transceive(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx break; case EMFAUTH: // When a MIFARE Classic AUTH fails, the tag is automatically in HALT state - res = NFC_ETGRELEASED; + res = NFC_EMFCAUTHFAIL; break; default: res = NFC_ECHIP; break; }; - /* - { EMFAUTH, "Mifare Authentication Error" }, - */ if (res < 0) { pnd->last_error = res; diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 2e25ddb..55454a9 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -632,7 +632,7 @@ nfc_initiator_deselect_target(nfc_device *pnd) * * @warning The configuration option \a NP_HANDLE_PARITY must be set to \c true (the default value). * - * @note When used with MIFARE Classic, NFC_ETGRELEASED error is returned if authentication command failed. You need to re-select the tag to operate with. + * @note When used with MIFARE Classic, NFC_EMFCAUTHFAIL error is returned if authentication command failed. You need to re-select the tag to operate with. * */ int