Find Vendor/Product ID from uhid device
Hans Petter Selasky
hselasky at c2i.net
Sun Mar 21 10:36:15 UTC 2010
On Saturday 20 March 2010 20:30:01 Martin Laabs wrote:
> Hi,
>
> I'am currently porting the linux-js joystick driver to the new USB stack.
> Since this driver operates on top other drivers (in the case of USB ontop
> the uhid driver) it needs to figure out whether /dev/uhid* is a device it
> can operate on.
> The driver scans all /dev/uhidX entries and compares the vendor and product
> id against a table. In the old stack this was possible through scanning all
> /dev/ugenX devices, get the device_info struct and compare the
> udi_devnames[] against the "uhidX" string.
> However - the udi_devname string disappeared in the new usb stack and this
> way seems to be not open anymore for me.
> Can you give me a hint how to figure the vendor and product id of a
> /dev/uhidX device.
>
Hi,
I would recommend you use libusb in userland to do this. Then you get all the
information you need for the ID-match and more. If that is not desirable, we
can add that information like an IOCTL. usbconfig show_ifdrv might also give
you some clues.
Currently the libusb20 interface is the most stable.
Doesn't the linux-js joystick driver already have a parser for HID descriptors
and more?
man libusb20
You might find the following function useful to detach the /dev/uhidX driver.
Currently only implemented in 9-current, but present in 8-release:
libusb20_dev_detach_kernel_driver(pdev, iface_index);
--HPS
More information about the freebsd-usb
mailing list