[libhid-discuss] RE: How to use multiple interfaces?

Velu, Muthu MVelu at wms.com
Tue Mar 13 16:41:33 CET 2007


Thanks Charles.

I am using 2.6.5 kernel.

> USB error: could not claim interface 1: Device or resource busy Check
> that you have permissions to write to 004/024 and, if you don't, that
> you set up hotplug (http://linux- <http://linux-> 
> hotplug.sourceforge.net/) correctly.

I get the above error, even when I was trying with interface 0 but I
could be able to use the device successfully after detaching/claiming
the device. The error on the first attempt with interface 0 is
> USB error: could not claim interface 1: Device or resource busy

But with interface 1, it is
> USB error: could not claim interface 1: No such file or directory

but it still claimed the device in retry attempt and I see that in the
/proc/bus/usb/devices too

> I:  If#= 1 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)


I captured the output to a file as my program runs as part of  a
different shell script.  I will retry by piping the output from the
program itself.

I will try to blacklist the device in the kernel and see if any thing
changes.
 
Thanks again.
Muthu



-----Original Message-----
From: Charles Lepple [mailto:clepple at ghz.cc <mailto:clepple at ghz.cc> ]
Sent: Tuesday, March 13, 2007 8:00 AM
To: Velu, Muthu
Cc: libhid List
Subject: Re: How to use multiple interfaces?

On Mar 12, 2007, at 6:06 PM, Velu, Muthu wrote:

> Charles,
> Thanks so much for your quick response. I just sent a reply but not
> sure if the mail went through.

I think the confusion might have been due to the domain - you posted
last year from wmsgaming.com instead of wms.com. No big deal.

> As you metioned, I got the libhid from SVN trunk and there were only
> two file chenges ( hid_penings.c & hid_preparations.c).
>
> I am using libusb-0.1.12 version of libusb. Should I update this
> library too?

I don't think anything relevant has changed in libusb.

Which version of the kernel are you using?

> USB error: could not claim interface 1: No such file or directory
> Check that you have permissions to write to 004/024 and, if you don't,
> that you set up hotplug (http://linux- <http://linux-> 
> hotplug.sourceforge.net/) correctly.

The only function that I can see in the kernel that can return ENOENT
for claiming an interface is this one:

http://lxr.linux.no/ident?i=claimintf
<http://lxr.linux.no/ident?i=claimintf>  (click the link under "Defined
as a function").

> USB error: could not claim interface 1: Device or resource busy Check
> that you have permissions to write to 004/024 and, if you don't, that
> you set up hotplug (http://linux- <http://linux-> 
> hotplug.sourceforge.net/) correctly.

Same for EBUSY:

http://lxr.linux.no/ident?i=usb_driver_claim_interface
<http://lxr.linux.no/ident?i=usb_driver_claim_interface> 

These error messages look out-of-order - how did you capture stdout and
stderr?

