[libhid-discuss] Enumerate

Charles Lepple clepple at ghz.cc
Sun Oct 21 13:42:39 UTC 2007


On Oct 20, 2007, at 4:19 PM, Alex wrote:

> Does anyone have an example for a way to list all HID devices that are
> accessible to the current user on a system [with vendor and product
> strings as well]?

There are a number of ways you could approach this, depending on what  
you are trying to do with the list, and how accurate you want it to be.

The current libhid code does not distinguish between HID interfaces,  
and regular USB interfaces on a device. If you are trying to narrow  
down the list, be aware that some devices specify the HID class in  
the device descriptor, and others specify it in the interface  
descriptor.

You could use a custom matching function in hid_find_usb_device(),  
and use libusb calls on the *usbdev that gets passed each time the  
matcher function is called.

-- 
Charles Lepple





More information about the libhid-discuss mailing list