usb/137189: [usb][patch] create and use sysctl nodes for HID report descriptors

Eygene Ryabinkin rea-fbsd at codelabs.ru
Tue Jul 28 15:40:31 UTC 2009


HPS wrote:
> > I can, but how to relate the device name under devfs to the descriptor
> > to be retrieved?
>
> By unit number and device address, like usbconfig.

Yes, but these numbers are the ugen ones; on my system, for example,
ums0 maps to ugen5.3.0.

>>  I can enumerate all HID descriptors via libusb, but I
> > can't currently say which device uses them.
>
> Try:
>
> usbconfig show_ifdrv

Yes, that's better.  But can I rely that the first item in the output of
the libusb20_dev_get_iface_desc() will be the device name?  And still,
to get the report descriptor from one device, I should walk the entire
USB tree until I'll find the device I am interested in.  May be there
are some other ways?  I understand that enumeration is the principle of
the USB bus, but may be there are another ways to directly grab 'struct
libusb20_device *' or alike for the devfs node I am interested in?

> > Why do you dislike the sysctl approach? It is simple and reliable.
>
> It's duplicating access to data. There is not that much wrong about
> it, except it will not work if the device is of another kind. I.E. you
> would have to patch the HID sysctl node into every driver accessing
> HID descriptors?

Just now -- yes, I'll need it.  But probably I can move this
functionality into the USB bus level -- it will automatically create
this sysctl node for all HID children and will dispose it on the detach.
usb_probe_and_attach() is a candidate for such functionality.  Will it
be bad?
-- 
Eygene
 _                ___       _.--.   #
 \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
 /  ' `         ,       __.--'      #  to read the on-line manual
 )/' _/     \   `-_,   /            #  while single-stepping the kernel.
 `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
    {_.-``-'         {_/            #


More information about the freebsd-usb mailing list