]> git.proxmox.com Git - systemd.git/blob - man/udev.html
Imported Upstream version 214
[systemd.git] / man / udev.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>udev</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 214</span><hr><div class="refentry"><a name="udev"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>udev — Dynamic device management</p></div><div class="refsect1"><a name="idm214182478784"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p>udev supplies the system software with device events, manages permissions
23 of device nodes and may create additional symlinks in the <code class="filename">/dev</code>
24 directory, or renames network interfaces. The kernel usually just assigns unpredictable
25 device names based on the order of discovery. Meaningful symlinks or network device
26 names provide a way to reliably identify devices based on their properties or
27 current configuration.</p><p>The udev daemon, <a href="systemd-udevd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd-udevd.service</span>(8)</span></a>, receives device uevents directly from
28 the kernel whenever a device is added or removed from the system, or it changes its
29 state. When udev receives a device event, it matches its configured set of rules
30 against various device attributes to identify the device. Rules that match may
31 provide additional device information to be stored in the udev database or
32 to be used to create meaningful symlink names.</p><p>All device information udev processes is stored in the udev database and
33 sent out to possible event subscribers. Access to all stored data and the event
34 sources is provided by the library libudev.</p></div><div class="refsect1"><a name="idm214182474192"></a><h2 id="Rules Files">Rules Files<a class="headerlink" title="Permalink to this headline" href="#Rules%20Files"></a></h2><p>The udev rules are read from the files located in the
35 system rules directory <code class="filename">/usr/lib/udev/rules.d</code>,
36 the volatile runtime directory <code class="filename">/run/udev/rules.d</code>
37 and the local administration directory <code class="filename">/etc/udev/rules.d</code>.
38 All rules files are collectively sorted and processed in lexical order,
39 regardless of the directories in which they live. However, files with
40 identical filenames replace each other. Files in <code class="filename">/etc</code>
41 have the highest priority, files in <code class="filename">/run</code> take precedence
42 over files with the same name in <code class="filename">/usr/lib</code>. This can be
43 used to override a system-supplied rules file with a local file if needed;
44 a symlink in <code class="filename">/etc</code> with the same name as a rules file in
45 <code class="filename">/usr/lib</code>, pointing to <code class="filename">/dev/null</code>,
46 disables the rules file entirely. Rule files must have the extension
47 <code class="filename">.rules</code>; other extensions are ignored.</p><p>Every line in the rules file contains at least one key-value pair.
48 Except for empty lines or lines beginning with "<code class="literal">#</code>", which are ignored.
49 There are two kinds of keys: match and assignment.
50 If all match keys match against their values, the rule gets applied and the
51 assignment keys get the specified values assigned.</p><p>A matching rule may rename a network interface, add symlinks
52 pointing to the device node, or run a specified program as part of
53 the event handling.</p><p>A rule consists of a comma-separated list of one or more key-value pairs.
54 Each key has a distinct operation, depending on the used operator. Valid
55 operators are:</p><div class="variablelist"><dl class="variablelist"><dt id="=="><span class="term">"<code class="literal">==</code>"</span><a class="headerlink" title="Permalink to this term" href="#=="></a></dt><dd><p>Compare for equality.</p></dd><dt id="!="><span class="term">"<code class="literal">!=</code>"</span><a class="headerlink" title="Permalink to this term" href="#!="></a></dt><dd><p>Compare for inequality.</p></dd><dt id="="><span class="term">"<code class="literal">=</code>"</span><a class="headerlink" title="Permalink to this term" href="#="></a></dt><dd><p>Assign a value to a key. Keys that represent a list are reset
56 and only this single value is assigned.</p></dd><dt id="+="><span class="term">"<code class="literal">+=</code>"</span><a class="headerlink" title="Permalink to this term" href="#+="></a></dt><dd><p>Add the value to a key that holds a list of entries.</p></dd><dt id=":="><span class="term">"<code class="literal">:=</code>"</span><a class="headerlink" title="Permalink to this term" href="#:="></a></dt><dd><p>Assign a value to a key finally; disallow any later changes.</p></dd></dl></div><p>The following key names can be used to match against device properties.
57 Some of the keys also match against properties of the parent devices in sysfs,
58 not only the device that has generated the event. If multiple keys that match
59 a parent device are specified in a single rule, all these keys must match at
60 one and the same parent device.</p><div class="variablelist"><dl class="variablelist"><dt id="ACTION"><span class="term"><code class="varname">ACTION</code></span><a class="headerlink" title="Permalink to this term" href="#ACTION"></a></dt><dd><p>Match the name of the event action.</p></dd><dt id="DEVPATH"><span class="term"><code class="varname">DEVPATH</code></span><a class="headerlink" title="Permalink to this term" href="#DEVPATH"></a></dt><dd><p>Match the devpath of the event device.</p></dd><dt id="KERNEL"><span class="term"><code class="varname">KERNEL</code></span><a class="headerlink" title="Permalink to this term" href="#KERNEL"></a></dt><dd><p>Match the name of the event device.</p></dd><dt id="NAME"><span class="term"><code class="varname">NAME</code></span><a class="headerlink" title="Permalink to this term" href="#NAME"></a></dt><dd><p>Match the name of a network interface. It can be used once the
61 NAME key has been set in one of the preceding rules.</p></dd><dt id="SYMLINK"><span class="term"><code class="varname">SYMLINK</code></span><a class="headerlink" title="Permalink to this term" href="#SYMLINK"></a></dt><dd><p>Match the name of a symlink targeting the node. It can
62 be used once a SYMLINK key has been set in one of the preceding
63 rules. There may be multiple symlinks; only one needs to match.
64 </p></dd><dt id="SUBSYSTEM"><span class="term"><code class="varname">SUBSYSTEM</code></span><a class="headerlink" title="Permalink to this term" href="#SUBSYSTEM"></a></dt><dd><p>Match the subsystem of the event device.</p></dd><dt id="DRIVER"><span class="term"><code class="varname">DRIVER</code></span><a class="headerlink" title="Permalink to this term" href="#DRIVER"></a></dt><dd><p>Match the driver name of the event device. Only set this key for devices
65 which are bound to a driver at the time the event is generated.</p></dd><dt id="ATTR{filename}"><span class="term"><code class="varname">ATTR{<em class="replaceable"><code>filename</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#ATTR%7Bfilename%7D"></a></dt><dd><p>Match sysfs attribute values of the event device. Trailing
66 whitespace in the attribute values is ignored unless the specified match
67 value itself contains trailing whitespace.
68 </p></dd><dt id="KERNELS"><span class="term"><code class="varname">KERNELS</code></span><a class="headerlink" title="Permalink to this term" href="#KERNELS"></a></dt><dd><p>Search the devpath upwards for a matching device name.</p></dd><dt id="SUBSYSTEMS"><span class="term"><code class="varname">SUBSYSTEMS</code></span><a class="headerlink" title="Permalink to this term" href="#SUBSYSTEMS"></a></dt><dd><p>Search the devpath upwards for a matching device subsystem name.</p></dd><dt id="DRIVERS"><span class="term"><code class="varname">DRIVERS</code></span><a class="headerlink" title="Permalink to this term" href="#DRIVERS"></a></dt><dd><p>Search the devpath upwards for a matching device driver name.</p></dd><dt id="ATTRS{filename}"><span class="term"><code class="varname">ATTRS{<em class="replaceable"><code>filename</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#ATTRS%7Bfilename%7D"></a></dt><dd><p>Search the devpath upwards for a device with matching sysfs attribute values.
69 If multiple <code class="varname">ATTRS</code> matches are specified, all of them
70 must match on the same device. Trailing whitespace in the attribute values is ignored
71 unless the specified match value itself contains trailing whitespace.</p></dd><dt id="TAGS"><span class="term"><code class="varname">TAGS</code></span><a class="headerlink" title="Permalink to this term" href="#TAGS"></a></dt><dd><p>Search the devpath upwards for a device with matching tag.</p></dd><dt id="ENV{key}"><span class="term"><code class="varname">ENV{<em class="replaceable"><code>key</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#ENV%7Bkey%7D"></a></dt><dd><p>Match against a device property value.</p></dd><dt id="TAG"><span class="term"><code class="varname">TAG</code></span><a class="headerlink" title="Permalink to this term" href="#TAG"></a></dt><dd><p>Match against a device tag.</p></dd><dt id="TEST{octal mode mask}"><span class="term"><code class="varname">TEST{<em class="replaceable"><code>octal mode mask</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#TEST%7Boctal%20mode%20mask%7D"></a></dt><dd><p>Test the existence of a file. An octal mode mask can be specified
72 if needed.</p></dd><dt id="PROGRAM"><span class="term"><code class="varname">PROGRAM</code></span><a class="headerlink" title="Permalink to this term" href="#PROGRAM"></a></dt><dd><p>Execute a program to determine whether there
73 is a match; the key is true if the program returns
74 successfully. The device properties are made available to the
75 executed program in the environment. The program's standard ouput
76 is available in the <code class="varname">RESULT</code> key.</p><p>This can only be used for very short-running foreground tasks. For details,
77 see <code class="varname">RUN</code>.</p></dd><dt id="RESULT"><span class="term"><code class="varname">RESULT</code></span><a class="headerlink" title="Permalink to this term" href="#RESULT"></a></dt><dd><p>Match the returned string of the last <code class="varname">PROGRAM</code> call.
78 This key can be used in the same or in any later rule after a
79 <code class="varname">PROGRAM</code> call.</p></dd></dl></div><p>Most of the fields support shell glob pattern matching. The following
80 pattern characters are supported:</p><div class="variablelist"><dl class="variablelist"><dt id="*"><span class="term">"<code class="literal">*</code>"</span><a class="headerlink" title="Permalink to this term" href="#*"></a></dt><dd><p>Matches zero or more characters.</p></dd><dt id="?"><span class="term">"<code class="literal">?</code>"</span><a class="headerlink" title="Permalink to this term" href="#?"></a></dt><dd><p>Matches any single character.</p></dd><dt id="[]"><span class="term">"<code class="literal">[]</code>"</span><a class="headerlink" title="Permalink to this term" href="#%5B%5D"></a></dt><dd><p>Matches any single character specified within the brackets. For
81 example, the pattern string "<code class="literal">tty[SR]</code>"
82 would match either "<code class="literal">ttyS</code>" or "<code class="literal">ttyR</code>".
83 Ranges are also supported via the "<code class="literal">-</code>" character.
84 For example, to match on the range of all digits, the pattern
85 "<code class="literal">[0-9]</code>" could be used. If the first character
86 following the "<code class="literal">[</code>" is a "<code class="literal">!</code>",
87 any characters not enclosed are matched.</p></dd></dl></div><p>The following keys can get values assigned:</p><div class="variablelist"><dl class="variablelist"><dt id="NAME"><span class="term"><code class="varname">NAME</code></span><a class="headerlink" title="Permalink to this term" href="#NAME"></a></dt><dd><p>The name to use for a network interface. See
88 <a href="systemd.link.html"><span class="citerefentry"><span class="refentrytitle">systemd.link</span>(5)</span></a>
89 for a higher-level mechanism for setting the interface name.
90 The name of a device node cannot be changed by udev, only additional
91 symlinks can be created.</p></dd><dt id="SYMLINK"><span class="term"><code class="varname">SYMLINK</code></span><a class="headerlink" title="Permalink to this term" href="#SYMLINK"></a></dt><dd><p>The name of a symlink targeting the node. Every matching rule adds
92 this value to the list of symlinks to be created.</p><p>The set of characters to name a symlink is limited. Allowed
93 characters are "<code class="literal">0-9A-Za-z#+-.:=@_/</code>", valid UTF-8 character
94 sequences, and "<code class="literal">\x00</code>" hex encoding. All other
95 characters are replaced by a "<code class="literal">_</code>" character.</p><p>Multiple symlinks may be specified by separating the names by the
96 space character. In case multiple devices claim the same name, the link
97 always points to the device with the highest link_priority. If the current
98 device goes away, the links are re-evaluated and the device with the
99 next highest link_priority becomes the owner of the link. If no
100 link_priority is specified, the order of the devices (and which one of
101 them owns the link) is undefined.</p><p>Symlink names must never conflict with the kernel's default device
102 node names, as that would result in unpredictable behavior.
103 </p></dd><dt id="OWNER, GROUP, MODE"><span class="term"><code class="varname">OWNER</code>, <code class="varname">GROUP</code>, <code class="varname">MODE</code></span><a class="headerlink" title="Permalink to this term" href="#OWNER,%20GROUP,%20MODE"></a></dt><dd><p>The permissions for the device node. Every specified value overrides
104 the compiled-in default value.</p></dd><dt id="SECLABEL{module}"><span class="term"><code class="varname">SECLABEL{<em class="replaceable"><code>module</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#SECLABEL%7Bmodule%7D"></a></dt><dd><p>Applies the specified Linux Security Module label to the device node.</p></dd><dt id="ATTR{key}"><span class="term"><code class="varname">ATTR{<em class="replaceable"><code>key</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#ATTR%7Bkey%7D"></a></dt><dd><p>The value that should be written to a sysfs attribute of the
105 event device.</p></dd><dt id="ENV{key}"><span class="term"><code class="varname">ENV{<em class="replaceable"><code>key</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#ENV%7Bkey%7D"></a></dt><dd><p>Set a device property value. Property names with a leading "<code class="literal">.</code>"
106 are neither stored in the database nor exported to events or
107 external tools (run by, for example, the <code class="varname">PROGRAM</code>
108 match key).</p></dd><dt id="TAG"><span class="term"><code class="varname">TAG</code></span><a class="headerlink" title="Permalink to this term" href="#TAG"></a></dt><dd><p>Attach a tag to a device. This is used to filter events for users
109 of libudev's monitor functionality, or to enumerate a group of tagged
110 devices. The implementation can only work efficiently if only a few
111 tags are attached to a device. It is only meant to be used in
112 contexts with specific device filter requirements, and not as a
113 general-purpose flag. Excessive use might result in inefficient event
114 handling.</p></dd><dt id="RUN{type}"><span class="term"><code class="varname">RUN{<em class="replaceable"><code>type</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#RUN%7Btype%7D"></a></dt><dd><p>Add a program to the list of programs to be executed after
115 processing all the rules for a specific event, depending on
116 "<code class="literal">type</code>":</p><div class="variablelist"><dl class="variablelist"><dt id="program"><span class="term">"<code class="literal">program</code>"</span><a class="headerlink" title="Permalink to this term" href="#program"></a></dt><dd><p>Execute an external program specified as the assigned
117 value. If no absolute path is given, the program is expected
118 to live in <code class="filename">/usr/lib/udev</code>; otherwise, the
119 absolute path must be specified.</p><p>This is the default if no <em class="replaceable"><code>type</code></em>
120 is specified.</p></dd><dt id="builtin"><span class="term">"<code class="literal">builtin</code>"</span><a class="headerlink" title="Permalink to this term" href="#builtin"></a></dt><dd><p>As <code class="varname">program</code>, but use one of the
121 built-in programs rather than an external one.</p></dd></dl></div><p>The program name and following arguments are separated by spaces.
122 Single quotes can be used to specify arguments with spaces.</p><p>This can only be used for very short-running foreground tasks. Running an
123 event process for a long period of time may block all further events for
124 this or a dependent device.</p><p>Starting daemons or other long-running processes is not appropriate
125 for udev; the forked processes, detached or not, will be unconditionally
126 killed after the event handling has finished.</p></dd><dt id="LABEL"><span class="term"><code class="varname">LABEL</code></span><a class="headerlink" title="Permalink to this term" href="#LABEL"></a></dt><dd><p>A named label to which a <code class="varname">GOTO</code> may jump.</p></dd><dt id="GOTO"><span class="term"><code class="varname">GOTO</code></span><a class="headerlink" title="Permalink to this term" href="#GOTO"></a></dt><dd><p>Jumps to the next <code class="varname">LABEL</code> with a matching name.</p></dd><dt id="IMPORT{type}"><span class="term"><code class="varname">IMPORT{<em class="replaceable"><code>type</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#IMPORT%7Btype%7D"></a></dt><dd><p>Import a set of variables as device properties,
127 depending on "<code class="literal">type</code>":</p><div class="variablelist"><dl class="variablelist"><dt id="program"><span class="term">"<code class="literal">program</code>"</span><a class="headerlink" title="Permalink to this term" href="#program"></a></dt><dd><p>Execute an external program specified as the assigned value and
128 import its output, which must be in environment key
129 format. Path specification, command/argument separation,
130 and quoting work like in <code class="varname">RUN</code>.</p></dd><dt id="builtin"><span class="term">"<code class="literal">builtin</code>"</span><a class="headerlink" title="Permalink to this term" href="#builtin"></a></dt><dd><p>Similar to "<code class="literal">program</code>", but use one of the
131 built-in programs rather than an external one.</p></dd><dt id="file"><span class="term">"<code class="literal">file</code>"</span><a class="headerlink" title="Permalink to this term" href="#file"></a></dt><dd><p>Import a text file specified as the assigned value, the content
132 of which must be in environment key format.</p></dd><dt id="db"><span class="term">"<code class="literal">db</code>"</span><a class="headerlink" title="Permalink to this term" href="#db"></a></dt><dd><p>Import a single property specified as the assigned value from the
133 current device database. This works only if the database is already populated
134 by an earlier event.</p></dd><dt id="cmdline"><span class="term">"<code class="literal">cmdline</code>"</span><a class="headerlink" title="Permalink to this term" href="#cmdline"></a></dt><dd><p>Import a single property from the kernel command line. For simple flags
135 the value of the property is set to "<code class="literal">1</code>".</p></dd><dt id="parent"><span class="term">"<code class="literal">parent</code>"</span><a class="headerlink" title="Permalink to this term" href="#parent"></a></dt><dd><p>Import the stored keys from the parent device by reading
136 the database entry of the parent device. The value assigned to
137 <code class="option">IMPORT{parent}</code> is used as a filter of key names
138 to import (with the same shell glob pattern matching used for
139 comparisons).</p></dd></dl></div><p>This can only be used for very short-running foreground tasks. For details
140 see <code class="option">RUN</code>.</p></dd><dt id="WAIT_FOR"><span class="term"><code class="varname">WAIT_FOR</code></span><a class="headerlink" title="Permalink to this term" href="#WAIT_FOR"></a></dt><dd><p>Wait for a file to become available or until a timeout of
141 10 seconds expires. The path is relative to the sysfs device;
142 if no path is specified, this waits for an attribute to appear.</p></dd><dt id="OPTIONS"><span class="term"><code class="varname">OPTIONS</code></span><a class="headerlink" title="Permalink to this term" href="#OPTIONS"></a></dt><dd><p>Rule and device options:</p><div class="variablelist"><dl class="variablelist"><dt id="link_priority=value"><span class="term"><code class="option">link_priority=<em class="replaceable"><code>value</code></em></code></span><a class="headerlink" title="Permalink to this term" href="#link_priority=value"></a></dt><dd><p>Specify the priority of the created symlinks. Devices with higher
143 priorities overwrite existing symlinks of other devices. The default is 0.</p></dd><dt id="event_timeout="><span class="term"><code class="option">event_timeout=</code></span><a class="headerlink" title="Permalink to this term" href="#event_timeout="></a></dt><dd><p>Number of seconds an event waits for operations to finish before
144 giving up and terminating itself.</p></dd><dt id="string_escape=none|replace"><span class="term"><code class="option">string_escape=<em class="replaceable"><code>none|replace</code></em></code></span><a class="headerlink" title="Permalink to this term" href="#string_escape=none%7Creplace"></a></dt><dd><p>Usually control and other possibly unsafe characters are replaced
145 in strings used for device naming. The mode of replacement can be specified
146 with this option.</p></dd><dt id="static_node="><span class="term"><code class="option">static_node=</code></span><a class="headerlink" title="Permalink to this term" href="#static_node="></a></dt><dd><p>Apply the permissions specified in this rule to the
147 static device node with the specified name. Also, for every
148 tag specified in this rule, create a symlink
149 in the directory
150 <code class="filename">/run/udev/static_node-tags/<em class="replaceable"><code>tag</code></em></code>
151 pointing at the static device node with the specified name.
152 Static device node creation is performed by systemd-tmpfiles
153 before systemd-udevd is started. The static nodes might not
154 have a corresponding kernel device; they are used to trigger
155 automatic kernel module loading when they are accessed.</p></dd><dt id="watch"><span class="term"><code class="option">watch</code></span><a class="headerlink" title="Permalink to this term" href="#watch"></a></dt><dd><p>Watch the device node with inotify; when the node is
156 closed after being opened for writing, a change uevent is
157 synthesized.</p></dd><dt id="nowatch"><span class="term"><code class="option">nowatch</code></span><a class="headerlink" title="Permalink to this term" href="#nowatch"></a></dt><dd><p>Disable the watching of a device node with inotify.</p></dd></dl></div></dd></dl></div><p>The <code class="varname">NAME</code>, <code class="varname">SYMLINK</code>,
158 <code class="varname">PROGRAM</code>, <code class="varname">OWNER</code>,
159 <code class="varname">GROUP</code>, <code class="varname">MODE</code>, and
160 <code class="varname">RUN</code> fields support simple string substitutions.
161 The <code class="varname">RUN</code> substitutions are performed after all rules
162 have been processed, right before the program is executed, allowing for
163 the use of device properties set by earlier matching rules. For all other
164 fields, substitutions are performed while the individual rule is being
165 processed. The available substitutions are:</p><div class="variablelist"><dl class="variablelist"><dt id="$kernel, %k"><span class="term"><code class="option">$kernel</code>, <code class="option">%k</code></span><a class="headerlink" title="Permalink to this term" href="#%24kernel,%20%k"></a></dt><dd><p>The kernel name for this device.</p></dd><dt id="$number, %n"><span class="term"><code class="option">$number</code>, <code class="option">%n</code></span><a class="headerlink" title="Permalink to this term" href="#%24number,%20%n"></a></dt><dd><p>The kernel number for this device. For example,
166 "<code class="literal">sda3</code>" has kernel number "<code class="literal">3</code>".
167 </p></dd><dt id="$devpath, %p"><span class="term"><code class="option">$devpath</code>, <code class="option">%p</code></span><a class="headerlink" title="Permalink to this term" href="#%24devpath,%20%p"></a></dt><dd><p>The devpath of the device.</p></dd><dt id="$id, %b"><span class="term"><code class="option">$id</code>, <code class="option">%b</code></span><a class="headerlink" title="Permalink to this term" href="#%24id,%20%b"></a></dt><dd><p>The name of the device matched while searching the devpath
168 upwards for <code class="option">SUBSYSTEMS</code>, <code class="option">KERNELS</code>,
169 <code class="option">DRIVERS</code>, and <code class="option">ATTRS</code>.
170 </p></dd><dt id="$driver"><span class="term"><code class="option">$driver</code></span><a class="headerlink" title="Permalink to this term" href="#%24driver"></a></dt><dd><p>The driver name of the device matched while searching the
171 devpath upwards for <code class="option">SUBSYSTEMS</code>,
172 <code class="option">KERNELS</code>, <code class="option">DRIVERS</code>, and
173 <code class="option">ATTRS</code>.
174 </p></dd><dt id="$attr{file}, %s{file}"><span class="term"><code class="option">$attr{<em class="replaceable"><code>file</code></em>}</code>, <code class="option">%s{<em class="replaceable"><code>file</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#%24attr%7Bfile%7D,%20%s%7Bfile%7D"></a></dt><dd><p>The value of a sysfs attribute found at the device where
175 all keys of the rule have matched. If the matching device does not
176 have such an attribute, and a previous <code class="option">KERNELS</code>,
177 <code class="option">SUBSYSTEMS</code>, <code class="option">DRIVERS</code>, or
178 <code class="option">ATTRS</code> test selected a parent device, then the
179 attribute from that parent device is used.
180 </p><p>If the attribute is a symlink, the last element of the
181 symlink target is returned as the value.
182 </p></dd><dt id="$env{key}, %E{key}"><span class="term"><code class="option">$env{<em class="replaceable"><code>key</code></em>}</code>, <code class="option">%E{<em class="replaceable"><code>key</code></em>}</code></span><a class="headerlink" title="Permalink to this term" href="#%24env%7Bkey%7D,%20%E%7Bkey%7D"></a></dt><dd><p>A device property value.</p></dd><dt id="$major, %M"><span class="term"><code class="option">$major</code>, <code class="option">%M</code></span><a class="headerlink" title="Permalink to this term" href="#%24major,%20%M"></a></dt><dd><p>The kernel major number for the device.</p></dd><dt id="$minor, %m"><span class="term"><code class="option">$minor</code>, <code class="option">%m</code></span><a class="headerlink" title="Permalink to this term" href="#%24minor,%20%m"></a></dt><dd><p>The kernel minor number for the device.</p></dd><dt id="$result, %c"><span class="term"><code class="option">$result</code>, <code class="option">%c</code></span><a class="headerlink" title="Permalink to this term" href="#%24result,%20%c"></a></dt><dd><p>The string returned by the external program requested with
183 <code class="varname">PROGRAM</code>.
184 A single part of the string, separated by a space character, may be selected
185 by specifying the part number as an attribute: "<code class="literal">%c{N}</code>".
186 If the number is followed by the "<code class="literal">+</code>" character, this part plus all remaining parts
187 of the result string are substituted: "<code class="literal">%c{N+}</code>".</p></dd><dt id="$parent, %P"><span class="term"><code class="option">$parent</code>, <code class="option">%P</code></span><a class="headerlink" title="Permalink to this term" href="#%24parent,%20%P"></a></dt><dd><p>The node name of the parent device.</p></dd><dt id="$name"><span class="term"><code class="option">$name</code></span><a class="headerlink" title="Permalink to this term" href="#%24name"></a></dt><dd><p>The current name of the device. If not changed by a rule, it is the
188 name of the kernel device.</p></dd><dt id="$links"><span class="term"><code class="option">$links</code></span><a class="headerlink" title="Permalink to this term" href="#%24links"></a></dt><dd><p>A space-separated list of the current symlinks. The value is
189 only set during a remove event or if an earlier rule assigned a value.</p></dd><dt id="$root, %r"><span class="term"><code class="option">$root</code>, <code class="option">%r</code></span><a class="headerlink" title="Permalink to this term" href="#%24root,%20%r"></a></dt><dd><p>The udev_root value.</p></dd><dt id="$sys, %S"><span class="term"><code class="option">$sys</code>, <code class="option">%S</code></span><a class="headerlink" title="Permalink to this term" href="#%24sys,%20%S"></a></dt><dd><p>The sysfs mount point.</p></dd><dt id="$devnode, %N"><span class="term"><code class="option">$devnode</code>, <code class="option">%N</code></span><a class="headerlink" title="Permalink to this term" href="#%24devnode,%20%N"></a></dt><dd><p>The name of the device node.</p></dd><dt id="%%"><span class="term"><code class="option">%%</code></span><a class="headerlink" title="Permalink to this term" href="#%%"></a></dt><dd><p>The "<code class="literal">%</code>" character itself.</p></dd><dt id="$$"><span class="term"><code class="option">$$</code></span><a class="headerlink" title="Permalink to this term" href="#%24%24"></a></dt><dd><p>The "<code class="literal">$</code>" character itself.</p></dd></dl></div></div><div class="refsect1"><a name="idm214181258176"></a><h2 id="Hardware Database Files">Hardware Database Files<a class="headerlink" title="Permalink to this headline" href="#Hardware%20Database%20Files"></a></h2><p>The hwdb files are read from the files located in the
190 system hwdb directory <code class="filename">/usr/lib/udev/hwdb.d</code>,
191 the volatile runtime directory <code class="filename">/run/udev/hwdb.d</code>
192 and the local administration directory <code class="filename">/etc/udev/hwdb.d</code>.
193 All hwdb files are collectively sorted and processed in lexical order,
194 regardless of the directories in which they live. However, files with
195 identical filenames replace each other. Files in <code class="filename">/etc</code>
196 have the highest priority, files in <code class="filename">/run</code> take precedence
197 over files with the same name in <code class="filename">/usr/lib</code>. This can be
198 used to override a system-supplied hwdb file with a local file if needed;
199 a symlink in <code class="filename">/etc</code> with the same name as a hwdb file in
200 <code class="filename">/usr/lib</code>, pointing to <code class="filename">/dev/null</code>,
201 disables the hwdb file entirely. hwdb files must have the extension
202 <code class="filename">.hwdb</code>; other extensions are ignored.</p><p>The hwdb file contains data records consisting of matches and
203 associated key-value pairs. Every record in the hwdb starts with one or
204 more match string, specifying a shell glob to compare the database
205 lookup string against. Multiple match lines are specified in additional
206 consecutive lines. Every match line is compared indivdually, they are
207 combined by OR. Every match line must start at the first character of
208 the line.</p><p>The match lines are followed by one or more key-value pair lines, which
209 are recognized by a leading space character. The key name and value are separated
210 by "<code class="literal">=</code>". An empty line signifies the end
211 of a record. Lines beginning with "<code class="literal">#</code>" are ignored.</p><p>The content of all hwdb files is read by
212 <a href="udevadm.html"><span class="citerefentry"><span class="refentrytitle">udevadm</span>(8)</span></a>
213 and compiled to a binary database located at <code class="filename">/etc/udev/hwdb.bin</code>.
214 During runtime only the binary database is used.</p></div><div class="refsect1"><a name="idm214181245744"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
215 <a href="systemd-udevd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd-udevd.service</span>(8)</span></a>,
216 <a href="udevadm.html"><span class="citerefentry"><span class="refentrytitle">udevadm</span>(8)</span></a>
217 <a href="systemd.link.html"><span class="citerefentry"><span class="refentrytitle">systemd.link</span>(5)</span></a>
218 </p></div></div></body></html>