mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-04-12 01:26:19 +00:00
Rework and fix error frames detection.
While here, rename the pn53x_transceive_callback() function to pn53x_transceive_check_ack_frame_callback() to make it more obvious what it is supposed to do.
This commit is contained in:
@@ -285,7 +285,7 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s
|
||||
PRINT_HEX("RX", abtRx,ret);
|
||||
#endif
|
||||
|
||||
if (!pn53x_transceive_callback (pnd, abtRx, ret))
|
||||
if (!pn53x_transceive_check_ack_frame_callback (pnd, abtRx, ret))
|
||||
return false;
|
||||
|
||||
ret = usb_bulk_read(pus->pudh, pus->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
@@ -305,6 +305,9 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s
|
||||
#endif
|
||||
usb_bulk_write(pus->pudh, pus->uiEndPointOut, (char *)ack_frame, 6, USB_TIMEOUT);
|
||||
|
||||
if (!pn53x_transceive_check_error_frame_callback (pnd, abtRx, ret))
|
||||
return false;
|
||||
|
||||
// When the answer should be ignored, just return a succesful result
|
||||
if(pbtRx == NULL || pszRxLen == NULL) return true;
|
||||
|
||||
@@ -329,8 +332,5 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s
|
||||
|
||||
memcpy( pbtRx, abtRx + 7, *pszRxLen);
|
||||
|
||||
if (abtRx[5] != pbtTx[0] + 1) {
|
||||
pnd->iLastError = DEISERRFRAME;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user