From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 19 04:39:46 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AE3916A41F for ; Wed, 19 Oct 2005 04:39:46 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id E244343D49 for ; Wed, 19 Oct 2005 04:39:45 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.3/8.13.3) with ESMTP id j9J4bQUe033117; Tue, 18 Oct 2005 22:37:26 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 18 Oct 2005 22:38:45 -0600 (MDT) Message-Id: <20051018.223845.67882192.imp@bsdimp.com> To: dr2867@pacbell.net From: "M. Warner Losh" In-Reply-To: <43553287.4030907@pacbell.net> References: <43553287.4030907@pacbell.net> 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 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Tue, 18 Oct 2005 22:37:27 -0600 (MDT) Cc: freebsd-hackers@freebsd.org Subject: Re: Accessing USB Mass Storage Device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2005 04:39:46 -0000 In message: <43553287.4030907@pacbell.net> Daniel Rudy writes: : : When the umass driver is compiled into the kernel, and one inserts a USB : mass storage device, how does one access the device descriptors (serial : number) while the device is listed as a da device? I would perfer to : have the OS do all the work of accessing the hardware. The serial number can be obtained with devifo. However, since cam doesn't hook into the device tree, mapping da number to umass number can be tricky in the arbitrary case. devinfo -v | grep umass umass0 pnpinfo vendor=0x054c product=0x014d devclass=0x00 devsubclass=0x00 release=0x0110 sernum="0052450548137984" intclass=0x08 intsubclass= at port=0 interface=0 : How does one read and write data to the device using /dev/ugen? One can't. You can't have multiple drivers attach to the same hardware. They would interfere with each other unless there was some sort of time domain sharing of the device. Even that would be, ummm, challanging in the arbitrary general case (but I want to get the serial number of my disk that's mounted, why can't I do that?). Arbitrary sharing is tough to do. Since ugen is so arbitrary in what you can do with it, I don't imagine it would ever be implemented. Another option would be to do what we do with pci already, and have a small set of information that we can query the device in a non-distruptive (mostly) way and expand that to usb. The usb bus (well uhub, since it is the usb bus) would create device nodes that could be querried for standard information. We've started doing this with pccard and cardbus, so you can now get, eg, the CIS, the power states (well, that's in my mind/tree right now), etc. Warner