umass to /dev/da* mapping

Mike Clarke jmc-freebsd2 at
Mon Dec 5 23:29:36 UTC 2011

On Monday 05 December 2011, Polytropon wrote:

> On Mon, 5 Dec 2011 17:08:15 +0000, Mike Clarke wrote:


> > 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

More information about the freebsd-questions mailing list