From owner-freebsd-usb@FreeBSD.ORG Sat Aug 23 06:11:22 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19F7B106566B for ; Sat, 23 Aug 2008 06:11:22 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe16.swip.net [212.247.155.225]) by mx1.freebsd.org (Postfix) with ESMTP id A29768FC14 for ; Sat, 23 Aug 2008 06:11:21 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=6MIg2jpqvhTpo/gR8GzG7Q==:17 a=FpyXMhlm8Iw7h970FWUA:9 a=oaoaxbByU1mF0bYq7Z8A:7 a=ITY0qFmhrg5hg_3tk3qhEYI8-k4A:4 a=LY0hPdMaydYA:10 Received: from [62.113.133.243] (account mc467741@c2i.net [62.113.133.243] verified) by mailfe16.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 308905427; Sat, 23 Aug 2008 08:11:19 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Sat, 23 Aug 2008 08:13:05 +0200 User-Agent: KMail/1.9.7 References: <200808221948.m7MJmglt004097@brother.ludd.ltu.se> In-Reply-To: <200808221948.m7MJmglt004097@brother.ludd.ltu.se> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808230813.05981.hselasky@c2i.net> Cc: Peter B Subject: Re: usb match() function X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Aug 2008 06:11:22 -0000 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