diff options
author | Seneral <12800840+Seneral@users.noreply.github.com> | 2020-07-02 02:23:36 +0200 |
---|---|---|
committer | Tormod Volden <debian.tormod@gmail.com> | 2022-03-21 23:08:50 +0100 |
commit | 8102b7576c52b10f5806f785884e5cf3a4fb4a40 (patch) | |
tree | 689b1100a8cfa05fc1510323edf659ab9bbe5fa2 | |
parent | deb0d561b8af80c246b2933ebc1abd5feee45cc4 (diff) | |
download | libusb-8102b7576c52b10f5806f785884e5cf3a4fb4a40.tar.gz |
windows: Correct isochronous frame calculation for full-speed devices
The WinUSB isochronous transfer implementation always assumed HighSpeed
microframes.
https://github.com/libusb/libusb/issues/747#issuecomment-649491619
References #747
References #749
-rw-r--r-- | libusb/os/windows_winusb.c | 6 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index fed7d0d..6c0db2a 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -2990,7 +2990,11 @@ static int winusbx_submit_iso_transfer(int sub_api, struct usbi_transfer *itrans // WinUSB only supports isoch transfers spanning a full USB frames. Later, we might be smarter about this // and allocate a temporary buffer. However, this is harder than it seems as its destruction would depend on overlapped // IO... - iso_transfer_size_multiple = (pipe_info_ex.MaximumBytesPerInterval * 8) / interval; + if (transfer->dev_handle->dev->speed >= LIBUSB_SPEED_HIGH) // Microframes (125us) + iso_transfer_size_multiple = (pipe_info_ex.MaximumBytesPerInterval * 8) / interval; + else // Normal Frames (1ms) + iso_transfer_size_multiple = pipe_info_ex.MaximumBytesPerInterval / interval; + if (transfer->length % iso_transfer_size_multiple != 0) { usbi_err(TRANSFER_CTX(transfer), "length of isoch buffer must be a multiple of the MaximumBytesPerInterval * 8 / Interval"); return LIBUSB_ERROR_INVALID_PARAM; diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 78fef60..f9d6b03 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11713 +#define LIBUSB_NANO 11714 |