Page MenuHomeFreeBSD

D11494.id30458.diff
No OneTemporary

D11494.id30458.diff

Index: lib/libusb/libusb.h
===================================================================
--- lib/libusb/libusb.h
+++ lib/libusb/libusb.h
@@ -388,6 +388,7 @@
uint8_t bNumDeviceCapabilities;
struct libusb_usb_2_0_device_capability_descriptor *usb_2_0_ext_cap;
struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap;
+ struct libusb_bos_dev_capability_descriptor *dev_capability;
} libusb_bos_descriptor __aligned(sizeof(void *));
typedef struct libusb_usb_2_0_extension_descriptor {
Index: lib/libusb/libusb10_desc.c
===================================================================
--- lib/libusb/libusb10_desc.c
+++ lib/libusb/libusb10_desc.c
@@ -470,6 +470,7 @@
ptr->bNumDeviceCapabilities = ((const uint8_t *)buf)[4];
ptr->usb_2_0_ext_cap = NULL;
ptr->ss_usb_cap = NULL;
+ ptr->dev_capability = NULL;
dcap_20 = (void *)(ptr + 1);
ss_cap = (void *)(dcap_20 + 1);
@@ -485,6 +486,15 @@
break;
ptr->usb_2_0_ext_cap = dcap_20;
+ /*
+ * This assumes dcap_20 and ss_cap occupy a contiguous block of
+ * memory, as allocated above. Should this change, this and the
+ * later setting of ptr->dev_capability will need to be
+ * re-evaluated.
+ */
+ if (ptr->dev_capability == NULL ||
+ (char *)ptr->dev_capability > (char *)dcap_20)
+ ptr->dev_capability = (struct libusb_bos_dev_capability_descriptor *)dcap_20;
dcap_20->bLength = LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE;
dcap_20->bDescriptorType = dtype;
@@ -502,6 +512,9 @@
break;
ptr->ss_usb_cap = ss_cap;
+ if (ptr->dev_capability == NULL ||
+ (char *)ptr->dev_capability > (char *)ss_cap)
+ ptr->dev_capability = (struct libusb_bos_dev_capability_descriptor *)ss_cap;
ss_cap->bLength = LIBUSB_SS_USB_DEVICE_CAPABILITY_SIZE;
ss_cap->bDescriptorType = dtype;

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 26, 12:36 AM (20 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27984422
Default Alt Text
D11494.id30458.diff (1 KB)

Event Timeline