From af584bd4749b3de932dd69f0b2a4b673ee6300c7 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Sun, 25 Jul 2010 16:31:53 +0000 Subject: [PATCH] Fix packet length checksum computation. The doc says LCS (aka abtTx[4]) must be set so that the lower byte of LCS+LEN (aka abtTx[3]) is 0x00. This has not to be related to the USB buffer size, so that we can adjust it without breaking down the libnfc. --- libnfc/drivers/pn53x_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index fce726f..6b08daa 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -251,7 +251,7 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons // Packet length = data length (len) + checksum (1) + end of stream marker (1) abtTx[3] = szTxLen; // Packet length checksum - abtTx[4] = BUFFER_LENGTH - abtTx[3]; + abtTx[4] = 0x0100 - abtTx[3]; // Copy the PN53X command into the packet abtTx memmove(abtTx+5,pbtTx,szTxLen);