[libhid-discuss] Set values to PATHLEN, RECV_PACKET_LEN y PATH_OUT

Charles Lepple clepple at ghz.cc
Tue Sep 19 11:44:22 UTC 2006


On Sep 19, 2006, at 7:32 AM, el cintura partida wrote:

> Hello,
>
> I trying read a input mice.  How get usage path, a buffer, and the  
> length of
> the latter from lsusb? In function hid_get_input_report (include/ 
> hid.h) I need
> set values to PATHLEN, RECV_PACKET_LEN y PATH_OUT of usb device.

If you run test_libhid on your device, you can call hid_dump_tree()  
to list the values for PATH_OUT (and PATHLEN is just the number of  
usage page/usage pairs in the "path").

>
>             Item(Global): Usage Page, data= [ 0x09 ] 9
>                             Buttons
>             Item(Local ): Usage Minimum, data= [ 0x01 ] 1
>                             Button 1 (Primary)
>             Item(Local ): Usage Maximum, data= [ 0x03 ] 3
>                             Button 3 (Tertiary)
...
>             Item(Global): Report Count, data= [ 0x03 ] 3
>             Item(Global): Report Size, data= [ 0x01 ] 1

3 bits for buttons


>             Item(Main  ): Input, data= [ 0x02 ] 2
>                             Data Variable Absolute No_Wrap Linear
>                             Preferred_State No_Null_Position  
> Non_Volatile
> Bitfield
>             Item(Global): Report Count, data= [ 0x01 ] 1
>             Item(Global): Report Size, data= [ 0x05 ] 5
>             Item(Main  ): Input, data= [ 0x01 ] 1
>                             Constant Array Absolute No_Wrap Linear
>                             Preferred_State No_Null_Position  
> Non_Volatile
> Bitfield

5 padding bits

>             Item(Global): Usage Page, data= [ 0x01 ] 1
>                             Generic Desktop Controls
>             Item(Local ): Usage, data= [ 0x30 ] 48
>                             Direction-X
>             Item(Local ): Usage, data= [ 0x31 ] 49
>                             Direction-Y
>             Item(Local ): Usage, data= [ 0x38 ] 56
>                             Wheel
>             Item(Global): Logical Minimum, data= [ 0x81 ] 129
>             Item(Global): Logical Maximum, data= [ 0x7f ] 127
>             Item(Global): Report Size, data= [ 0x08 ] 8
>             Item(Global): Report Count, data= [ 0x03 ] 3
>             Item(Main  ): Input, data= [ 0x06 ] 6
>                             Data Variable Relative No_Wrap Linear
>                             Preferred_State No_Null_Position  
> Non_Volatile
> Bitfield

3 * 8 bits of motion delta

>             Item(Main  ): End Collection, data=none
>             Item(Local ): Usage, data= [ 0x3c ] 60
>                             Motion Wakeup
>             Item(Global): Logical Minimum, data= [ 0x00 ] 0
>             Item(Global): Logical Maximum, data= [ 0x01 ] 1
>             Item(Global): Report Size, data= [ 0x01 ] 1
>             Item(Global): Report Count, data= [ 0x01 ] 1
>             Item(Main  ): Feature, data= [ 0x22 ] 34
>                             Data Variable Absolute No_Wrap Linear
>                             No_Preferred_State No_Null_Position  
> Non_Volatile
> Bitfield
>             Item(Global): Report Count, data= [ 0x07 ] 7
>             Item(Main  ): Feature, data= [ 0x01 ] 1
>                             Constant Array Absolute No_Wrap Linear
>                             Preferred_State No_Null_Position  
> Non_Volatile
> Bitfield

1 bit "motion wakeup" plus 7 padding bits

so I'd try setting RECV_PACKET_LEN to 5.

If you are only targeting Linux, you also might want to try the /dev/ 
input interface.

-- 
Charles Lepple
clepple at ghz.cc





More information about the libhid-discuss mailing list