SDB:Linux Infrared Remote Control

Jump to: navigation, search
This article or section refers to the version '11.2' and it is now obsolete!
Please refer to this article's discussion page for more information.


The package LIRC is used to receive and convert remote control signals.You can control many programs via remote control in combination with irexec and irxevent. Very interesting is to control some programs like VDR, MythTV, MPlayer and Kaffeine with LIRC.


The easiest way to install LIRC is, to do this with Yast. Search for LIRC and the compatible LIRC kernel module in the default repositories. Don't you know which kernel do you run? You can check this with

 user$ uname -r

Also you can download the Tarball from and compile it by yourself. If you want the latest version of LIRC, you must download it with cvs. A detailed manual is stored here.

Useful Links for the Installation


Get available systeminformations

When you installed LIRC and the compatible kernel module, dmesg should print useful informations(first with unplugged receiver and then with the receiver plugged in) about the infrared receiver of the remote control. You can check what kind of remote control it is with the dmesg output. For example if you have a HID remote control.

 user@host:~> dmesg
 usb 7-2: new low speed USB device using uhci_hcd and address 3
 usb 7-2: configuration #1 chosen from 1 choice
 input: HID 05a4:9881 as /devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.0/input/input7
 input,hidraw1: USB HID v1.10 Keyboard [HID 05a4:9881] on usb-0000:00:1d.1-2
 input: HID 05a4:9881 as /devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.1/input/input8
 input,hidraw2: USB HID v1.10 Mouse [HID 05a4:9881] on usb-0000:00:1d.1-2
 usb 7-2: New USB device found, idVendor=05a4, idProduct=9881
 usb 7-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

I you have a common remote control, the output of dmesg looks like this:

 user@host:~> dmesg
 usb 7-2: new low speed USB device using uhci_hcd and address 4
 usb 7-2: configuration #1 chosen from 1 choice
 usb 7-2: New USB device found, idVendor=0bc7, idProduct=0006
 usb 7-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
 usb 7-2: Product: RF receiver
 usb 7-2: Manufacturer: X10 WTI
 input: X10 WTI RF receiver as /devices/pci0000:00/0000:00:1d.1/usb7/7-2/input/input9
 ati_remote: Weird data, len=1 ff 00 00 00 00 00 ...
 usbcore: registered new interface driver ati_remote
 ati_remote: Registered USB driver ATI/X10 RF USB Remote Control v. 2.2.1
 lirc_dev: IR Remote Control driver registered, major 61
 lirc_atiusb: USB remote driver for LIRC $Revision: 1.71 $
 lirc_atiusb: Paul Miller <>
 usbcore: registered new interface driver lirc_atiusb

The outpot of dmesg displays many usesful informations for the next configuration steps. In the first case it's a HID remote control in and in the second it's a remote control which depends on the LIRC driver "lirc_atiusb".

Installing a serial receiver with openSUSE 11.2


You must have installed the packages lirc and the compatible kernel module (here lirc-kmp-desktop). The tool setserial is used to configure the kernel driver of the serial port. Install these packages with:

host# zypper in lirc lirc-kmp-desktop

Configuration and test the kernel module

  • clearing the serial Port with setserial
  • configure kernel module in /etc/modprobe.d/lirc

First check if the choosen port is assigned to something. (here: /dev/ttyS0 - COM1 in the mainboard manual):

host# setserial /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4

In this case is the port assigned to the kernel driver. You can clear the port with the following command.

host# setserial /dev/ttyS0 uart none

Warning! This takes only effect until the next reboot. Now you can load the lirc-kernelmodule.

Now check his status

host#  setserial /dev/ttyS0
/dev/ttyS0, UART: unknown, Port: 0x03f8, IRQ: 4

Load the kernel driver with:

host# modprobe -v lirc_serial
insmod /lib/modules/ irq=4 io=0x3f8

Now you can must create the configuration file for the kernel module "lirc_serial"(driver for serial receiver) with

 host# echo -e "alias char-major-61 lirc_serial\noptions lirc_serial irq=4 io=0x3f8\n" > /etc/modprobe.d/lirc.conf

To unassign the serial port permanently add this line

setserial /dev/ttyS0 uart none



Remote controls which where controlled with the LIRC module

After the output from dmesg you should know which LIRC_module is needed to control the receiver of the remote control. In my case it is "lirc_serial". You must edit folling lines of the /etc/sysconfig/lirc with a common editor like vim or nano as root:

old: LIRCD_DEVICE="" new: LIRCD_DEVICE="/dev/lirc0" (it also can be "/dev/lirc". Check this with

user@host$ ls /dev/lir*

old: LIRC_MODULE="" new: LIRC_MODULE="lirc_serial" You must replace lirc_serial" with your module. You can check which module you're running in the next setence

You can check if all your modules loaded corrently with the command lsmod

host# lsmod | grep lirc
lirc_serial            14708  0
lirc_dev               11068  1 lirc_serial

In some cases you want prevent to load a module. You can do this with this command:

 host# echo "blacklist ati_remote" >> /etc/modprobe.d/blacklist

Now we modify the /etc/sysconfig/kernel file to load the module on boot. Add these lines.


If you want to add some other modules seperate these with spaces.

After Reboot the module should correctly loaded. You can check this with:

host# lsmod | grep lirc
lirc_serial            14708  0
lirc_dev               11068  1 lirc_serial

The file /dev/lirc0 should also exist.

HID (Human Interface Device) remote control

The System creates a few files in /dev/input/, which were controlled by the remote control. HID devices were controlled by two serveral files to use all the buttons of the remote control. If you don't know which files are used by the remote control, reboot the system with the plugged infrared receiver. Now go to /dev/input/ unplug your infrared device and watch which files disappear. If you plug in your device again, some new file were created in /dev/input/event* (you can ignore /dev/input/mice und /dev/input/mouse*). These new files are proppriated to the receiver. After reboot are the files in /dev/input/event in some cases different. If you are affected to this you should use the files in /dev/input/by-id* or /dev/input/by-path/ . You should also modify the script lirc_multievent (See below) .

In opposition to an usual remote control which is controlled by the LIRC module, you mustn't modify the files /etc/sysconfig/lirc alternatively /etc/init.d/lirc. (If you haven't installed LIRC with yast, you must choose the driver "devinput"!!).LIRC starts with the script lirc_multievent (see below). Copy this file into /etc/init.d and make it executable (chmod +x). After that enable the service in the RunlevelEditor. You can also use insserv instead of the Yast RunlevelEditor.

