linux-msm / qdl

BSD 3-Clause "New" or "Revised" License
196 stars 76 forks source link

usb: Correct libusb timeout handling #67

Closed quic-bjorande closed 3 weeks ago

quic-bjorande commented 4 weeks ago

The documentation for libusb_bulk_transfer() specifies that in the event that the read or write request is split into multiple chunks, some of these may still be transferred despite a LIBUSB_ERROR_TIMEOUT is returned.

In the transition to libusb this detail was missed and completed read transfers are sometimes considred to be timeouts and the data discarded, obviously resulting in failure to continue.

Consider the "transferred" value in the event of timeout, to avoid this.

Although not yet spotted in testing, the same logic is introduced for the write path.