LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Can I make a udev rule for a particular usb port? (http://www.linuxquestions.org/questions/slackware-14/can-i-make-a-udev-rule-for-a-particular-usb-port-621291/)

kairen 02-15-2008 03:45 AM

Can I make a udev rule for a particular usb port?
 
I have two front usb ports. The first can mount an external disk and so that port is dedicated to it. The other one is for flash drives.

I made udev rules for the disk using it's vendor and model. Now I am looking for a way to assign a name to the flash port so it allways makes a node with the same name.

now I plug disk first -> /dev/sdb1, sdb2
then flash -> /dev/sdc1

if I change the order I get /dev/sdc1, /dev/sdc2 for the disk
and /dev/sdb1 for the flash
I want it allways to be "/dev/flash" when I use that particular port

Sorry for the dummy explanation - I wanted to be as clear as possible.

:)

Thanks

pdw_hu 02-15-2008 06:09 AM

You can't assign USB ports to device names.
As you've said that you've already created custom udev rules ("I made udev rules for the disk using it's vendor and model."), just create one for your flash drives to point to /dev/flash

Something like mine:
# Cruzer Mini 256MB
SUBSYSTEMS=="usb", ATTRS{serial}=="000080191" SYMLINK+="cruzer%n"

kairen 02-15-2008 07:13 AM

ok :)
if I was to mount only one flash drive it is fine.

I have to be able to mount a dozen different flash drives. So I really can not make rules for all of them

dracolich 02-15-2008 08:30 AM

Quote:

Originally Posted by kairen (Post 3057982)
ok :)
if I was to mount only one flash drive it is fine.

I have to be able to mount a dozen different flash drives. So I really can not make rules for all of them

Why not? If your goal is to have them all use the same /dev name that can be achieved with the SYMLINK+= rule element. In 10-local.rules make your rules for each flash drive and give them all the same SYMLINK name.

This should works as long as you never change your arrangement to have more than one flash drive connected at the same time.


All times are GMT -5. The time now is 05:43 AM.