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

Velu, Muthu MVelu at wms.com
Mon Mar 12 23:06:26 CET 2007


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

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?

The application created on windows by the firmware developer can talk to devices' all interfaces (0-3) .

Here is the code snippet. 

    hid_set_debug(HID_DEBUG_ALL);
    hid_set_debug_stream(stdout);
    hid_set_usb_debug(5);
    ret = hid_init();
    hid = hid_new_HIDInterface();
    ret = hid_force_open(hid, 0x01 &matcher, 10);

The above code works, if I use 0x00 as an interface. I am getting the following error, when I use 0x01.

usb_os_init: Found USB VFS at /proc/bus/usb
usb_os_find_busses: Found 005
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 001 on 005
usb_os_find_devices: Found 024 on 004
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 001 on 004
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 004 on 002
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 002 on 002
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
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-hotplug.sourceforge.net/) correctly.
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-hotplug.sourceforge.net/) correctly.
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

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



Thanks in advance.
Muthu


-----Original Message-----
From: Charles Lepple [mailto:clepple at ghz.cc]
Sent: Thu 3/8/2007 7:39 PM
To: Velu, Muthu
Cc: libhid Liste
Subject: Re: How to use multiple interfaces?
 
BTW, please use the libhid-discuss list at alioth:

http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss

The old list at ailab.ch is being shut down.

On Mar 8, 2007, at 7:28 PM, Velu, Muthu wrote:
> Charles,
> I have an HID device with multiple interfaces (0-3) with IN  
> endpoints (81-84) respectively.
>
> It works OK if  I use with interface 0.
>
> When I tried hid_force_open() with interface 1, I got the following  
> error.
> "WARNING: hid_prepare_hid_descriptor(): failed to get HID  
> descriptor for USB device 004/003[1] "
Can you increase the log level and copy the entire set of messages?

You may also need to set the USB_DEBUG environment variable to see  
why this call is failing.
> I noticed the comment on hid_prepare_hid_descriptor() function and  
> realized it always uses USB_ENDPOINT_IN+1.
>
> So I changed it to USB_ENDPOINT_IN+2 but still getting the same error.
>
> I am using libhid-0.2.15+20060325 version of the library.
>
> What should I do to get it work?
>
> Should I use another version of the libray?

I would advise using the SVN version if you can. See details on the  
libhid home page:

http://libhid.alioth.debian.org/

-- 
Charles Lepple





More information about the libhid-discuss mailing list