From 3f513b62467d1842ec0771aaec01fde2f57bfb9c Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 6 Sep 2012 00:47:08 +0100 Subject: [PATCH] Core: Update libusb.h header in accordance with the latest USB specs * IMPORTANT: This update fixes a typo in the API where MaxPower was being used instead of bMaxPower, with the latter being what is actually in the specs. * As a result, applications that were using MaxPower need to be updated for bMaxPower. * If you must maintain compatibility with libusb or older versions of libusbx, you may also want to either use a #define or copy/paste struct libusb_config_descriptor from libusb.h under a new name, and then use a cast on calls that require it. For more info, see the 1.0.13 release notes in the NEWS file. * Also update copyright notice --- libusb/libusb.h | 26 +++++++++++++++++++------- libusb/os/windows_usb.c | 2 +- libusb/version_nano.h | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libusb/libusb.h b/libusb/libusb.h index de31a56..ae00c53 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -1,7 +1,9 @@ /* * Public libusbx header file - * Copyright © 2007-2008 Daniel Drake * Copyright © 2001 Johannes Erdfelt + * Copyright © 2007-2008 Daniel Drake + * Copyright © 2012 Pete Batard + * For more information, please visit: http://libusbx.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -231,6 +233,9 @@ enum libusb_descriptor_type { /** Hub descriptor */ LIBUSB_DT_HUB = 0x29, + + /** SuperSpeed Hub descriptor */ + LIBUSB_DT_SUPERSPEED_HUB = 0x2A, }; /* Descriptor sizes per descriptor type */ @@ -277,7 +282,7 @@ enum libusb_transfer_type { }; /** \ingroup misc - * Standard requests, as defined in table 9-3 of the USB2 specifications */ + * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */ enum libusb_standard_request { /** Request status of the specific recipient */ LIBUSB_REQUEST_GET_STATUS = 0x00, @@ -315,6 +320,13 @@ enum libusb_standard_request { /** Set then report an endpoint's synchronization frame */ LIBUSB_REQUEST_SYNCH_FRAME = 0x0C, + + /** Sets both the U1 and U2 Exit Latency */ + LIBUSB_REQUEST_SET_SEL = 0x30, + + /** Delay from the time a host transmits a packet to the time it is + * received by the device. */ + LIBUSB_SET_ISOCH_DELAY = 0x31, }; /** \ingroup misc @@ -394,7 +406,7 @@ enum libusb_iso_usage_type { /** \ingroup desc * A structure representing the standard USB device descriptor. This - * descriptor is documented in section 9.6.1 of the USB 2.0 specification. + * descriptor is documented in section 9.6.1 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. */ struct libusb_device_descriptor { @@ -448,7 +460,7 @@ struct libusb_device_descriptor { /** \ingroup desc * A structure representing the standard USB endpoint descriptor. This - * descriptor is documented in section 9.6.3 of the USB 2.0 specification. + * descriptor is documented in section 9.6.6 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. */ struct libusb_endpoint_descriptor { @@ -498,7 +510,7 @@ struct libusb_endpoint_descriptor { /** \ingroup desc * A structure representing the standard USB interface descriptor. This - * descriptor is documented in section 9.6.5 of the USB 2.0 specification. + * descriptor is documented in section 9.6.5 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. */ struct libusb_interface_descriptor { @@ -560,7 +572,7 @@ struct libusb_interface { /** \ingroup desc * A structure representing the standard USB configuration descriptor. This - * descriptor is documented in section 9.6.3 of the USB 2.0 specification. + * descriptor is documented in section 9.6.3 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. */ struct libusb_config_descriptor { @@ -590,7 +602,7 @@ struct libusb_config_descriptor { /** Maximum power consumption of the USB device from this bus in this * configuration when the device is fully opreation. Expressed in units * of 2 mA. */ - uint8_t MaxPower; + uint8_t bMaxPower; /** Array of interfaces supported by this configuration. The length of * this array is determined by the bNumInterfaces field. */ diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index fce4d43..9fdccdb 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -3192,7 +3192,7 @@ static int _hid_get_config_descriptor(struct hid_device_priv* dev, void *data, s cd->bConfigurationValue = 1; cd->iConfiguration = 0; cd->bmAttributes = 1 << 7; /* bus powered */ - cd->MaxPower = 50; + cd->bMaxPower = 50; id->bLength = LIBUSB_DT_INTERFACE_SIZE; id->bDescriptorType = LIBUSB_DT_INTERFACE; diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 3cf00d6..ff347c9 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10564 +#define LIBUSB_NANO 10565 -- 2.7.4