[libhid-discuss] unable to get input report

Charles Lepple clepple at ghz.cc
Tue Jan 13 16:05:58 UTC 2009


On Jan 13, 2009, at 3:44 AM, stdht.inbox at gmail.com wrote:

> Hello
>
> My device is an usb barcode scanner. It works in 2 modes: simulates
> usb keyboard or acts like usb2serial device (general hid). I use it  
> in mode 2 as
> general hid device.
> I used raw hid under linux and was able to read interrupt reports and
> used function ioctl(HIDIOCGUSAGES,...) to retrieve all the array of
> usages (about 63 values)...

If you send me some pointers to the "raw hid" API, I will take a look  
at it. I am in the process of rewriting the libhid backend to not be  
tied to just raw libusb calls.

>
> Now I am using libhid. I receive interrupt reports without problems
> but how to get array of usages????
>
> hid_get_input_report with path 0xff03c00, 0xff030d03, 0xff030022
> or 0xff03c00, 0xff030d03, 0xff030050 with lengths (1,63,64) fails
> with code 20.

The error code is meant to be somewhat generic. (You can look up the  
message name with hid_strerror(), by the way). What is usually more  
interesting is the trace messages, as they tell you what operations  
succeeded and failed.

> My hidtrace and related info:
>
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        16
>   idVendor           0x05e0 Symbol Technologies
>   idProduct          0x0600
>   bcdDevice            2.01
>   iManufacturer           1 ?Symbol Technologies, Inc, 2002
>   iProduct                2 Symbol Bar Code Scanner
>   iSerial                 3 S/N:1BBFACCB09D4 Rev:NBRMIAAU5
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           34
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          4 Bus Powered
>     bmAttributes         0x80
>       (Bus Powered)
>     MaxPower              400mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         3 Human Interface Devices
>       bInterfaceSubClass      1 Boot Interface Subclass
>       bInterfaceProtocol      1 Keyboard
>       iInterface              0
>         HID Device Descriptor:
>           bLength                 9
>           bDescriptorType        33
>           bcdHID               1.10
>           bCountryCode            0 Not supported
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength      40
>           Report Descriptor: (length is 40)
>             Item(Global): Usage Page, data= [ 0x03 0xff ] 65283
>                             (null)
>             Item(Local ): Usage, data= [ 0x00 0x0c ] 3072
>                             (null)
>             Item(Main  ): Collection, data= [ 0x01 ] 1
>                             Application
>             Item(Local ): Usage, data= [ 0x03 0x0d ] 3331
>                             (null)
>             Item(Main  ): Collection, data= [ 0x02 ] 2
>                             Logical
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x01 ] 1
>             Item(Global): Logical Minimum, data= [ 0x00 ] 0
>             Item(Global): Logical Maximum, data= [ 0x3f ] 63
>             Item(Local ): Usage, data= [ 0x50 ] 80
>                             (null)
>             Item(Main  ): Input, data= [ 0x02 ] 2
>                             Data Variable Absolute No_Wrap Linear
>                             Preferred_State No_Null_Position  
> Non_Volatile Bitfield
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x3f ] 63
>             Item(Global): Logical Minimum, data= [ 0x00 ] 0
>             Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>             Item(Local ): Usage, data= [ 0x22 ] 34
>                             (null)
>             Item(Main  ): Input, data= [ 0x00 ] 0
>                             Data Array Absolute No_Wrap Linear
>                             Preferred_State No_Null_Position  
> Non_Volatile Bitfield
>             Item(Main  ): End Collection, data=none
>             Item(Main  ): End Collection, data=none
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval              10
> Device Status:     0x0000
>   (Bus Powered)
>
> TRACE: hid_dump_tree(): iterating the parse tree for USB device  
> 003/030[0]...
> parse tree of HIDInterface 003/030[0]:
>   path: 0xff030c00.0xff030d03.0xff030050; type: 0x80
>   path: 0xff030c00.0xff030d03.0xff030022; type: 0x80

It looks like you would use 0xff030c00.0xff030d03.0xff030022 with  
length 63.

I haven't checked recently, but I think libhid discards the rest of  
the buffer if you only request one item from a report.

You could also try hid_get_input_report(), passing in the length of  
the whole report (looks to be 64) if you know you need both items.

>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>   path: 0xff030c00.0xff030d03.0x00000000; type: 0x80
>
>
>
>
> -----------------------------------------------------
>
>
> Best regards,
> Serge.
>
>
> _______________________________________________
> libhid-discuss mailing list
> libhid-discuss at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
> http://libhid.alioth.debian.org/




More information about the libhid-discuss mailing list