stm32-usb.rs
stm32-usb.rs copied to clipboard
Fix Zero Length Packet bug
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.