I'm developing a driver for multiple USB speeds and according to the universal specification, I'm allowed to draw a greater amount of current from a USB 3.0 hub than the other versions.

Is there a way on Windows to determine the different USB speeds? I'm basically asking for a place to get started. Thanks in advance.

  • \$\begingroup\$ Please clarify your question further. "The different USB speeds" of what? Do you want to determine the data-transfer speeds of the various USB ports on a given computer? \$\endgroup\$ – boardbite Aug 24 '12 at 20:13
  • \$\begingroup\$ I want to clarify regarding USB normal/full/high/super speeds (mentioned in the specification) \$\endgroup\$ – Yasuko Dino Aug 24 '12 at 20:16
  • \$\begingroup\$ For more info, you can check for normal/full speeds using the power settings of the USB hubs/devices \$\endgroup\$ – Daniel Li Aug 29 '12 at 15:30

Since you're using Windows, you should look into using Windows Driver Frameworks (WDF). This is the Windows equivalent to libusb on POSIX-compliant computers.

WDF Reference

Look through the example code (there's a toaster/firefly driver example in there) on how to set up a WDFIOTARGET given a device ID. Use this implementation with your hub, enumerating it upon device insertion.

Then, you'll want to send the IOCTL, IOCTL_USB_GET_NODE_INFORMATION, to the hub represented by a WDFIOTARGET in order to retrieve a USB_NODE_INFORMATION structure.

(source: sgi.com)

IOCTL Reference


Then, retrieve with the following access pattern:

// retrieve UsbNodeInfo here with your USB_GET_NODE_INFORMATION signal
UCHAR DescriptorType;
DescriptorType = UsbNodeInfo->u.HubInformation.HubDescriptor.bDescriptorType

HubInformation Reference

HubDescriptor Reference

This will retrieve a descriptor type of either 0x2A (3.0) or 0x29 (2.0 or lower). Using this information, you can send the proper IOCTL you want to the device in order to demand a greater amount of current from the hub like so:

if (DescriptorType == 0x2A) {
    // handle USB 3.0 current specification here
} else {
    // handle USB 2.0 current specification here

Hopefully this is enough for you to get started.

  • \$\begingroup\$ Minor correction - the windows equivalent to libusb is libusb - it's a an abstraction layer on any platform on which it runs, not the native way of doing things. \$\endgroup\$ – Chris Stratton Sep 20 '13 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.