Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
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? – boardbite Aug 24 '12 at 20:13
I want to clarify regarding USB normal/full/high/super speeds (mentioned in the specification) – Yasuko Dino Aug 24 '12 at 20:16
For more info, you can check for normal/full speeds using the power settings of the USB hubs/devices – Daniel Li Aug 29 '12 at 15:30

1 Answer

up vote 5 down vote accepted

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.

                                      

IOCTL Reference

USB_NODE_INFORMATION Reference

Then, retrieve with the following access pattern:

PUSB_NODE_INFORMATION UsbNodeInfo = NULL;
// 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. Enjoy!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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