[libhid-discuss] Get feature report - select report ids?

Charles Lepple clepple at ghz.cc
Thu Sep 13 03:22:11 UTC 2007


On Sep 12, 2007, at 12:52 PM, Tim Braun wrote:

> Here's a patch which changes the API for accessing feature reports to
> allow accessing more than the first feature report.
>
> I have a device which supplies five different feature reports, and  
> this
> code change allows me to access them all.

Going strictly according to the spec, different features should have  
different HID usage numbers if they are in different reports. At the  
API level, report IDs should not be exposed (IMHO) if the report  
descriptor was designed correctly.

I admit there are some corner cases where multiple-byte features (or  
inputs or outputs) are not handled correctly, but it sounds like  
these are spread across multiple reports.

> A couple of questions :
>
> 1. How do we feel about adding a parameter to this api call?

I'd rather not break the API over this. If it were C++, I'd say sure,  
add another parameter with a default value, but I think it could be  
also handled with a different function.

> 2. Why is it necessary to set the report id twice?  After the return
> from the hid_find_object() call, the ReportID field is reset from that
>    which is requested.

This goes back to my point about the Report ID not being exposed - in  
a "proper" descriptor, you identify HID report elements, and libhid  
does the dirty work to figure out what report ID to retrieve  
(specifically, in hid_find_object()).

I know the calling conventions are not well documented (after all,  
the hidif pointer parameter to that function is marked const, and the  
structure gets changed), but that's the legacy of the HIDParser code.

-- 
Charles Lepple






More information about the libhid-discuss mailing list