Obtaining USB connection speed in KMDF/WDF

Hello all, I feel like I am totally missing something here so I apologize if this is a stupid question…

I maintain a KMDF USB 3.1 Gen2 device driver and I would like to detect the negotiated connection speed from within the device driver, i.e. if the device is running in SuperSpeed (5Gbps) or SuperSpeedPlus (10Gbps) mode.

I tried the obvious WdfUsbTargetDeviceQueryUsbCapability, unfortunately there is no GUID for SuperSpeedPlus capability, only HighSpeed and SuperSpeed. I am using the latest WDK 10.0.18362.0 version. (Have MSFT guys simply forgot to add it or is it intentionally not supported anymore?)

So I took a look at the UsbView source code and they use the USB_NODE_CONNECTION_INFORMATION_EX_V2 structure which contains this information. However, for that I think I would need to know the USB hub handle my device is attached to so I can send it the IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2.

So this leads me to following questions:

  1. What’s the best way to detect SuperSpeedPlus connection speed from within a KMDF driver?
  2. How can I obtain handle to the USB hub object my device is attached to - so I can send it IOCTLs?
  3. Similarly, can I obtain handle to the USB controller the hub is attached to?

The last two would be really nice to have at least for debugging purposes as I could detect whether I am connected to an Intel or AsMedia controller or whether there are other devices attached in the same hub.

Thank you!


I have NEVER understood why they would chose to use enumeration and GUIDs for this kind of information. They could have made this all very simple and completely future proof by having a simple “ConnectionSpeed” value as an integer. 1, 12, 480, 5000, 10000; easy and extensible.

Since your device driver is connected to a hub, any request that you send south from your driver is going to the hub, and then to the host controller. That’s the beauty of driver stacks.