[libhid-discuss] finding multiple devices in libhid

martin f krafft madduck at madduck.net
Mon Jan 14 17:14:32 UTC 2008


also sprach Warren Jasper <wjasper at tx.ncsu.edu> [2008.01.12.1439 +0100]:
> I was looking through the source for hid_find_usb_device() and was
> wondering why, once you find a device, you don't check to see if
> it already open with hid_is_open().

That's simple: because none of us ever needed it.

> That way, multiple calls to hid_find_device()  will not only
> return a match, but an un-opened match.  Otherwise, how do you
> find multiple  devices with the same Vendor ID and Product ID?

If these devices can be distinguished from each other, then
I suggest the search method should take more criteria. Couldn't bus
ID be used?

Otherwise one could implement this as an iteration, like you
suggest. Somehow, I think that adding a new function
hid_find_devices(), which returns a linked list of all matching
devices, would be a better approach.

I don't have time to work on libhid anymore, but if you see yourself
in the position to implement this, I'd apply the tested patch to the
repository.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
perl -e 'print "The earth is a disk!\n" if ( "a" == "b" );'
                                                   (dedicated to nori)
 
spamtraps: madduck.bogus at madduck.net


More information about the libhid-discuss mailing list