diff options
| author | HiFiPhile <[email protected]> | 2026-06-23 10:07:24 +0200 |
|---|---|---|
| committer | HiFiPhile <[email protected]> | 2026-06-23 10:26:08 +0200 |
| commit | ca89edf2ef46484cf56bf1efbaf3a7b14616eeac (patch) | |
| tree | 1200373b38432df5266b2168902bf1f209edceaa | |
| parent | 030bb962aed6efba443221660fb13f6dbd3ae710 (diff) | |
dcd/ch32hs: drop OUT packet whose data toggle doesn't match
Signed-off-by: HiFiPhile <[email protected]>
| -rw-r--r-- | src/portable/wch/dcd_ch32_usbhs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/portable/wch/dcd_ch32_usbhs.c b/src/portable/wch/dcd_ch32_usbhs.c index 4ab92817e..99dab7086 100644 --- a/src/portable/wch/dcd_ch32_usbhs.c +++ b/src/portable/wch/dcd_ch32_usbhs.c @@ -418,7 +418,9 @@ void dcd_int_handler(uint8_t rhport) { if (token == USBHS_TOKEN_PID_SOF) { uint32_t frame_count = USBHSD->FRAME_NO & USBHS_FRAME_NO_NUM_MASK; dcd_event_sof(rhport, frame_count, true); - } else if (token == USBHS_TOKEN_PID_OUT) { + // Drop an OUT packet whose data toggle doesn't match what we expect -- a host retransmit + // after a lost ACK, or a host that doesn't alternate DATA0/DATA1. + } else if (token == USBHS_TOKEN_PID_OUT && (int_status & USBHS_DEV_UIS_TOG_OK)) { update_out(rhport, ep_num, len); } else if (token == USBHS_TOKEN_PID_IN) { update_in(rhport, ep_num, false); |
