usbd_attach() returns EBUSY

I have encountered serious problem while trying to write simple program for usb HID device. Whenever i call usbd_attach() it returns EBUSY.

Logs:
hidview:
HIDD v1.00, v1.00 DDK

Device Address : 0
Vendor : 0xffffffff (Legacy PS2 Keyboard)
Product : 0xffffffff (Keyboard)
Version : r1.00
Usage : Keyboard

Device Address : 1
Vendor : 0xffffffff (Legacy PS2/Serial Mouse)
Product : 0xffffffff (Mouse)
Version : r1.00
Usage : Mouse

Device Address : 2
Vendor : 0x08bb (Burr-Brown from TI )
Product : 0x29b2 (USB Audio CODEC )
Version : r2.00
Usage : Consumer Control

usb:
USB 0 (UHCI) v1.10, v1.01 DDK, v1.01 HCD

Device Address : 1
Vendor : 0x0451 (Texas Instruments)
Product : 0x2036 (General Purpose USB Hub)
Class : 0x09 (Hub)
Subclass : 0x00
Protocol : 0x00
Hub Number Ports : 2
Hub Characteristics : 0x0004 (Ganged power, Compound, Global over-current)
Hub Power On->Good : 100 ms
Hub Power Requirements : 100 mA

Device Address : 2
Vendor : 0x08bb (Burr-Brown from TI )
Product : 0x29b2 (USB Audio CODEC )
Class : 0x00 (Independent per interface)

Device Address : 3
Vendor : 0x0403 (FTDI)
Product : 0x6001 (FT232R USB UART)
Class : 0x00 (Independent per interface)

USB 1 (UHCI) v1.10, v1.01 DDK, v1.01 HCD

USB 2 (UHCI) v1.10, v1.01 DDK, v1.01 HCD

USB 3 (UHCI) v1.10, v1.01 DDK, v1.01 HCD

USB 4 (EHCI) v1.10, v1.01 DDK, v1.01 HCD

I have found a solution on foundry27 to use io-hid command with igndev option. Ive tried it: system("slay io-hid"); system("io-hid -dusb igndev=0x0451:0x2036 &"); system("io-hid -dusb igndev=0x08bb:0x29b2 &"); However it doesnt work for me.

Thanks

Wallace,

I’ll assume you are using QNX 6.5 and not an earlier version (where that igndev command isn’t supported).

Assuming that’s true (about 6.5) then you should put all your parameters to io-hid on the same line. In other words, don’t start io-hid twice because each instance will be attaching to one of your devices thus ensuring both are busy :slight_smile:

Try:

system(“io-hid -dusb igndev=0x0451:0x2036 igndev=0x08bb:0x29b2 &”);

If that doesn’t work, try a comma between the two devices

system(“io-hid -dusb igndev=0x0451:0x2036,0x08bb:0x29b2 &”);

Tim

Well pidin info reports it is qnx 6.4.1, but igndev option seems to be supported however. After system boot hidview reports the device (0x08bb:0x29b2) until I type io-hid -dusb igndev=0x08bb:0x29b2, unfortunately usbd_attach() still returns E_BUSSY. Is there any other way to prevent io-hid from using the device?

I`ve also tried qnx 6.5.0 live, result is the same as above.

Wallace,

What happens if you slay io-hid and then run your program? Does it attach then and not get the E_BUSY error.

If it attaches correctly when io-hid id not running you can simply start your program first and then io-hid afterward.

Looking at the doc’s, what you are entering is correct. Have you tried entering the -v option for verbosity to see if anything gets reported that might be a clue to the problem.

The only other thing I can think of is that if you are stopping and starting io-hid you might need to stop/start io-usb as well because io-usb may be remembering that io-hid was using that device.

Tim

Ive managed to bypass the problem. QNX documentation mentions 2 methods of attaching to usb devices, in a loop or in a insertion callback function. I was using the first one, when ubsd_attach() is called in insertion callback all is fine. However, I still dont know why the usbd_attach() returns EBUSY when called in a loop.