Re: need absolute location/device of usb flash disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 3 Aug 2009, Jim Paris wrote:

Joseph Mack NA3T wrote:
I'm going to be writing images to usb flash disks on 15 ports on multiple
hubs. I need to know which port on a hub is associated with which
/dev/sd?? device, so I can tell the user where to insert their flash key
and when the write is done.
..
What should I do to give the device a name determined from an absolute
location?

Check the links in /dev/disk/by-path,

Thanks didn't know about this.

The entries have specific info about the particular disk at that location, whereas I want the rule to apply to any disk. So it's not obvious how to use this info.

I've almost got everything I want however.

I started with systool, which is what worked a couple of years ago. However apparently it recovers info which is not visible to the udev rules system and I was using this info.

Instead starting with

# udevinfo -q path -n /dev/sda1
/block/sda/sda1

# udevinfo -a -p /block/sda/sda1

gives all the info usable by udev rules. Apparently you need one rule specific to your device and one (or more?) rules from device parents. This gave me rules like

KERNELS=="4-3:1.0", SUBSYSTEM=="block", NAME="flashL%n"

which work fine. I've now labeled all my ports by location.

There's rules about GROUP in one of my files (50-...)

KERNEL=="sd*[!0-9]", ATTR{removable}=="1", GROUP="plugdev"
KERNEL=="sd*[0-9]", ATTRS{removable}=="1", GROUP="plugdev"

I can't use these rules to apply a GROUP to flash disks in the usb ports of interest, but not to flash disks in the other port. Any ideas on assigning the GROUP?

Thanks Joe

--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux