diff options
| author | Jan Dümpelmann <[email protected]> | 2020-06-30 12:55:39 +0200 |
|---|---|---|
| committer | Jan Dümpelmann <[email protected]> | 2020-06-30 12:55:39 +0200 |
| commit | 9e35ef73f7ea4813eea5531b4b8edc871cbc9e8d (patch) | |
| tree | 05ca829586f6a311a62670d2232f1e37b872a9fe /src/portable | |
| parent | 05996aee640269b7e91fcf441c286d3ec09f3c34 (diff) | |
Fix receiving of short packet data (ep out)
Diffstat (limited to 'src/portable')
| -rw-r--r-- | src/portable/st/synopsys/dcd_synopsys.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c index b47101e60..0e8743ad8 100644 --- a/src/portable/st/synopsys/dcd_synopsys.c +++ b/src/portable/st/synopsys/dcd_synopsys.c @@ -576,6 +576,12 @@ static void handle_rxflvl_ints(USB_OTG_OUTEndpointTypeDef * out_ep) { // Increment pointer to xfer data xfer->buffer += bcnt; + + // Truncate transfer length in case of short packet + if(bcnt < xfer->max_size){ + xfer->total_len -= (out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DOEPTSIZ_XFRSIZ_Pos; + if(epnum == 0) xfer->total_len -= ep0_pending[TUSB_DIR_OUT]; + } } break; case 0x03: // Out packet done (Interrupt) |
