core: Fix libusb_get_max_iso_packet_size() for superspeed plus
authorChris Dickens <christopher.a.dickens@gmail.com>
Mon, 13 Jan 2020 22:07:31 +0000 (14:07 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Mon, 13 Jan 2020 22:07:31 +0000 (14:07 -0800)
The current logic fails to consider superspeed plus devices properly.
Fix this by checking for superspeed or greater instead of matching
against superspeed.

Closes #553

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/core.c
libusb/version_nano.h

index 0048dade76961f3c6aac5c99a551607ba67ecfe2..5c0a2e01529456fee7af4279fb68c74cbc460076 100644 (file)
@@ -1121,8 +1121,8 @@ int API_EXPORTED libusb_get_max_iso_packet_size(libusb_device *dev,
                goto out;
        }
 
-       speed = libusb_get_device_speed( dev );
-       if (speed == LIBUSB_SPEED_SUPER) {
+       speed = libusb_get_device_speed(dev);
+       if (speed >= LIBUSB_SPEED_SUPER) {
                r = libusb_get_ss_endpoint_companion_descriptor(dev->ctx, ep, &ss_ep_cmp);
                if (r == LIBUSB_SUCCESS) {
                        r = ss_ep_cmp->wBytesPerInterval;
@@ -1131,7 +1131,7 @@ int API_EXPORTED libusb_get_max_iso_packet_size(libusb_device *dev,
        }
 
        /* If the device isn't a SuperSpeed device or retrieving the SS endpoint didn't worked. */
-       if (speed != LIBUSB_SPEED_SUPER || r < 0) {
+       if (speed < LIBUSB_SPEED_SUPER || r < 0) {
                val = ep->wMaxPacketSize;
                ep_type = (enum libusb_transfer_type) (ep->bmAttributes & 0x3);
 
index 7ae99d19f1c9c80579470ad85d1a57da037f7b1e..57c2b1dc79d16d5f2876230e1a1140f6a806768a 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11425
+#define LIBUSB_NANO 11426