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

Anmol Ranka Anmol_Ranka at mindtree.com
Fri May 4 12:35:11 UTC 2007


I will take care of keeping the whole list in the loop.



-----Original Message-----
From: Charles Lepple [mailto:clepple at ghz.cc] 
Sent: Friday, May 04, 2007 5:57 PM
To: Anmol Ranka
Cc: libhid-discuss List
Subject: Re: [libhid-discuss] Asynchronous I/0 operation through libhid

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  
> 'libhid'?
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.

Charles Lepple

This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return  e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited.  Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.

More information about the libhid-discuss mailing list