udev.xml revision bd284db142c1d3fb6e2a709678c8828c12c52466
220a21d38f675eb835f5758e3d23e896573aa5eaLennart Poettering<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <refentryinfo>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering </refentryinfo>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <refmiscinfo class="version"></refmiscinfo>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <refpurpose>dynamic device management</refpurpose>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>udev provides a dynamic device directory containing only the files for
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering actually present devices. It creates or removes device node files in the
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <filename>/dev</filename> directory, or it renames network interfaces.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>Usually udev runs as <citerefentry><refentrytitle>udevd</refentrytitle>
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek <manvolnum>8</manvolnum></citerefentry> and receives uevents directly from the
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek kernel if a device is added or removed from the system.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>If udev receives a device event, it matches its configured rules
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering against the available device attributes provided in sysfs to identify the device.
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek Rules that match may provide additional device information or specify a device
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering node name and multiple symlink names and instruct udev to run additional programs
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering as part of the device event handling.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>udev configuration files are placed in <filename>/etc/udev/</filename>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering and <filename>/lib/udev/</filename>. All empty lines, or lines beginning with
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering '#' will be ignored.</para>
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek <refsect2><title>Configuration file</title>
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek <para>udev expects its main configuration file at <filename>/etc/udev/udev.conf</filename>.
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek It consists of a set of variables allowing the user to override default udev values.
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek The following variables can be set:</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <variablelist>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>Specifies where to place the device nodes in the filesystem.
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering The default value is <filename>/dev</filename>.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering </varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>The logging priority. Valid values are the numerical syslog priorities
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering or their textual representations: <option>err</option>, <option>info</option>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering </varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering </variablelist>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>The udev rules are read from the files located in the
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering default rules directory <filename>/lib/udev/rules.d/</filename>,
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering the custom rules directory <filename>/etc/udev/rules.d/</filename>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering and the temporary rules directory <filename>/dev/.udev/rules.d/</filename>.
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering All rule files are sorted and processed in lexical order, regardless
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering in which of these directories they live.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>Rule files are required to have a unique name, duplicate file names
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering are ignored. Files in <filename>/etc/udev/rules.d/</filename> have precedence
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering over files with the same name in <filename>/lib/udev/rules.d/</filename>. This
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering can be used to ignore a default rules file if needed.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>Every line in the rules file contains at least one key value pair.
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering There are two kind of keys, match and assignment keys.
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering If all match keys are matching against its value, the rule gets applied and the
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering assign keys get the specified value assigned.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>A matching rule may specify the name of the device node, add a symlink
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering pointing to the node, or run a specified program as part of the event handling.
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering If no matching rule is found, the default device node name is used.</para>
68dd0956ef9d607e6ff9aea15883a2c290a33c2aTom Gundersen <para>A rule consists of a list of one or more key value pairs separated by
68dd0956ef9d607e6ff9aea15883a2c290a33c2aTom Gundersen a comma. Each key has a distinct operation, depending on the used operator. Valid
68dd0956ef9d607e6ff9aea15883a2c290a33c2aTom Gundersen operators are:</para>
68dd0956ef9d607e6ff9aea15883a2c290a33c2aTom Gundersen <variablelist>
68dd0956ef9d607e6ff9aea15883a2c290a33c2aTom Gundersen <varlistentry>
499b604b21c02ee64c8590a76d7900d64d7a5cb7Zbigniew Jędrzejewski-Szmek <para>Compare for equality.</para>
69beda1f75070b36d0562e4050cd567bf2da5a87Kay Sievers </varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering </varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>Assign a value to a key. Keys that represent a list, are reset
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering and only this single value is assigned.</para>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering </varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <varlistentry>
6936cd8926b6935364874b3701e86fe823e8c4ceLennart Poettering <para>Add the value to a key that holds a list of entries.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Assign a value to a key finally; disallow any later changes,
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering which may be used to prevent changes by any later rules.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </variablelist>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>The following key names can be used to match against device properties.
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering Some of the keys also match against properties of the parent devices in sysfs,
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering not only the device that has generated the event. If multiple keys that match
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering a parent device are specified in a single rule, all these keys must match at
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering one and the same parent device.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the name of the event action.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the devpath of the event device.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the name of the event device.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the name of the node or network interface. It can
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering be used once the NAME key has been set in one of the preceding
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the subsystem of the event device.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the driver name of the event device. Only set for devices
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering which are bound to a driver at the time the event is generated.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt <varlistentry>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt <term><option>ATTR{<replaceable>filename</replaceable>}</option></term>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match sysfs attribute values of the event device. Trailing
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering whitespace in the attribute values is ignored, if the specified match
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering value does not contain trailing whitespace itself.
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Search the devpath upwards for a matching device name.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Search the devpath upwards for a matching device subsystem name.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Search the devpath upwards for a matching device driver name.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <term><option>ATTRS{<replaceable>filename</replaceable>}</option></term>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Search the devpath upwards for a device with matching sysfs attribute values.
b8bde11658366290521e3d03316378b482600323Jan Engelhardt If multiple <option>ATTRS</option> matches are specified, all of them
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering must match on the same device. Trailing whitespace in the attribute values is ignored,
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering if the specified match value does not contain trailing whitespace itself.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <term><option>ENV{<replaceable>key</replaceable>}</option></term>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match against a device property value.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <term><option>TEST{<replaceable>octal mode mask</replaceable>}</option></term>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Test the existence of a file. An octal mode mask can be specified
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering if needed.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Execute a program. The key is true, if the program returns
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering successfully. The device properties are made available to the
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering executed program in the environment. The program's output printed to
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering stdout, is available in the RESULT key.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Match the returned string of the last PROGRAM call. This key can
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering be used in the same or in any later rule after a PROGRAM call.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </variablelist>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Most of the fields support a shell style pattern matching. The following
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering pattern characters are supported:</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <variablelist>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Matches zero, or any number of characters.</para>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering </varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <varlistentry>
51c61cda1a542c9e999bfdc6aab4a029c0ae7f5aLennart Poettering <para>Matches any single character.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Matches any single character specified within the brackets. For
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'.
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering Ranges are also supported within this match with the '-' character.
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering For example, to match on the range of all digits, the pattern [0-9] would
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering be used. If the first character following the '[' is a '!', any characters
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering not enclosed are matched.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </variablelist>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>The following keys can get values assigned:</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <variablelist>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>The name of the node to be created, or the name the network interface
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering should be renamed to.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>The name of a symlink targeting the node. Every matching rule can add
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering this value to the list of symlinks to be created along with the device node.
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering Multiple symlinks may be specified by separating the names by the space
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering character.</para>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <term><option>OWNER, GROUP, MODE</option></term>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt <para>The permissions for the device node. Every specified value overwrites
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering the compiled-in default value.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <term><option>ATTR{<replaceable>key</replaceable>}</option></term>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>The value that should be written to a sysfs attribute of the
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering event device.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <term><option>ENV{<replaceable>key</replaceable>}</option></term>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Set a device property value.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Add a program to the list of programs to be executed for a specific
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering device. This can only be used for very short running tasks. Running an
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering event process for a long period of time may block all further events for
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering this or a dependent device. Long running tasks need to be immediately
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering detached from the event process itself.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>If the specified string starts with
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <option>socket:<replaceable>path</replaceable></option>, all current event
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering values will be passed to the specified socket, as a message in the same
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering format the kernel sends an uevent. If the first character of the specified path
4ef6e535e30c67d4ff34b2ca785e555dbaeac14eKay Sievers is an @ character, an abstract namespace socket is used, instead of an existing
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering socket file.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
4ef6e535e30c67d4ff34b2ca785e555dbaeac14eKay Sievers <para>Named label where a GOTO can jump to.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Jumps to the next LABEL with a matching name</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <term><option>IMPORT{<replaceable>type</replaceable>}</option></term>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Import a set of variables as device properties,
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering depending on <replaceable>type</replaceable>:</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <variablelist>
4ef6e535e30c67d4ff34b2ca785e555dbaeac14eKay Sievers <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Execute an external program specified as the assigned value and
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering import its output, which must be in environment key format.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Import a text file specified as the assigned value, which must be in
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering environment key format.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>Import the stored keys from the parent device by reading
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering the database entry of the parent device. The value assigned to
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <option>IMPORT{parent}</option> is used as a filter of key names
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering to import (with the same shell-style pattern matching used for
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering comparisons).</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </variablelist>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering <para>If no option is given, udev will choose between <option>program</option>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering and <option>file</option> based on the executable bit of the file
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering permissions.</para>
699b6b3491dc265ead79602404ad67ccdacae302Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>Wait for a file to become available.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <variablelist>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
ed28905eecf631916f03edd0a7dfad8b0a177990Kay Sievers <para>Stops further rules application. No later rules will have
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering any effect.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <term><option>ignore_remove</option></term>
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering <para>Do not remove the device node when the device goes away. This may be
949138ccc3417748b0978980e4a1c67955dd4ba4Ansgar Burchardt useful as a workaround for broken device drivers.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <term><option>link_priority=<replaceable>value</replaceable></option></term>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>Specify the priority of the created symlinks. Devices with higher
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering priorities overwrite existing symlinks of other devices. The default is 0.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <term><option>all_partitions</option></term>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>Create the device nodes for all available partitions of a block device.
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering This may be useful for removable media devices where media changes are not
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering detected.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <term><option>event_timeout=</option></term>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>Number of seconds an event will wait for operations to finish, before it
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering will terminate itself.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <term><option>string_escape=<replaceable>none|replace</replaceable></option></term>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>Usually control and other possibly unsafe characters are replaced
b8bde11658366290521e3d03316378b482600323Jan Engelhardt in strings used for device naming. The mode of replacement can be specified
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering with this option.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>Watch the device node with inotify, when closed after being opened for
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering writing, a change uevent will be synthesised.</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </variablelist>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt </variablelist>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <para>The <option>NAME</option>, <option>SYMLINK</option>, <option>PROGRAM</option>,
b8bde11658366290521e3d03316378b482600323Jan Engelhardt <option>OWNER</option>, <option>GROUP</option>, <option>MODE</option> and <option>RUN</option>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering fields support simple printf-like string substitutions. The <option>RUN</option>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering format chars gets applied after all rules have been processed, right before the program
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering is executed. It allows the use of device properties set by earlier matching
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering rules. For all other fields, substitutions are applied while the individual rule is
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering being processed. The available substitutions are:</para>
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering <variablelist>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt <varlistentry>
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering <term><option>$kernel</option>, <option>%k</option></term>
b8bde11658366290521e3d03316378b482600323Jan Engelhardt <para>The kernel name for this device.</para>
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering </varlistentry>
ed28905eecf631916f03edd0a7dfad8b0a177990Kay Sievers <varlistentry>
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering <term><option>$number</option>, <option>%n</option></term>
d27893efdf652c6d85ea590fa0b7c2b88f817083Lennart Poettering <para>The kernel number for this device. For example, 'sda3' has
13b28d822462e9a0a7130ad40bed08cb380082f0Lennart Poettering kernel number of '3'</para>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <varlistentry>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering <term><option>$devpath</option>, <option>%p</option></term>
43c71255b3db02916f4f70afa18bab196c6f4a45Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$id</option>, <option>%b</option></term>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <para>The name of the device matched while searching the devpath upwards for
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>.
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John </varlistentry>
4670e9d5f23fc39360c086fb58eadf8b157ee205Jan Engelhardt <varlistentry>
1e190502e78cea1f8bcb62e6d390305c89e41e6aZbigniew Jędrzejewski-Szmek <term><option>$driver</option></term>
1e190502e78cea1f8bcb62e6d390305c89e41e6aZbigniew Jędrzejewski-Szmek <para>The driver name of the device matched while searching the devpath upwards for
1e190502e78cea1f8bcb62e6d390305c89e41e6aZbigniew Jędrzejewski-Szmek <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>.
4c2413bffa7861bd3c4b3589c821ab7e0ac51c83Jan Engelhardt </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
4c2413bffa7861bd3c4b3589c821ab7e0ac51c83Jan Engelhardt <term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <para>The value of a sysfs attribute found at the device, where
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering all keys of the rule have matched. If the matching device does not have
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering such an attribute, follow the chain of parent devices and use the value
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John of the first attribute that matches.
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John If the attribute is a symlink, the last element of the symlink target is
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering returned as the value.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term>
4c2413bffa7861bd3c4b3589c821ab7e0ac51c83Jan Engelhardt </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$major</option>, <option>%M</option></term>
dfb08b058401d56c395f4f2d20ff214d31a277e5Zbigniew Jędrzejewski-Szmek <para>The kernel major number for the device.</para>
dfb08b058401d56c395f4f2d20ff214d31a277e5Zbigniew Jędrzejewski-Szmek <term><option>$minor</option>, <option>%m</option></term>
dfb08b058401d56c395f4f2d20ff214d31a277e5Zbigniew Jędrzejewski-Szmek <para>The kernel minor number for the device.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$result</option>, <option>%c</option></term>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <para>The string returned by the external program requested with PROGRAM.
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering A single part of the string, separated by a space character may be selected
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering by specifying the part number as an attribute: <option>%c{N}</option>.
4c2413bffa7861bd3c4b3589c821ab7e0ac51c83Jan Engelhardt If the number is followed by the '+' char this part plus all remaining parts
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering of the result string are substituted: <option>%c{N+}</option></para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$parent</option>, <option>%P</option></term>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <para>The node name of the parent device.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <para>The current name of the device node. If not changed by a rule, it is the
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering name of the kernel device.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <para>The current list of symlinks, separated by a space character. The value is
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering only set if an earlier rule assigned a value, or during a remove events.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
b97610038a122ff30e60b1996369ca4b979d8b19Kay Sievers <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$root</option>, <option>%r</option></term>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <term><option>$sys</option>, <option>%S</option></term>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
4c2413bffa7861bd3c4b3589c821ab7e0ac51c83Jan Engelhardt <varlistentry>
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John <term><option>$tempnode</option>, <option>%N</option></term>
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John <para>The name of a created temporary device node to provide access to
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John the device from a external program before the real node is created.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </varlistentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </variablelist>
4c2413bffa7861bd3c4b3589c821ab7e0ac51c83Jan Engelhardt <para>The count of characters to be substituted may be limited by specifying
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John the format length value. For example, '%3s{file}' will only
8b7d0494a3fe35209d4db0d1b9e065e7e5cc9875Jason St. John insert the first three characters of the sysfs attribute</para>
8e420494bc59d8b9d43e6d34d8ec8bb765946c74Lennart Poettering <para>Written by Greg Kroah-Hartman <email>greg@kroah.com</email> and
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering Kay Sievers <email>kay.sievers@vrfy.org</email>. With much help from
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering Dan Stekloff and many others.</para>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <refentrytitle>udevd</refentrytitle><manvolnum>8</manvolnum>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering </citerefentry>,
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <citerefentry>
e49b5aada0df13c9e8fce7338ae34e075dd7ccd1Lennart Poettering <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>