From 449ac79193438b233508adf6bd7310f875be4d01 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 05:34:05 +0200 Subject: update Debian rules Signed-off-by: Kay Sievers --- etc/udev/debian/cd-aliases.rules | 20 ++++----- etc/udev/debian/devfs.rules | 32 ++++++------- etc/udev/debian/hotplugd.rules | 7 +++ etc/udev/debian/permissions.rules | 11 +++-- etc/udev/debian/persistent.rules | 79 ++++++++++++++++++--------------- etc/udev/debian/simple-cd-aliases.rules | 7 --- etc/udev/debian/udev.rules | 18 +++++--- 7 files changed, 96 insertions(+), 78 deletions(-) delete mode 100644 etc/udev/debian/simple-cd-aliases.rules diff --git a/etc/udev/debian/cd-aliases.rules b/etc/udev/debian/cd-aliases.rules index b96d3a571d..22f710032b 100644 --- a/etc/udev/debian/cd-aliases.rules +++ b/etc/udev/debian/cd-aliases.rules @@ -1,17 +1,15 @@ -# These rules create the /dev/{cdrom,dvd,...} symlinks. Also see the -# /etc/udev/cdsymlinks.conf config file. +# These rules create the /dev/{cdrom,dvd,...} symlinks. # # If you would like to statically configure the aliases instead, you can # use rules like: # BUS=="ide", ID=="1.0", SYMLINK+="cdrom" -BUS=="scsi", KERNEL=="sr[0-9]*", \ - PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ - SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ - SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="ide", KERNEL=="pcd[0-9]*", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ - SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +# The variables for IDE devices are imported in permissions.rules. +BUS=="scsi", KERNEL=="sr[0-9]*", ACTION=="add", \ + IMPORT{program}="/sbin/cdrom_id --export $tempnode" + +ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e" +ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" +ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" +ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%e" diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 89e0db2aac..b1696c7d24 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -15,30 +15,26 @@ # workaround for devices which do not report media changes BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT=="IOMEGA ZIP *", \ - NAME="%k", OPTIONS+="all_partitions" + PROGRAM="/sbin/ata_id --export $tempnode", ENV{ID_MODEL}=="IOMEGA_ZIP*", \ + NAME="%k", OPTIONS+="all_partitions" # IDE devices BUS=="ide", KERNEL=="hd[a-z]*", \ PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK+="%k %c{2}" + NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -BUS=="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK+="%k %c{2}" +BUS=="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers -KERNEL=="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK+="%k" -KERNEL=="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK+="%k" -KERNEL=="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK+="%k" +KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK+="%k" # other block devices -KERNEL=="md[0-9]*", NAME="md/%n", -KERNEL=="loop[0-9]*", NAME="loop/%n" -KERNEL=="ram[0-9]*", NAME="rd/%n" +KERNEL=="md[0-9]*", NAME="md/%n", +KERNEL=="loop[0-9]*", NAME="loop/%n" +KERNEL=="ram[0-9]*", NAME="rd/%n" # USB devices BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" @@ -50,6 +46,10 @@ BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ SYMLINK+="pilot" +# usbfs-like devices +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k K=$${K#usbdev} B=$${K%%%%.*} D=$${K#*.}; echo bus/usb/$$B/$$D'", \ + SYMLINK+="%c" + # serial devices KERNEL=="ttyS[0-9]*", NAME="tts/%n" KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n" @@ -69,7 +69,7 @@ KERNEL=="video[0-9]*", NAME="v4l/%k" KERNEL=="radio[0-9]*", NAME="v4l/%k" KERNEL=="vbi[0-9]*", NAME="v4l/%k" KERNEL=="vtx[0-9]*", NAME="v4l/%k" -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'KNAME=%k KNAME=$${KNAME#dvb} A=$${KNAME%%%%.*} D=$${KNAME#*.}; echo dvb/adapter$$A/$$D'", \ NAME="%c" KERNEL=="fb[0-9]*", NAME="fb/%n" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -100,6 +100,8 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" # sound devices KERNEL=="controlC[0-9]*", NAME="snd/%k" diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules index cf84682abf..e311d22678 100644 --- a/etc/udev/debian/hotplugd.rules +++ b/etc/udev/debian/hotplugd.rules @@ -3,6 +3,13 @@ SUBSYSTEM=="drivers", OPTIONS="last_rule" SUBSYSTEM=="module", OPTIONS="last_rule" # compatibility support for the obsolete hotplug.d and dev.d directories +# do not run the hotplug.d scripts when started from udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" RUN+="/sbin/udev_run_devd" +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 52d7aa9536..02bfefdd27 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -1,12 +1,14 @@ # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" +SUBSYSTEM=="block", SYSFS{../removable}=="1", GROUP="floppy" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", GROUP="cdrom" -BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" -BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add", \ + IMPORT{program}="/sbin/cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" # SCSI devices BUS=="scsi", SYSFS{type}=="1", GROUP="tape" @@ -52,6 +54,7 @@ KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", GROUP="video" KERNEL=="nvram", GROUP="nvram" KERNEL=="rtc", MODE="0660", GROUP="audio" +KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" KERNEL=="cdemu[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index b444a27bf6..a6467fa319 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -1,49 +1,58 @@ # This file contains the rules needed to create persistent device names. # we are only interested in add actions for block devices -ACTION!="add", GOTO="no_volume_id" -SUBSYSTEM!="block", GOTO="no_volume_id" +SUBSYSTEM!="block", GOTO="no_volume_id" +ACTION!="add", GOTO="no_volume_id" # and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|sr*", GOTO="no_volume_id" +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="no_volume_id" + +# skip removable ide devices, because open(2) on them causes an events loop +BUS=="ide", SYSFS{removable}=="1", GOTO="no_volume_id" +BUS=="ide", SYSFS{../removable}=="1", GOTO="no_volume_id" # disk id -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" - -KERNEL=="hd*[0-9]", IMPORT{parent}="ID_*" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", \ - IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", \ - IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -KERNEL=="sd*[0-9]", IMPORT{parent}="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", \ + IMPORT{program}="/sbin/ata_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", \ + IMPORT{program}="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="/sbin/scsi_id -g -x -s %p -d %N" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d %N" + +KERNEL=="dasd*[!0-9]", \ + IMPORT{program}="/sbin/dasd_id --export $tempnode" + +KERNEL=="hd*[0-9]|sd*[0-9]|dasd*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$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]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # path -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", \ - SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", \ + IMPORT{program}="/sbin/path_id %p", -KERNEL=="*[0-9]", IMPORT{parent}="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -# volume label and uuid -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +# UUID and volume label +KERNEL=="*[!0-9]|sr*", SYSFS{removable}=="1", GOTO="no_volume_id" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # end of processing -SUBSYSTEM=="block", LABEL="no_volume_id" +LABEL="no_volume_id" diff --git a/etc/udev/debian/simple-cd-aliases.rules b/etc/udev/debian/simple-cd-aliases.rules deleted file mode 100644 index 45ffeeac6b..0000000000 --- a/etc/udev/debian/simple-cd-aliases.rules +++ /dev/null @@ -1,7 +0,0 @@ -# grouping of optical drives from multiple kernel subsystems -BUS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="cdrom%e" -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", \ - SYMLINK+="cdrom%e" -BUS=="ide", KERNEL=="pcd[0-9]*", SYSFS{removable}=="1", SYMLINK+="cdrom%e" - diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 07087a3a36..27eb43e54c 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -15,28 +15,32 @@ # workaround for devices which do not report media changes BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT=="IOMEGA ZIP *", \ + PROGRAM="/sbin/ata_id --export $tempnode", ENV{ID_MODEL}=="IOMEGA_ZIP*", \ NAME="%k", OPTIONS+="all_partitions" # SCSI devices BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" # USB devices -BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ - SYMLINK+=="pilot" + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k K=$${K#usbdev} B=$${K%%%%.*} D=$${K#*.}; echo bus/usb/$$B/$$D'", \ + SYMLINK+="%c" # serial devices KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k K=$${K#dvb} A=$${K%%%%.*} D=$${K#*.}; echo dvb/adapter$$A/$$D'", \ NAME="%c" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -54,6 +58,8 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" # ALSA devices KERNEL=="controlC[0-9]*", NAME="snd/%k" -- cgit v1.2.3-54-g00ecf