chiark / gitweb /
man page: document when substitutions are applied for RUN and other keys
[elogind.git] / docs / udev.xml
index 02dcd2586a8173939d55f0341a8bc9e74f6d195d..e0542a6be199048f024550dd784835bb17a47a6a 100644 (file)
@@ -27,7 +27,7 @@
 
       <refmeta>
         <refentrytitle>udev</refentrytitle>
-        <manvolnum>8</manvolnum>
+        <manvolnum>7</manvolnum>
       </refmeta>
 
       <refnamediv>
@@ -42,9 +42,7 @@
 
         <para>Usually udev runs as <citerefentry><refentrytitle>udevd</refentrytitle>
         <manvolnum>8</manvolnum></citerefentry> and receives uevents directly from the
-        kernel if a device is added or removed form the system. The program
-        <command>udev</command> itself may be used as an event handler in situations,
-        where running the daemon is not appropriate, like in initramfs.</para>
+        kernel if a device is added or removed form the system.</para>
 
         <para>If udev receives a device event, it matches its configured rules
         against the available device attributes provided in sysfs to identify the device.
@@ -55,7 +53,7 @@
 
       <refsect1><title>CONFIGURATION</title>
         <para>All udev configuration files are placed in <filename>/etc/udev/*</filename>.
-        Every file consist of a set of lines of text. All empty lines or lines beginning
+        Every file consists of a set of lines of text. All empty lines or lines beginning
         with '#' will be ignored.</para>
 
         <refsect2><title>Configuration file</title>
               </listitem>
             </varlistentry>
 
-            <varlistentry>
-              <term><option>udev_db</option></term>
-              <listitem>
-                <para>The name and location of the udev database. The default value is
-                <filename>/dev/.udevdb</filename>.</para>
-              </listitem>
-            </varlistentry>
-
             <varlistentry>
               <term><option>udev_rules</option></term>
               <listitem>
             <varlistentry>
               <term><option>ACTION</option></term>
               <listitem>
-                <para>Match the kernel action name.</para>
+                <para>Match the name of the event action.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>KERNEL</option></term>
               <listitem>
-                <para>Match the kernel device name</para>
+                <para>Match the name of the device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>DEVPATH</option></term>
               <listitem>
-                <para>Match the kernel devpath.</para>
+                <para>Match the devpath of the device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>SUBSYSTEM</option></term>
               <listitem>
-                <para>Match the kernel subsystem name</para>
+                <para>Match the subsystem of the device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>BUS</option></term>
               <listitem>
-                <para>Match the typ of bus the device is connected to.</para>
+                <para>Search the devpath upwards for a matching device subsystem name.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>DRIVER</option></term>
               <listitem>
-                <para>Match the kernel driver name.</para>
+                <para>Search the devpath upwards for a matching device driver name.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>ID</option></term>
               <listitem>
-                <para>Match the device number on the bus.</para>
+                <para>Search the devpath upwards for a matching device name.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>ENV{<replaceable>key</replaceable>}</option></term>
+              <term><option>SYSFS{<replaceable>filename</replaceable>}</option></term>
               <listitem>
-                <para>Match against the value of an environment key. Depending on
-                the specified operation, this key is also used as a assignment.</para>
+                <para>Search the devpath upwards for a device with matching sysfs attribute values.
+                Up to five <option>SYSFS</option> keys can be specified per rule. All attributes
+                must match on the same device. Trailing whitespace in the attribute values is ignored,
+                if the specified match value does not contain trailing whitespace itself.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>SYSFS{<replaceable>filename</replaceable>}</option></term>
+              <term><option>ENV{<replaceable>key</replaceable>}</option></term>
               <listitem>
-                <para>Match the sysfs attribute value. Up to five values can be specified.
-                Trailing whitespace is ignored, if the specified match value does not contain
-                trailing whitespace itself.</para>
+                <para>Match against the value of an environment variable. Up to five <option>ENV</option>
+                keys can be specified per rule. This key can also be used to export a variable to
+                the environment.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>NAME</option></term>
               <listitem>
-                <para>The name of the node to be created, or the name, the network interface
-                should be renamed to. Only one rule can set the a name, all later rules with
+                <para>The name of the node to be created, or the name the network interface
+                should be renamed to. Only one rule can set the node name, all later rules with
                 a NAME key will be ignored.</para>
               </listitem>
             </varlistentry>
             <varlistentry>
               <term><option>OWNER, GROUP, MODE</option></term>
               <listitem>
-                <para>The permissions for the device node. Every specified value over writes
+                <para>The permissions for the device node. Every specified value overwrites
                 the compiled-in default value.</para>
               </listitem>
             </varlistentry>
             <varlistentry>
               <term><option>ENV{<replaceable>key</replaceable>}</option></term>
               <listitem>
-                <para>Export the key to the environment. Depending on the specified
-                operation, this key is also used as a match.</para>
+                <para>Export a variable to the environment. This key can also be used to match
+                against an environment variable.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
               <term><option>IMPORT{<replaceable>type</replaceable>}</option></term>
               <listitem>
-                <para>Import the printed result or the content of a file in environment key
+                <para>Import the printed result or the value of a file in environment key
                 format into the event environment. <option>program</option> will execute an
                 external program and read its output. <option>file</option> will inport a
                 text file. If no option is given, udev will determine it from the  executable
             <varlistentry>
               <term><option>WAIT_FOR_SYSFS</option></term>
               <listitem>
-                <para>Wait for the specified sysfs file of the device to be created. May be used
-                to fight agains timing issues wth the kernel.</para>
+                <para>Wait for the specified sysfs file of the device to be created. Can be used
+                to fight against kernel sysfs timing issues.</para>
               </listitem>
             </varlistentry>
 
           </variablelist>
 
           <para>The <option>NAME</option>, <option>SYMLINK</option>, <option>PROGRAM</option>,
-          <option>OWNER</option>  and  <option>GROUP</option>  fields  support  simple
-          printf-like string substitutions:</para>
+          <option>OWNER</option>, <option>GROUP</option>  and  <option>RUN</option>
+          fields support simple printf-like string substitutions. The <option>RUN</option>
+          format chars gets applied after all rules have been processed, right before the program
+          is executed. It allows the use of the complete environment set by earlier matching
+          rules. For all other fields, substitutions are applied while the individual rule is
+          being processed. The available substitutions are:</para>
           <variablelist>
             <varlistentry>
-              <term><option>%k</option>, <option>$kernel</option></term>
+              <term><option>$kernel</option>, <option>%k</option></term>
               <listitem>
                 <para>The kernel name for this device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%b</option>, <option>$id</option></term>
+              <term><option>$number</option>, <option>%n</option></term>
               <listitem>
-                <para>The kernel bus id for this device.</para>
+                <para>The kernel number for this device. For example, 'sda3' has
+                kernel number of '3'</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%n</option>, <option>$number</option></term>
+              <term><option>$devpath</option>, <option>%p</option></term>
               <listitem>
-                <para>The kernel number for this device. For example, 'sda3' has
-                kernel number of '3'</para>
+                <para>The devpath of the device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%p</option>, <option>$devpath</option></term>
+              <term><option>$id</option>, <option>%b</option></term>
               <listitem>
-                <para>The devpath of the device.</para>
+                <para>The name of the device matched while searching the devpath upwards for
+                  <option>BUS</option>, <option>ID</option> <option>DRIVER</option> and <option>SYSFS</option>.
+                </para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%s{<replaceable>file</replaceable>}</option>, <option>$sysfs{<replaceable>file</replaceable>}</option></term>
+              <term><option>$sysfs{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term>
               <listitem>
-                <para>The content of a sysfs attribute.</para>
+                <para>The value of a sysfs attribute found at the current or a parent device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%e{<replaceable>key</replaceable>}</option>, <option>$env{<replaceable>key</replaceable>}</option></term>
+              <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term>
               <listitem>
                 <para>The value of an environment variable.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%m</option>, <option>$major</option></term>
+              <term><option>$major</option>, <option>%M</option></term>
               <listitem>
                 <para>The kernel major number for the device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%M</option> <option>$minor</option></term>
+              <term><option>$minor</option> <option>%m</option></term>
               <listitem>
                 <para>The kernel minor number for the device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%c</option>, <option>$result</option></term>
+              <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
             </varlistentry>
 
             <varlistentry>
-              <term><option>%e</option>, <option>$enum</option></term>
-              <listitem>
-                <para>If a device node already exists with the name, the smallest next free
-                number is used. This  can be used to create compatibility symlinks and enumerate
-                devices of the same type originating from different kernel subsystems.</para>
-                <para>Note: The use of the enumeration facility is unreliable for events that
-                request a number at the same time. The  use  of enumerations in todays setups
-                where devices can come and go at any time is not recomended.</para>
-              </listitem>
-            </varlistentry>
-
-            <varlistentry>
-              <term><option>%P</option>, <option>$parent</option></term>
+              <term><option>$parent</option>, <option>%P</option></term>
               <listitem>
                 <para>The node name of the parent device.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%r</option>, <option>$root</option></term>
+              <term><option>$root</option>, <option>%r</option></term>
               <listitem>
                 <para>The udev_root value.</para>
               </listitem>
             </varlistentry>
 
             <varlistentry>
-              <term><option>%N</option>, <option>$tempnode</option></term>
+              <term><option>$tempnode</option>, <option>%N</option></term>
               <listitem>
                 <para>The name of a created temporary device node to provide access to
                 the device from a external program before the real node is created.</para>
       <refsect1>
         <title>SEE ALSO</title>
         <para><citerefentry>
-            <refentrytitle>udev</refentrytitle><manvolnum>8</manvolnum>
+            <refentrytitle>udevd</refentrytitle><manvolnum>8</manvolnum>
           </citerefentry>, 
           <citerefentry>
             <refentrytitle>udevinfo</refentrytitle><manvolnum>8</manvolnum>
           </citerefentry>, 
-          <citerefentry>
-            <refentrytitle>udevd</refentrytitle><manvolnum>8</manvolnum>
-          </citerefentry>, 
           <citerefentry>
             <refentrytitle>udevmonitor</refentrytitle><manvolnum>8</manvolnum>
         </citerefentry></para>