Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Obtaining USB connection speed in KMDF/WDF

LuboLubo Member Posts: 8

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!

Lubo

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,578

    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.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA