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

Charles Lepple clepple at ghz.cc
Sun Mar 11 18:24:30 CET 2007


On Mar 11, 2007, at 12:41 PM, James & Julia wrote:

> So basically, the usb device does not have all the
> required "usb api" defined correctly.
> The report descriptor is probably what is not
> fully implemented by the usb device?
> I suspect that the usb snoop captured the windows system
> attempting to get retrieve the report descriptor with
> a valid descriptor handle (34) but the device returned
> an error and did not recognize the request.

Actually, the usbsnoop output shows a report descriptor. I am not  
sure why it flagged the request as invalid. Which version of usbsnoop  
are you using?

>   This corresponds
> to what the libhid is saying with the protocol error.
> however, the windows system seems to ignore the fact that it
> cant get the report descriptor and allow it to work.

Not quite; see above.

> Is there an easy way to get the libhid to do the same?

If this is custom firmware, then you can probably just talk to the  
device through libusb. There are simple function calls to send/ 
receive control messages, and to read and write from interrupt  
endpoints.

If you are trying to stick with the HID standard, then we just need  
to match up what Windows is doing under the hood to what libhid,  
libusb and the Linux kernel are doing.

Here's the function call that corresponds to URB #6 in your previous  
email:

http://www.ghz.cc/~clepple/libhid/doc/html/hid__preparation_8c- 
source.html#l00058

Your setup packet is as follows: 00000000: 81 06 00 22 00 00 6f 00

bmRequestType = 0x81 (libhid is using the wrong constant names to  
calculate this, but the end result is still correct)

bRequest = 0x06 (libhid: USB_REQ_GET_DESCRIPTOR)

wValue = 0x2200 (libhid: (USB_DT_REPORT << 8) + 0)

wIndex = 0x0000 (libhid: interface; 0 from your logs)

wLength = 0x006f (libhid: hidif->hid_parser->ReportDescSize)

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.

There are also some debugging options in the Linux kernel to see all  
of the USB transactions at a very low level. The latest snapshots of  
Wireshark (formerly Ethereal) can load these USB capture sessions.

-- 
Charles Lepple
clepple at ghz.cc





More information about the libhid-discuss mailing list