udev.xml revision b45f770f0049fbdf3f6c9db0ab11deeff4ccd86d
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<?xml version='1.0'?>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<refentry id="udev">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <refentryinfo>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <title>udev</title>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <productname>systemd</productname>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <authorgroup>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <author>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <contrib>Developer</contrib>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <firstname>Greg</firstname>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <surname>Kroah-Hartmann</surname>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <email>greg@kroah.com</email>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd </author>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <author>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <contrib>Developer</contrib>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <firstname>Kay</firstname>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd <surname>Sievers</surname>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <email>kay@vrfy.org</email>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </author>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd </authorgroup>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd </refentryinfo>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi
c04f76acce77126cf88b09350e56ea8c6b4a064enilgun <refmeta>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd <refentrytitle>udev</refentrytitle>
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end <manvolnum>7</manvolnum>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen </refmeta>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <refnamediv>
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem <refname>udev</refname>
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem <refpurpose>Linux dynamic device management</refpurpose>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </refnamediv>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
3f08db06526d6901aa08c110b5bc7dde6bc39905nd <refsect1><title>Description</title>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>udev supplies the system software with device events, manages permissions
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd of device nodes and may create additional symlinks in the <filename>/dev</filename>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd directory, or renames network interfaces. The kernel usually just assigns unpredictable
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd device names based on the order of discovery. Meaningful symlinks or network device
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd names provide a way to reliably identify devices based on their properties or
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd current configuration.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>The udev daemon, <citerefentry><refentrytitle>udevd</refentrytitle>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <manvolnum>8</manvolnum></citerefentry>, receives device uevents directly from
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd the kernel whenever a device is added or removed from the system, or it changes its
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd state. When udev receives a device event, it matches its configured set of rules
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd against various device attributes to identify the device. Rules that match may
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd provide additional device information to be stored in the udev database or
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd to be used to create meaningful symlink names.</para>
71fccc298df6a1540d408151a26aa22beed55d0bnd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>All device information udev processes is stored in the udev database and
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd sent out to possible event subscribers. Access to all stored data and the event
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd sources is provided by the library libudev.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </refsect1>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <refsect1><title>Configuration</title>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>udev configuration files are placed in <filename>/etc/udev</filename>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd and <filename>/usr/lib/udev</filename>. All empty lines or lines beginning with
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd '#' are ignored.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <refsect2><title>Configuration file</title>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>udev expects its main configuration file at <filename>/etc/udev/udev.conf</filename>.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd It consists of a set of variables allowing the user to override default udev values.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd The following variables can be set:</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <variablelist>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>udev_root</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Specifies where to place the device nodes in the filesystem.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd The default value is <filename>/dev</filename>.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>udev_log</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>The logging priority. Valid values are the numerical syslog priorities
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd or their textual representations: <option>err</option>, <option>info</option>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd and <option>debug</option>.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </variablelist>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </refsect2>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <refsect2><title>Rules files</title>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>The udev rules are read from the files located in the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd system rules directory <filename>/usr/lib/udev/rules.d</filename>,
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd the volatile runtime directory <filename>/run/udev/rules.d</filename>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd and the local administration directory <filename>/etc/udev/rules.d</filename>.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd All rules files are collectively sorted and processed in lexical order,
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd regardless of the directories in which they live. However, files with
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd identical file names replace each other. Files in <filename>/etc</filename>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd have the highest priority, files in <filename>/run</filename> take precedence
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd over files with the same name in <filename>/lib</filename>. This can be
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd used to override a system-supplied rules file with a local file if needed;
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd a symlink in <filename>/etc</filename> with the same name as a rules file in
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <filename>/lib</filename>, pointing to <filename>/dev/null</filename>,
71fccc298df6a1540d408151a26aa22beed55d0bnd disables the rules file entirely.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Rule files must have the extension <filename>.rules</filename>; other
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd extensions are ignored.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Every line in the rules file contains at least one key-value pair.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd There are two kind of keys: match and assignment.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd If all match keys are matching against its value, the rule gets applied and the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd assignment keys get the specified value assigned.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>A matching rule may rename a network interface, add symlinks
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd pointing to the device node, or run a specified program as part of
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd the event handling.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak <para>A rule consists of a comma-separated list of one or more key-value pairs.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Each key has a distinct operation, depending on the used operator. Valid
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd operators are:</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <variablelist>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>==</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Compare for equality.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>!=</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Compare for inequality.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>=</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Assign a value to a key. Keys that represent a list are reset
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd and only this single value is assigned.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
71fccc298df6a1540d408151a26aa22beed55d0bnd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
a8703cfb67133446eef7af1043640e71486e9ecand <term><option>+=</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Add the value to a key that holds a list of entries.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>:=</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Assign a value to a key finally; disallow any later changes.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
71fccc298df6a1540d408151a26aa22beed55d0bnd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </variablelist>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>The following key names can be used to match against device properties.
71fccc298df6a1540d408151a26aa22beed55d0bnd Some of the keys also match against properties of the parent devices in sysfs,
71fccc298df6a1540d408151a26aa22beed55d0bnd not only the device that has generated the event. If multiple keys that match
71fccc298df6a1540d408151a26aa22beed55d0bnd a parent device are specified in a single rule, all these keys must match at
71fccc298df6a1540d408151a26aa22beed55d0bnd one and the same parent device.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <variablelist>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
b3c7a2279fa7a45f5807d9a404760b9b3760df50nd <term><option>ACTION</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
316f02e3836836c82e19019ff23f90a7ebc65289nilgun <para>Match the name of the event action.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
22d5d84393d960a2027f472036f3fee15d7dbce9nd <varlistentry>
22d5d84393d960a2027f472036f3fee15d7dbce9nd <term><option>DEVPATH</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <para>Match the devpath of the event device.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
623eebe956d9c2d6d073ed3eae855b56030b40e9noodl <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>KERNEL</option></term>
ffb88a4885747797937e30a5ac8b1606da3cb4adnd <listitem>
909ce17e2bd0faef7b1c294f2307f009793fd493nd <para>Match the name of the event device.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe
42af92a661a06b3cebc88d585aad75064a309d51nd <varlistentry>
ffb88a4885747797937e30a5ac8b1606da3cb4adnd <term><option>NAME</option></term>
6fe26506780e73be2a412d758af77fafdf03291and <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Match the name of a network interface. It can be used once the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd NAME key has been set in one of the preceding rules.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
08cf4a15275e4cb65a424b3a1db5410bfb51085cjim <term><option>SYMLINK</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <para>Match the name of a symlink targeting the node. It can
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd be used once a SYMLINK key has been set in one of the preceding
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd rules. There may be multiple symlinks; only one needs to match.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
05ede5110427cb9dc071cc671d5aaba5d3b88c79nd <term><option>SUBSYSTEM</option></term>
e8b603fa9ccf7b17b11b42df6d8916fd97c2331dnd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Match the subsystem of the event device.</para>
4ed26c413f67a5aae20b95909828f30bb5dc2286poirier </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
611049e38bfbaeb173d2d7fab2e44a48753436a1nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>DRIVER</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Match the driver name of the event device. Only set this key for devices
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd which are bound to a driver at the time the event is generated.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
03a4ff9ac4c9b8009249010e7c53bb86ff05915and <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>ATTR{<replaceable>filename</replaceable>}</option></term>
d0828c8a321dc5e9ea60550f052294669c08cf93jim <listitem>
d0828c8a321dc5e9ea60550f052294669c08cf93jim <para>Match sysfs attribute values of the event device. Trailing
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd whitespace in the attribute values is ignored unless the specified match
4b5981e276e93df97c34e4da05ca5cf8bbd937dand value itself contains trailing whitespace.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
2704de98885368683621b01c8f8f4e4b01557611takashi
2704de98885368683621b01c8f8f4e4b01557611takashi <varlistentry>
2704de98885368683621b01c8f8f4e4b01557611takashi <term><option>KERNELS</option></term>
d0828c8a321dc5e9ea60550f052294669c08cf93jim <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Search the devpath upwards for a matching device name.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
c819c19c2f1ffbf3a3f12a4070cc6c3f4ea2a6f2sf </varlistentry>
d2b809e5d72658bff23819d8b77f20e4939af541nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
a4687128d43515b5791a6efc6ba55314478f9552jim <term><option>SUBSYSTEMS</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Search the devpath upwards for a matching device subsystem name.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd <term><option>DRIVERS</option></term>
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Search the devpath upwards for a matching device driver name.</para>
438b4817913a5ff55d9cad4c7ddf133330b4466ejim </listitem>
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi </varlistentry>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
4126704c4950bfd46d32ad54e3b106ac6d868a73sf <term><option>ATTRS{<replaceable>filename</replaceable>}</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd <para>Search the devpath upwards for a device with matching sysfs attribute values.
4ed26c413f67a5aae20b95909828f30bb5dc2286poirier If multiple <option>ATTRS</option> matches are specified, all of them
6d20aeba2c4aa0938bc6e0659d13adc7670ff421poirier must match on the same device. Trailing whitespace in the attribute values is ignored
5f4e50966b2b9b58436a1651cbe588d1b595657ewrowe unless the specified match value itself contains trailing whitespace.</para>
11495c9f0bd33e51a25b4d532beadfbcf9b944a3nilgun </listitem>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
79b024b81f6bb3c44dce77a7552191daf8b522d2jim <varlistentry>
f772e8f448c223e5ea306f1bf92d97d968f972d5jim <term><option>TAGS</option></term>
f772e8f448c223e5ea306f1bf92d97d968f972d5jim <listitem>
f772e8f448c223e5ea306f1bf92d97d968f972d5jim <para>Search the devpath upwards for a device with matching tag.</para>
fac8c35bfb158112226ab43ddf84d59daca5dc30nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
1de1266f0ea387d6373be8415745dfd2ab876341jim
1de1266f0ea387d6373be8415745dfd2ab876341jim <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>ENV{<replaceable>key</replaceable>}</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Match against a device property value.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
898711b68797304101de0882fa576c8908acfae6nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <term><option>TAG</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Match against a device tag.</para>
03c25fb6f628ac81f2ecb637d1e7502dcee783f3nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
4126704c4950bfd46d32ad54e3b106ac6d868a73sf
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>TEST{<replaceable>octal mode mask</replaceable>}</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Test the existence of a file. An octal mode mask can be specified
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd if needed.</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <term><option>PROGRAM</option></term>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Execute a program to determine whether there
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd is a match; the key is true if the program returns
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd successfully. The device properties are made available to the
71fccc298df6a1540d408151a26aa22beed55d0bnd executed program in the environment. The program's stdout
71fccc298df6a1540d408151a26aa22beed55d0bnd is available in the RESULT key.</para>
71fccc298df6a1540d408151a26aa22beed55d0bnd <para>This can only be used for very short-running foreground tasks. For details
71fccc298df6a1540d408151a26aa22beed55d0bnd see <option>RUN</option>.</para>
71fccc298df6a1540d408151a26aa22beed55d0bnd </listitem>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </varlistentry>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd <term><option>RESULT</option></term>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd <listitem>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi <para>Match the returned string of the last PROGRAM call. This key can
c04f76acce77126cf88b09350e56ea8c6b4a064enilgun be used in the same or in any later rule after a PROGRAM call.</para>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd </listitem>
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end </varlistentry>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen </variablelist>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <para>Most of the fields support shell-style pattern matching. The following
9c1260efa52c82c2a58e5b5f20cd6902563d95f5rbowen pattern characters are supported:</para>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <variablelist>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <varlistentry>
<term><option>*</option></term>
<listitem>
<para>Matches zero or more characters.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>?</option></term>
<listitem>
<para>Matches any single character.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>[]</option></term>
<listitem>
<para>Matches any single character specified within the brackets. For
example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'.
Ranges are also supported via the '-' character.
For example, to match on the range of all digits, the pattern [0-9] could
be used. If the first character following the '[' is a '!', any characters
not enclosed are matched.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The following keys can get values assigned:</para>
<variablelist>
<varlistentry>
<term><option>NAME</option></term>
<listitem>
<para>The name to use for a network interface. The name of a device node
can not be changed by udev, only additional symlinks can be created.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>SYMLINK</option></term>
<listitem>
<para>The name of a symlink targeting the node. Every matching rule adds
this value to the list of symlinks to be created. Multiple symlinks may be
specified by separating the names by the space character. In case multiple
devices claim the same name, the link always points to the device with
the highest link_priority. If the current device goes away, the links are
re-evaluated and the device with the next highest link_priority becomes the owner of
the link. If no link_priority is specified, the order of the devices (and
which one of them owns the link) is undefined. Also, symlink names must
never conflict with the kernel's default device node names, as that would
result in unpredictable behavior.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>OWNER, GROUP, MODE</option></term>
<listitem>
<para>The permissions for the device node. Every specified value overrides
the compiled-in default value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>ATTR{<replaceable>key</replaceable>}</option></term>
<listitem>
<para>The value that should be written to a sysfs attribute of the
event device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>ENV{<replaceable>key</replaceable>}</option></term>
<listitem>
<para>Set a device property value. Property names with a leading '.'
are neither stored in the database nor exported to events or
external tools (run by, say, the PROGRAM match key).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>TAG</option></term>
<listitem>
<para>Attach a tag to a device. This is used to filter events for users
of libudev's monitor functionality, or to enumerate a group of tagged
devices. The implementation can only work efficiently if only a few
tags are attached to a device. It is only meant to be used in
contexts with specific device filter requirements, and not as a
general-purpose flag. Excessive use might result in inefficient event
handling.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>RUN</option></term>
<listitem>
<para>Add a program to the list of programs to be executed for a specific
device.</para>
<para>If no absolute path is given, the program is expected to live in
/usr/lib/udev, otherwise the absolute path must be specified. The program
name and following arguments are separated by spaces. Single quotes can
be used to specify arguments with spaces.</para>
<para>This can only be used for very short-running foreground tasks. Running an
event process for a long period of time may block all further events for
this or a dependent device.</para>
<para>Starting daemons or other long running processes is not appropriate
for udev; the forked processes, detached or not, will be unconditionally
killed after the event handling has finished.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>LABEL</option></term>
<listitem>
<para>A named label to which a GOTO may jump.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>GOTO</option></term>
<listitem>
<para>Jumps to the next LABEL with a matching name.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>IMPORT{<replaceable>type</replaceable>}</option></term>
<listitem>
<para>Import a set of variables as device properties,
depending on <replaceable>type</replaceable>:</para>
<variablelist>
<varlistentry>
<term><option>program</option></term>
<listitem>
<para>Execute an external program specified as the assigned value and
import its output, which must be in environment key
format. Path specification, command/argument separation,
and quoting work like in <option>RUN</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>file</option></term>
<listitem>
<para>Import a text file specified as the assigned value, the content
of which must be in environment key format.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>db</option></term>
<listitem>
<para>Import a single property specified as the assigned value from the
current device database. This works only if the database is already populated
by an earlier event.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>cmdline</option></term>
<listitem>
<para>Import a single property from the kernel command line. For simple flags
the value of the property is set to '1'.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>parent</option></term>
<listitem>
<para>Import the stored keys from the parent device by reading
the database entry of the parent device. The value assigned to
<option>IMPORT{parent}</option> is used as a filter of key names
to import (with the same shell-style pattern matching used for
comparisons).</para>
</listitem>
</varlistentry>
</variablelist>
<para>This can only be used for very short-running foreground tasks. For details
see <option>RUN</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>WAIT_FOR</option></term>
<listitem>
<para>Wait for a file to become available or until a timeout of
10 seconds expires. The path is relative to the sysfs device;
if no path is specified, this waits for an attribute to appear.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>OPTIONS</option></term>
<listitem>
<para>Rule and device options:</para>
<variablelist>
<varlistentry>
<term><option>link_priority=<replaceable>value</replaceable></option></term>
<listitem>
<para>Specify the priority of the created symlinks. Devices with higher
priorities overwrite existing symlinks of other devices. The default is 0.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>event_timeout=</option></term>
<listitem>
<para>Number of seconds an event waits for operations to finish before
giving up and terminating itself.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>string_escape=<replaceable>none|replace</replaceable></option></term>
<listitem>
<para>Usually control and other possibly unsafe characters are replaced
in strings used for device naming. The mode of replacement can be specified
with this option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>static_node=</option></term>
<listitem>
<para>Apply the permissions specified in this rule to the static device node with
the specified name. Static device node creation can be requested by kernel modules.
These nodes might not have a corresponding kernel device at the time udevd is
started; they can trigger automatic kernel module loading.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>watch</option></term>
<listitem>
<para>Watch the device node with inotify; when the node is closed after being opened for
writing, a change uevent is synthesized.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>nowatch</option></term>
<listitem>
<para>Disable the watching of a device node with inotify.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
<para>The <option>NAME</option>, <option>SYMLINK</option>, <option>PROGRAM</option>,
<option>OWNER</option>, <option>GROUP</option>, <option>MODE</option> and <option>RUN</option>
fields support simple string substitutions. The <option>RUN</option>
substitutions are performed after all rules have been processed, right before the program
is executed, allowing for the use of device properties set by earlier matching
rules. For all other fields, substitutions are performed while the individual rule is
being processed. The available substitutions are:</para>
<variablelist>
<varlistentry>
<term><option>$kernel</option>, <option>%k</option></term>
<listitem>
<para>The kernel name for this device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$number</option>, <option>%n</option></term>
<listitem>
<para>The kernel number for this device. For example, 'sda3' has
kernel number of '3'</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$devpath</option>, <option>%p</option></term>
<listitem>
<para>The devpath of the device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$id</option>, <option>%b</option></term>
<listitem>
<para>The name of the device matched while searching the devpath upwards for
<option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$driver</option></term>
<listitem>
<para>The driver name of the device matched while searching the devpath upwards for
<option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term>
<listitem>
<para>The value of a sysfs attribute found at the device where
all keys of the rule have matched. If the matching device does not have
such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or
ATTRS test selected a parent device, then the attribute from that
parent device is used.</para>
<para>If the attribute is a symlink, the last element of the symlink target is
returned as the value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term>
<listitem>
<para>A device property value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$major</option>, <option>%M</option></term>
<listitem>
<para>The kernel major number for the device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$minor</option>, <option>%m</option></term>
<listitem>
<para>The kernel minor number for the device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$result</option>, <option>%c</option></term>
<listitem>
<para>The string returned by the external program requested with PROGRAM.
A single part of the string, separated by a space character, may be selected
by specifying the part number as an attribute: <option>%c{N}</option>.
If the number is followed by the '+' character, this part plus all remaining parts
of the result string are substituted: <option>%c{N+}</option></para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$parent</option>, <option>%P</option></term>
<listitem>
<para>The node name of the parent device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$name</option></term>
<listitem>
<para>The current name of the device. If not changed by a rule, it is the
name of the kernel device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$links</option></term>
<listitem>
<para>A space-separated list of the current symlinks. The value is
only set during a remove event or if an earlier rule assigned a value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$root</option>, <option>%r</option></term>
<listitem>
<para>The udev_root value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$sys</option>, <option>%S</option></term>
<listitem>
<para>The sysfs mount point.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$devnode</option>, <option>%N</option></term>
<listitem>
<para>The name of the device node.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>%%</option></term>
<listitem>
<para>The '%' character itself.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>$$</option></term>
<listitem>
<para>The '$' character itself.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<refsect1>
<title>See Also</title>
<para><citerefentry>
<refentrytitle>udevd</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
</citerefentry></para>
</refsect1>
</refentry>