summaryrefslogtreecommitdiff
path: root/rules/rules.d
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-07-18 15:56:03 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-07-18 15:56:03 +0200
commit282988c4f8a85c28468e6442e86efe51dc71cc93 (patch)
treefda0a6ba62adffd8f7c4762b9694ab77e4ea563f /rules/rules.d
parent41dd741442ab496901c38f6cd38404bd954f1857 (diff)
move default rules from /etc/udev/rules.d/ to /lib/udev/rules.d/
None of these rules is supposed to be changed by users, so move them out of /etc. Custom rules, and automatically generated rules stay in /etc. All rules are still processed in lexical order, regardless which directory they live in.
Diffstat (limited to 'rules/rules.d')
-rw-r--r--rules/rules.d/50-udev-default.rules107
-rw-r--r--rules/rules.d/60-persistent-input.rules32
-rw-r--r--rules/rules.d/60-persistent-storage-tape.rules24
-rw-r--r--rules/rules.d/60-persistent-storage.rules63
-rw-r--r--rules/rules.d/60-persistent-v4l.rules14
-rw-r--r--rules/rules.d/80-drivers.rules17
-rw-r--r--rules/rules.d/95-udev-late.rules8
7 files changed, 265 insertions, 0 deletions
diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
new file mode 100644
index 0000000000..718d1899f5
--- /dev/null
+++ b/rules/rules.d/50-udev-default.rules
@@ -0,0 +1,107 @@
+# do not edit this file, it will be overwritten on update
+
+KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule"
+KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule"
+KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS+="last_rule"
+KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS+="last_rule"
+KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS+="last_rule"
+KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS+="last_rule"
+KERNEL=="console", MODE="0600", OPTIONS+="last_rule"
+
+# serial
+KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp"
+KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove"
+KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp"
+KERNEL=="hvc*|hvsi*", GROUP="uucp"
+KERNEL=="lirc0", SYMLINK+="lirc"
+
+# mem
+KERNEL=="null|zero|full|random|urandom", MODE="0666"
+KERNEL=="null", SYMLINK+="XOR"
+KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
+KERNEL=="ram0", SYMLINK+="ramdisk"
+KERNEL=="ram1", SYMLINK+="ram"
+
+# input
+KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640"
+KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600"
+KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k"
+
+# video4linux
+KERNEL=="vbi0", SYMLINK+="vbi"
+KERNEL=="radio0", SYMLINK+="radio"
+KERNEL=="video0", SYMLINK+="video"
+
+# graphics
+KERNEL=="agpgart", MODE="0600"
+KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666"
+KERNEL=="fb0", SYMLINK+="fb"
+
+# DVB video
+SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c"
+
+# Firewire
+KERNEL=="dv1394*", SYMLINK+="dv1394/%n"
+KERNEL=="video1394*", NAME="video1394/%n"
+
+# firmware class requests
+SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh"
+
+# libusb device nodes
+SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
+
+# printer
+KERNEL=="parport[0-9]*", GROUP="lp"
+SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp"
+SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp"
+KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n"
+KERNEL=="irlpt[0-9]*", GROUP="lp"
+
+# block, tapes, block-releated
+SUBSYSTEM=="block", GROUP="disk", MODE="0640"
+SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n"
+SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60"
+SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900"
+KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions"
+KERNEL=="fd[0-9]", GROUP="floppy"
+KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k"
+KERNEL=="sch[0-9]*", GROUP="disk"
+KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0640"
+KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk"
+KERNEL=="pg[0-9]*", GROUP="disk"
+KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk"
+KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk"
+KERNEL=="rawctl", NAME="raw/%k", GROUP="disk"
+SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk"
+KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k"
+KERNEL=="pktcdvd", NAME="pktcdvd/control"
+KERNEL=="qft0", SYMLINK+="ftape"
+SUBSYSTEM=="bsg", NAME="bsg/%k"
+SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk"
+
+# network
+KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove"
+
+# CPU
+KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid"
+KERNEL=="msr[0-9]*", NAME="cpu/%n/msr"
+KERNEL=="microcode", NAME="cpu/microcode", MODE="0600"
+
+# miscellaneous
+KERNEL=="fuse", MODE="0666"
+KERNEL=="rtc|rtc0", MODE="0644"
+KERNEL=="rtc0", SYMLINK+="rtc"
+KERNEL=="auer[0-9]*", NAME="usb/%k"
+KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k"
+KERNEL=="mmtimer", MODE="0644"
+KERNEL=="rflash[0-9]*", MODE="0400"
+KERNEL=="rrom[0-9]*", MODE="0400"
+KERNEL=="sbpcd0", SYMLINK+="sbpcd"
+KERNEL=="slram[0-9]*", SYMLINK+="xpram%n"
+KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k"
+KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k"
+KERNEL=="iowarrior[0-9]*", NAME="usb/%k"
+
+# do not delete static device nodes
+ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove"
+
diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules
new file mode 100644
index 0000000000..34d5ef1557
--- /dev/null
+++ b/rules/rules.d/60-persistent-input.rules
@@ -0,0 +1,32 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add|change", GOTO="persistent_input_end"
+SUBSYSTEM!="input", GOTO="persistent_input_end"
+KERNEL=="input[0-9]*", GOTO="persistent_input_end"
+
+# usb devices
+SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export"
+SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd"
+SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse"
+
+# other devices
+DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr"
+DRIVERS=="atkbd", ENV{ID_CLASS}="kbd"
+DRIVERS=="psmouse", ENV{ID_CLASS}="mouse"
+ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir"
+ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick"
+
+# fill empty serial number
+ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial"
+
+# by-id links
+KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}"
+KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}"
+
+# by-path
+IMPORT{program}="path_id %p"
+ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}"
+ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}"
+
+LABEL="persistent_input_end"
+
diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules
new file mode 100644
index 0000000000..d3226f1320
--- /dev/null
+++ b/rules/rules.d/60-persistent-storage-tape.rules
@@ -0,0 +1,24 @@
+# do not edit this file, it will be overwritten on update
+
+# persistent storage links: /dev/tape/{by-id,by-path}
+
+ACTION!="add|change", GOTO="persistent_storage_tape_end"
+
+# type 8 devices are "Medium Changers"
+KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}"
+
+SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end"
+
+KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
+KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
+KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id"
+KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi"
+KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst"
+
+# by-path (parent device path)
+KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p"
+KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}"
+KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst"
+
+LABEL="persistent_storage_tape_end"
diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
new file mode 100644
index 0000000000..5ae0c7fec9
--- /dev/null
+++ b/rules/rules.d/60-persistent-storage.rules
@@ -0,0 +1,63 @@
+# do not edit this file, it will be overwritten on update
+
+# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path}
+# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
+
+# forward scsi device event to corresponding block device
+ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"
+
+ACTION!="add|change", GOTO="persistent_storage_end"
+SUBSYSTEM!="block", GOTO="persistent_storage_end"
+
+# skip rules for inappropriate block devices
+KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end"
+
+# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
+KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
+KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
+
+# ignore partitions that span the entire disk
+TEST=="whole_disk", GOTO="persistent_storage_end"
+
+# /sys/class/block will export this
+ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk"
+ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition"
+
+# for partitions import parent information
+ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+
+# by-id (hardware serial number)
+KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
+KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
+KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
+
+KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"
+KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss"
+KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+
+# libata compat (links like hd*)
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}"
+KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n"
+
+KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"
+KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n"
+
+# by-path (parent device path)
+ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
+
+# skip unpartitioned removable media devices from drivers which do not send "change" events
+ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
+
+# import filesystem metadata
+IMPORT{program}="vol_id --export $tempnode"
+
+# by-label/by-uuid links (filesystem metadata)
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+LABEL="persistent_storage_end"
diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules
new file mode 100644
index 0000000000..0d673ab396
--- /dev/null
+++ b/rules/rules.d/60-persistent-v4l.rules
@@ -0,0 +1,14 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add|change", GOTO="persistent_v4l_end"
+SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end"
+
+# check for valid "index" number
+TEST!="index", GOTO="persistent_v4l_end"
+ATTR{index}!="?*", GOTO="persistent_v4l_end"
+
+IMPORT{program}="path_id %p"
+ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}"
+ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}"
+
+LABEL="persistent_v4l_end"
diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules
new file mode 100644
index 0000000000..881d7581bf
--- /dev/null
+++ b/rules/rules.d/80-drivers.rules
@@ -0,0 +1,17 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add", GOTO="drivers_end"
+
+DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}"
+SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \
+ RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'"
+SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms"
+SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block"
+SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block"
+SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block"
+SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi"
+SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg"
+SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev"
+
+LABEL="drivers_end"
+
diff --git a/rules/rules.d/95-udev-late.rules b/rules/rules.d/95-udev-late.rules
new file mode 100644
index 0000000000..7207081d46
--- /dev/null
+++ b/rules/rules.d/95-udev-late.rules
@@ -0,0 +1,8 @@
+# do not edit this file, it will be overwritten on update
+
+# run a command on remove events
+ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}"
+
+# event to be catched by udevmonitor
+RUN+="socket:@/org/kernel/udev/monitor"
+