This was an untested case as no other operating system sents 0-length
out packets (they're not necessary). The correct response is to ACK
them by clearing the OUTPKT_RDY bit so that another packet can be sent.
Signed-off-by: Keith Packard <keithp@keithp.com>
if ((USBCSOL & USBCSOL_OUTPKT_RDY) == 0)
return AO_READ_AGAIN;
ao_usb_out_bytes = (USBCNTH << 8) | USBCNTL;
- if (ao_usb_out_bytes == 0)
+ if (ao_usb_out_bytes == 0) {
+ USBINDEX = AO_USB_OUT_EP;
+ USBCSOL &= ~USBCSOL_OUTPKT_RDY;
return AO_READ_AGAIN;
+ }
}
--ao_usb_out_bytes;
c = USBFIFO[AO_USB_OUT_EP << 1];