summaryrefslogtreecommitdiff
path: root/etc/udev/rules.d
diff options
context:
space:
mode:
Diffstat (limited to 'etc/udev/rules.d')
-rw-r--r--etc/udev/rules.d/05-udev-early.rules4
-rw-r--r--etc/udev/rules.d/60-persistent-input.rules28
-rw-r--r--etc/udev/rules.d/60-persistent-storage.rules48
3 files changed, 80 insertions, 0 deletions
diff --git a/etc/udev/rules.d/05-udev-early.rules b/etc/udev/rules.d/05-udev-early.rules
new file mode 100644
index 0000000000..417ee67d6f
--- /dev/null
+++ b/etc/udev/rules.d/05-udev-early.rules
@@ -0,0 +1,4 @@
+# sysfs is populated after the event is sent
+ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
+ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
+
diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules
new file mode 100644
index 0000000000..c177e1f19c
--- /dev/null
+++ b/etc/udev/rules.d/60-persistent-input.rules
@@ -0,0 +1,28 @@
+ACTION!="add", GOTO="persistent_input_end"
+SUBSYSTEM!="input", GOTO="persistent_input_end"
+KERNEL=="input[0-9]*", GOTO="persistent_input_end"
+
+# usb devices
+BUS=="usb", IMPORT{program}="usb_id -x"
+BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd"
+BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse"
+
+# other devices
+DRIVER=="pcspkr", ENV{ID_CLASS}="spkr"
+DRIVER=="atkbd", ENV{ID_CLASS}="kbd"
+DRIVER=="psmouse", ENV{ID_CLASS}="mouse"
+SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir"
+
+ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial"
+
+# by-id links
+KERNEL=="mouse*", 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*", 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/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules
new file mode 100644
index 0000000000..5a63a4fa70
--- /dev/null
+++ b/etc/udev/rules.d/60-persistent-storage.rules
@@ -0,0 +1,48 @@
+# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name}
+# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
+
+ACTION!="add", GOTO="persistent_storage_end"
+SUBSYSTEM!="block", GOTO="persistent_storage_end"
+
+# skip rules for inappropriate block devices
+KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end"
+
+# never access removable ide devices, the drivers are causing event loops on open()
+KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
+KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end"
+
+# for partitions import parent information
+KERNEL=="*[0-9]", 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]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
+
+KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394"
+KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x"
+KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode"
+KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode"
+KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode"
+KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+
+# by-path (shortest physical path)
+KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
+KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}"
+KERNEL=="sr*|st*", GOTO="persistent_storage_end"
+KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
+
+# by-label/by-uuid (filesystem properties)
+KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end"
+IMPORT{program}="vol_id --export $tempnode"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
+
+# BIOS Enhanced Disk Device
+KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode"
+KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
+KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
+
+LABEL="persistent_storage_end"