| From 99f5d4b260f4e58749780acea8c176717db3d87c Mon Sep 17 00:00:00 2001 |
| From: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Date: Mon, 14 Sep 2015 16:20:07 +0300 |
| Subject: [PATCH 1/7] lsusb: Add support for the USB 3.1 SuperSpeedPlus device |
| capability desc |
| |
| USB 3.1 devices have a SuperSpeedPlus USB device capability descriptor |
| as part of the BOS descritptor. It if exists then show this content |
| togeter with the rest of the BOS descriptor. |
| |
| A sample output looks like: |
| |
| SuperSpeedPlus USB Device Capability: |
| bLength 20 |
| bDescriptorType 16 |
| bDevCapabilityType 10 |
| bmAttributes 0x00000001 |
| Sublink Speed Attribute count 1 |
| Sublink Speed ID count 0 |
| wFunctionalitySupport 0x1100 |
| bmSublinkSpeedAttr[0] 0x000a4030 |
| Speed attr ID: 0 10Gb/s Symmetric RX SuperSpeedPlus |
| bmSublinkSpeedAttr[1] 0x000a40b0 |
| Speed attr ID: 0 10Gb/s Symmetric TX SuperSpeedPlus |
| |
| Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> |
| (cherry picked from commit 21d0d7a58947a5d9b48682711a45b87aa85c33a8) |
| --- |
| lsusb.c | 40 ++++++++++++++++++++++++++++++++++++++++ |
| 1 file changed, 40 insertions(+) |
| |
| diff --git a/lsusb.c b/lsusb.c |
| index 620eccc..1eadcf8 100644 |
| --- a/lsusb.c |
| +++ b/lsusb.c |
| @@ -69,6 +69,7 @@ |
| #define USB_DC_20_EXTENSION 0x02 |
| #define USB_DC_SUPERSPEED 0x03 |
| #define USB_DC_CONTAINER_ID 0x04 |
| +#define USB_DC_SUPERSPEEDPLUS 0x0a |
| |
| /* Conventional codes for class-specific descriptors. The convention is |
| * defined in the USB "Common Class" Spec (3.11). Individual class specs |
| @@ -3695,6 +3696,42 @@ static void dump_ss_device_capability_desc(unsigned char *buf) |
| printf(" bU2DevExitLat %8u micro seconds\n", buf[8] + (buf[9] << 8)); |
| } |
| |
| +static void dump_ssp_device_capability_desc(unsigned char *buf) |
| +{ |
| + int i; |
| + unsigned int bm_attr, ss_attr; |
| + char bitrate_prefix[] = " KMG"; |
| + |
| + if (buf[0] < 12) { |
| + printf(" Bad SuperSpeedPlus USB Device Capability descriptor.\n"); |
| + return; |
| + } |
| + |
| + bm_attr = convert_le_u32(buf + 4); |
| + printf(" SuperSpeedPlus USB Device Capability:\n" |
| + " bLength %5u\n" |
| + " bDescriptorType %5u\n" |
| + " bDevCapabilityType %5u\n" |
| + " bmAttributes 0x%08x\n", |
| + buf[0], buf[1], buf[2], bm_attr); |
| + |
| + printf(" Sublink Speed Attribute count %u\n", buf[4] & 0x1f); |
| + printf(" Sublink Speed ID count %u\n", (bm_attr >> 5) & 0xf); |
| + printf(" wFunctionalitySupport 0x%02x%02x\n", buf[9], buf[8]); |
| + |
| + for (i = 0; i <= (buf[4] & 0x1f); i++) { |
| + ss_attr = convert_le_u32(buf + 12 + (i * 4)); |
| + printf(" bmSublinkSpeedAttr[%u] 0x%08x\n", i, ss_attr); |
| + printf(" Speed Attribute ID: %u %u%cb/s %s %s SuperSpeed%s\n", |
| + ss_attr & 0x0f, |
| + ss_attr >> 16, |
| + (bitrate_prefix[((ss_attr >> 4) & 0x3)]), |
| + (ss_attr & 0x40)? "Asymmetric" : "Symmetric", |
| + (ss_attr & 0x80)? "TX" : "RX", |
| + (ss_attr & 0x4000)? "Plus": "" ); |
| + } |
| +} |
| + |
| static void dump_container_id_device_capability_desc(unsigned char *buf) |
| { |
| if (buf[0] < 20) { |
| @@ -3782,6 +3819,9 @@ static void dump_bos_descriptor(libusb_device_handle *fd) |
| case USB_DC_SUPERSPEED: |
| dump_ss_device_capability_desc(buf); |
| break; |
| + case USB_DC_SUPERSPEEDPLUS: |
| + dump_ssp_device_capability_desc(buf); |
| + break; |
| case USB_DC_CONTAINER_ID: |
| dump_container_id_device_capability_desc(buf); |
| break; |
| -- |
| 2.12.2 |
| |