Strange results with usbd_connect()


I have the devb-umass class driver running & an active connection handler to the stack. But when i try to attach to the device, it always returns a BUSY error.

Now if i club this attach() and extract descriptors code into a function & move it to some other file and access it externally, then iam able to attach and extract USB device info.

How is this possible? wht difference does it make if i have the code in the same file or in other file and access it externally?

Many Thanks !!


What kind of USB device are you inserting?

From what I remember (been a while since I worked with this) if it is a HID class device and you are running devi-hid then devi-hid attaches to it 1st and you always get the BUSY error because only one process can attach.

If you do not have a HID class device then I am not sure why you are getting the BUSY error because I don’t recall getting that problem.


iam using all kinds of devices, USB stick, mouse, keyboard, media player, dongles etc…

but i do not start the drivers for all these. onyl devb-umass is running.

is this behaviour OK? and so why? it is not per QNX documentation.


Just a quick review of the USB hierarchy.

At the top is io-usb. This is the most basic USB driver that talks to the USB hardware on your motherboard. The driver you write connects to this when it receives the device insertions/removals/connects/disconnects etc.

devb-umass is a driver for USB mass storage devices. It connects to io-usb and is informed (and mounts a USB drive) when a mass storage usb device is inserted. After that it handles everything related to a mass storage device.

devi-hid is similar to devb-umass except it is designed to work with HID devices (keyboard, mice, joysticks etc).

So if devi-hid and devb-umass are running they will interfere with your programs ability to connect to those types of devices.

I assume you have downloaded the USB tdk from the QNX site with the example USB drivers for a mouse, keyboard and printer. These are all designed to work with io-usb. If you haven’t, I’d suggest you grab this tdk for the sample source code. It is quite invaluable.

What exactly are you wanting to accomplish anyway? I assume you just want to detect a certain USB device as opposed to any USB device (if you are trying to detect and use any USB device then you are trying to re-write io-usb which is not recommended).