From: Chris Dickens Date: Mon, 13 Jan 2020 22:07:31 +0000 (-0800) Subject: core: Fix libusb_get_max_iso_packet_size() for superspeed plus X-Git-Tag: upstream/1.0.24~158 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbd4991a2478ae57e39347bf8610e636554e4c1f;p=platform%2Fupstream%2Flibusb.git core: Fix libusb_get_max_iso_packet_size() for superspeed plus 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 --- diff --git a/libusb/core.c b/libusb/core.c index 0048dad..5c0a2e0 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -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); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 7ae99d1..57c2b1d 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11425 +#define LIBUSB_NANO 11426