[libhid-discuss] Asynchronous I/0 operation through libhid
clepple at ghz.cc
Fri May 4 12:27:07 UTC 2007
On May 4, 2007, at 8:07 AM, Anmol Ranka wrote:
> Thanks again for the quick reply and patience.
If you want to keep the free support coming, please keep the list
CC'd. (This allows other people the opportunity to search for answers
in the mailing list archives.)
Private support is not free, it is known as "consulting".
> I have few more doubts:
> · Asynchronous I/O is only supported in the development
> version of
> libusb (which has an incompatible API). Can you please
> explain it in
> detail? Do you mean it will be available in next release of
no, it will be available in the next major release of libusb, and I
don't have any control over when that gets released.
> · If I have to access the USB HID device from a single
> thread, then how can I perform both read and write simultaneously.
> I assume the read operation supported by 'libhid' is blocking.
If you are using hid_get_input_report() and hid_set_output_report(),
these calls use the same control endpoint, and can never be properly
executed simultaneously. You might be able to get away with
simultaneous reads and writes to two different (interrupt) endpoints,
but bear in mind that most USB device firmware is not multithreaded
Again, you can queue up low-level USB requests so that it looks like
you are reading and writing simultaneously, but if the requests go to
the same endpoint on the same device, the requests will be serialized.
More information about the libhid-discuss