[libhid-discuss] Fwd: Opening multiple devices

Charles Lepple clepple at ghz.cc
Wed Jan 23 03:21:50 UTC 2008


[I missed the reply-all button.]

Begin forwarded message:

From: Charles Lepple
Date: January 22, 2008 10:16:42 PM EST
To: Warren Jasper
Subject: Re: [libhid-discuss] Opening multiple devices

On Jan 22, 2008, at 11:00 AM, Warren Jasper wrote:

> 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.

Looks good. I can't test this at the moment, but I'll put it in the  
tree [rev. 355] and see if anyone else has trouble with it.

I agree that it should be dynamic, but 20 devices should be OK for  
most people.

-- 
Charles Lepple



More information about the libhid-discuss mailing list