[libhid-discuss] help deciphering HID descriptor

Hans-Christoph Steiner hans at eds.org
Wed Nov 28 19:25:01 UTC 2007


Hey,

I've been having trouble translating the HID output descriptor into  
something that works in libhid.  lsusb -vvv doesn't output the  
descriptor (it says Report Descriptor: ** UNAVAILABLE **), so I am  
using the Mac OS X USB Prober.app.  I attached the descriptor  for my  
Logitech RumblePad 2 USB.  I am reading fine, I get the buttons and  
the axes, but I can't figure out the output part.

Here's the code I am using to write (I've changed the path[] a few  
times).  "x" is a struct that is passed in to this function:

     const int path[] = {0x000c0001, 0x000c0001};
     long path_element;
     unsigned int const depth = 2;
     unsigned char const SEND_PACKET_LEN = 2;
     char const PACKET[] = { 0x50 };

     if ( !hid_is_opened(x->x_hidinterface) )
     {
         error("[usbhid] device not open, can't set data");
         return;
     }
     x->x_hid_return = hid_set_output_report(x->x_hidinterface,
                                             path,
                                             depth,
                                             PACKET,
                                             SEND_PACKET_LEN);




Here's the info from USB Prober:


Low Speed device @ 3  
(0x1A200000): .............................................    
Composite device: "Logitech RumblePad 2 USB"
     Device Descriptor
         Descriptor Version Number:   0x0110
         Device Class:   0   (Composite)
         Device Subclass:   0
         Device Protocol:   0
         Device MaxPacketSize:   8
         Device VendorID/ProductID:   0x046D/0xC218   (Logitech Inc.)
         Device Version Number:   0x0100
         Number of Configurations:   1
         Manufacturer String:   1 "Logitech"
         Product String:   2 "Logitech RumblePad 2 USB"
         Serial Number String:   0 (none)
     Configuration Descriptor
         Length (and contents):   41
         Number of Interfaces:   1
         Configuration Value:   1
         Attributes:   0x80 (bus-powered)
         MaxPower:   500 ma
         Interface #0 - HID
             Alternate Setting   0
             Number of Endpoints   2
             Interface Class:   3   (HID)
             Interface Subclass;   0
             Interface Protocol:   0
             HID Descriptor
                 Descriptor Version Number:   0x0110
                 Country Code:   0
                 Descriptor Count:   1
                 Descriptor 1
                     Type:   0x22  (Report Descriptor)
                     Length (and contents):   119
                     Parsed Report Descriptor:
                           Usage Page    (Generic Desktop)
                           Usage (Joystick)
                               Collection (Application)
                                     Collection (Logical)
                                       Logical Minimum.........    (0)
                                       Logical Maximum.........    (255)
                                       Physical Minimum........    (0)
                                       Physical Maximum........    (255)
                                       Report Size.............    (8)
                                       Report Count............    (4)
                                       Usage (X)
                                       Usage (Y)
                                       Usage (Z)
                                       Usage (Rz)
                                       Input...................    
(Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null  
Position, Bitfield)
                                       Logical Maximum.........    (7)
                                       Physical Maximum........    (315)
                                       Report Size.............    (4)
                                       Report Count............    (1)
                                       Unit....................    (20)
                                       Usage (Hat Switch)
                                       Input...................    
(Data, Variable, Absolute, No Wrap, Linear, Preferred State, Null  
State, Bitfield)
                                       Unit....................    (0)
                                       Logical Maximum.........    (1)
                                       Physical Maximum........    (1)
                                       Report Size.............    (1)
                                       Report Count............    (12)
                                       Usage Page    (Button)
                                       Usage Minimum...........    (1)
                                       Usage Maximum...........    (12)
                                       Input...................    
(Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null  
Position, Bitfield)
                                       Usage Page    (65280)
                                       Report Size.............    (1)
                                       Report Count............    (16)
                                       Logical Maximum.........    (1)
                                       Physical Maximum........    (1)
                                       Usage 1 (0x1)
                                       Input...................    
(Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null  
Position, Bitfield)
                                     End Collection
                                     Collection (Logical)
                                       Logical Maximum.........    (255)
                                       Physical Maximum........    (255)
                                       Report Size.............    (8)
                                       Report Count............    (7)
                                       Usage 2 (0x2)
                                       Output..................    
(Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null  
Position, Nonvolatile, Bitfield)
                                     End Collection
                                     Collection (Logical)
                                       Logical Maximum.........    (255)
                                       Physical Maximum........    (255)
                                       Report Size.............    (8)
                                       Report Count............    (5)
                                       Usage Page    (65280)
                                       Usage 1 (0x1)
                                       Feature.................    
(Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null  
Position, Nonvolatile, Bitfield)
                                     End Collection
                               End Collection




------------------------------------------------------------------------ 
----

Using ReBirth is like trying to play an 808 with a long stick.    - 
David Zicarelli




More information about the libhid-discuss mailing list