> USB error: could not claim interface 1: Device or resource busy USB
> error: error sending control message: Connection timed out
>  NOTICE: hid_init(): libhid 0.2.15+20060325.0.0 is being initialized.
>   TRACE: hid_init(): initialising USB subsystem...
>   TRACE: hid_init(): scanning for USB busses...
>   TRACE: hid_init(): scanning for USB devices...
>  NOTICE: hid_init(): successfully initialised HID library.
>   TRACE: hid_new_HIDInterface(): creating a new HIDInterface
> instance...
>   TRACE: hid_force_open(): forcefully opening a device interface
> according to matching criteria...
>   TRACE: hid_get_usb_handle(): acquiring handle for a USB device...
>   TRACE: hid_find_usb_device(): enumerating USB busses...
>   TRACE: hid_find_usb_device(): enumerating USB devices on bus 005...
>   TRACE: hid_find_usb_device(): inspecting USB device 005/001[1]...
>   TRACE: hid_compare_usb_device(): comparing match specifications to
> USB device...
>   TRACE: hid_compare_usb_device(): inspecting vendor ID...
>   TRACE: hid_compare_usb_device(): no match on vendor ID.
>   TRACE: hid_compare_usb_device(): inspecting product ID...
>   TRACE: hid_compare_usb_device(): no match on product ID.
>   TRACE: hid_compare_usb_device(): no custom matching function
> supplied.
>  NOTICE: hid_find_usb_device(): vendor 0x0000 of USB device 005/001
> [1] does not match 0x153a.
>   TRACE: hid_find_usb_device(): enumerating USB devices on bus 004...
>   TRACE: hid_find_usb_device(): inspecting USB device 004/024[1]...
>   TRACE: hid_compare_usb_device(): comparing match specifications to
> USB device...
>   TRACE: hid_compare_usb_device(): inspecting vendor ID...
>   TRACE: hid_compare_usb_device(): match on vendor ID: 0x153a.
>   TRACE: hid_compare_usb_device(): inspecting product ID...
>   TRACE: hid_compare_usb_device(): match on product ID: 0x000b.
>   TRACE: hid_compare_usb_device(): no custom matching function
> supplied.
>  NOTICE: hid_find_usb_device(): found a matching USB device 004/024
> [1].
>   TRACE: hid_force_open(): claiming USB device 004/024[1].
>   TRACE: hid_os_force_claim(): failed to claim USB device 004/024 [1],
> trying 9 more time(s)...
>   TRACE: hid_os_force_claim(): detaching kernel driver from USB device
> 004/024[1]...
>   TRACE: hid_os_force_claim(): trying again to claim USB device
> 004/024[1]...
>  NOTICE: hid_force_open(): successfully claimed USB device 004/024[1].
>   TRACE: hid_init_parser(): initialising the HID parser for USB Device
> 004/024[1]...
>   TRACE: hid_init_parser(): allocating space for HIDData structure...
>   TRACE: hid_init_parser(): successfully allocated memory for HIDData
> strcture.
>   TRACE: hid_init_parser(): allocating space for HIDParser
> structure...
>   TRACE: hid_init_parser(): successfully allocated memory for
> HIDParser strcture.
>  NOTICE: hid_init_parser(): successfully initialised the HID parser
> for USB Device 004/024[1].
>   TRACE: hid_prepare_hid_descriptor(): initialising the HID descriptor
> for USB device 004/024[1]...
>   TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor for
> USB device 004/024[1]...
> WARNING: hid_prepare_hid_descriptor(): failed to get HID descriptor
> for USB device 004/024[1]
>   TRACE: hid_close(): closing USB device 004/024[1]...
>   TRACE: hid_close(): closing handle of USB device 004/024[1]...
>  NOTICE: hid_close(): successfully closed USB device 004/024[1].
>   TRACE: hid_reset_parser(): resetting the HID parser for USB device
> 004/024[1]...
>   TRACE: hid_close(): freeing memory allocated for HID parser...
>   TRACE: hid_close(): resetting HIDInterface...
>
>
> dmesg command displays this error
> usb 4-2: control timeout on ep0in
> usbfs: USBDEVFS_CONTROL failed cmd oledbtnpnlsvc dev 24 rqt 129 rq
> 6 len 9 ret -110

This corresponds to the "USB error: error sending control message: 
Connection timed out" error message above.

> device details (/proc/bus/usb/devices)
> T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 24 Spd=12  MxCh= 0
> D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs=  1
> P:  Vendor=153a ProdID=000b Rev= 0.01
> C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=100mA
> I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid
> E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=10ms
> E:  Ad=01(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
> I:  If#= 1 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
> E:  Ad=82(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
> E:  Ad=02(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
> I:  If#= 2 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid
> E:  Ad=83(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
> E:  Ad=03(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
> I:  If#= 3 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid
> E:  Ad=84(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
> E:  Ad=04(O) Atr=03(Int.) MxPS=  64 Ivl=10ms

I don't know. I have successfully connected to one of two HID interfaces
on a USB KVM (with the other interface still claimed by the kernel
usbhid.ko driver), so it is definitely possible. You may need to add a
few more debug statements to isolate exactly what the error codes are.
Another thing is to "blacklist" this device from the kernel HID driver,
and see if there are still any problems.

--
Charles Lepple






More information about the libhid-discuss mailing list