From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 19 15:40:44 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 7CC3916A41F for ; Wed, 19 Oct 2005 15:40:44 +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 1A6A243D4C for ; Wed, 19 Oct 2005 15:40:44 +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 j9JFaniN068295; Wed, 19 Oct 2005 09:36:50 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 19 Oct 2005 09:38:08 -0600 (MDT) Message-Id: <20051019.093808.123396894.imp@bsdimp.com> To: alsbergt@cs.huji.ac.il From: "M. Warner Losh" In-Reply-To: <20051017143356.GA12188@zoopee.org> References: <20051017143356.GA12188@zoopee.org> 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]); Wed, 19 Oct 2005 09:36:50 -0600 (MDT) Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to determine link of umass/da devices 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 15:40:44 -0000 In message: <20051017143356.GA12188@zoopee.org> Tom Alsberg writes: : With tools like usbdevs and sysctl, I can find out what USB devices : are connected, and also what USB drivers handle them (so I can see, : for example, that there is a SanDisk Cruzer Micro connected to port 2 : in bus 3 and the umass driver under it). You can find this out best via the devinfo interface. : I can also find out what da devices there are using camcontrol. Right. cam doesn't hook the da devices into the device tree. : However, how can I find out which da device was assigned to which : umass/usb device? Generally, you can't. There's not really an interface to get this information. devinfo assumes that things like disk drives would be in the device tree and except for cam, all other drivers conform to this world view. There's some efforts to update and lock cam which I think will rectify this. : I see this info in some inconvenient form in : dmesg. But I need something easier to handle programmatically to : write a program that uses that data. I prefer not to resort to some : ugly hack like trying to parse dmesg. Especially since dmesg can disapper quickly on some systems. : Also, I'd be interested if it were possible to have my program : informed when devices are connected/disconnected. Can a process ask : usbd to send it some signal and somehow provide the details of the : event when a device is connected/disconnected? devd provides a pipe of all events from the kernel in /var/run/devd.pipe. Warner