From owner-freebsd-current@FreeBSD.ORG Sat Aug 7 05:13:15 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 38E4316A4CE for ; Sat, 7 Aug 2004 05:13:15 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C8F343D1D for ; Sat, 7 Aug 2004 05:13:14 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.11/8.12.11) with ESMTP id i775BpfN029705; Fri, 6 Aug 2004 23:11:52 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 06 Aug 2004 23:12:31 -0600 (MDT) Message-Id: <20040806.231231.33567668.imp@bsdimp.com> To: chris@tellme3times.com From: "M. Warner Losh" In-Reply-To: <41124C8B.2060902@tellme3times.com> References: <4110F5AE.6030403@tellme3times.com> <20040804.212242.112819552.imp@bsdimp.com> <41124C8B.2060902@tellme3times.com> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org Subject: Re: USB drivers X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2004 05:13:15 -0000 In message: <41124C8B.2060902@tellme3times.com> Chris writes: : M. Warner Losh wrote: : : > : >You misunerstand what's actually happening. There's no case in the : >tree where two drivers are attached, at the same time, to the same : >device node. There's only one set of pointers. However, with USB, : >there can be reasons why multiple things can attach to the same : >driver. The usb code tries to do smart things for devices that have : >multiple configurations. : > : >With USB and multi-function devices, here's the code that we use: : > : > /* First try with device specific drivers. */ : > probe and attach driver with a config # of -1 (usegeneric = 0) : > return if successful : > /* Next try with interface drivers. */ : > foreach valid configuration : > foreach interface : > probe and attach driver : > /* Finally try the generic driver. */ : > probe and attach driver with a config # of -1 (usegeneric = 1) : > return if successful : > : >I'm not familiar with the specific instance of ulpt and unlpt. : > : > : : : You are right I do not understand. All I know is that when the system : boots, at some point a test is done to see if their are USB devices. If : devices exist then attach drivers. True. : What I am trying to determine is why my multifunction printer/scanner : receives only one of the two drivers. Is it because the printer does : not respond properly? Is it because the printer is not defined? I have : many questions here. Yes. Usb is a little complicated in this area, and there are a number of details that are hard to get right. It wouldn't surprise me if the current set of drivers are less than completely optimal. : I looked in the following and just see the code for that specific : device. It does not test for multifunction devices. I do not see any : code that follows the logic above. : : src/sys/dev/usb/ulpt.c : src/sys/dev/usb/uscanner.c : src/sys/dev/usb/usbdevs True. The above code is from usb/usb_subr.c in usbd_probe_and_attach(). : If you can point me in the right direction, or to some documents on USB : driver writing I will try to figure this out. Any help would be : appreciated. I will get this to work because I need both and the effort : required to switch is just not convenient. I think that the first thing that should be done is to look at the usb configuration. /usr/ports/sysutils/udesc_dump is a good place to start to investigate things. Also, the usb mindshare book is good to understand usb and the layers of the configuation onion. There's a book in the works that should help, but I'm afraid that I can't say more than that at this time. Warner