[libhid-discuss] Opening multiple devices
Warren Jasper
wjasper at tx.ncsu.edu
Tue Jan 22 16:00:46 UTC 2008
Problem: One of the shortcomings of the current implementation of
libhid is that it does not handle multiple devices correctly. For
example, with
two identical devices on the USB bus with the same vendor and product
id's, libhid returns a handle to the first successful match. I do not
believe that
this was the intended behavior of the package.
Solution:
I have attached a patch to hid_opening.c that should fix the
problem. It basically keeps a list of currently open device/interface
pairs, and keeps searching
for a new device/interface before looking for a match. Before
returning from hid_open for hid_force_open, it adds the device to the
list of open
device/interface pairs.
This implementation does not work for different processes and is not
currently thread safe. However, libhid has these same issues.
Enjoy,
Warren
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_hid_opening
Url: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20080122/d9929992/attachment.txt
More information about the libhid-discuss
mailing list