[libhid-discuss] libhid problems with interrupt_read/write
Charles Lepple
clepple at ghz.cc
Fri Apr 6 16:06:03 UTC 2007
Thomas Maclean wrote:
>
> Ugh. Sorry. I had been using some online doxygen docs for hid.h and it
> hadn't occured to me that it could change. Lesson learned.
yeah, if I ever find the idiot who posted them... :-)
http://www.ghz.cc/~clepple/libhid/doc/html/hid_8h.html#ce983c54fd45ac9913faa7d0cb730090
It's up to date now.
> I am pretty sure I'm linking against the same distribution of libhid
> because I only have that one version (installed in /usr/local/lib ).
>
> Wow ... in my world (embedded telecom systems) 100 msec is a long time!
> I'll try increasing the timeout a bit. My CPU is reasonably fast (1 GHz)
> - no rocket, but not some embedded 33 MHz processor.
The raw data rate for low-speed USB is 1.5 Mbit/sec, but the actual
throughput is much lower.
> I tried printing the usb_strerror() when I get error returns from my hid
> calls, but mostly the returned string says something along the lines of
> the device was busy or anavailable.
>
> I was looking for ways to 'clear' the error on the pipe (i.e. after I get
> a timeout, all subsequent reads fail.) I thought I had something
> to clear the error by performing a zero-byte read, but I don't think this
> does anything. The odd thing I noticed when doing this is that when I
> try to read 8 bytes and I get a timeout, the warning tells me I got zero
> bytes. When I subsequently perfrom a zero-byte read, the warning tells me
> that I requested 0 bytes, but it sent 8 (though the read buffer seems
> empty).
Odd, maybe I need to check the code there, but in the actual HID spec, I
don't think that zero-byte reads are ever used.
I'm not sure that this is really the proper way to fix things, but there
is this libusb function:
http://libusb.sourceforge.net/doc/function.usbclearhalt.html
--
Charles Lepple
clepple at ghz.cc
More information about the libhid-discuss
mailing list