Implement PN53x extended information frames with USB devices. (Fixes Issue 158)

This commit is contained in:
Romuald Conty 2011-05-06 15:03:08 +00:00
parent 11a91af749
commit 805d738b24
3 changed files with 12 additions and 3 deletions

View file

@ -324,7 +324,7 @@ arygon_tama_receive (nfc_device_t * pnd, byte_t * pbtData, const size_t szDataLe
return -1; return -1;
} else if ((0xff == abtRxBuf[3]) && (0xff == abtRxBuf[4])) { } else if ((0xff == abtRxBuf[3]) && (0xff == abtRxBuf[4])) {
// Extended frame // Extended frame
// FIXME: Code this // ARYGON devices does not support extended frame sending
abort (); abort ();
} else { } else {
// Normal frame // Normal frame

View file

@ -309,6 +309,7 @@ pn532_uart_receive (nfc_device_t * pnd, byte_t * pbtData, const size_t szDataLen
} else if ((0xff == abtRxBuf[3]) && (0xff == abtRxBuf[4])) { } else if ((0xff == abtRxBuf[3]) && (0xff == abtRxBuf[4])) {
// Extended frame // Extended frame
pnd->iLastError = uart_receive (DRIVER_DATA(pnd)->port, abtRxBuf, 3, 0); pnd->iLastError = uart_receive (DRIVER_DATA(pnd)->port, abtRxBuf, 3, 0);
if (pnd->iLastError) return -1;
// (abtRxBuf[0] << 8) + abtRxBuf[1] (LEN) include TFI + (CC+1) // (abtRxBuf[0] << 8) + abtRxBuf[1] (LEN) include TFI + (CC+1)
len = (abtRxBuf[0] << 8) + abtRxBuf[1] - 2; len = (abtRxBuf[0] << 8) + abtRxBuf[1] - 2;

View file

@ -461,8 +461,16 @@ read:
return -1; return -1;
} else if ((0xff == abtRxBuf[offset]) && (0xff == abtRxBuf[offset + 1])) { } else if ((0xff == abtRxBuf[offset]) && (0xff == abtRxBuf[offset + 1])) {
// Extended frame // Extended frame
// FIXME: Code this offset += 2;
abort ();
// (abtRxBuf[offset] << 8) + abtRxBuf[offset + 1] (LEN) include TFI + (CC+1)
len = (abtRxBuf[offset] << 8) + abtRxBuf[offset + 1] - 2;
if (((abtRxBuf[offset] + abtRxBuf[offset + 1] + abtRxBuf[offset + 2]) % 256) != 0) {
// TODO: Retry
ERR ("%s", "Length checksum mismatch");
pnd->iLastError = DEIO;
return -1;
}
offset += 3; offset += 3;
} else { } else {
// Normal frame // Normal frame