[libhid-discuss] libhid::error sending control message: Protocol error !!
Peter Stuge
peter at stuge.se
Sat Feb 26 01:17:20 UTC 2011
Hi Mohamad,
Mohamed Ait Ouaziz wrote:
> > > > > I try to write a user-space driver to control a usb device.
> > > >
> > > > Do you know how you will communicate with the device on top of USB?
> >
> > Do you?
>
> Actually i don't. My understanding is that i after opening the
> device i will send and receive reports!!
Ah, sorry, this wasn't quite what I meant, but you are correct in
that reports are used for HID class devices.
What I mean is if you know (from vendor documentation, or from
reverse engineering) what you will put inside the reports, so to
speak.
That is the difficult part with any USB device.
> > Strongly recommend using HIDAPI. http://www.signal11.us/oss/hidapi/
>
> I will look at this and come back to you.
Great! Depending on how the device communicates, HIDAPI can be
significantly more suitable than libhid or libusb. For devices
which are only freeriding on HID in order to avoid having a kernel
driver at all cost HIDAPI is frequently the better fit.
> Thank you for your time.
You're welcome!
Mohamed Ait Ouaziz wrote:
> Peter,
>
> here is the simple code im trying to execute:
..
> ret = hid_force_open(hid, 0, &matcher, 3);
> ret = hid_write_identification(stdout, hid);
> ret = hid_dump_tree(stdout, hid);
>
> return 0;
> }
>
> Do you have any idea about the origin of the error?
The code looks good to me, although I'm not quite a libhid expert.
I still believe that the problem may be either in the device, or
between libhid and the device. Ie. I think it would be very useful
to test exchanging some data also with another library.
Your device is a little odd when it comes to USB, because it's USB
interface (this is a special term in the USB protocol) is HID class,
while the USB device is not. This can create complications. Would
suggest testing with HIDAPI, and if that also doesn't work then
either look into fixing HIDAPI or possibly use a kernel API directly.
//Peter
More information about the libhid-discuss
mailing list