[libhid-discuss] hid_interrupt_read error codes
Lars Krueger
lars_e_krueger at gmx.de
Sun Jun 24 17:45:40 UTC 2007
Hi.
I have some problems with the return codes of hid_interrupt_read. If libhid has a problem sending the packet to the device, it returns the same error code as if it hit the timeout.
My main loop is this:
while( 1)
{
ret = hid_interrupt_read( theHid, theEndPoint, thePacket, thePacketLen, 20);
printf( "ret=%d\n", ret);
if( ret == HID_RET_SUCCESS )
{
... Process packet
}
else
{
... Do idle stuff
}
}
The output is:
ret=21
ret=21
ret=21
When I unplug the device:
USB error: error submitting URB: No such device
ret=21
USB error: error submitting URB: No such device
ret=21
Error 21 is HID_RET_FAIL_INT_READ, which is acceptable, bug a timeout is strictly not a read failure.
Do I make any mistake using hid_interrupt_read, or is this a bug in libhid that the URB submission error is reported on stderr, but not in the error code?
Any help appreciated.
PS: I use libhid to convert USB keyboard events to X11 events in order to make radical keymap changes. See usbhotkey.sf.net for details.
--
Lars Krueger
http://LarsKrueger.homestead.com/files
mailto:lars_e_krueger at gmx.de
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
More information about the libhid-discuss
mailing list