diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 2ea3d49..38fd778 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -475,12 +475,13 @@ pn53x_InAutoPoll(nfc_device_t* pnd, nfc_target_t* pntTargets, size_t* pszTargetFound) { size_t szTxInAutoPoll, n, szRxLen; - byte_t abtRx[256]; + byte_t abtRx[MAX_FRAME_LEN]; bool res; byte_t *pbtTxInAutoPoll; - if(pnd->nc == NC_PN531) { - // TODO This function is not supported by pn531 (set errno = ENOSUPP or similar) + if(pnd->nc != NC_PN532) { + // This function is not supported by pn531 neither pn533 + pnd->iLastError = DENOTSUP; return false; } @@ -495,7 +496,7 @@ pn53x_InAutoPoll(nfc_device_t* pnd, pbtTxInAutoPoll[4+n] = pnttTargetTypes[n]; } - szRxLen = 256; + szRxLen = MAX_FRAME_LEN; res = pnd->pdc->transceive(pnd, pbtTxInAutoPoll, szTxInAutoPoll, abtRx, &szRxLen); if((szRxLen == 0)||(res == false)) { @@ -569,7 +570,8 @@ static struct sErrorMessage { /* TODO: Move me in more generic code for libnfc 1.6 */ { DEINVAL, "Invalid argument" }, { DEIO, "Input/output error" }, - { DETIMEOUT, "Operation timed-out" } + { DETIMEOUT, "Operation timed-out" }, + { DENOTSUP, "Operation not supported" } }; const char * diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 9d976d8..4de277a 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -73,6 +73,7 @@ #define DENACK 0x0100 /* NACK */ #define DEACKMISMATCH 0x0200 /* Unexpected data */ #define DEISERRFRAME 0x0300 /* Error frame */ +#define DENOTSUP 0x0400 /* Not supported */ bool pn53x_transceive_check_ack_frame_callback(nfc_device_t* pnd, const byte_t *pbtRxFrame, const size_t szRxFrameLen); bool pn53x_transceive_check_error_frame_callback(nfc_device_t* pnd, const byte_t *pbtRxFrame, const size_t szRxFrameLen);