lirc-config-tool

Section: User Commands (1)


Updated: Aug 2015


Index Return to Main Contents
 

NAME

lirc-config-tool - tool to scan and generate lirc config files  

SYNOPSIS

lirc-config-tool -s|-u [ -c FILE]

lirc-config-tool [-o DIR] [-d] [-c FILE] [FILES]

lirc-config-tool -l  

OPTIONS

Without options, generates all available application specific lircrc files in ~/.config/lirc. The optional [files] is a list of files to build or dump, as listed by -l.

-s
Scan lircd file for key symbols which are duplicated or not in namespace.
-u
Update existing lircd file to use key symbols in namespace.
-l
List available files to generate.
-d
Dump file templates usable as stdin on stdout.
-o <dir>
Output directory, defaults to ~/.config/lirc
-c <lircd-filename>
lircd(8) config file, defaults to /usr/etc/lirc/lircd.conf
-h
Print help message

 

DESCRIPTION

The script is designed to assist in the setup of the lirc(8) configuration files for ordinary remote controls. It is not aimed to handle full-blown keyboards or joystick devices. The generated lircrc files represents a starting point which will need further, manual refinements but might "work" in a basic sense in many cases.

The setup involves normalizing the lircd.conf to use symbols in the legal namespace, and to create application specific lircrc files which uses the normalized symbols.

To assist normalizing /usr/etc/lircd.conf, the script can report symbols used which not are in the namespace. It can can also update many of these symbols to corresponding symbols within the namespace.

The script also can create application specific lircrc files such as mythtv.lircrc or vlc.lircrc. It then uses the normalized key symbols in /usr/etc/lirdc.conf. By default, files are created in ~/.config/lirc.

Generated lircrc files basically combines known keys from /usr/etc/lirc/lircd.conf with template data for an application. The process results in a lircrc file, a list a of unused keys and some entries which don't match any existing key. The unused keys and unmatched entries are written as comments into the generated file.

An 'illegal' key i. e., a key not in namespace, will not match any entry and will thus always be unused. However, it's perfectly possible to use it later on while manually modifying the lircrc files.

When updating files, script always makes backup copies.

The generated lircrc files are intended to be included in a main ~/.config/lircrc file. A minimal such might look like


    include ~/.config/lirc/mythtv.lircrc

 

EXAMPLES

Scan /usr/etc/lirc/lircd.conf for duplicated symbols and symbols not in namespace:

lirc-config-tool -s

Update a local lircd.conf file to use symbols in namespace:

lirc-config-tool -uc ./lircd.conf

List available files to generate:

lirc-config-tool -l

Generate one of the files listed by -l, creates ~/.config/lirc/mythtv.lircrc:

lirc-config-tool mythtv

Dump template data for mythtv:

lirc-config-tool -d mythtv >mythtv.lircdata

Use possibly edited data to create a modified mythtv.lircrc in current dir:

lirc-config-tool -o . stdin < mythtv.lircdata

 

LIRCD.CONF CONVERSIONS

The -s option simply reports all key symbols not in namespace. It also reports some symbols which although legal are inappropriate in this context, notably KEY_NUMERIC_0..KEY_NUMERIC_9. If present, duplicated keys are also reported.

The -u option converts several known symbols to their corresponding KEY_* symbols. Symbols which have names like KEY_WINDOWS but not are in namespace gets a X_ prefix e. g., KEY_WINDOWS -> X_KEY_WINDOWS. The converted file thus guarantees that any key symbol starting with KEY_ is a legal symbol.

All known numeric keys such as '1', 'KEY_1', 'KEY_KP_1', 'KEY_NUMERIC_1 are converted to KEY_1.

All modifications are marked by comments in file.

 

EXTENDING

The script can be extended to support more applications by providing a shell function named *.lircdata. E. g., to add a new application named "my_app" based on the built-in vlc application:


         $ lirc-config-tool -d vlc >my_app.lircdata
         $ function my_app_lircdata()
         > {
         >    cat my_app.lircdata
         > }
         $ export -f my_app_lircdata
         $ lirc-config-tool  my_app

 

DATA FORMAT

The script uses a simple, line-oriented format to represent the lircrc files. The purpose of the format is to be compact and thus to give a good overview, and also to be easy to parse. Each line is divided in comma-separated tokens. There are four kind of lines.

Comment lines begins with a '#'. These are copied verbatim to the output file.

The first data line represents global items, applicable to all entrys. The first word is the program name. It's used in the first 'program=' line. Following words, if present, are optional lines which will be appended to each entry in the file.

A data line starting with 'begin' or 'end' is a mode block designator. It's copied verbatim to output file.

All other data lines represents a button/config entry. The format is
    <button> <config> [extra]...
The button value is used in the button = line, and the config item is used in the config = line. Both are mandatory. Following items, if any, are copied as verbatim lines to the entry.

An unlikely example: The data format


    myprog, flags = quit
    begin volume_mode
    KEY_VOLUMEUP, volume-up, delay=4, repeat=1
    KEY_VOLUMEDOWN, volume-down
    end volume_mode

translates to:


    begin volume_mode
        begin
            program = myprog
            button  = KEY_VOLUME_UP
            config  = volume-up
            delay   = 4
            repeat  = 1
            flags   = quit
        end
        begin
            program = myprog
            button  = KEY_VOLUME_DOWN
            config  = volume-down
            flags   = quit
        end
    end volume_mode

 

COPYRIGHT

License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  

SEE ALSO

lircd(8)
http://www.lirc.org/ - Main lirc documentation


 

Index

NAME
SYNOPSIS
OPTIONS
DESCRIPTION
EXAMPLES
LIRCD.CONF CONVERSIONS
EXTENDING
DATA FORMAT
COPYRIGHT
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 20:22:15 GMT, June 09, 2017