usb match() function
Hans Petter Selasky
hselasky at c2i.net
Sat Aug 23 06:11:22 UTC 2008
On Friday 22 August 2008, Peter B wrote:
> Within the usb drivers (/usr/src/sys/dev/usb/u*.c) there's an matching
> routine where the 'uaa->iface' is supposed to be assigned before the
> routine is called.
>
> However for a new device or class this doesn't seem to work. Instead 'uaa'
> is set like for an generic device (two interfaces, no "default" in my
> case).
>
> So how is one supposed to make the kernel fill in 'uaa->iface' ..?
>
> Code excerpt:
> static int
> *_match(device_t self)
> {
> struct usb_attach_arg *uaa = device_get_ivars(self);
> usb_interface_descriptor_t *id;
>
> DPRINTFN(10,("*_match\n"));
> if (uaa->iface == NULL)
> return (UMATCH_NONE);
It is usually like this the the probe function is called once with iface ==
NULL, to give the driver a chance to claim the whole device. The you have to
set the config yourself. If this fails, the iface is set to the various
interfaces to hook on interface specific drivers.
BTW: This feature is going away. All probes will be interface specific and the
config can only be set from userland in the future.
--HPS
More information about the freebsd-usb
mailing list