Skip to content

Commit e25840e

Browse files
committed
manually did arduino#88 and tested - fixes keyboardcontroller sluggishness
1 parent ae5e0b8 commit e25840e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

libraries/USBHost/src/Usb.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
262262
continue;
263263
}
264264
if(rcode) {
265-
//printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
265+
uhd_freeze_pipe(pep->epAddr);
266+
//printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
266267
return(rcode);// break; //should be 0, indicating ACK. Else return error code.
267268
}
268269
/* check for RCVDAVIRQ and generate error if not present */
@@ -304,6 +305,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
304305
break;
305306
} // if
306307
} //while( 1 )
308+
uhd_freeze_pipe(pep->epAddr);
307309
return ( rcode);
308310
}
309311

@@ -422,6 +424,15 @@ uint32_t USBHost::dispatchPkt(uint32_t token, uint32_t epAddr, uint32_t nak_limi
422424
}
423425

424426
//case hrNAK:
427+
if((USB->HOST.HostPipe[epAddr].PINTFLAG.reg & USB_HOST_PINTFLAG_TRFAIL) ) {
428+
USB->HOST.HostPipe[epAddr].PINTFLAG.reg = USB_HOST_PINTFLAG_TRFAIL;
429+
nak_count++;
430+
if(nak_limit && (nak_count == nak_limit)) {
431+
rcode = USB_ERRORFLOW;
432+
return (rcode);
433+
}
434+
}
435+
425436
if( (usb_pipe_table[epAddr].HostDescBank[0].STATUS_BK.reg & USB_ERRORFLOW ) ) {
426437
nak_count++;
427438
if(nak_limit && (nak_count == nak_limit)) {

0 commit comments

Comments
 (0)