Udev rules - wyrfel

From ThinkWiki
Revision as of 22:43, 24 September 2004 by Wyrfel (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This creates the usual /dev/floppy, /dev/cdrom, /dev/mouse etc. symlinks. Additionally it also creates a dir /dev/names.d which includes symlinks which consist of more expressive names, which you can then use in scripts to provide nice names. For instance /dev/names.d/DVD-CDRW will point to /dev/names.d/sr0, when the Toshiba SD-R9012 drive is inserted into the Ultrabay. So you can make a script realise that the human readable descriptor of /dev/names.d/sr0 is DVD-CDRW.

Save this as i.e. /etc/udev/rules.d/00-t41p.rules to make it take affect.


# /etc/udev/rules.d/00-t41p.rules: Rule definitions for the 2373-GHG T41p.
#
# creates useful symlinks and a names.d folder with symlinks that can
# be used by scripts to trigger expressive names for some devices
 
# create a /dev/mouse symlink for /dev/psaux
KERNEL="psaux", SYMLINK="mouse names.d/Mouse"
 
# get the /dev/floppy symlink
KERNEL="fd0", SYMLINK="floppy names.d/Floppy"
 
# create the /dev/dvd, /dev/cdrom and /dev/cdrw symlinks
BUS="scsi", KERNEL="sr[0-9]", SYSFS{vendor}="TOSHIBA", SYSFS{model}="DVD-ROM SD-R9012", NAME="%k", SYMLINK="cdrom dvd cdrw names.d/DVD-CDRW"
 
# add a /dev/flash symlink for PCMCIA mounted CompactFlash cards
BUS="ide", SYSFS{dev}="33:*", NAME="%k", SYMLINK="flash%n names.d/CompactFlash"