stm32-usb.rs icon indicating copy to clipboard operation
stm32-usb.rs copied to clipboard

Fix Zero Length Packet bug

Open jcard0na opened this issue 1 year ago • 0 comments

To determine if a Zero-Length Packet needs to be sent, we check if data_reminder is greater than zero at the end of a data transfer. Before this fix, pack_csw() resets data_remainder to CommandStatusWrapper::BYTES before checking it. This results in thinking that there was still data to be sent and therefore sending an unnecessary ZLP before the command response. This causes problems with MacOS Read(10) commands.

Fix by checking data_remainder before it is overwritten.

jcard0na avatar Jan 17 '24 19:01 jcard0na