Commit 09bbe721 authored by Damien George's avatar Damien George
Browse files

stmhal: Fix USB CDC not flushing packets when an exact multiple of 64.

Need to send a zero-sized packet after sending an exact multiple of 64
bytes (not just after sending 64 bytes exactly).

Addresses issue #494, part 2.
parent 0fb80c30
......@@ -313,7 +313,7 @@ void USBD_CDC_HAL_TIM_PeriodElapsedCallback(void) {
// the host waits for all data to arrive (ie, waits for a packet < max packet size).
// To flush a packet of exactly max packet size, we need to send a zero-size packet.
// See eg http://www.cypress.com/?id=4&rID=92719
UserTxNeedEmptyPacket = (buffsize == CDC_DATA_FS_MAX_PACKET_SIZE && UserTxBufPtrOutShadow == UserTxBufPtrIn);
UserTxNeedEmptyPacket = (buffsize > 0 && buffsize % CDC_DATA_FS_MAX_PACKET_SIZE == 0 && UserTxBufPtrOutShadow == UserTxBufPtrIn);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment