Skip to content

Commit 3410b8c

Browse files
committed
also handle ZLP in USB_Recv
The fix in arduino/Arduino#6886 is incomplete. `USB_Recv` also needs to handle ZLPs. Signed-off-by: Taylor Yu <code@argon.blue>
1 parent a9eb703 commit 3410b8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

avr/cores/keyboardio/USBCore.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ int USB_Recv(u8 ep, void* d, int len)
245245

246246
LockEP lock(ep);
247247
u8 n = FifoByteCount();
248+
if (!n && HasOUT()) {
249+
ReleaseRX(); // handle ZLP
250+
n = FifoByteCount();
251+
}
248252
len = min(n,len);
249253
n = len;
250254
u8* dst = (u8*)d;

0 commit comments

Comments
 (0)