pn53x_usb: try to recover device if usb read fails, solves partly Issue 122

This commit is contained in:
Philippe Teuwen 2010-10-12 16:04:40 +00:00
parent 9d1e72a9f7
commit 2fb1de34f4

View file

@ -327,6 +327,8 @@ pn53x_usb_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szT
if (ret < 0) { if (ret < 0) {
DBG ("usb_bulk_read failed with error %d", ret); DBG ("usb_bulk_read failed with error %d", ret);
pnd->iLastError = DEIO; pnd->iLastError = DEIO;
// try to interrupt current device state
pn53x_usb_ack(pnd);
return false; return false;
} }
#ifdef DEBUG #ifdef DEBUG
@ -340,6 +342,8 @@ pn53x_usb_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szT
if (ret < 0) { if (ret < 0) {
DBG ("usb_bulk_read failed with error %d", ret); DBG ("usb_bulk_read failed with error %d", ret);
pnd->iLastError = DEIO; pnd->iLastError = DEIO;
// try to interrupt current device state
pn53x_usb_ack(pnd);
return false; return false;
} }
#ifdef DEBUG #ifdef DEBUG