[libhid-discuss] Asynchronous I/0 operation through libhid

Charles Lepple clepple at ghz.cc
Fri May 4 11:31:54 UTC 2007


On May 4, 2007, at 5:50 AM, Anmol Ranka wrote:

>  1) Is asynchronous non blocking I/0 operation supported by  
> libhid-0.2.16. If
> yes, can you please provide me its documentation?

No. It uses libusb 0.1.x to communicate with the USB device, and  
asynchronous I/O is only supported in the development version of  
libusb (which has an incompatible API).

>  2)Can I simultaneously perform read and write operation at a time?  
> Let me
> elaborate. I will create a thread which will perform blocking
> 'hid_get_input_report'(libhid's equivalent read API) operation. In his
> scenario, will 'hid_set_output_report' (libhid's equivalent write API)
> request from another thread go through?

In terms of the actual packets on the wire, you can't do this. With  
asynchronous I/O, you could queue up a read and a write request back- 
to-back, but I would recommend against using libhid from multiple  
threads until you have proven that it works in a single thread, and  
that both your host and device are OK with multiple threads accessing  
the same USB device.

-- 
Charles Lepple




More information about the libhid-discuss mailing list