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