mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
c22daec1b0
USB CDC uses BULK endpoints to send/receive data. Typically, a USB host will enqueue large buffers on its IN (device-to-host) URBs. These buffers are larger than the max packet size for the bulk endpoint. The USB standard requires that an IN transfer ends when one of these is true: * a short packet (ie. less than max packet size) is sent by the device * a zero length packet (ZLP) * enough packets that the entire host buffer is filled Our device implementation never sends ZLPs. We sometimes send packets that are exactly max-packet-size bytes long. This would result in partially filling a host buffer without signalling (via ZLP) that the transmission had finished. The host would then wait until the next transfer had taken place before processing the first data, thus delaying the first data. This change simply forces all of our transfers to be short packets and avoids the need to worry about zero length packets. This is at the cost of some efficiency on the host side since its large buffers will only ever be partially filled. Conflicts: flight/PiOS/STM32F30x/pios_usb_cdc.c