From 7a7687b3b81208b770b9071feb98a7c06eb17e7f Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 28 Sep 2010 15:15:36 +0000 Subject: [PATCH] Hack that allow to re-use PN53x (connected in USB) when something goes wrong. New issue Summary: Implement the abort mechanism (PCD->PICC ACK) Currently, this issue is motivated by the need to reconnect to the device after a failure: ie. Issue 114. BTW, this feature could also be useful to break an infinite polling or to cancel a previously sent command. --- libnfc/drivers/pn53x_usb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 6b80a35..6384fbc 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -239,6 +239,14 @@ pn53x_usb_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szT // TODO: Move this one level up for libnfc-1.6 uint8_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; + // FIXME Little hack to reset chip before talking to it: + if (pbtTx[1] == 2) { // hooked to the getfirmware command... +#ifdef DEBUG + PRINT_HEX ("TX", ack_frame, 6); +#endif + usb_bulk_write (pus->pudh, pus->uiEndPointOut, (char *) ack_frame, 6, USB_TIMEOUT); +} + // Packet length = data length (len) + checksum (1) + end of stream marker (1) abtTx[3] = szTxLen; // Packet length checksum