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