Fixed readNB() bug

Fixed a race condition with readNB() in USBHID that caused reports to be
periodically returned empty.
pull/236/head
neilt6 2014-03-26 12:00:06 -06:00
parent b6fadb4e11
commit f0453b3e07
1 changed files with 3 additions and 0 deletions

View File

@ -59,6 +59,9 @@ bool USBHID::readNB(HID_REPORT *report)
uint32_t bytesRead = 0;
bool result;
result = USBDevice::readEP_NB(EPINT_OUT, report->data, &bytesRead, MAX_HID_REPORT_SIZE);
// if readEP_NB did not succeed, does not issue a readStart
if (!result)
return false;
report->length = bytesRead;
if(!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE))
return false;