need absolute location/device of usb flash disk

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

 



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.

About 4yrs ago (with '=' syntax), systool would allow me to write udev rules like

#if want flash memory recognised differently
#in different positions on external hub
BUS="usb", ID="1-1.1", SYSFS{manufacturer}="PNY     ", SYSFS{product}="USB 2.0 FD      ", NAME="flashA%n"
BUS="usb", ID="1-1.2", SYSFS{manufacturer}="PNY     ", SYSFS{product}="USB 2.0 FD      ", NAME="flashB%n"
BUS="usb", ID="1-1.3", SYSFS{manufacturer}="PNY     ", SYSFS{product}="USB 2.0 FD      ", NAME="flashC%n"
BUS="usb", ID="1-1.4", SYSFS{manufacturer}="PNY     ", SYSFS{product}="USB 2.0 FD      ", NAME="flashD%n"

I'm now running sysfsutils v-2.1.0, udevd v111, uname -r=2.6.22.19

My attempt to get this to work now looking at the usb bus

#systool -vb usb

gives

 Device path = "/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-3"
.
.
    product             = "USB Flash Memory"


the following rule (constructed by swiping the above "Device path") is ignored (I get /dev/sda* for the usb drive)

BUS=="usb", SYSFS{Device path}=="/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-3", NAME="flashB%n"


Instead I looked at the scsi bus

# systool -vb scsi
Bus = "scsi"

  Device path = "/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-3/4-3:1.0/host5/target5:0:0/5:0:0:0"
.
.
    model               = "USB Flash Memory"

since the host/target changes on each insertion I tried these two rules which are also ignored (get /dev/sda*)


BUS=="scsi", SYSFS{Device path}=="/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-3/4-3:1.0/*", NAME="flashB%n"
BUS=="scsi", SYSFS{Device path}=="/sys/devices/pci0000:00/0000:00:1d.7/usb4/*", NAME="flashB%n"

As a control to show that I can construct a rule that works, these work

#OK gives devices pny*
BUS=="scsi", SYSFS{vendor}=="        ", SYSFS{model}=="USB Flash Memory", NAME="pny%n"
#OK gives devices flashB*
BUS=="scsi", SYSFS{vendor}=="        ", SYSFS{model}=="USB Flash Memory", NAME="flashB%n"
#OK gives flashB*
BUS=="usb", SYSFS{product}=="USB Flash Memory", NAME="flashB%n"


#this doesn't work, gives devices like usbdev4.15_ep00
BUS=="scsi", SYSFS{modalias}="scsi:t-0x00", NAME="flashB%n"


What should I do to give the device a name determined from an absolute location?

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