diff options
Diffstat (limited to 'rules/debian')
-rw-r--r-- | rules/debian/50-udev.rules | 98 | ||||
-rw-r--r-- | rules/debian/60-persistent-input.rules | 41 | ||||
-rw-r--r-- | rules/debian/60-persistent-storage-tape.rules | 44 | ||||
-rw-r--r-- | rules/debian/60-persistent-storage.rules | 109 | ||||
-rw-r--r-- | rules/debian/60-persistent-v4l.rules | 17 | ||||
-rw-r--r-- | rules/debian/75-cd-aliases-generator.rules | 11 | ||||
-rw-r--r-- | rules/debian/75-persistent-net-generator.rules | 86 | ||||
-rw-r--r-- | rules/debian/80-drivers.rules | 57 | ||||
-rw-r--r-- | rules/debian/91-permissions.rules | 130 | ||||
-rw-r--r-- | rules/debian/95-late.rules | 18 |
10 files changed, 611 insertions, 0 deletions
diff --git a/rules/debian/50-udev.rules b/rules/debian/50-udev.rules new file mode 100644 index 0000000000..e3a10701cf --- /dev/null +++ b/rules/debian/50-udev.rules @@ -0,0 +1,98 @@ +# import the properties of optical drives +KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add|change", DRIVERS=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +KERNEL=="sr[0-9]*", ACTION=="add|change", \ + IMPORT{program}="cdrom_id --export $tempnode" + +# workarounds for devices which do not report media changes +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ + ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" +SUBSYSTEMS=="scsi", KERNEL=="sd[a-z]", ATTR{removable}=="1", \ + ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", \ + ATTRS{media}=="floppy", OPTIONS+="all_partitions" + +# SCSI devices +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" +SUBSYSTEM=="bsg", NAME="bsg/%k" + +# USB devices +SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ + ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", ACTION=="add", \ + PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ + NAME="$result" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ + NAME="$result" +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" +KERNEL=="evtchn", NAME="xen/%k" +KERNEL=="rtc0", SYMLINK+="rtc" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +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" +KERNEL=="rdma_cm", NAME="infiniband/%k" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="transcode", NAME="zap/transcode" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", NAME="etherd/%k" + +KERNEL=="device-mapper", NAME="mapper/control" + diff --git a/rules/debian/60-persistent-input.rules b/rules/debian/60-persistent-input.rules new file mode 100644 index 0000000000..8f49d250b1 --- /dev/null +++ b/rules/debian/60-persistent-input.rules @@ -0,0 +1,41 @@ +SUBSYSTEM!="input", GOTO="persistent_input_end" +ACTION!="add|change", GOTO="persistent_input_end" +# ignore the mid-level drivers +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" +# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ + ATTRS{modalias}!="input:*-*k*14A,*r*", \ + ENV{ID_CLASS}="joystick" + +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links, generic and for the event devices +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 links +IMPORT{program}="path_id $devpath" +KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + diff --git a/rules/debian/60-persistent-storage-tape.rules b/rules/debian/60-persistent-storage-tape.rules new file mode 100644 index 0000000000..94a0b816d4 --- /dev/null +++ b/rules/debian/60-persistent-storage-tape.rules @@ -0,0 +1,44 @@ +# This file contains the rules needed to create persistent device names. + +# we are only interested in add and change actions for block devices +ACTION!="add|change", GOTO="persistent_storage_tape_end" + +# "Medium Changers" +KERNEL=="sg[0-9]*", \ + SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ + IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode" + +KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ + 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_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="usb", \ + IMPORT{program}="usb_id --export $devpath" + +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}", \ + ENV{ID_BUS}="scsi", \ + IMPORT{program}="scsi_id --export --device=$env{BSG_DEV}" + +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" + +KERNEL=="st*[0-9]|nst*[0-9]", \ + IMPORT{program}="path_id $devpath" +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" + +# end of processing +LABEL="persistent_storage_tape_end" + diff --git a/rules/debian/60-persistent-storage.rules b/rules/debian/60-persistent-storage.rules new file mode 100644 index 0000000000..65e7204531 --- /dev/null +++ b/rules/debian/60-persistent-storage.rules @@ -0,0 +1,109 @@ +# This file contains the rules needed to create persistent device names. + +# forward scsi device events to the corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", \ + TEST=="block", ATTR{block/*/uevent}="change" + +# we are only interested in add and change actions for block devices +ACTION!="add|change", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# and we can safely ignore these kinds of devices +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" + +# skip removable ide devices, because open(2) on them causes an events loop +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" + +# skip xen virtual hard disks +DRIVERS=="vbd", GOTO="no_hardware_id" + +# check these attributes of /sys/class/block nodes +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" + +# look for different kinds of unique identificators +KERNEL=="hd*[!0-9]", \ + IMPORT{program}="ata_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", \ + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="usb", \ + IMPORT{program}="usb_id --export $devpath" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ + ENV{ID_BUS}="scsi", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" +KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", \ + ENV{ID_BUS}="cciss", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" + +KERNEL=="dasd*[!0-9]", \ + IMPORT{program}="dasd_id --export $tempnode" + +KERNEL=="sd*[!0-9]|hd*[!0-9]", \ + IMPORT{program}="edd_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", \ + PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result" + +# find the physical path of the device +ENV{DEVTYPE}=="disk", IMPORT{program}="path_id $devpath" + +LABEL="no_hardware_id" + +# import the variables of partitions from the parent disks +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# obsolete PATA driver +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" +# hd*-like compatibility links for libata and PATA devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", \ + 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]", ATTR{name}=="?*", ATTR{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]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|dasd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +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" + +# UUID and volume label +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="persistent_storage_end" + diff --git a/rules/debian/60-persistent-v4l.rules b/rules/debian/60-persistent-v4l.rules new file mode 100644 index 0000000000..5a317b6c18 --- /dev/null +++ b/rules/debian/60-persistent-v4l.rules @@ -0,0 +1,17 @@ +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" + +# ignore devices without a valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id $devpath" + +KERNEL=="video*|vbi*", ENV{ID_PATH}=="?*", \ + SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" + +KERNEL=="audio*", ENV{ID_PATH}=="?*", \ + SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" + diff --git a/rules/debian/75-cd-aliases-generator.rules b/rules/debian/75-cd-aliases-generator.rules new file mode 100644 index 0000000000..6b178a0ae7 --- /dev/null +++ b/rules/debian/75-cd-aliases-generator.rules @@ -0,0 +1,11 @@ +# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and +# write them to /etc/udev/rules.d/70-persistent-cd.rules. + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS!="usb|ieee1394", \ + PROGRAM="write_cd_rules", SYMLINK+="$result" + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS=="usb|ieee1394", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="$result" + diff --git a/rules/debian/75-persistent-net-generator.rules b/rules/debian/75-persistent-net-generator.rules new file mode 100644 index 0000000000..e8d3b888e0 --- /dev/null +++ b/rules/debian/75-persistent-net-generator.rules @@ -0,0 +1,86 @@ +# These rules generate rules to keep network interface names unchanged +# across reboots write them to /etc/udev/rules.d/70-persistent-net.rules. + +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + +# ignore interfaces without a driver link like bridges and VLANs +DRIVERS!="?*", GOTO="persistent_net_generator_end" + +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ + GOTO="persistent_net_generator_end" + +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + +# ignore UML virtual interfaces +DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" + +# ignore "secondary" raw interfaces of the madwifi driver +KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" + +# ignore "secondary" monitor interfaces of mac80211 drivers +KERNEL=="wlan*", ATTRS{type}=="803", GOTO="persistent_net_generator_end" + +# by default match on the MAC address and interface type +ENV{MATCHADDR}="$attr{address}" +ENV{MATCHIFTYPE}="$attr{type}" + +# ignore interfaces with locally administered or null MAC addresses +# and VMWare virtual interfaces +ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" +ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" +ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}="" + +# ibmveth interfaces have stable locally administered MAC addresses +SUBSYSTEMS=="ibmveth", ENV{MATCHADDR}="$attr{address}" + +# S/390 interfaces are matched only by id +SUBSYSTEMS=="ccwgroup", \ + ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}="" + +# terminate processing if there are not enough conditions to create a rule +ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \ + GOTO="persistent_net_generator_end" + + +# provide nice comments for the generated rules +SUBSYSTEMS=="pci", \ + ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" +SUBSYSTEMS=="pcmcia", \ + ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}" +SUBSYSTEMS=="usb", \ + ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}" +SUBSYSTEMS=="ccwgroup", \ + ENV{COMMENT}="S/390 device at $id" +SUBSYSTEMS=="ibmveth", \ + ENV{COMMENT}="LPAR virtual device at $id" +SUBSYSTEMS=="ieee1394", \ + ENV{COMMENT}="Firewire device $attr{host_id}" +ENV{COMMENT}=="", \ + ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" +ATTRS{driver}=="?*", \ + ENV{COMMENT}="$env{COMMENT} ($attr{driver})" + + +# generate and write the rule +IMPORT{program}="write_net_rules" + +# rename the interface if requested +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" + diff --git a/rules/debian/80-drivers.rules b/rules/debian/80-drivers.rules new file mode 100644 index 0000000000..edfcfa5394 --- /dev/null +++ b/rules/debian/80-drivers.rules @@ -0,0 +1,57 @@ +ACTION!="add", GOTO="hotplug_not_add_event" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" + +# this driver is broken and should not be loaded automatically on kernels +# < 2.6.21 (see #398962) +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" + +# load the drivers +ENV{MODALIAS}=="?*", \ + RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" + +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ + RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" + +SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" + +# rules for subsystems which lack proper hotplug support +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" + +# needed for kernels < 2.6.22 +SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ + ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}!="Onstream" +SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" + +SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ + RUN+="/sbin/modprobe sg" + +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" + +# From here on follows the hotplug agents which do not load modules +LABEL="hotplug_driver_loaded" + +# FIXME: does a sane default exist? +#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ +# RUN+="scsi-re-add" + +SUBSYSTEM=="firmware", RUN+="firmware.agent" + +LABEL="hotplug_not_add_event" + +SUBSYSTEM=="net", RUN+="net.agent" + +# Log every event to /dev/hotplug.log (for debugging). +#RUN+="logger.agent" + diff --git a/rules/debian/91-permissions.rules b/rules/debian/91-permissions.rules new file mode 100644 index 0000000000..5182a4bd28 --- /dev/null +++ b/rules/debian/91-permissions.rules @@ -0,0 +1,130 @@ +ACTION!="add", GOTO="permissions_end" + +# devices needed to load the drivers providing them +KERNEL=="tun", OPTIONS+="ignore_remove" +KERNEL=="ppp", OPTIONS+="ignore_remove" +KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +# the aacraid driver is broken and reports that disks removable (see #404927) +SUBSYSTEM=="block", ATTRS{removable}=="1", \ + DRIVERS!="aacraid", GROUP="floppy" +# all block devices on these buses are "removable" +SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" + +KERNEL=="cbm", GROUP="floppy" + +# IDE devices +ENV{ID_CDROM}=="?*", GROUP="cdrom" +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" + +# USB devices +KERNEL=="legousbtower*", MODE="0666" +KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ + MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ + ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0666" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="inotify", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="nvram", GROUP="nvram" +KERNEL=="rtc|rtc[0-9]*", GROUP="audio" +KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" +KERNEL=="fuse", GROUP="fuse" +KERNEL=="kqemu", MODE="0666" +KERNEL=="kvm", GROUP="kvm" +KERNEL=="tun", MODE="0666" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +KERNEL=="uverbs*", GROUP="rdma" +KERNEL=="ucm*", GROUP="rdma" +KERNEL=="rdma_cm", GROUP="rdma" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" +KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \ + MODE="0664", GROUP="audio" +KERNEL=="lirc[0-9]*", GROUP="video" + +KERNEL=="sgi_*", MODE="0666" +KERNEL=="z90crypt", MODE="0666" +KERNEL=="iseries/ibmsis*", GROUP="disk" +KERNEL=="iseries/nvt*", GROUP="disk" +KERNEL=="iseries/vt*", GROUP="disk" +KERNEL=="iseries/vtty*", GROUP="dialout" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440", GROUP="disk" + +LABEL="permissions_end" + diff --git a/rules/debian/95-late.rules b/rules/debian/95-late.rules new file mode 100644 index 0000000000..622e019ef3 --- /dev/null +++ b/rules/debian/95-late.rules @@ -0,0 +1,18 @@ +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# ignore the events generated by virtual consoles +KERNEL=="ptmx", OPTIONS+="last_rule" +KERNEL=="console", OPTIONS+="last_rule" +KERNEL=="tty" , OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", OPTIONS+="last_rule" +KERNEL=="pty*", OPTIONS+="last_rule" +SUBSYSTEM=="vc", OPTIONS+="last_rule" + +# do not delete static device nodes +ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", \ + OPTIONS+="ignore_remove" + +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + |