]>
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> | |
44 | <para>udev configuration files are placed in <filename>/etc/udev/</filename> | |
0e846301 | 45 | and <filename>/lib/udev/</filename>. All empty lines or lines beginning with |
63749b1a KS |
46 | '#' will be ignored.</para> |
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 | |
74 | default rules directory <filename>/lib/udev/rules.d/</filename>, | |
75 | the custom rules directory <filename>/etc/udev/rules.d/</filename> | |
4ec9c3e7 | 76 | and the temporary rules directory <filename>/run/udev/rules.d/</filename>. |
63749b1a | 77 | All rule files are sorted and processed in lexical order, regardless |
6593e896 MP |
78 | in which of these directories they live. Files in |
79 | <filename>/etc/udev/rules.d/</filename> have precedence over files with | |
80 | the same name in <filename>/lib/udev/rules.d/</filename>. This can be | |
81 | used to ignore a default rules file if needed.</para> | |
63749b1a | 82 | |
6593e896 MP |
83 | <para>Rule files must end in <filename>.rules</filename>, other extensions |
84 | are ignored.</para> | |
63749b1a KS |
85 | |
86 | <para>Every line in the rules file contains at least one key value pair. | |
87 | There are two kind of keys, match and assignment keys. | |
88 | If all match keys are matching against its value, the rule gets applied and the | |
89 | assign keys get the specified value assigned.</para> | |
90 | ||
91 | <para>A matching rule may rename a network interface, add symlinks | |
92 | pointing to the device node, or run a specified program as part of | |
93 | the event handling.</para> | |
94 | ||
95 | <para>A rule consists of a list of one or more key value pairs separated by | |
96 | a comma. Each key has a distinct operation, depending on the used operator. Valid | |
97 | operators are:</para> | |
98 | <variablelist> | |
99 | <varlistentry> | |
100 | <term><option>==</option></term> | |
101 | <listitem> | |
102 | <para>Compare for equality.</para> | |
103 | </listitem> | |
104 | </varlistentry> | |
105 | ||
106 | <varlistentry> | |
107 | <term><option>!=</option></term> | |
108 | <listitem> | |
109 | <para>Compare for inequality.</para> | |
110 | </listitem> | |
111 | </varlistentry> | |
112 | ||
113 | <varlistentry> | |
114 | <term><option>=</option></term> | |
115 | <listitem> | |
0e846301 | 116 | <para>Assign a value to a key. Keys that represent a list are reset |
63749b1a KS |
117 | and only this single value is assigned.</para> |
118 | </listitem> | |
119 | </varlistentry> | |
120 | ||
121 | <varlistentry> | |
122 | <term><option>+=</option></term> | |
123 | <listitem> | |
124 | <para>Add the value to a key that holds a list of entries.</para> | |
125 | </listitem> | |
126 | </varlistentry> | |
127 | ||
128 | <varlistentry> | |
129 | <term><option>:=</option></term> | |
130 | <listitem> | |
131 | <para>Assign a value to a key finally; disallow any later changes, | |
132 | which may be used to prevent changes by any later rules.</para> | |
133 | </listitem> | |
134 | </varlistentry> | |
135 | </variablelist> | |
136 | ||
137 | <para>The following key names can be used to match against device properties. | |
138 | Some of the keys also match against properties of the parent devices in sysfs, | |
139 | not only the device that has generated the event. If multiple keys that match | |
140 | a parent device are specified in a single rule, all these keys must match at | |
141 | one and the same parent device.</para> | |
142 | <variablelist> | |
143 | <varlistentry> | |
144 | <term><option>ACTION</option></term> | |
145 | <listitem> | |
146 | <para>Match the name of the event action.</para> | |
147 | </listitem> | |
148 | </varlistentry> | |
149 | ||
150 | <varlistentry> | |
151 | <term><option>DEVPATH</option></term> | |
152 | <listitem> | |
153 | <para>Match the devpath of the event device.</para> | |
154 | </listitem> | |
155 | </varlistentry> | |
156 | ||
157 | <varlistentry> | |
158 | <term><option>KERNEL</option></term> | |
159 | <listitem> | |
160 | <para>Match the name of the event device.</para> | |
161 | </listitem> | |
162 | </varlistentry> | |
163 | ||
164 | <varlistentry> | |
165 | <term><option>NAME</option></term> | |
166 | <listitem> | |
167 | <para>Match the name of the node or network interface. It can | |
168 | be used once the NAME key has been set in one of the preceding | |
169 | rules.</para> | |
170 | </listitem> | |
171 | </varlistentry> | |
172 | ||
173 | <varlistentry> | |
174 | <term><option>SYMLINK</option></term> | |
175 | <listitem> | |
176 | <para>Match the name of a symlink targeting the node. It can | |
177 | be used once a SYMLINK key has been set in one of the preceding | |
178 | rules. There may be multiple symlinks; only one needs to match. | |
179 | </para> | |
180 | </listitem> | |
181 | </varlistentry> | |
182 | ||
183 | <varlistentry> | |
184 | <term><option>SUBSYSTEM</option></term> | |
185 | <listitem> | |
186 | <para>Match the subsystem of the event device.</para> | |
187 | </listitem> | |
188 | </varlistentry> | |
189 | <varlistentry> | |
190 | <term><option>DRIVER</option></term> | |
191 | <listitem> | |
192 | <para>Match the driver name of the event device. Only set for devices | |
193 | which are bound to a driver at the time the event is generated.</para> | |
194 | </listitem> | |
195 | </varlistentry> | |
196 | <varlistentry> | |
197 | <term><option>ATTR{<replaceable>filename</replaceable>}</option></term> | |
198 | <listitem> | |
199 | <para>Match sysfs attribute values of the event device. Trailing | |
200 | whitespace in the attribute values is ignored, if the specified match | |
201 | value does not contain trailing whitespace itself. | |
202 | </para> | |
203 | </listitem> | |
204 | </varlistentry> | |
205 | ||
206 | <varlistentry> | |
207 | <term><option>KERNELS</option></term> | |
208 | <listitem> | |
209 | <para>Search the devpath upwards for a matching device name.</para> | |
210 | </listitem> | |
211 | </varlistentry> | |
212 | ||
213 | <varlistentry> | |
214 | <term><option>SUBSYSTEMS</option></term> | |
215 | <listitem> | |
216 | <para>Search the devpath upwards for a matching device subsystem name.</para> | |
217 | </listitem> | |
218 | </varlistentry> | |
219 | ||
220 | <varlistentry> | |
221 | <term><option>DRIVERS</option></term> | |
222 | <listitem> | |
223 | <para>Search the devpath upwards for a matching device driver name.</para> | |
224 | </listitem> | |
225 | </varlistentry> | |
226 | ||
227 | <varlistentry> | |
228 | <term><option>ATTRS{<replaceable>filename</replaceable>}</option></term> | |
229 | <listitem> | |
230 | <para>Search the devpath upwards for a device with matching sysfs attribute values. | |
231 | If multiple <option>ATTRS</option> matches are specified, all of them | |
232 | must match on the same device. Trailing whitespace in the attribute values is ignored, | |
233 | if the specified match value does not contain trailing whitespace itself.</para> | |
234 | </listitem> | |
235 | </varlistentry> | |
236 | ||
237 | <varlistentry> | |
238 | <term><option>ENV{<replaceable>key</replaceable>}</option></term> | |
239 | <listitem> | |
240 | <para>Match against a device property value.</para> | |
241 | </listitem> | |
242 | </varlistentry> | |
243 | ||
244 | <varlistentry> | |
245 | <term><option>TAG</option></term> | |
246 | <listitem> | |
247 | <para>Match against a device tag.</para> | |
248 | </listitem> | |
249 | </varlistentry> | |
250 | ||
251 | <varlistentry> | |
252 | <term><option>TEST{<replaceable>octal mode mask</replaceable>}</option></term> | |
253 | <listitem> | |
254 | <para>Test the existence of a file. An octal mode mask can be specified | |
255 | if needed.</para> | |
256 | </listitem> | |
257 | </varlistentry> | |
258 | ||
259 | <varlistentry> | |
260 | <term><option>PROGRAM</option></term> | |
261 | <listitem> | |
262 | <para>Execute a program. The key is true, if the program returns | |
263 | successfully. The device properties are made available to the | |
264 | executed program in the environment. The program's output printed to | |
265 | stdout, is available in the RESULT key.</para> | |
266 | </listitem> | |
267 | </varlistentry> | |
268 | ||
269 | <varlistentry> | |
270 | <term><option>RESULT</option></term> | |
271 | <listitem> | |
272 | <para>Match the returned string of the last PROGRAM call. This key can | |
273 | be used in the same or in any later rule after a PROGRAM call.</para> | |
274 | </listitem> | |
275 | </varlistentry> | |
276 | </variablelist> | |
277 | ||
278 | <para>Most of the fields support a shell style pattern matching. The following | |
279 | pattern characters are supported:</para> | |
280 | <variablelist> | |
281 | <varlistentry> | |
282 | <term><option>*</option></term> | |
283 | <listitem> | |
284 | <para>Matches zero, or any number of characters.</para> | |
285 | </listitem> | |
286 | </varlistentry> | |
287 | <varlistentry> | |
288 | <term><option>?</option></term> | |
289 | <listitem> | |
290 | <para>Matches any single character.</para> | |
291 | </listitem> | |
292 | </varlistentry> | |
293 | <varlistentry> | |
294 | <term><option>[]</option></term> | |
295 | <listitem> | |
296 | <para>Matches any single character specified within the brackets. For | |
297 | example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. | |
298 | Ranges are also supported within this match with the '-' character. | |
299 | For example, to match on the range of all digits, the pattern [0-9] would | |
300 | be used. If the first character following the '[' is a '!', any characters | |
301 | not enclosed are matched.</para> | |
302 | </listitem> | |
303 | </varlistentry> | |
304 | </variablelist> | |
305 | ||
306 | <para>The following keys can get values assigned:</para> | |
307 | <variablelist> | |
308 | <varlistentry> | |
309 | <term><option>NAME</option></term> | |
310 | <listitem> | |
311 | <para>The name, a network interface should be renamed to. Or as | |
b8015eea | 312 | a temporary workaround, the name a device node should be named. |
63749b1a KS |
313 | Usually the kernel provides the defined node name, or even creates |
314 | and removes the node before udev even receives any event. Changing | |
315 | the node name from the kernel's default creates inconsistencies | |
316 | and is not supported. If the kernel and NAME specify different names, | |
317 | an error will be logged. Udev is only expected to handle device node | |
318 | permissions and to create additional symlinks, not to change | |
319 | kernel-provided device node names. Instead of renaming a device node, | |
320 | SYMLINK should be used. Symlink names must never conflict with | |
321 | device node names, it will result in unpredictable behavior.</para> | |
322 | </listitem> | |
323 | </varlistentry> | |
324 | ||
325 | <varlistentry> | |
326 | <term><option>SYMLINK</option></term> | |
327 | <listitem> | |
328 | <para>The name of a symlink targeting the node. Every matching rule will add | |
329 | this value to the list of symlinks to be created. Multiple symlinks may be | |
330 | specified by separating the names by the space character. In case multiple | |
331 | devices claim the same name, the link will always point to the device with | |
332 | the highest link_priority. If the current device goes away, the links will | |
333 | be re-evaluated and the device with the next highest link_priority will own | |
334 | the link. If no link_priority is specified, the order of the devices, and | |
335 | which one of them will own the link, is undefined. Claiming the same name for | |
336 | a symlink, which is or might be used for a device node, may result in | |
337 | unexpected behavior and is not supported. | |
338 | </para> | |
339 | </listitem> | |
340 | </varlistentry> | |
341 | ||
342 | <varlistentry> | |
343 | <term><option>OWNER, GROUP, MODE</option></term> | |
344 | <listitem> | |
345 | <para>The permissions for the device node. Every specified value overwrites | |
346 | the compiled-in default value.</para> | |
347 | </listitem> | |
348 | </varlistentry> | |
349 | ||
350 | <varlistentry> | |
351 | <term><option>ATTR{<replaceable>key</replaceable>}</option></term> | |
352 | <listitem> | |
353 | <para>The value that should be written to a sysfs attribute of the | |
354 | event device.</para> | |
355 | </listitem> | |
356 | </varlistentry> | |
357 | ||
358 | <varlistentry> | |
359 | <term><option>ENV{<replaceable>key</replaceable>}</option></term> | |
360 | <listitem> | |
361 | <para>Set a device property value. Property names with a leading '.' | |
362 | are not stored in the database or exported to external tool or events.</para> | |
363 | </listitem> | |
364 | </varlistentry> | |
365 | ||
366 | <varlistentry> | |
367 | <term><option>TAG</option></term> | |
368 | <listitem> | |
369 | <para>Attach a tag to a device. This is used to filter events for users | |
370 | of libudev's monitor functionality, or to enumerate a group of tagged | |
371 | devices. The implementation can only work efficiently if only a few | |
372 | tags are attached to a device. It is only meant to be used in | |
373 | contexts with specific device filter requirements, and not as a | |
374 | general-purpose flag. Excessive use might result in inefficient event | |
375 | handling.</para> | |
376 | </listitem> | |
377 | </varlistentry> | |
378 | ||
379 | <varlistentry> | |
380 | <term><option>RUN</option></term> | |
381 | <listitem> | |
382 | <para>Add a program to the list of programs to be executed for a specific | |
383 | device. This can only be used for very short running tasks. Running an | |
384 | event process for a long period of time may block all further events for | |
385 | this or a dependent device. Long running tasks need to be immediately | |
864fde8a | 386 | detached from the event process itself.</para> |
63749b1a KS |
387 | <para>If no absolute path is given, the program is expected to live in |
388 | <filename>/lib/udev</filename>, otherwise the absolute path must be | |
389 | specified. Program name and arguments are separated by spaces. Single quotes | |
390 | can be used to specify arguments with spaces.</para> | |
391 | </listitem> | |
392 | </varlistentry> | |
393 | ||
394 | <varlistentry> | |
395 | <term><option>LABEL</option></term> | |
396 | <listitem> | |
397 | <para>Named label where a GOTO can jump to.</para> | |
398 | </listitem> | |
399 | </varlistentry> | |
400 | ||
401 | <varlistentry> | |
402 | <term><option>GOTO</option></term> | |
403 | <listitem> | |
404 | <para>Jumps to the next LABEL with a matching name</para> | |
405 | </listitem> | |
406 | </varlistentry> | |
407 | ||
408 | <varlistentry> | |
409 | <term><option>IMPORT{<replaceable>type</replaceable>}</option></term> | |
410 | <listitem> | |
411 | <para>Import a set of variables as device properties, | |
412 | depending on <replaceable>type</replaceable>:</para> | |
413 | <variablelist> | |
414 | <varlistentry> | |
415 | <term><option>program</option></term> | |
416 | <listitem> | |
417 | <para>Execute an external program specified as the assigned value and | |
418 | import its output, which must be in environment key | |
419 | format. Path specification, command/argument separation, | |
420 | and quoting work like in <option>RUN</option>.</para> | |
421 | </listitem> | |
422 | </varlistentry> | |
423 | <varlistentry> | |
424 | <term><option>file</option></term> | |
425 | <listitem> | |
426 | <para>Import a text file specified as the assigned value, which must be in | |
427 | environment key format.</para> | |
428 | </listitem> | |
429 | </varlistentry> | |
430 | <varlistentry> | |
431 | <term><option>db</option></term> | |
432 | <listitem> | |
433 | <para>Import a single property specified as the assigned value from the | |
434 | current device database. This works only if the database is already populated | |
435 | by an earlier event.</para> | |
436 | </listitem> | |
437 | </varlistentry> | |
c4f6dcc4 KS |
438 | <varlistentry> |
439 | <term><option>cmdline</option></term> | |
440 | <listitem> | |
441 | <para>Import a single property from the kernel commandline. For simple flags | |
442 | the value of the property will be set to '1'.</para> | |
443 | </listitem> | |
444 | </varlistentry> | |
63749b1a KS |
445 | <varlistentry> |
446 | <term><option>parent</option></term> | |
447 | <listitem> | |
448 | <para>Import the stored keys from the parent device by reading | |
449 | the database entry of the parent device. The value assigned to | |
450 | <option>IMPORT{parent}</option> is used as a filter of key names | |
451 | to import (with the same shell-style pattern matching used for | |
452 | comparisons).</para> | |
453 | </listitem> | |
454 | </varlistentry> | |
455 | </variablelist> | |
456 | <para>If no option is given, udev will choose between <option>program</option> | |
457 | and <option>file</option> based on the executable bit of the file | |
458 | permissions.</para> | |
459 | </listitem> | |
460 | </varlistentry> | |
461 | ||
462 | <varlistentry> | |
463 | <term><option>WAIT_FOR</option></term> | |
464 | <listitem> | |
465 | <para>Wait for a file to become available or until a 10 | |
10790144 MP |
466 | seconds timeout expires. The path is relative to the sysfs device, |
467 | i. e. if no path is specified this waits for an attribute to appear.</para> | |
63749b1a KS |
468 | </listitem> |
469 | </varlistentry> | |
470 | ||
471 | <varlistentry> | |
472 | <term><option>OPTIONS</option></term> | |
473 | <listitem> | |
474 | <para>Rule and device options:</para> | |
475 | <variablelist> | |
476 | <varlistentry> | |
477 | <term><option>link_priority=<replaceable>value</replaceable></option></term> | |
478 | <listitem> | |
479 | <para>Specify the priority of the created symlinks. Devices with higher | |
480 | priorities overwrite existing symlinks of other devices. The default is 0.</para> | |
481 | </listitem> | |
482 | </varlistentry> | |
483 | <varlistentry> | |
484 | <term><option>event_timeout=</option></term> | |
485 | <listitem> | |
0e846301 | 486 | <para>Number of seconds an event will wait for operations to finish before it |
63749b1a KS |
487 | will terminate itself.</para> |
488 | </listitem> | |
489 | </varlistentry> | |
490 | <varlistentry> | |
491 | <term><option>string_escape=<replaceable>none|replace</replaceable></option></term> | |
492 | <listitem> | |
493 | <para>Usually control and other possibly unsafe characters are replaced | |
494 | in strings used for device naming. The mode of replacement can be specified | |
495 | with this option.</para> | |
496 | </listitem> | |
497 | </varlistentry> | |
9fa68615 KS |
498 | <varlistentry> |
499 | <term><option>static_node=</option></term> | |
500 | <listitem> | |
501 | <para>Apply the permissions specified in this rule to a static device node with | |
0e846301 | 502 | the specified name. Static device nodes might be provided by kernel modules |
9fa68615 | 503 | or copied from <filename>/lib/udev/devices</filename>. These nodes might not have |
0e846301 MW |
504 | a corresponding kernel device at the time udevd is started; they can trigger |
505 | automatic kernel module loading.</para> | |
9fa68615 KS |
506 | </listitem> |
507 | </varlistentry> | |
63749b1a KS |
508 | <varlistentry> |
509 | <term><option>watch</option></term> | |
510 | <listitem> | |
511 | <para>Watch the device node with inotify, when closed after being opened for | |
512 | writing, a change uevent will be synthesised.</para> | |
513 | </listitem> | |
514 | </varlistentry> | |
3b529da4 KS |
515 | <varlistentry> |
516 | <term><option>nowatch</option></term> | |
517 | <listitem> | |
518 | <para>Disable the watching of a device node with inotify.</para> | |
519 | </listitem> | |
520 | </varlistentry> | |
63749b1a KS |
521 | </variablelist> |
522 | </listitem> | |
523 | </varlistentry> | |
524 | </variablelist> | |
525 | ||
526 | <para>The <option>NAME</option>, <option>SYMLINK</option>, <option>PROGRAM</option>, | |
527 | <option>OWNER</option>, <option>GROUP</option>, <option>MODE</option> and <option>RUN</option> | |
528 | fields support simple printf-like string substitutions. The <option>RUN</option> | |
529 | format chars gets applied after all rules have been processed, right before the program | |
530 | is executed. It allows the use of device properties set by earlier matching | |
531 | rules. For all other fields, substitutions are applied while the individual rule is | |
532 | being processed. The available substitutions are:</para> | |
533 | <variablelist> | |
534 | <varlistentry> | |
535 | <term><option>$kernel</option>, <option>%k</option></term> | |
536 | <listitem> | |
537 | <para>The kernel name for this device.</para> | |
538 | </listitem> | |
539 | </varlistentry> | |
540 | ||
541 | <varlistentry> | |
542 | <term><option>$number</option>, <option>%n</option></term> | |
543 | <listitem> | |
544 | <para>The kernel number for this device. For example, 'sda3' has | |
545 | kernel number of '3'</para> | |
546 | </listitem> | |
547 | </varlistentry> | |
548 | ||
549 | <varlistentry> | |
550 | <term><option>$devpath</option>, <option>%p</option></term> | |
551 | <listitem> | |
552 | <para>The devpath of the device.</para> | |
553 | </listitem> | |
554 | </varlistentry> | |
555 | ||
556 | <varlistentry> | |
557 | <term><option>$id</option>, <option>%b</option></term> | |
558 | <listitem> | |
559 | <para>The name of the device matched while searching the devpath upwards for | |
560 | <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>. | |
561 | </para> | |
562 | </listitem> | |
563 | </varlistentry> | |
564 | ||
565 | <varlistentry> | |
566 | <term><option>$driver</option></term> | |
567 | <listitem> | |
568 | <para>The driver name of the device matched while searching the devpath upwards for | |
569 | <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>. | |
570 | </para> | |
571 | </listitem> | |
572 | </varlistentry> | |
573 | ||
574 | <varlistentry> | |
575 | <term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term> | |
576 | <listitem> | |
0e846301 | 577 | <para>The value of a sysfs attribute found at the device where |
63749b1a | 578 | all keys of the rule have matched. If the matching device does not have |
83184d00 MP |
579 | such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or |
580 | ATTRS test selected a parent device, use the attribute from that | |
581 | parent device. | |
63749b1a KS |
582 | If the attribute is a symlink, the last element of the symlink target is |
583 | returned as the value.</para> | |
584 | </listitem> | |
585 | </varlistentry> | |
586 | ||
587 | <varlistentry> | |
588 | <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term> | |
589 | <listitem> | |
590 | <para>A device property value.</para> | |
591 | </listitem> | |
592 | </varlistentry> | |
593 | ||
594 | <varlistentry> | |
595 | <term><option>$major</option>, <option>%M</option></term> | |
596 | <listitem> | |
597 | <para>The kernel major number for the device.</para> | |
598 | </listitem> | |
599 | </varlistentry> | |
600 | ||
601 | <varlistentry> | |
602 | <term><option>$minor</option>, <option>%m</option></term> | |
603 | <listitem> | |
604 | <para>The kernel minor number for the device.</para> | |
605 | </listitem> | |
606 | </varlistentry> | |
607 | ||
608 | <varlistentry> | |
609 | <term><option>$result</option>, <option>%c</option></term> | |
610 | <listitem> | |
611 | <para>The string returned by the external program requested with PROGRAM. | |
612 | A single part of the string, separated by a space character may be selected | |
613 | by specifying the part number as an attribute: <option>%c{N}</option>. | |
614 | If the number is followed by the '+' char this part plus all remaining parts | |
615 | of the result string are substituted: <option>%c{N+}</option></para> | |
616 | </listitem> | |
617 | </varlistentry> | |
618 | ||
619 | <varlistentry> | |
620 | <term><option>$parent</option>, <option>%P</option></term> | |
621 | <listitem> | |
622 | <para>The node name of the parent device.</para> | |
623 | </listitem> | |
624 | </varlistentry> | |
625 | ||
626 | <varlistentry> | |
627 | <term><option>$name</option></term> | |
628 | <listitem> | |
629 | <para>The current name of the device node. If not changed by a rule, it is the | |
630 | name of the kernel device.</para> | |
631 | </listitem> | |
632 | </varlistentry> | |
633 | ||
634 | <varlistentry> | |
635 | <term><option>$links</option></term> | |
636 | <listitem> | |
637 | <para>The current list of symlinks, separated by a space character. The value is | |
638 | only set if an earlier rule assigned a value, or during a remove events.</para> | |
639 | </listitem> | |
640 | </varlistentry> | |
641 | ||
642 | <varlistentry> | |
643 | <term><option>$root</option>, <option>%r</option></term> | |
644 | <listitem> | |
645 | <para>The udev_root value.</para> | |
646 | </listitem> | |
647 | </varlistentry> | |
648 | ||
649 | <varlistentry> | |
650 | <term><option>$sys</option>, <option>%S</option></term> | |
651 | <listitem> | |
652 | <para>The sysfs mount point.</para> | |
653 | </listitem> | |
654 | </varlistentry> | |
655 | ||
656 | <varlistentry> | |
657 | <term><option>$tempnode</option>, <option>%N</option></term> | |
658 | <listitem> | |
659 | <para>The name of a created temporary device node to provide access to | |
660 | the device from a external program before the real node is created.</para> | |
661 | </listitem> | |
662 | </varlistentry> | |
663 | ||
664 | <varlistentry> | |
665 | <term><option>%%</option></term> | |
666 | <listitem> | |
667 | <para>The '%' character itself.</para> | |
668 | </listitem> | |
669 | </varlistentry> | |
670 | ||
671 | <varlistentry> | |
672 | <term><option>$$</option></term> | |
673 | <listitem> | |
674 | <para>The '$' character itself.</para> | |
675 | </listitem> | |
676 | </varlistentry> | |
677 | </variablelist> | |
678 | </refsect2> | |
679 | </refsect1> | |
680 | ||
681 | <refsect1><title>Author</title> | |
682 | <para>Written by Greg Kroah-Hartman <email>greg@kroah.com</email> and | |
683 | Kay Sievers <email>kay.sievers@vrfy.org</email>. With much help from | |
684 | Dan Stekloff and many others.</para> | |
685 | </refsect1> | |
686 | ||
687 | <refsect1> | |
688 | <title>See Also</title> | |
689 | <para><citerefentry> | |
690 | <refentrytitle>udevd</refentrytitle><manvolnum>8</manvolnum> | |
691 | </citerefentry>, | |
692 | <citerefentry> | |
693 | <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum> | |
694 | </citerefentry></para> | |
695 | </refsect1> | |
696 | </refentry> |