diff --git a/libnfc/drivers/acr122_usb.c b/libnfc/drivers/acr122_usb.c index 55d735b..de5f7fa 100644 --- a/libnfc/drivers/acr122_usb.c +++ b/libnfc/drivers/acr122_usb.c @@ -185,6 +185,9 @@ struct acr122_usb_data { #define RDR_to_PC_DataBlock 0x80 #define RDR_to_PC_Escape 0x83 +// ISO 7816-4 +#define SW1_More_Data_Available 0x61 + // This frame template is copied at init time // Its designed for TAMA sending but is also used for simple ADPU frame: acr122_build_frame_from_apdu() will overwrite needed bytes const uint8_t acr122_usb_frame_template[] = { @@ -649,6 +652,11 @@ read: pnd->last_error = NFC_EIO; return pnd->last_error; } + if (abtRxBuf[10] != SW1_More_Data_Available) { + log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unexpected Status Word (SW1: %02x SW2: %02x)", abtRxBuf[10], abtRxBuf[11]); + pnd->last_error = NFC_EIO; + return pnd->last_error; + } acr122_usb_send_apdu(pnd, APDU_GetAdditionnalData, 0x00, 0x00, NULL, 0, abtRxBuf[11], abtRxBuf, sizeof(abtRxBuf)); offset = 0; break;