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

Using udev rules to create nodes in /dev with deterministic names (was: Re: xcdroast)



On Dec 31 2004, Tom Allison wrote:
> This brings up another point.  How are you supposed to know what USB 
> device is assigned to a USB storage device?  My only solution is to plug 
> it in and watch the logs.  Are there any better alternatives?

Yes, use udev and make it create device files specific to your devices.
Here are the contents of my own udev rules, which create appropriate
files under the /dev hierarchy:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rbrito@dumont:~$ cat /etc/udev/rules.d/10-local-udev.rules 
#
# udev rules file made by Rogério Brito, mostly with information gathered with
# udevinfo -a -p /sys/<class|block>/<bus>/<device>
#

# USB Key Drive: "Leading Driver Co.,LTD.", "USB Mass Storage Device"
BUS="usb", SYSFS{idProduct}="2317", SYSFS{idVendor}="067b", NAME="usb/key%n", SYMLINK="sda%n"

# Printer: "DeskJet 840C", "BR1391S0WNKV"
BUS="usb", SYSFS{idProduct}="0604", SYSFS{idVendor}="03f0", NAME="usb/lp%n", SYMLINK="hp_lp"

# iPod
BUS="ieee1394", SYSFS{model_name_kv}="iPod", NAME="ipod%n"

# HD in Firewire Enclosure
BUS="scsi", SYSFS{vendor}="QUANTUM*", SYSFS{model}="FIREBALLlct15 30", NAME="firewire%n"
rbrito@dumont:~$ 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Hope this helps, Rogério Brito.

-- 
Learn to quote e-mails decently at:
http://pub.tsn.dk/how-to-quote.php
http://learn.to/quote
http://www.xs4all.nl/~sbpoley/toppost.htm



Reply to: