nfc_initiator_transceive_bytes() returns NFC_EMFCAUTHFAIL when AUTH command failed on a Mifare Classic

This commit is contained in:
Romuald Conty 2012-11-01 01:27:06 +01:00
parent 3629219a3b
commit 9f90a04a84
4 changed files with 8 additions and 6 deletions

2
NEWS
View file

@ -16,7 +16,7 @@ API Changes:
take a constant size for Rx buffer take a constant size for Rx buffer
- New nfc_initiator_target_is_present() to test is the previously selected - New nfc_initiator_target_is_present() to test is the previously selected
target is available in the field 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 command failed on a Mifare Classic
- New nfc_initiator_init_secure_element() to initiate a connection with - New nfc_initiator_init_secure_element() to initiate a connection with
secure element (Only supported with a PN532 with SAM equipped) secure element (Only supported with a PN532 with SAM equipped)

View file

@ -181,6 +181,11 @@ extern "C" {
* Error while RF transmission * Error while RF transmission
*/ */
#define NFC_ERFTRANS -20 #define NFC_ERFTRANS -20
/** @ingroup error
* @hideinitializer
* MIFARE Classic: authentication failed
*/
#define NFC_EMFCAUTHFAIL -30
/** @ingroup error /** @ingroup error
* @hideinitializer * @hideinitializer
* Software error (allocation, file/pipe creation, etc.) * Software error (allocation, file/pipe creation, etc.)

View file

@ -285,15 +285,12 @@ pn53x_transceive(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx
break; break;
case EMFAUTH: case EMFAUTH:
// When a MIFARE Classic AUTH fails, the tag is automatically in HALT state // When a MIFARE Classic AUTH fails, the tag is automatically in HALT state
res = NFC_ETGRELEASED; res = NFC_EMFCAUTHFAIL;
break; break;
default: default:
res = NFC_ECHIP; res = NFC_ECHIP;
break; break;
}; };
/*
{ EMFAUTH, "Mifare Authentication Error" },
*/
if (res < 0) { if (res < 0) {
pnd->last_error = res; pnd->last_error = res;

View file

@ -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). * @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 int