Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 2010 11:34:28 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Subject:   Re: Find Vendor/Product ID from uhid device
Message-ID:  <201003211134.28085.hselasky@c2i.net>
In-Reply-To: <4BA52239.8000300@martinlaabs.de>
References:  <4BA52239.8000300@martinlaabs.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003211134.28085.hselasky>