[libhid-discuss] Trouble with IOCTL_USB_REAPURB

Charles Lepple clepple at ghz.cc
Fri Dec 22 23:09:57 CET 2006


On Dec 22, 2006, at 5:41 AM, Storm Scratcher wrote:

> Hi Charles,
>
> Thanks for answers.
>
> Host controller is a SL811HS.

Sounds vaguely familiar, but I haven't had any firsthand experience  
with it.

> I tried with libusb-0.1.8 and i get this : "could not claim  
> interface 0: Device or resource busy"

You should still be able to juggle versions around and get things to  
work (e.g. use libhid-detach-device linked against libusb > 0.1.8 to  
detach the kernel driver), and then use an older version of libusb  
with libhid.

> usb_set_debug: Setting debugging level to 9 (on)
>  NOTICE: hid_init(): libhid 0.2.14.0.0 is being initialized.

What version of libusb did you use here?

>   TRACE: hid_prepare_parser(): dumping the raw report descriptor
>   TRACE: hid_prepare_parser(): 0x000: 0x05 0x01 0x09 0x06 0xa1 0x01  
> 0x05 0x07
>   TRACE: hid_prepare_parser(): 0x008: 0x19 0xe0 0x29 0xe7 0x15 0x00  
> 0x25 0x01
>   TRACE: hid_prepare_parser(): 0x010: 0x75 0x01 0x95 0x08 0x81 0x02  
> 0x95 0x01
>   TRACE: hid_prepare_parser(): 0x018: 0x75 0x08 0x81 0x01 0x95 0x05  
> 0x75 0x01
>   TRACE: hid_prepare_parser(): 0x020: 0x05 0x08 0x19 0x01 0x29 0x05  
> 0x91 0x02
>   TRACE: hid_prepare_parser(): 0x028: 0x95 0x01 0x75 0x03 0x91 0x01  
> 0x95 0x06
>   TRACE: hid_prepare_parser(): 0x030: 0x75 0x08 0x15 0x00 0x25 0x65  
> 0x05 0x07
>   TRACE: hid_prepare_parser(): 0x038: 0x19 0x00 0x29 0x65 0x81 0x00  
> 0xc0

If you use libhid-*/hidparser/extract_report_descriptor.py on the  
above data, it will do a somewhat more accurate dump of the HID  
report descriptor.

Essentially, it is trying to look like a keyboard or keypad. (Usage  
Page 1: Generic Desktop Controls, Usage 6: Keyboard).

libhid was actually designed for the opposite case of a keyboard. In  
an UPS, the "tree" of HID items (as enclosed by collections, etc) is  
several levels deep, but each item is no longer than 32 bits. In a  
keyboard, the "tree" is only one or two levels deep (Application  
collection, and then the keys/lights), but the bitfield for the keys  
is wide enough for at least 103 keys.

This is the short explanation why the hidparser code dumps out a ton  
of zeroes at the end of the usage "path": it was not meant to handle  
the arrays that HID keyboards typically use to represent a lot of  
very similar switches.

Have you looked at using the Linux input event API?

-- 
Charles Lepple
clepple at ghz.cc





More information about the libhid-discuss mailing list