[libhid-discuss] Bug in hid_opening: hid_compare_usb_device()

Charles Lepple clepple at ghz.cc
Tue Feb 5 03:38:20 UTC 2008


On Feb 4, 2008, at 10:15 PM, Warren Jasper wrote:

> If there is a device with product ID 0x7f, and you want to open a  
> device with product ID 0x7d, what value of the "mask" or "match" do  
> you
> suggest I use so that if 0x7f exists but 0x7d does not exist it  
> will not try to open a handle to the wrong device?

I will admit that this wasn't the sort of thing we anticipated with  
libhid.

However, I keep mentioning the custom matching function because I  
guess I don't completely understand the way you are deploying libhid.

There are a couple of programs out there that use libhid, but don't  
have very strict requirements for a specific version of libhid. I  
want to make sure that we don't cause too much trouble for them. (One  
of the programs controls Apple LCD monitors, and I seem to remember  
that the PIDs for the monitors fit well into the match/mask scheme  
that libhid uses now. So yes, it's a feature, although it isn't  
obvious or 100% correct for all situations.) For someone who wants to  
open a whole class of devices with the same VID, and with the first  
few bits of the PID being the same, we need to provide some sort of  
wildcard mechanism.

On the other hand, if you can completely specify what version of  
libhid that your system uses, it shouldn't be too hard to just patch  
it as you go. I'm trying not to sound too exasperated here, but I am  
trying to strike a balance between making it easy for people who have  
already written code that works with libhid as-is, and people who can  
easily add features using the hooks already in libhid (such as the  
custom matching function).

It sounds like we need another branch for new features and bugfixes  
that will break existing apps.

-- 
Charles Lepple





More information about the libhid-discuss mailing list