[libhid-discuss] libhid USB error: error sending control message: Protocol error

Charles Lepple clepple at ghz.cc
Sun Mar 11 21:19:03 CET 2007


On Mar 11, 2007, at 3:55 PM, hatmakers wrote:

>> So the only thing that I can think of is that hidif->hid_parser-
>>> ReportDescSize isn't correctly being sent. You can add a debug TRACE
>> () statement to hid_prepare_report_descriptor() to verify this.
>
>
> The code will fail when it tries to prepare the hid descriptor which
> returns -71 from the usb control msg.  (see TRACE).

Ah, my mistake. I was looking at the report descriptor URB that you  
sent, and I forgot to look back at the debug output.

>   TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor  
> for USB
> device(endpoint: 80) 001/024[0]...
> USB error: error sending control message: Protocol error
>   TRACE: hid_prepare_hid_descriptor():
> usb_control_msg(devhandle,129,6,8448,0,(char *)buffer, 24,10000)  
> RETURNED: -71
> WARNING: hid_prepare_hid_descriptor(): failed to get HID descriptor  
> for USB

Does this match one of the earlier URBs in the usbsnoop logfile?

> And since that is failing (hid_preparation.c)
> it never sets the  ReportDescSize
> which is required for the hid_prepare_report_descriptor()\
> right?
> or is ReportDescSize able to be set someplace else?

Hmm, it appears as though this code <http://www.ghz.cc/~clepple/ 
libhid/doc/html/hid__preparation_8c-source.html#l00025> is just  
trying to retrieve the first 9 bytes, and that is where the firmware  
is getting confused. (The HID descriptor is variable-length, but the  
first 9 bytes are a standard descriptor header.)

The HID access code in NUT[*] has a workaround for some HID UPSes  
that do not return the right number of bytes for the report, but I  
think we are seeing slightly different symptoms here.

[*] http://www.networkupstools.org and http://boxster.ghz.cc/projects/ 
nut/browser/trunk/drivers/libusb.c#L249

Did you change the code to use 24 instead for the length? (I'm  
looking at the parameters to usb_control_msg() above.)

-- 
Charles Lepple
clepple at ghz.cc





More information about the libhid-discuss mailing list