Find Vendor/Product ID from uhid device

Hans Petter Selasky hselasky at c2i.net
Sun Mar 21 13:16:50 UTC 2010


On Sunday 21 March 2010 13:03:22 Martin Laabs wrote:
> Hello Hans,

Hi Martin,

> 
> Hans Petter Selasky wrote:
> > 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.
> 
> Unfortunately the linux-js driver creates a new device in /dev/input which
> is IMHO impossible for a userland program. So I have to detect the usb
> devices in kernel space.

That is not true. Search Google for cuse4bsd :-)
> 
>   If that is not desirable, we
> 
> > can add that information like an IOCTL. usbconfig show_ifdrv might also
> > give you some clues.
> 
> Yes - in fact. I.e. the output I am interested in is
> ugen2.2.0: uhid0: <Logitech Logitech Extreme 3D, class 0/0, rev 1.10/2.04,
> addr 2>
> Now I could figure out that ugen2.2.0 has idVendor=0x046d idProduct=0xc215
> with usbconfig dump_device_desc. After that the driver would check that ids
> against its database and if it would match it would use the /dev/uhid0
> device. (with kopen - see below)
> 

> 
> Do you think it is much effort to add a ioctl to the uhid driver that
> reports the corresponding  usb_device_info struct? This would make porting
> the linux-js driver much more simple for me.
> Or is there a (simple accessible) data structure inside the kernel where I
> can get the information which vendor/product id correspond to a uhidX
> attached device?

This should be quite trivial, if cuse4bsd does not help anything.

Just an idea:

Maybe we can import the linux-js driver into the webcamd framework? Could you 
have a look at it. Then the code changes will be minimal!

--HPS

http://www.selasky.org/hans_petter/video4bsd


More information about the freebsd-usb mailing list