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