How to extract USB config, interface & device descriptor

Hi All,

Can any one please give me a SAMPLE CODE to extract the below information from the USB stack.

After connecting to the stack, when a USB device is connected to the system:

  1. sample code to extract device descriptors?
  2. sample code to extract interface descriptors?
  3. sample code to extract configuration descriptors?

I did not find sample code in QNX help and so posting this request.

Any links, code example shall help. Thank you very much for your help.


Its no code, but i think you may want to take a look for the usbd_* functions.
Especially the usbd_descriptor() for obtaining device descritpors.
I never used this in code yet ^^

I always get a Resource Busy error message when I try to attach() to my device. Any clues why???

iam able to read all the descriptor data now. The issue was that the device was in use by some other process.

Now I have a new issue. I start the device driver before I start my application that connects to the stack to get device insert/remove
notifications. In this case, I always get the device busy message.

is there a way to get the descriptors even when the device is in use? any known alternatives ?
or is it that the device, interface and config descriptors have to be read before the correspondign class driver is loaded?

thank you once again.


The reason the device is busy is because the USB driver (io-usb) is already controlling it. Hence your driver can’t control it as well. You can only start your driver or io-usb but not both.

What kind of device do you actually have that your trying to talk to?

Unless it’s something that io-usb can’t talk to for you, I suggest you download the USB DDK (mentioned in the helpviewer) from (assuming you have valid licences you can download it free). This gives code examples of how a USB mouse, keyboard and printer work (inclusing dealing with device insertions/removals). It’s fairly straightforward (esp if you’ve ever done a resource manager) and should simplify your work quite a bit assuming io-usb can see your device.