Date: Sun, 24 Aug 2008 14:02:49 +0200 From: Bernd Walter <ticso@cicely7.cicely.de> To: Peter B <pb@ludd.ltu.se> Cc: freebsd-hackers@freebsd.org Subject: Re: usb match() function Message-ID: <20080824120234.GM23672@cicely7.cicely.de> In-Reply-To: <200808222002.m7MK2fvo004486@brother.ludd.ltu.se> References: <200808222002.m7MK2fvo004486@brother.ludd.ltu.se>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 22, 2008 at 10:02:41PM +0200, 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' ..? Your function is potentially getting called multiple times. First all drivers (except ugen) are asked for the whole device and if all refuses it splits the device into the interfaces and asks every driver again - if no driver claims at least a single interface ugen is asked for the whole device. So you have to refuse the whole device and wait for the interface run. If there's no interface run then another driver already claimed it or your device has no interfaces defined. > Code excerpt (v7.x): > 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); > -- B.Walter <bernd@bwct.de> http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080824120234.GM23672>