]>
Commit | Line | Data |
---|---|---|
7b86ada7 | 1 | <?xml version='1.0'?> |
63749b1a KS |
2 | <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> |
3 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
7b86ada7 KS |
4 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
5 | ||
63749b1a KS |
6 | <refentry id="udev"> |
7 | <refentryinfo> | |
7b86ada7 | 8 | <title>udev</title> |
63749b1a KS |
9 | <productname>udev</productname> |
10 | </refentryinfo> | |
11 | ||
12 | <refmeta> | |
13 | <refentrytitle>udev</refentrytitle> | |
14 | <manvolnum>7</manvolnum> | |
15 | </refmeta> | |
16 | ||
17 | <refnamediv> | |
18 | <refname>udev</refname> | |
19 | <refpurpose>Linux dynamic device management</refpurpose> | |
20 | </refnamediv> | |
21 | ||
22 | <refsect1><title>Description</title> | |
23 | <para>udev supplies the system software with device events, manages permissions | |
24 | of device nodes and may create additional symlinks in the <filename>/dev</filename> | |
25 | directory, or renames network interfaces. The kernel usually just assigns unpredictable | |
26 | device names based on the order of discovery. Meaningful symlinks or network device | |
27 | names provide a way to reliably identify devices based on their properties or | |
28 | current configuration.</para> | |
29 | ||
0e4fa2ab MW |
30 | <para>The udev daemon, <citerefentry><refentrytitle>udevd</refentrytitle> |
31 | <manvolnum>8</manvolnum></citerefentry>, receives device uevents directly from | |
63749b1a KS |
32 | the kernel whenever a device is added or removed from the system, or it changes its |
33 | state. When udev receives a device event, it matches its configured set of rules | |
0e846301 MW |
34 | against various device attributes to identify the device. Rules that match may |
35 | provide additional device information to be stored in the udev database or | |
63749b1a KS |
36 | to be used to create meaningful symlink names.</para> |
37 | ||
0e846301 | 38 | <para>All device information udev processes is stored in the udev database and |
63749b1a | 39 | sent out to possible event subscribers. Access to all stored data and the event |
17fd0f60 | 40 | sources is provided by the library libudev.</para> |
63749b1a KS |
41 | </refsect1> |
42 | ||
43 | <refsect1><title>Configuration</title> | |
12a362be KS |
44 | <para>udev configuration files are placed in <filename>/etc/udev</filename> |
45 | and <filename>/usr/lib/udev</filename>. All empty lines or lines beginning with | |
933b5623 | 46 | '#' are ignored.</para> |
63749b1a KS |
47 | |
48 | <refsect2><title>Configuration file</title> | |
49 | <para>udev expects its main configuration file at <filename>/etc/udev/udev.conf</filename>. | |
50 | It consists of a set of variables allowing the user to override default udev values. | |
51 | The following variables can be set:</para> | |
52 | <variablelist> | |
53 | <varlistentry> | |
54 | <term><option>udev_root</option></term> | |
55 | <listitem> | |
56 | <para>Specifies where to place the device nodes in the filesystem. | |
57 | The default value is <filename>/dev</filename>.</para> | |
58 | </listitem> | |
59 | </varlistentry> | |
60 | ||
61 | <varlistentry> | |
62 | <term><option>udev_log</option></term> | |
63 | <listitem> | |
64 | <para>The logging priority. Valid values are the numerical syslog priorities | |
65 | or their textual representations: <option>err</option>, <option>info</option> | |
66 | and <option>debug</option>.</para> | |
67 | </listitem> | |
68 | </varlistentry> | |
69 | </variablelist> | |
70 | </refsect2> | |
71 | ||
72 | <refsect2><title>Rules files</title> | |
73 | <para>The udev rules are read from the files located in the | |
12a362be KS |
74 | system rules directory <filename>/usr/lib/udev/rules.d</filename>, |
75 | the local administration directory <filename>/etc/udev/rules.d</filename> | |
76 | and the volatile runtime directory <filename>/run/udev/rules.d</filename>. | |
1021e6df KS |
77 | All rules files are collectively sorted and processed in lexical order, |
78 | regardless of the directories in which they live. However, files with | |
79 | identical file names replace each other. Files in <filename>/run</filename> | |
80 | have the highest priority, files in <filename>/etc</filename> take precedence | |
81 | over files with the same name in <filename>/lib</filename>. This can be | |
82 | used to overwrite a system rules file if needed; a symlink in | |
83 | <filename>/etc</filename> with the same name as a rules file in | |
84 | <filename>/lib</filename>, pointing to <filename>/dev/null</filename>, | |
85 | disables the rules file entirely.</para> | |
63749b1a | 86 | |
c3cba32f MW |
87 | <para>Rule files must have the extension <filename>.rules</filename>; other |
88 | extensions are ignored.</para> | |
63749b1a | 89 | |
feedf8f3 | 90 | <para>Every line in the rules file contains at least one key-value pair. |
57c0409f | 91 | There are two kind of keys: match and assignment. |
63749b1a | 92 | If all match keys are matching against its value, the rule gets applied and the |
b834042f | 93 | assignment keys get the specified value assigned.</para> |
63749b1a KS |
94 | |
95 | <para>A matching rule may rename a network interface, add symlinks | |
96 | pointing to the device node, or run a specified program as part of | |
97 | the event handling.</para> | |
98 | ||
55f5037c MW |
99 | <para>A rule consists of a comma-separated list of one or more key-value pairs. |
100 | Each key has a distinct operation, depending on the used operator. Valid | |
63749b1a KS |
101 | operators are:</para> |
102 | <variablelist> | |
103 | <varlistentry> | |
104 | <term><option>==</option></term> | |
105 | <listitem> | |
106 | <para>Compare for equality.</para> | |
107 | </listitem> | |
108 | </varlistentry> | |
109 | ||
110 | <varlistentry> | |
111 | <term><option>!=</option></term> | |
112 | <listitem> | |
113 | <para>Compare for inequality.</para> | |
114 | </listitem> | |
115 | </varlistentry> | |
116 | ||
117 | <varlistentry> | |
118 | <term><option>=</option></term> | |
119 | <listitem> | |
0e846301 | 120 | <para>Assign a value to a key. Keys that represent a list are reset |
63749b1a KS |
121 | and only this single value is assigned.</para> |
122 | </listitem> | |
123 | </varlistentry> | |
124 | ||
125 | <varlistentry> | |
126 | <term><option>+=</option></term> | |
127 | <listitem> | |
128 | <para>Add the value to a key that holds a list of entries.</para> | |
129 | </listitem> | |
130 | </varlistentry> | |
131 | ||
132 | <varlistentry> | |
133 | <term><option>:=</option></term> | |
134 | <listitem> | |
2bf11540 | 135 | <para>Assign a value to a key finally; disallow any later changes.</para> |
63749b1a KS |
136 | </listitem> |
137 | </varlistentry> | |
138 | </variablelist> | |
139 | ||
140 | <para>The following key names can be used to match against device properties. | |
141 | Some of the keys also match against properties of the parent devices in sysfs, | |
142 | not only the device that has generated the event. If multiple keys that match | |
143 | a parent device are specified in a single rule, all these keys must match at | |
144 | one and the same parent device.</para> | |
145 | <variablelist> | |
146 | <varlistentry> | |
147 | <term><option>ACTION</option></term> | |
148 | <listitem> | |
149 | <para>Match the name of the event action.</para> | |
150 | </listitem> | |
151 | </varlistentry> | |
152 | ||
153 | <varlistentry> | |
154 | <term><option>DEVPATH</option></term> | |
155 | <listitem> | |
156 | <para>Match the devpath of the event device.</para> | |
157 | </listitem> | |
158 | </varlistentry> | |
159 | ||
160 | <varlistentry> | |
161 | <term><option>KERNEL</option></term> | |
162 | <listitem> | |
163 | <para>Match the name of the event device.</para> | |
164 | </listitem> | |
165 | </varlistentry> | |
166 | ||
167 | <varlistentry> | |
168 | <term><option>NAME</option></term> | |
169 | <listitem> | |
220893b3 KS |
170 | <para>Match the name of a network interface. It can be used once the |
171 | NAME key has been set in one of the preceding rules.</para> | |
63749b1a KS |
172 | </listitem> |
173 | </varlistentry> | |
174 | ||
175 | <varlistentry> | |
176 | <term><option>SYMLINK</option></term> | |
177 | <listitem> | |
178 | <para>Match the name of a symlink targeting the node. It can | |
179 | be used once a SYMLINK key has been set in one of the preceding | |
180 | rules. There may be multiple symlinks; only one needs to match. | |
181 | </para> | |
182 | </listitem> | |
183 | </varlistentry> | |
184 | ||
185 | <varlistentry> | |
186 | <term><option>SUBSYSTEM</option></term> | |
187 | <listitem> | |
188 | <para>Match the subsystem of the event device.</para> | |
189 | </listitem> | |
190 | </varlistentry> | |
191 | <varlistentry> | |
192 | <term><option>DRIVER</option></term> | |
193 | <listitem> | |
2e7f69eb | 194 | <para>Match the driver name of the event device. Only set this key for devices |
63749b1a KS |
195 | which are bound to a driver at the time the event is generated.</para> |
196 | </listitem> | |
197 | </varlistentry> | |
198 | <varlistentry> | |
199 | <term><option>ATTR{<replaceable>filename</replaceable>}</option></term> | |
200 | <listitem> | |
201 | <para>Match sysfs attribute values of the event device. Trailing | |
65e039c2 MW |
202 | whitespace in the attribute values is ignored unless the specified match |
203 | value itself contains trailing whitespace. | |
63749b1a KS |
204 | </para> |
205 | </listitem> | |
206 | </varlistentry> | |
207 | ||
208 | <varlistentry> | |
209 | <term><option>KERNELS</option></term> | |
210 | <listitem> | |
211 | <para>Search the devpath upwards for a matching device name.</para> | |
212 | </listitem> | |
213 | </varlistentry> | |
214 | ||
215 | <varlistentry> | |
216 | <term><option>SUBSYSTEMS</option></term> | |
217 | <listitem> | |
218 | <para>Search the devpath upwards for a matching device subsystem name.</para> | |
219 | </listitem> | |
220 | </varlistentry> | |
221 | ||
222 | <varlistentry> | |
223 | <term><option>DRIVERS</option></term> | |
224 | <listitem> | |
225 | <para>Search the devpath upwards for a matching device driver name.</para> | |
226 | </listitem> | |
227 | </varlistentry> | |
228 | ||
229 | <varlistentry> | |
230 | <term><option>ATTRS{<replaceable>filename</replaceable>}</option></term> | |
231 | <listitem> | |
232 | <para>Search the devpath upwards for a device with matching sysfs attribute values. | |
233 | If multiple <option>ATTRS</option> matches are specified, all of them | |
65e039c2 MW |
234 | must match on the same device. Trailing whitespace in the attribute values is ignored |
235 | unless the specified match value itself contains trailing whitespace.</para> | |
63749b1a KS |
236 | </listitem> |
237 | </varlistentry> | |
238 | ||
7df0ed83 KS |
239 | <varlistentry> |
240 | <term><option>TAGS</option></term> | |
241 | <listitem> | |
242 | <para>Search the devpath upwards for a device with matching tag.</para> | |
243 | </listitem> | |
244 | </varlistentry> | |
245 | ||
63749b1a KS |
246 | <varlistentry> |
247 | <term><option>ENV{<replaceable>key</replaceable>}</option></term> | |
248 | <listitem> | |
249 | <para>Match against a device property value.</para> | |
250 | </listitem> | |
251 | </varlistentry> | |
252 | ||
253 | <varlistentry> | |
254 | <term><option>TAG</option></term> | |
255 | <listitem> | |
256 | <para>Match against a device tag.</para> | |
257 | </listitem> | |
258 | </varlistentry> | |
259 | ||
260 | <varlistentry> | |
261 | <term><option>TEST{<replaceable>octal mode mask</replaceable>}</option></term> | |
262 | <listitem> | |
263 | <para>Test the existence of a file. An octal mode mask can be specified | |
264 | if needed.</para> | |
265 | </listitem> | |
266 | </varlistentry> | |
267 | ||
268 | <varlistentry> | |
269 | <term><option>PROGRAM</option></term> | |
270 | <listitem> | |
2e9820e3 MW |
271 | <para>Execute a program to determine whether there |
272 | is a match; the key is true if the program returns | |
63749b1a | 273 | successfully. The device properties are made available to the |
2e9820e3 MW |
274 | executed program in the environment. The program's stdout |
275 | is available in the RESULT key.</para> | |
63749b1a KS |
276 | </listitem> |
277 | </varlistentry> | |
278 | ||
279 | <varlistentry> | |
280 | <term><option>RESULT</option></term> | |
281 | <listitem> | |
282 | <para>Match the returned string of the last PROGRAM call. This key can | |
283 | be used in the same or in any later rule after a PROGRAM call.</para> | |
284 | </listitem> | |
285 | </varlistentry> | |
286 | </variablelist> | |
287 | ||
401e59e9 | 288 | <para>Most of the fields support shell-style pattern matching. The following |
63749b1a KS |
289 | pattern characters are supported:</para> |
290 | <variablelist> | |
291 | <varlistentry> | |
292 | <term><option>*</option></term> | |
293 | <listitem> | |
954e9c52 | 294 | <para>Matches zero or more characters.</para> |
63749b1a KS |
295 | </listitem> |
296 | </varlistentry> | |
297 | <varlistentry> | |
298 | <term><option>?</option></term> | |
299 | <listitem> | |
300 | <para>Matches any single character.</para> | |
301 | </listitem> | |
302 | </varlistentry> | |
303 | <varlistentry> | |
304 | <term><option>[]</option></term> | |
305 | <listitem> | |
306 | <para>Matches any single character specified within the brackets. For | |
307 | example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. | |
2c47027b MW |
308 | Ranges are also supported via the '-' character. |
309 | For example, to match on the range of all digits, the pattern [0-9] could | |
63749b1a KS |
310 | be used. If the first character following the '[' is a '!', any characters |
311 | not enclosed are matched.</para> | |
312 | </listitem> | |
313 | </varlistentry> | |
314 | </variablelist> | |
315 | ||
316 | <para>The following keys can get values assigned:</para> | |
317 | <variablelist> | |
318 | <varlistentry> | |
319 | <term><option>NAME</option></term> | |
320 | <listitem> | |
220893b3 KS |
321 | <para>The name to use for a network interface. The name of a device node |
322 | can not be changed by udev, only additional symlinks can be created.</para> | |
63749b1a KS |
323 | </listitem> |
324 | </varlistentry> | |
325 | ||
326 | <varlistentry> | |
327 | <term><option>SYMLINK</option></term> | |
328 | <listitem> | |
933b5623 | 329 | <para>The name of a symlink targeting the node. Every matching rule adds |
63749b1a KS |
330 | this value to the list of symlinks to be created. Multiple symlinks may be |
331 | specified by separating the names by the space character. In case multiple | |
933b5623 MW |
332 | devices claim the same name, the link always points to the device with |
333 | the highest link_priority. If the current device goes away, the links are | |
334 | re-evaluated and the device with the next highest link_priority becomes the owner of | |
9f38b806 MW |
335 | the link. If no link_priority is specified, the order of the devices (and |
336 | which one of them owns the link) is undefined. Also, symlink names must | |
337 | never conflict with the kernel's default device node names, as that would | |
338 | result in unpredictable behavior. | |
63749b1a KS |
339 | </para> |
340 | </listitem> | |
341 | </varlistentry> | |
342 | ||
343 | <varlistentry> | |
344 | <term><option>OWNER, GROUP, MODE</option></term> | |
345 | <listitem> | |
346 | <para>The permissions for the device node. Every specified value overwrites | |
347 | the compiled-in default value.</para> | |
348 | </listitem> | |
349 | </varlistentry> | |
350 | ||
351 | <varlistentry> | |
352 | <term><option>ATTR{<replaceable>key</replaceable>}</option></term> | |
353 | <listitem> | |
354 | <para>The value that should be written to a sysfs attribute of the | |
355 | event device.</para> | |
356 | </listitem> | |
357 | </varlistentry> | |
358 | ||
359 | <varlistentry> | |
360 | <term><option>ENV{<replaceable>key</replaceable>}</option></term> | |
361 | <listitem> | |
362 | <para>Set a device property value. Property names with a leading '.' | |
ed9c5fb7 MW |
363 | are neither stored in the database nor exported to events or |
364 | external tools (run by, say, the PROGRAM match key).</para> | |
63749b1a KS |
365 | </listitem> |
366 | </varlistentry> | |
367 | ||
368 | <varlistentry> | |
369 | <term><option>TAG</option></term> | |
370 | <listitem> | |
371 | <para>Attach a tag to a device. This is used to filter events for users | |
372 | of libudev's monitor functionality, or to enumerate a group of tagged | |
373 | devices. The implementation can only work efficiently if only a few | |
374 | tags are attached to a device. It is only meant to be used in | |
375 | contexts with specific device filter requirements, and not as a | |
376 | general-purpose flag. Excessive use might result in inefficient event | |
377 | handling.</para> | |
378 | </listitem> | |
379 | </varlistentry> | |
380 | ||
381 | <varlistentry> | |
382 | <term><option>RUN</option></term> | |
383 | <listitem> | |
384 | <para>Add a program to the list of programs to be executed for a specific | |
385 | device. This can only be used for very short running tasks. Running an | |
386 | event process for a long period of time may block all further events for | |
387 | this or a dependent device. Long running tasks need to be immediately | |
864fde8a | 388 | detached from the event process itself.</para> |
63749b1a | 389 | <para>If no absolute path is given, the program is expected to live in |
14957190 KS |
390 | /usr/lib/udev, otherwise the absolute path must be specified. The program |
391 | name and following arguments are separated by spaces. Single quotes can | |
392 | be used to specify arguments with spaces.</para> | |
63749b1a KS |
393 | </listitem> |
394 | </varlistentry> | |
395 | ||
396 | <varlistentry> | |
397 | <term><option>LABEL</option></term> | |
398 | <listitem> | |
c24dfc80 | 399 | <para>A named label to which a GOTO may jump.</para> |
63749b1a KS |
400 | </listitem> |
401 | </varlistentry> | |
402 | ||
403 | <varlistentry> | |
404 | <term><option>GOTO</option></term> | |
405 | <listitem> | |
2f16de29 | 406 | <para>Jumps to the next LABEL with a matching name.</para> |
63749b1a KS |
407 | </listitem> |
408 | </varlistentry> | |
409 | ||
410 | <varlistentry> | |
411 | <term><option>IMPORT{<replaceable>type</replaceable>}</option></term> | |
412 | <listitem> | |
413 | <para>Import a set of variables as device properties, | |
414 | depending on <replaceable>type</replaceable>:</para> | |
415 | <variablelist> | |
416 | <varlistentry> | |
417 | <term><option>program</option></term> | |
418 | <listitem> | |
419 | <para>Execute an external program specified as the assigned value and | |
420 | import its output, which must be in environment key | |
421 | format. Path specification, command/argument separation, | |
422 | and quoting work like in <option>RUN</option>.</para> | |
423 | </listitem> | |
424 | </varlistentry> | |
425 | <varlistentry> | |
426 | <term><option>file</option></term> | |
427 | <listitem> | |
b6a49cd6 MW |
428 | <para>Import a text file specified as the assigned value, the content |
429 | of which must be in environment key format.</para> | |
63749b1a KS |
430 | </listitem> |
431 | </varlistentry> | |
432 | <varlistentry> | |
433 | <term><option>db</option></term> | |
434 | <listitem> | |
435 | <para>Import a single property specified as the assigned value from the | |
436 | current device database. This works only if the database is already populated | |
437 | by an earlier event.</para> | |
438 | </listitem> | |
439 | </varlistentry> | |
c4f6dcc4 KS |
440 | <varlistentry> |
441 | <term><option>cmdline</option></term> | |
442 | <listitem> | |
ad9c70a8 | 443 | <para>Import a single property from the kernel command line. For simple flags |
933b5623 | 444 | the value of the property is set to '1'.</para> |
c4f6dcc4 KS |
445 | </listitem> |
446 | </varlistentry> | |
63749b1a KS |
447 | <varlistentry> |
448 | <term><option>parent</option></term> | |
449 | <listitem> | |
450 | <para>Import the stored keys from the parent device by reading | |
451 | the database entry of the parent device. The value assigned to | |
452 | <option>IMPORT{parent}</option> is used as a filter of key names | |
453 | to import (with the same shell-style pattern matching used for | |
454 | comparisons).</para> | |
455 | </listitem> | |
456 | </varlistentry> | |
457 | </variablelist> | |
63749b1a KS |
458 | </listitem> |
459 | </varlistentry> | |
460 | ||
461 | <varlistentry> | |
462 | <term><option>WAIT_FOR</option></term> | |
463 | <listitem> | |
793681cb MW |
464 | <para>Wait for a file to become available or until a timeout of |
465 | 10 seconds expires. The path is relative to the sysfs device; | |
466 | if no path is specified, this waits for an attribute to appear.</para> | |
63749b1a KS |
467 | </listitem> |
468 | </varlistentry> | |
469 | ||
470 | <varlistentry> | |
471 | <term><option>OPTIONS</option></term> | |
472 | <listitem> | |
473 | <para>Rule and device options:</para> | |
474 | <variablelist> | |
475 | <varlistentry> | |
476 | <term><option>link_priority=<replaceable>value</replaceable></option></term> | |
477 | <listitem> | |
478 | <para>Specify the priority of the created symlinks. Devices with higher | |
479 | priorities overwrite existing symlinks of other devices. The default is 0.</para> | |
480 | </listitem> | |
481 | </varlistentry> | |
482 | <varlistentry> | |
483 | <term><option>event_timeout=</option></term> | |
484 | <listitem> | |
933b5623 MW |
485 | <para>Number of seconds an event waits for operations to finish before |
486 | giving up and terminating itself.</para> | |
63749b1a KS |
487 | </listitem> |
488 | </varlistentry> | |
489 | <varlistentry> | |
490 | <term><option>string_escape=<replaceable>none|replace</replaceable></option></term> | |
491 | <listitem> | |
492 | <para>Usually control and other possibly unsafe characters are replaced | |
493 | in strings used for device naming. The mode of replacement can be specified | |
494 | with this option.</para> | |
495 | </listitem> | |
496 | </varlistentry> | |
9fa68615 KS |
497 | <varlistentry> |
498 | <term><option>static_node=</option></term> | |
499 | <listitem> | |
0fbda083 | 500 | <para>Apply the permissions specified in this rule to the static device node with |
0e846301 | 501 | the specified name. Static device nodes might be provided by kernel modules |
12a362be | 502 | or copied from <filename>/usr/lib/udev/devices</filename>. These nodes might not have |
0e846301 MW |
503 | a corresponding kernel device at the time udevd is started; they can trigger |
504 | automatic kernel module loading.</para> | |
9fa68615 KS |
505 | </listitem> |
506 | </varlistentry> | |
63749b1a KS |
507 | <varlistentry> |
508 | <term><option>watch</option></term> | |
509 | <listitem> | |
620da34d MW |
510 | <para>Watch the device node with inotify; when the node is closed after being opened for |
511 | writing, a change uevent is synthesized.</para> | |
63749b1a KS |
512 | </listitem> |
513 | </varlistentry> | |
3b529da4 KS |
514 | <varlistentry> |
515 | <term><option>nowatch</option></term> | |
516 | <listitem> | |
517 | <para>Disable the watching of a device node with inotify.</para> | |
518 | </listitem> | |
519 | </varlistentry> | |
63749b1a KS |
520 | </variablelist> |
521 | </listitem> | |
522 | </varlistentry> | |
523 | </variablelist> | |
524 | ||
525 | <para>The <option>NAME</option>, <option>SYMLINK</option>, <option>PROGRAM</option>, | |
526 | <option>OWNER</option>, <option>GROUP</option>, <option>MODE</option> and <option>RUN</option> | |
57e80484 MW |
527 | fields support simple string substitutions. The <option>RUN</option> |
528 | substitutions are performed after all rules have been processed, right before the program | |
529 | is executed, allowing for the use of device properties set by earlier matching | |
530 | rules. For all other fields, substitutions are performed while the individual rule is | |
63749b1a KS |
531 | being processed. The available substitutions are:</para> |
532 | <variablelist> | |
533 | <varlistentry> | |
534 | <term><option>$kernel</option>, <option>%k</option></term> | |
535 | <listitem> | |
536 | <para>The kernel name for this device.</para> | |
537 | </listitem> | |
538 | </varlistentry> | |
539 | ||
540 | <varlistentry> | |
541 | <term><option>$number</option>, <option>%n</option></term> | |
542 | <listitem> | |
543 | <para>The kernel number for this device. For example, 'sda3' has | |
544 | kernel number of '3'</para> | |
545 | </listitem> | |
546 | </varlistentry> | |
547 | ||
548 | <varlistentry> | |
549 | <term><option>$devpath</option>, <option>%p</option></term> | |
550 | <listitem> | |
551 | <para>The devpath of the device.</para> | |
552 | </listitem> | |
553 | </varlistentry> | |
554 | ||
555 | <varlistentry> | |
556 | <term><option>$id</option>, <option>%b</option></term> | |
557 | <listitem> | |
558 | <para>The name of the device matched while searching the devpath upwards for | |
559 | <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>. | |
560 | </para> | |
561 | </listitem> | |
562 | </varlistentry> | |
563 | ||
564 | <varlistentry> | |
565 | <term><option>$driver</option></term> | |
566 | <listitem> | |
567 | <para>The driver name of the device matched while searching the devpath upwards for | |
568 | <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>. | |
569 | </para> | |
570 | </listitem> | |
571 | </varlistentry> | |
572 | ||
573 | <varlistentry> | |
574 | <term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term> | |
575 | <listitem> | |
0e846301 | 576 | <para>The value of a sysfs attribute found at the device where |
63749b1a | 577 | all keys of the rule have matched. If the matching device does not have |
83184d00 | 578 | such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or |
f2db23cd | 579 | ATTRS test selected a parent device, then the attribute from that |
f61501b0 MW |
580 | parent device is used.</para> |
581 | <para>If the attribute is a symlink, the last element of the symlink target is | |
63749b1a KS |
582 | returned as the value.</para> |
583 | </listitem> | |
584 | </varlistentry> | |
585 | ||
586 | <varlistentry> | |
587 | <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term> | |
588 | <listitem> | |
589 | <para>A device property value.</para> | |
590 | </listitem> | |
591 | </varlistentry> | |
592 | ||
593 | <varlistentry> | |
594 | <term><option>$major</option>, <option>%M</option></term> | |
595 | <listitem> | |
596 | <para>The kernel major number for the device.</para> | |
597 | </listitem> | |
598 | </varlistentry> | |
599 | ||
600 | <varlistentry> | |
601 | <term><option>$minor</option>, <option>%m</option></term> | |
602 | <listitem> | |
603 | <para>The kernel minor number for the device.</para> | |
604 | </listitem> | |
605 | </varlistentry> | |
606 | ||
607 | <varlistentry> | |
608 | <term><option>$result</option>, <option>%c</option></term> | |
609 | <listitem> | |
610 | <para>The string returned by the external program requested with PROGRAM. | |
21188522 | 611 | A single part of the string, separated by a space character, may be selected |
63749b1a | 612 | by specifying the part number as an attribute: <option>%c{N}</option>. |
509c02f1 | 613 | If the number is followed by the '+' character, this part plus all remaining parts |
63749b1a KS |
614 | of the result string are substituted: <option>%c{N+}</option></para> |
615 | </listitem> | |
616 | </varlistentry> | |
617 | ||
618 | <varlistentry> | |
619 | <term><option>$parent</option>, <option>%P</option></term> | |
620 | <listitem> | |
621 | <para>The node name of the parent device.</para> | |
622 | </listitem> | |
623 | </varlistentry> | |
624 | ||
625 | <varlistentry> | |
626 | <term><option>$name</option></term> | |
627 | <listitem> | |
220893b3 | 628 | <para>The current name of the device. If not changed by a rule, it is the |
63749b1a KS |
629 | name of the kernel device.</para> |
630 | </listitem> | |
631 | </varlistentry> | |
632 | ||
633 | <varlistentry> | |
634 | <term><option>$links</option></term> | |
635 | <listitem> | |
e8b5e4e5 | 636 | <para>A space-separated list of the current symlinks. The value is |
2d74bc75 | 637 | only set during a remove event or if an earlier rule assigned a value.</para> |
63749b1a KS |
638 | </listitem> |
639 | </varlistentry> | |
640 | ||
641 | <varlistentry> | |
642 | <term><option>$root</option>, <option>%r</option></term> | |
643 | <listitem> | |
644 | <para>The udev_root value.</para> | |
645 | </listitem> | |
646 | </varlistentry> | |
647 | ||
648 | <varlistentry> | |
649 | <term><option>$sys</option>, <option>%S</option></term> | |
650 | <listitem> | |
651 | <para>The sysfs mount point.</para> | |
652 | </listitem> | |
653 | </varlistentry> | |
654 | ||
655 | <varlistentry> | |
220893b3 | 656 | <term><option>$devnode</option>, <option>%N</option></term> |
63749b1a | 657 | <listitem> |
220893b3 | 658 | <para>The name of the device node.</para> |
63749b1a KS |
659 | </listitem> |
660 | </varlistentry> | |
661 | ||
662 | <varlistentry> | |
663 | <term><option>%%</option></term> | |
664 | <listitem> | |
665 | <para>The '%' character itself.</para> | |
666 | </listitem> | |
667 | </varlistentry> | |
668 | ||
669 | <varlistentry> | |
670 | <term><option>$$</option></term> | |
671 | <listitem> | |
672 | <para>The '$' character itself.</para> | |
673 | </listitem> | |
674 | </varlistentry> | |
675 | </variablelist> | |
676 | </refsect2> | |
677 | </refsect1> | |
678 | ||
679 | <refsect1><title>Author</title> | |
680 | <para>Written by Greg Kroah-Hartman <email>greg@kroah.com</email> and | |
681 | Kay Sievers <email>kay.sievers@vrfy.org</email>. With much help from | |
682 | Dan Stekloff and many others.</para> | |
683 | </refsect1> | |
684 | ||
685 | <refsect1> | |
686 | <title>See Also</title> | |
687 | <para><citerefentry> | |
688 | <refentrytitle>udevd</refentrytitle><manvolnum>8</manvolnum> | |
689 | </citerefentry>, | |
690 | <citerefentry> | |
691 | <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum> | |
692 | </citerefentry></para> | |
693 | </refsect1> | |
694 | </refentry> |