[libhid-discuss] Determining output report total size and selecting reports

Jeff M jeff_at_werk at yahoo.com
Wed Feb 11 00:20:19 UTC 2009


For my device I am able to send and receive data with no issues if I hardcode the ReportID in hid_set_output_report.  I am stuck on how to programatically determine the total size of an output report and then to specify using a specific report.  For my device I am supposed to find an appropriately sized report and use that report for the message that I want to send.  Right now I am just sending all messages to the same report.

For my device when I run lsusb -vvv I get the following output reports. There are more but for sake of a brief example lets just look at reports 0x0d, 0x0e, and 0x0f.  Note, for all of the input and output reports there is only one usage page.

   Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
    Item(Local ): Usage, data= [ 0x01 ] 1
                    (null)
    Item(Main  ): Collection, data= [ 0x01 ] 1
                    Application
    Item(Global): Report Size, data= [ 0x08 ] 8
    Item(Global): Logical Maximum, data= [ 0x80 0x00 ] 128
    Item(Global): Logical Minimum, data= [ 0x00 ] 0
    Item(Local ): Usage, data= [ 0x01 ] 1
                    (null)

    Item(Global): Report ID, data= [ 0x0d ] 13
    Item(Global): Report Count, data= [ 0x05 ] 5
    Item(Main  ): Output, data= [ 0x02 0x01 ] 258
            Data Variable Absolute No_Wrap Linear
            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
    Item(Local ): Usage, data= [ 0x01 ] 1
                    (null)
    Item(Global): Report ID, data= [ 0x0e ] 14
    Item(Global): Report Count, data= [ 0x09 ] 9
    Item(Main  ): Output, data= [ 0x02 0x01 ] 258
                    Data Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Buffered Bytes
    Item(Local ): Usage, data= [ 0x01 ] 1
                    (null)
    Item(Global): Report ID, data= [ 0x0f ] 15
    Item(Global): Report Count, data= [ 0x0d ] 13
    Item(Main  ): Output, data= [ 0x02 0x01 ] 258
                    Data Variable Absolute No_Wrap Linear
                    Preferred_State No_Null_Position Non_Volatile Buffered Bytes
    Item(Local ): Usage, data= [ 0x01 ] 1
                    (null)

For report 0x0d the total size is 5 counts * 8 bytes = 40 bytes. 
For report 0x0e the total size is 9 counts * 8 bytes = 72 bytes.
For report 0x0f the total size is 13 counts * 8 bytes = 104 bytes.

Here is a identification dump.  According to the example program test_libhid.c you select the appropriate path and pass that into hid_set_output_report.  But if I set the PATH_IN[] variable to the below value I can only select the first report.  I don't see a way to select the other reports.  Each report has the same PATH!

 int const PATH_IN[] = { 0xff000001 };

0xff000001.0xff000001; type: 0x90 Report ID: 0x0d Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0d Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0d Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0d Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0d Size: 8
0xff000001.0xff000001; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0e Size: 8
0xff000001.0xff000001; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8
0xff000001.0x00000000; type: 0x90 Report ID: 0x0f Size: 8

Finally, if I go into function hid_set_output_report in hid_exchange.c and hardcode the ReportID I can send to any report that I want to.

hidif->hid_data->ReportID = 0x0d;

So, I have two questions.

1) How can I determine the total size of each report?  The Size variable 
is always 8 bytes and I don't see a Count variable.
2) How can I figure out the appropriate PATH_INT to pass to his_set_output_report() to select the appropriate ReportID?

Any help would be greatly appreciated!
Jeff


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20090210/f2b8ce58/attachment.htm 


More information about the libhid-discuss mailing list