chiark / gitweb /
rename "udev.c" to "test-udev.c" - it is only for testing
[elogind.git] / etc / udev / redhat / 50-udev.rules
1 # There are a number of modifiers that are allowed to be used in some of the
2 # fields.  See the udev man page for a full description of them.
3 #
4 # default is OWNER="root" GROUP="root", MODE="0600"
5 #
6
7 KERNEL=="*", OWNER="root" GROUP="root", MODE="0600"
8
9 # all block devices
10 SUBSYSTEM=="block",             GROUP="disk", MODE="0640"
11 KERNEL=="root",                 GROUP="disk", MODE="0640"
12
13 # console devices
14 KERNEL=="tty",                  NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule"
15 KERNEL=="console",              NAME="%k", MODE="0600", OPTIONS="last_rule"
16 KERNEL=="tty[0-9]*",            NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule"
17 KERNEL=="vc/[0-9]*",            NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule"
18
19 # pty devices
20 #  Set this to 0660 if you only want users belonging to tty group
21 #  to be able to allocate PTYs
22 KERNEL=="ptmx",                 NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule"
23 KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule"
24 KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule"
25 KERNEL=="pty/m*",               NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule"
26
27 # serial+dialup devices
28 KERNEL=="ippp*",                NAME="%k", MODE="0660"
29 KERNEL=="isdn*",                NAME="%k", MODE="0660"
30 KERNEL=="isdnctrl*",            NAME="%k", MODE="0660"
31 KERNEL=="capi",                 NAME="capi20", GROUP="uucp", MODE="0660"
32 KERNEL=="capi*",                NAME="capi/%n", GROUP="uucp", MODE="0660"
33 KERNEL=="dcbri*",               NAME="%k", MODE="0660"
34 KERNEL=="ircomm*",              NAME="%k", GROUP="uucp", MODE="0660"
35 KERNEL=="tts/[0-9]*",           NAME="%k", GROUP="uucp", MODE="0660"
36 KERNEL=="tts/USB[0-9]*",        NAME="%k", GROUP="uucp", MODE="0660"
37 KERNEL=="tty[A-Z]*",            NAME="%k", GROUP="uucp", MODE="0660"
38 KERNEL=="pppox*",               NAME="%k", GROUP="uucp", MODE="0660"
39 KERNEL=="ircomm*",              NAME="%k", GROUP="uucp", MODE="0660"
40 KERNEL=="modems/mwave*",        NAME="%k", GROUP="uucp", MODE="0660"
41 KERNEL=="hvc*",                 NAME="%k", GROUP="uucp", MODE="0660"
42 KERNEL=="hvsi*",                NAME="%k", GROUP="uucp", MODE="0660"
43 KERNEL=="iseries/vtty*",        NAME="%k", GROUP="uucp", MODE="0660"
44 KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660"
45 KERNEL=="ttyUSB*", ATTRS{product}=="palmOne Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660"
46 KERNEL=="ttyUSB*", ATTRS{product}=="Handspring Visor*", SYMLINK+="pilot", GROUP="uucp", MODE="0660"
47
48 # vc devices
49 KERNEL=="vcs",                  NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule"
50 KERNEL=="vcs[0-9]*",            NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule"
51 KERNEL=="vcsa",                 NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule"
52 KERNEL=="vcsa[0-9]*",           NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule"
53 KERNEL=="vcc/*",                NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule"
54
55 # memory devices
56 KERNEL=="random",               MODE="0666", OPTIONS="last_rule"
57 KERNEL=="urandom",              MODE="0444", OPTIONS="last_rule"
58 KERNEL=="mem",                  GROUP="kmem", MODE="0640", OPTIONS="last_rule"
59 KERNEL=="kmem",                 GROUP="kmem", MODE="0640", OPTIONS="last_rule"
60 KERNEL=="port",                 GROUP="kmem", MODE="0640", OPTIONS="last_rule"
61 KERNEL=="full",                 MODE="0666", OPTIONS="last_rule"
62 KERNEL=="null",                 MODE="0666", OPTIONS="last_rule"
63 KERNEL=="zero",                 MODE="0666", OPTIONS="last_rule"
64 # 183 = /dev/hwrng        Generic random number generator
65 KERNEL=="hw_random",            NAME="hwrng", SYMLINK+="%k"
66
67 # misc devices
68 KERNEL=="nvram",                MODE="0660"
69 KERNEL=="rtc",                  MODE="0644"
70
71 # floppy devices
72 KERNEL=="fd[01]*",              GROUP="floppy", MODE="0660"
73 # fix floppy devices
74 KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh"
75 KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M /dev/%k"
76 KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'"
77
78 # audio devices
79 KERNEL=="dsp*",                 MODE="0660"
80 KERNEL=="audio*",               MODE="0660"
81 KERNEL=="midi*",                MODE="0660"
82 KERNEL=="mixer*",               MODE="0660"
83 KERNEL=="sequencer*",           MODE="0660"
84 KERNEL=="sound/*",              MODE="0660"
85 KERNEL=="snd/*",                MODE="0660"
86 KERNEL=="beep",                 MODE="0660"
87 KERNEL=="admm*",                MODE="0660"
88 KERNEL=="adsp*",                MODE="0660"
89 KERNEL=="aload*",               MODE="0660"
90 KERNEL=="amidi*",               MODE="0660"
91 KERNEL=="dmfm*",                MODE="0660"
92 KERNEL=="dmmidi*",              MODE="0660"
93 KERNEL=="sndstat",              MODE="0660"
94
95 # lp devices
96 KERNEL=="lp*",                  GROUP="lp", MODE="0660"
97 KERNEL=="parport*",             GROUP="lp", MODE="0660"
98 KERNEL=="irlpt*",               GROUP="lp", MODE="0660"
99 KERNEL=="usblp*",               GROUP="lp", MODE="0660"
100 KERNEL=="usb/lp*",              GROUP="lp", MODE="0660"
101
102 # tape devices
103 KERNEL=="ht*",                  GROUP="disk", MODE="0660"
104 KERNEL=="nht*",                 GROUP="disk", MODE="0660"
105 KERNEL=="pt[0-9]*",             GROUP="disk", MODE="0660"
106 KERNEL=="npt*",                 GROUP="disk", MODE="0660"
107 KERNEL=="st*",                  GROUP="disk", MODE="0660"
108 KERNEL=="nst*",                 GROUP="disk", MODE="0660"
109 KERNEL=="osst*",                GROUP="disk", MODE="0660"
110 KERNEL=="nosst*",               GROUP="disk", MODE="0660"
111
112 # diskonkey devices
113 KERNEL=="diskonkey*",           GROUP="disk", MODE="0640"
114
115 # rem_ide devices
116 KERNEL=="microdrive*",          GROUP="disk", MODE="0640"
117
118 # kbd devices
119 KERNEL=="kbd",                  MODE="0644"
120
121 # joystick devices
122 KERNEL=="js[0-9]*",             MODE="0644"
123 KERNEL=="djs[0-9]*",            MODE="0644"
124
125 # v4l devices
126 KERNEL=="video*",               MODE="0660"
127 KERNEL=="radio*",               MODE="0660"
128 KERNEL=="winradio*",            MODE="0660"
129 KERNEL=="vtx*",                 MODE="0660"
130 KERNEL=="vbi*",                 MODE="0660"
131 KERNEL=="video/*",              MODE="0660"
132 KERNEL=="vttuner",              MODE="0660"
133 KERNEL=="v4l/*",                MODE="0660"
134
135 # input devices
136 KERNEL=="input/*",              MODE="0660"
137
138 # gpm devices
139 KERNEL=="gpmctl",               MODE="0700"
140
141 # dri devices
142 KERNEL=="nvidia*",              MODE="0660"
143 KERNEL=="3dfx*",                MODE="0660"
144 KERNEL=="card[0-9]*",           NAME="dri/%k", MODE="0666"
145
146 # usb devices
147 KERNEL=="usb/dabusb*",          MODE="0660"
148 KERNEL=="usb/mdc800*",          MODE="0660"
149 KERNEL=="usb/rio500",           MODE="0660"
150
151 # s390 devices
152 KERNEL=="z90crypt",             MODE="0666"
153 KERNEL=="slram[0-9]*",          SYMLINK+="xpram%n"
154
155 # DVB
156 KERNEL=="dvb",                  MODE="0660"
157 SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \
158         NAME="%c", MODE="0660"
159
160 KERNEL=="dm-[0-9]*",            OPTIONS+="ignore_device"
161
162 # alsa devices
163 KERNEL=="controlC[0-9]*",       NAME="snd/%k"
164 KERNEL=="hw[CD0-9]*",           NAME="snd/%k"
165 KERNEL=="pcm[CD0-9cp]*",        NAME="snd/%k"
166 KERNEL=="midi[CD0-9]*",         NAME="snd/%k"
167 KERNEL=="timer",                NAME="snd/%k"
168 KERNEL=="seq",                  NAME="snd/%k"
169
170 # input devices
171 KERNEL=="mice",                 NAME="input/%k"
172 KERNEL=="mouse*",               NAME="input/%k"
173 KERNEL=="event*",               NAME="input/%k"
174 KERNEL=="js*",                  NAME="input/%k", SYMLINK+="%k"
175 KERNEL=="ts*",                  NAME="input/%k"
176
177 # IEEE1394 (firewire) devices (must be before raw devices below)
178 KERNEL=="raw1394",              NAME="%k"
179 KERNEL=="dv1394*",              NAME="dv1394/%n"
180 KERNEL=="video1394*",           NAME="video1394/%n"
181
182 KERNEL=="raw[0-9]*",            NAME="raw/%k"
183
184 KERNEL=="lp[0-9]*",             SYMLINK+="par%n"
185 BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k"
186
187 KERNEL=="microcode",            NAME="cpu/%k"
188 KERNEL=="msr[0-9]*",            NAME="cpu/%n/msr"
189 KERNEL=="cpu[0-9]*",            NAME="cpu/%n/cpuid"
190
191 KERNEL=="ram1",                 SYMLINK+="ram"
192 KERNEL=="video0",               SYMLINK+="video"
193 KERNEL=="radio0",               SYMLINK+="radio"
194 KERNEL=="audio0",               SYMLINK+="audio"
195 KERNEL=="dsp0",                 SYMLINK+="dsp"
196 KERNEL=="fb0",                  SYMLINK+="fb"
197 KERNEL=="qft0",                 SYMLINK+="ftape"
198 KERNEL=="isdnctrl0",            SYMLINK+="isdnctrl"
199 KERNEL=="mixer0",               SYMLINK+="mixer"
200 KERNEL=="ram0",                 SYMLINK+="ramdisk"
201 KERNEL=="sbpcd0",               SYMLINK+="sbpcd"
202 KERNEL=="radio0",               SYMLINK+="radio"
203 KERNEL=="tty0",                 SYMLINK+="systty"
204 KERNEL=="vbi0",                 SYMLINK+="vbi"
205 KERNEL=="null",                 SYMLINK+="XOR"
206
207 KERNEL=="tun",                  NAME="net/%k"
208
209 KERNEL=="device-mapper",        NAME="mapper/control"
210
211 # old compat symlinks with enumeration
212 KERNEL=="sr[0-9]*",             SYMLINK+="cdrom cdrom-%k"
213 KERNEL=="scd[0-9]*",            SYMLINK+="cdrom cdrom-%k"
214 KERNEL=="pcd[0-9]*",            SYMLINK+="cdrom cdrom-%k"
215 KERNEL=="fd[0-9]*",             SYMLINK+="floppy-%k"
216 KERNEL=="nst[0-9]", BUS=="scsi",        SYMLINK+="tape-%k", MODE="0660"
217 KERNEL=="nosst[0-9]", BUS=="scsi",      SYMLINK+="tape-%k", MODE="0660"
218
219 KERNEL=="umad*",                NAME="infiniband/%k", MODE="0660"
220 KERNEL=="issm*",                NAME="infiniband/%k", MODE="0660"
221 KERNEL=="uverbs*",              NAME="infiniband/%k", MODE="0660"
222 KERNEL=="ucm*",                 NAME="infiniband/%k", MODE="0660"
223 KERNEL=="rdma_cm",              NAME="infiniband/%k", MODE="0660"
224
225 # Section for zaptel device
226 KERNEL=="zapctl",               NAME="zap/ctl"
227 KERNEL=="zaptimer",             NAME="zap/timer"
228 KERNEL=="zapchannel",           NAME="zap/channel"
229 KERNEL=="zappseudo",            NAME="zap/pseudo"
230 KERNEL=="zap[0-9]*",            NAME="zap/%n"
231
232 KERNEL=="pktcdvd", NAME="%k/control"
233
234 KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \
235         ATTRS{media}=="floppy", \
236         SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions"
237
238 KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", ATTRS{media}=="cdrom", SYMLINK+="cdrom cdrom-%k"
239
240 KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k"
241 KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k"
242
243 KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k"
244 KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k"
245
246 KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k"
247 KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k"
248
249 # rename sr* to scd*
250 KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n"
251 KERNEL=="hd*[0-9]", BUS=="ide", ATTRS{removable}=="1", \
252         OPTIONS+="ignore_remove"
253
254
255 #######################################
256 # Persistent block device stuff - begin
257 #######################################
258 # persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path}
259 # scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
260
261 ACTION!="add", GOTO="persistent_end"
262 SUBSYSTEM!="block", GOTO="persistent_end"
263
264 # skip rules for inappropriate block devices
265 KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_end"
266
267 # never access removable ide devices, the drivers are causing event loops on open()
268 BUS=="ide", DRIVER!="ide-cdrom", ATTRS{removable}=="1", GOTO="persistent_end"
269 BUS=="ide", KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_end"
270
271 # by-id (hardware serial number)
272 KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode"
273 KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
274 KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
275
276 KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
277 KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x"
278 KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode"
279 KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode"
280 KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode"
281 KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
282
283 # for partitions import parent information
284 KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*"
285 KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
286
287 # by-path (shortest physical path)
288 KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
289 KERNEL=="sr*", GOTO="persistent_end"
290 KERNEL=="*[0-9]", IMPORT{parent}=="ID_*"
291 KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
292
293 # by-label/by-uuid (filesystem properties)
294 KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_end"
295 IMPORT{program}="/lib/udev/vol_id --export $tempnode"
296 ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
297 ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
298
299 # BIOS Enhanced Disk Device
300 KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode"
301 KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
302 KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
303
304 LABEL="persistent_end"
305
306 #####################################
307 # Persistent block device stuff - end
308 #####################################
309
310
311 ACTION=="add", SUBSYSTEM=="usb_device", \
312         PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \
313         NAME="%c", MODE="0644"
314
315 ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
316
317 ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'"
318
319 # sd:           0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC
320 # sr:           4 TYPE_WORM, 5 TYPE_ROM
321 # st/osst:      1 TYPE_TAPE
322 # sg:           8 changer, [36] scanner
323 ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="0|7|14", \
324         RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'"
325 ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \
326         RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'"
327
328
329 ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg"
330 ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \
331         RUN+="/sbin/modprobe sd_mod"
332 ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \
333         RUN+="/sbin/modprobe sr_mod"
334
335 ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", \
336         SYMLINK+="scanner scanner-%k", MODE="0660"
337
338 ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", \
339         SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk"
340
341 ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \
342         ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst"
343 ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \
344         ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st"
345 ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}!="On[sS]tream", \
346         RUN+="/sbin/modprobe st"
347
348 # mmc block devices
349 ACTION=="add", SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block"
350
351 RUN+="socket:/org/kernel/udev/monitor"
352