📄 alsactl_init.xml
字号:
</para> </listitem> </varlistentry> <varlistentry> <term><option>ENV{<replaceable>key</replaceable>}</option></term> <listitem> <para>Match against the value of an environment variable. Up to five <option>ENV</option> keys can be specified per rule. Depending on the type of operator, this key is also used to export a variable to the environment.</para> </listitem> </varlistentry> <varlistentry> <term><option>PROGRAM</option></term> <listitem> <para>Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key.</para> <para>Several buildin commands are available:</para> <variablelist> <varlistentry> <term><option>__ctl_search</option></term> <listitem> <para>Search for a control. The CTL{name} key might contain match characters * and ?. An control index might be specified as first argument starting from zero (e.g. PROGRAM="__ctl_search 2").</para> </listitem> </varlistentry> <varlistentry> <term><option>__ctl_count</option></term> <listitem> <para>Search for a controls and return total count of matched ones. The CTL{name} key might contain match characters * and ?.</para> </listitem> </varlistentry> </variablelist> </listitem> </varlistentry> <varlistentry> <term><option>RESULT</option></term> <listitem> <para>Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call.</para> </listitem> </varlistentry> </variablelist> <para>Most of the fields support a shell style pattern matching. The following pattern characters are supported:</para> <variablelist> <varlistentry> <term><option>*</option></term> <listitem> <para>Matches zero, or any number of 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 within this match with the '-' character. For example, to match on the range of all digits, the pattern [0-9] would 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>CTL{numid}</option>, <option>CTL{iface}</option>, <option>CTL{device}</option>, <option>CTL{subdev}</option>, <option>CTL{name}</option>, <option>CTL{index}</option>, </term> <listitem> <para>Select universal control element.</para> </listitem> </varlistentry> <varlistentry> <term><option>CTL{value}</option></term> <listitem> <para>Value is set (written) also to soundcard's control device and RESULT key is set to errno code. The result of set operation is always true (it means continue with next key on line).</para> </listitem> </varlistentry> <varlistentry> <term><option>CTL{values}</option></term> <listitem> <para>Value is set (written) also to soundcard's control device (all control values are set to specified value) and RESULT key is set to errno code. The result of set operation is always true (it means continue with next key on line).</para> </listitem> </varlistentry> <varlistentry> <term><option>ENV{<replaceable>key</replaceable>}</option></term> <listitem> <para>Export a variable to the environment. Depending on the type of operator, this key is also to match against an environment variable.</para> </listitem> </varlistentry> <varlistentry> <term><option>RESULT</option></term> <listitem> <para>Set RESULT variable. Note that PROGRAM also sets this variable, but setting this variable manually might be useful to change code execution order (included files).</para> </listitem> </varlistentry> <varlistentry> <term><option>LABEL</option></term> <listitem> <para>Named label where a GOTO can jump to.</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>INCLUDE</option></term> <listitem> <para>Include specified filename or all files in specified directory</para> </listitem> </varlistentry> <varlistentry> <term><option>ACCESS</option></term> <listitem> <para>Check if specified file or directory exists</para> </listitem> </varlistentry> <varlistentry> <term><option>CONFIG{sysfs_device}</option></term> <listitem> <para>The relative path to sysfs subsystem specifying the root directory of a soundcard device. Usually, it should be set to "/class/sound/controlC$cardinfo{card}/device". </para> </listitem> </varlistentry> <varlistentry> <term><option>PRINT</option></term> <listitem> <para>PRINT value to stdout.</para> </listitem> </varlistentry> <varlistentry> <term><option>ERROR</option></term> <listitem> <para>PRINT value to stderr.</para> </listitem> </varlistentry> <varlistentry> <term><option>EXIT</option></term> <listitem> <para>Exit immediately and set program exit code to value (should be integer). If value is "return" string, parser leaves current included file and returns to parent configuration file.</para> </listitem> </varlistentry> </variablelist> <para>The <option>PROGRAM</option>, <option>RESULT</option>, <option>CTL{value}</option>, <option>PRINT</option>, <option>ERROR</option>, <option>EXIT</option>, <option>CONFIG{}</option> fields support simple printf-like string substitutions. 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>$cardinfo{<replaceable>attribute</replaceable>}</option>, <option>%i{<replaceable>attribute</replaceable>}</option></term> <listitem> <para>See CARDINFO{} for more details.</para> </listitem> </varlistentry> <varlistentry> <term><option>$ctl{<replaceable>attribute</replaceable>}</option>, <option>%C{<replaceable>attribute</replaceable>}</option></term> <listitem> <para>See CTL{} for more details.</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 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>The value of an environment variable.</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 '+' char this part plus all remaining parts of the result string are substituted: <option>%c{N+}</option></para> </listitem> </varlistentry> <varlistentry> <term><option>$sysfsroot</option>, <option>%r</option></term> <listitem> <para>Root directory where sysfs file-system is mounted. Ususally, this value is just "/sys".</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> <para>The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute</para> </refsect2> </refsect1> <refsect1><title>AUTHOR</title> <para>Written by Jaroslav Kysela <email>perex@perex.cz</email></para> <para>Some portions are written by Greg Kroah-Hartman <email>greg@kroah.com</email> and Kay Sievers <email>kay.sievers@vrfy.org</email>.</para> </refsect1> <refsect1> <title>SEE ALSO</title> <para><citerefentry> <refentrytitle>alsactl</refentrytitle><manvolnum>1</manvolnum> </citerefentry></para> </refsect1> </refentry> </section></article>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -