Subject: Re: accessing specific USB HID devices
To: Werner Backes <current-users@NetBSD.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: current-users
Date: 04/17/2004 02:32:56
----- Original Message -----
From: "Werner Backes" <werner@bit-1.de>
To: <current-users@NetBSD.org>
Sent: Saturday, April 17, 2004 1:18 AM
Subject: accessing specific USB HID devices


> I have a machine with 3 USB (HID) devices attached each with
> various report IDs so I end up with >25 /dev/uhid* device nodes.
> My question is: is there a way for an application to query which
> uhid device node belongs to which physical device? Because this
> mapping changes according to the sequence in which the devices
> are plugged in, it is not very practicable for an application to
> make this a command line option or so, because the only way to
> find out which uhid-device is which it to look at the dmesg
> output. I already read the uhidev and uhid man pages and look
> through the sources but couldn't find a solution. Do I miss
> something obvious here or is this just a feature lack in uhid?
>

Take a look into "man usb(4)". AFAIU executing some ioctl on /dev/usb device
you can:
1) query what devices are attached at current moment including what drivers
servicing them.
2) monitor in runtime devices state.

At least i used the second feature on NetBSD 1.6.1 and it works quite fine
i.e. i could catch devices/drivers attachment and detachment. By device
identifucation info you can find your expected device and upper level
driver, uhid in your case.

// wbr