This commit is contained in:
Philippe Teuwen 2017-04-20 09:06:41 +02:00
parent 767abe50e2
commit 1bf542b9e2

View file

@ -188,7 +188,7 @@ static void pn533_fix_usbdesc(nfc_device *pnd)
#define MAXSZXRAMUSBDESC 61
if ((szXramUsbDesc == 0) || (MAXSZXRAMUSBDESC > 61))
return;
/*
#if 0
// Debug routine to check if corruption occurred:
// Don't read more regs at once or it will trigger the bug and corrupt what we're busy reading!
uint8_t abtCmdRR[] = { ReadRegister, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@ -209,7 +209,7 @@ static void pn533_fix_usbdesc(nfc_device *pnd)
j++;
}
}
*/
#endif
// Abuse the overflow bug to restore USB descriptors in one go
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_INFO, "%s", "Fixing USB descriptors corruption");
uint8_t abtCmdWR[19 + MAXSZXRAMUSBDESC] = { GetFirmwareVersion };