Date: Sat, 23 Aug 2008 08:13:05 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-usb@freebsd.org Cc: Peter B <pb@ludd.ltu.se> Subject: Re: usb match() function Message-ID: <200808230813.05981.hselasky@c2i.net> In-Reply-To: <200808221948.m7MJmglt004097@brother.ludd.ltu.se> References: <200808221948.m7MJmglt004097@brother.ludd.ltu.se>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808230813.05981.hselasky>