From owner-freebsd-questions@FreeBSD.ORG Mon Dec 5 23:29:36 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A2D8106566C for ; Mon, 5 Dec 2011 23:29:36 +0000 (UTC) (envelope-from jmc-freebsd2@milibyte.co.uk) Received: from avasout08.plus.net (avasout08.plus.net [212.159.14.20]) by mx1.freebsd.org (Postfix) with ESMTP id 704258FC16 for ; Mon, 5 Dec 2011 23:29:34 +0000 (UTC) Received: from curlew.milibyte.co.uk ([84.92.153.232]) by avasout08 with smtp id 5bVY1i004516WCc01bVZVJ; Mon, 05 Dec 2011 23:29:33 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=LMnkseq9 c=1 sm=1 a=lfSX4pPLp9EkufIcToJk/A==:17 a=rLpCYgkgFLgA:10 a=ZTb9aqGL9YkA:10 a=8nJEP1OIZ-IA:10 a=3D1xnpn-IC1gojbX77IA:9 a=wPNLvfGTeEIA:10 a=lfSX4pPLp9EkufIcToJk/A==:117 Received: by curlew.milibyte.co.uk with local (Exim 4.77) (envelope-from ) id 1RXhyW-0000Z6-56; Mon, 05 Dec 2011 23:29:32 +0000 From: Mike Clarke To: freebsd-questions@freebsd.org, Polytropon Date: Mon, 5 Dec 2011 23:29:31 +0000 User-Agent: KMail/1.9.10 References: <201112051708.16072.jmc-freebsd2@milibyte.co.uk> <20111205182508.005fd1fd.freebsd@edvax.de> In-Reply-To: <20111205182508.005fd1fd.freebsd@edvax.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201112052329.32027.jmc-freebsd2@milibyte.co.uk> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: jmc-freebsd2@milibyte.co.uk X-SA-Exim-Scanned: No (on curlew.milibyte.co.uk); SAEximRunCond expanded to false Cc: Subject: Re: umass to /dev/da* mapping X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 23:29:36 -0000 On Monday 05 December 2011, Polytropon wrote: > On Mon, 5 Dec 2011 17:08:15 +0000, Mike Clarke wrote: [snip] > > Is there any convenient way for my script to determine which da* > > devices correspond to the umass device name? > > Maybe you could use a matching against > > match "bus" "0x????"; > match "vendor" "0x????"; > match "product" "0x????"; > match "release" "0x????"; > > to determine which device you're currently accessing. > As the USB IDs stay the same for at least the card > reader, it should be easy to conclude. :-) > > USB devices are usually "enumerated" in the order they > appear to the system. Thanks for that idea. I'd originally thought in terms of not being able to use the vendor info to identify a usb stick since that can't be known in advance for every stick that might ever be inserted but I'd overlooked using the info to eliminate the built in card reader. So now when any umass device is attached devd calls my script which just iterate over sysctl dev.umass | grep "%pnpinfo" building up a list of devices, adding four if it's the card reader or one for each other umass, and it works a treat. -- Mike Clarke