Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Dec 2011 18:25:08 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Mike Clarke <jmc-freebsd2@milibyte.co.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: umass to /dev/da* mapping
Message-ID:  <20111205182508.005fd1fd.freebsd@edvax.de>
In-Reply-To: <201112051708.16072.jmc-freebsd2@milibyte.co.uk>
References:  <201112051708.16072.jmc-freebsd2@milibyte.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 5 Dec 2011 17:08:15 +0000, Mike Clarke wrote:
> 
> I have a fairly simple perl script which is run by devd when I plug in a 
> USB memory stick. The script sets up some permissions and a link to 
> make life easy for a user to mount the memory stick.
> 
> This normally works fine but there are problems if the memory stick is 
> already inserted before booting.
> 
> Normally my internal 4 slot memory card reader is detected as umass0 
> with devices da[0-3] and when the USB memory stick is inserted it comes 
> up as umass1 with device da4 and my script works on that assumption. If 
> the USB stick is present on booting then it appears as da0 on umass0 
> and the card reader is da[1-4] on umass1 so the script fails.
> 
> 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.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111205182508.005fd1fd.freebsd>