The Linux software for dealing with infra-red remote controls is LIRC. LIRC has a number of components which work together to allow programs to respond to the buttons on a remote handset.

Kernel module

First, you need a LIRC kernel module for the receiver that you have. For example, the lirc_streamzap module works with the Streamzap remote control. Inserting this module into the kernel with modprobe will also load the core lirc_dev module. The main distributions ship a selection of lirc driver modules which match their pre-compiled kernels.

The kernel module communicates with programs through a device node. With a good udev configuration, this should be created automatically as (typically) /dev/lirc or /dev/lirc/0.

You can test that the kernel modules are working, by running the mode2 program:

 mode2 -d /dev/lirc/0

and then pressing keys on the remote. If all is working, you will get a long list of timings with each press of a key.

lircd configuration

The next part of LIRC configuration is the main LIRC daemon, lircd. There are pre-made configuration files for a wide range of controls -- there is one for the Streamzap module. Copy the config file to /etc/lirc/lircd.conf.

You can test the configuration by starting lircd with:

 lircd -d /dev/lirc/0 /etc/lirc/lircd.conf

and then running:


and pressing keys on the remote. This will print one or more lines with each keypress:

 00000000000028cb 00 MUTE Streamzap_PC_Remote

indicating the key pressed, the repeat number and the remote control the key press comes from.

Xine configuration

Configuration of individual applications is done on a per-user basis, in the ~/.lircrc file. xine can generate a skeleton configuration for itself, with:

 xine --keymap=lirc

Use this to create your .lircrc, or append to an existing one. The configuration consists of repeated stanzas, one for each key/effect:

 # playback pause toggle
        remote = Streamzap_PC_Remote
        button = PAUSE
        prog   = xine
        repeat = 0
        config = Pause

The above example stanza configures xine to react to a PAUSE event from the Streamzap_PC_Remote device by executing xine's Pause. The default skeleton output from xine puts xxxxx in the remote and button fields – you will need to set these yourself. You can delete unused effects from the file, or simply leave them with the xxxxxs.

xine needs to be built with LIRC support. You can test this with:

 xine -L

If it complains that there is no -L option by giving you the help text for the command-line switches, then there is no LIRC support. If it runs, then it does have LIRC support.

LinuxHints/LIRCandXine (last edited 2006-01-01 22:53:25 by 81)