Now you download the lircd.conf for the Linux input driver here and save the file as /etc/lircd,conf. This is a default file for all HID remote controls. You needn't configure your HID remote control with irrecord. But with a common remote control you must.

First test with irw:

host# irw

Perhaps you must add a parameter to name the device. Check "irw --help". A keypress on the remote control should give an output on console:

 user@host:~> irw
 0000000000010073 00 VOLUMEUP linux-input-layer
 0000000000010048 00 KP8 linux-input-layer
 000000000001006d 00 PAGEDOWN linux-input-layer

irrecord and the lircd.conf file

You can create a lircd.conf file for every supported remote control with the program irrecord, which belongs to the LIRC package. This file contains the key code and a name for the key (arbitrary). Files for many remote controls already existing. You can search them on the the project page. If you can't find any working files, you must create your own lircd.conf file with irrecord. You mustn't do this if you have a HID device, because you can use the default HID file. The assigned names for the key will be used in the .lircrc file. Start the record wird:

host# irrecord "filename"

Perhaps you must add a parameter to name the device. Check "irrecord --help". After you have pushed and named all buttons on the remote control, the /etc/lircd.conf file will be created.

irexec, irxevent, .lircrc & co

Both programs are included in the LIRC package. They were used to control programs or activate "events" of programs. irexec and irxevent use the .lircrc which is located(first you must create it.) in the home directory of the user. the request is effected with a script:

 irxevent /home/username/.lircrc &
 irexec /home/username/.lircrc &

You can find a detailed manual about the file format of a .lircrc here.

Starting script for a HID remote control

Copy the script and paste it as /etc/init.d/lirc_multievent. Make it executable with

host# chmod 750 /etc/init.d/lirc_multievent

#! /bin/sh 
# /etc/init.d/lirc_multievent 
# Provides: lirc
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 5
# Default-Stop: 0 1 2 3 6
# Short-Description: lirc for use with multiple /dev/input/ devices
# Description:
. /etc/rc.status
  lircd --driver=devinput --device=/dev/input/event2 --pidfile=/var/run/ --listen=9988;
  lircd --driver=devinput --device=/dev/input/event3 --pidfile=/var/run/ --connect=localhost:9988;
# In some cases you cannot allocate the files /dev/input/event after a reboot.
#But you can fix with changing the path to /dev/input/by-id/* or /dev/input /by-path/*
# lircd --driver=devinput --device=/dev/input/by-path/pci-0000:00:12.0-usb-0:3:1.0-event-kbd --pidfile=/var/run/ --listen=9988;
# lircd --driver=devinput --device=/dev/input/by-path/pci-0000:00:12.0-usb-0:3:1.1-event- --pidfile=/var/run/ --connect=localhost:9988;
# Example to control more than one device:
# lircd --driver=devinput --device=/dev/input/event1 --pidfile=/var/run/ --listen=9988
# lircd --driver=devinput --device=/dev/input/event2 --pidfile=/var/run/ --listen=9987
# lircd --driver=devinput --device=/dev/input/event3 --pidfile=/var/run/ --connect=localhost:9988 --connect=localhost:9987
  if test ! -e /dev/lircd; then ln -s /var/run/lirc/lircd /dev/lircd; fi     # check if symlink /dev/lircd  exists, if not then create one
  checkproc lircd
  if [ "$?" == 0 ]; then                                                     # check if lircd is actually running
    echo "sucess !";
    echo "could not start lircd";
    exit 1
case "$1" in
  checkproc lircd
  if [ "$?" == 0 ]; then
    echo -n "lirc is already running with pid: "
    pidof lircd
    exit 1;
    echo -n "starting lircd... ";
  rc_status -v1                           #  done-message
  checkproc lircd
  if [ "$?" == 0 ]; then
    echo "killing lircd"
    killproc lircd
    echo "lircd is not running"
  rc_status -v1
  checkproc lircd
  if [ "$?" == 0 ]; then
    echo -n "lircd is already running with pid: "
    pidof lircd
    echo "lircd will be killed"
    killproc lircd
  echo -n "starting lircd... ";
  rc_status -v1
  checkproc /usr/sbin/lircd
  if [ "$?" == 0 ]; then
    echo -n "lircd is running with pid: ";
    pidof lircd
    echo "lircd is not running";
  if test -e /dev/lircd; then 
    echo "/dev/lircd exists";
    echo "/dev/lircd does not exist";
  echo "Usage: $0 {start|stop|restart|status}";
  exit 1;

Programversion, Hardware

My infrared receiver is a Atric IR-Einschalter and a common noname univeral remote control. I tested the configuration file with openSUSE11.2 & lirc0.8.5