diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 2d022ac..a64f219 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -199,6 +199,8 @@ bool arygon_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTx byte_t abtRxBuf[BUFFER_LENGTH]; size_t szRxBufLen = BUFFER_LENGTH; size_t szPos; + // TODO: Move this one level up for libnfc-1.6 + uint8_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; // Packet length = data length (len) + checksum (1) + end of stream marker (1) abtTxBuf[4] = szTxLen; @@ -254,6 +256,14 @@ bool arygon_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTx // Only succeed when the result is at least 00 00 FF xx Fx Dx xx .. .. .. xx 00 (x = variable) if(szRxBufLen < 9) return false; +#ifdef DEBUG + PRINT_HEX("TX", ack_frame, 6); +#endif + if (!uart_send((serial_port)pnd->nds, ack_frame, 6)) { + ERR("%s", "Unable to transmit data. (TX)"); + return false; + } + // Remove the preceding and appending bytes 00 00 ff 00 ff 00 00 00 FF xx Fx .. .. .. xx 00 (x = variable) *pszRxLen = szRxBufLen - 9; memcpy(pbtRx, abtRxBuf+7, *pszRxLen); diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 0cf6bc2..709275a 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -181,6 +181,8 @@ bool pn532_uart_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t byte_t abtRxBuf[BUFFER_LENGTH]; size_t szRxBufLen = BUFFER_LENGTH; size_t szPos; + // TODO: Move this one level up for libnfc-1.6 + uint8_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; // Packet length = data length (len) + checksum (1) + end of stream marker (1) abtTxBuf[3] = szTxLen; @@ -236,6 +238,14 @@ bool pn532_uart_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t // Only succeed when the result is at least 00 00 FF xx Fx Dx xx .. .. .. xx 00 (x = variable) if(szRxBufLen < 9) return false; +#ifdef DEBUG + PRINT_HEX("TX", ack_frame,6); +#endif + if (!uart_send((serial_port)pnd->nds,ack_frame,6)) { + ERR("%s", "Unable to transmit data. (TX)"); + return false; + } + // Remove the preceding and appending bytes 00 00 ff 00 ff 00 00 00 FF xx Fx .. .. .. xx 00 (x = variable) *pszRxLen = szRxBufLen - 9; memcpy(pbtRx, abtRxBuf+7, *pszRxLen); diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 929a45e..16bc92f 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -243,6 +243,7 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff" byte_t abtRx[BUFFER_LENGTH]; usb_spec_t* pus = (usb_spec_t*)pnd->nds; + // TODO: Move this one level up for libnfc-1.6 uint8_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; // Packet length = data length (len) + checksum (1) + end of stream marker (1) @@ -298,6 +299,9 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s PRINT_HEX("RX", abtRx,ret); #endif +#ifdef DEBUG + PRINT_HEX("TX", ack_frame,6); +#endif usb_bulk_write(pus->pudh, pus->uiEndPointOut, (char *)ack_frame, 6, USB_TIMEOUT); // When the answer should be ignored, just return a succesful result