Installation

The most of LIRC kernel drivers are already included in the mainline kernel. You need to install lirc package only, if your hardware requires lirc_atiusb, lirc_i2c or lirc_wpc8769l modules.

Serial receivers

Serial receivers that depend on lirc_serial

Make sure that your serial port is activated in the BIOS. There you can also set and lookup I/O address and IRQ settings of your ports.

Now there might be a problem: the module lirc_serial is build to use ttyS0 (COM1), if your device is not connected to ttyS0, you will have to either change the module-options or rebuild the LIRC module. If your device is connected to ttyS0, you can skip this step

To change the options for the lirc_serial module, you edit /etc/modprobe.d/modprobe.conf and add this line:

options lirc_serial io=0x2f8 irq=3

You should change the values after io and irq to reflect you serial port settings, the values above may work for you if you are using ttyS1 (COM2) to connect your IR-device. But you will find the correct values by checking dmesg:

Loading

Now try to load the serial module:

# modprobe lirc_serial

If this produces an error which says your serial port is not ready, you have the problem that your serial port support is build into the kernel and not as a module (in the default arch kernel it is build into the kernel)

If it is built into the kernel you will have to do the following (remember that it is built into the kernel, you will need to make some changes later too)

You will have to release the serial port:

# setserial /dev/ttySx uart none

(Replace x with your port number)

Load the module again:

# modprobe lirc_serial

Now it should not show any errors, and the modules lirc_serial should be listed in lsmod

USB receivers including most onboard devices

This outlines the general procedure, the mceusb module which is used by many devices is used as an example.

# modprobe mceusb

Start the LIRC daemon:

$ /etc/rc.d/lircd start

Test it with irw, it will output the commands received by the IR receiver that match your lircd.conf file. So start irw, point your remote and start pressing buttons.

The above procedure however has been simplified and may not work that easily. One of the reasons the lircd daemon may not be working is because it expects to be run at startup and needs root permissions because it will create device nodes in /dev. Try "man lircd" for more information.

Setup a HID device with LIRC

Some remotes are supported in the kernel where they are treated as a keyboard and mouse. Every button on the device is recognized as keyboard or mouse events which can be used even without LIRC. LIRC can still be used with these devices to gain greater control over the events raised and integrate with programs that expect a LIRC remote rather than a keyboard. As drivers are migrated to the kernel, devices which use to only be useable through LIRC with their own lirc.conf files become standard HID devices.

Some HID remotes actually simulate a USB infrared keyboard and mouse. These remotes show up as two devices so you need to add two LIRC devices to lircd.conf.

First we need the /dev/input device for our remote:

$ ls /sys/class/rc/rc0

One of the files should be input#, where the number matches the event# of the device. (To clarify you can check that directory, it will have an event# file.

Note: If you have more than one ir device then there may be multiple directories under /sys/class/rc. Under event#cat name to verify which device you are looking at.

then go to /dev/input/by-id

$ ls -l /dev/input/by-id

You should find a file that symlinks to the input# above, and possibly others with a similar names for mouse events.

Note: Here we set up a LIRC device with the id 3353_3713, you should replace it with your own device input event name, whatever it is.

The latest version of the config file for HID remotes exists in the LIRC git repository [1]. Simply save it as /etc/lirc/lircd.conf.

In order to launch the LIRC daemon for HID remote, You must enable evdev module first

# modprobe evdev

Note: LIRC 0.8.6 has changed the default socket location from /dev/lircd to /var/run/lirc/lircd, but many applications still look for the socket in the old location. Since lirc-utils 0.8.6-3 the /etc/rc.d/lircd script creates a symlink from /dev/lircd to the /var/run/lirc/lircd socket when it starts the lircd daemon and removes the link when the daemon is stopped.

Other receivers

There are many receivers that do not need any kernel module at all. This applies to any type of receiver, including serial receivers and usb receivers. Check the next link to see what kernel modules you need to load, if any:

Checking module based receivers

NOTE: This section only applies if your device requires a lirc_[driver] kernel module.

Before you start using lirc, you should check if your receiver is working, and if there is IR interference. Possible sources of interference include monitors/televisions (especially plasma displays), fluorescent lamps and direct or ambient sunlight. Start the following command to display raw receiver input.

# mode2 -d /dev/lirc0

If you press buttons on any IR remote, you should see a series of pulses and spaces. If there is very frequent output without pressing buttons on your remote, your receiver suffers from interference. You want to avoid such interference, e.g. by placing the receiver behind or under your plasma tv.

If you can't make out where the interference is coming from, you can try to put a cardboard roll right in front of the receiving diode, so that it only gets light from a specific direction. Invoke mode2 as above. Then point at different locations till you receive IR noise.

LIRC daemon configuration

The lircd configuration lives under /etc/conf.d/lircd.conf, and it is all you need to setup your device if it does not require any special kernel module.

Making a configuration file

You need a configuration file for your remote control copied or symlinked to /etc/lirc/lircd.conf. A number of devices have already been included with the lirc package, they can be found in /usr/share/lirc/remotes. If your specific device is not included, the LIRC site offers configuration files for a large number of extra devices.

If your device does not already have a config file, you can create it yourself with the following command. You should avoid interference (see above) while creating the config file.

# irrecord -d /dev/lirc0 /tmp/my_remote

Just follow the instructions. To get a list of valid button names, refer to the output of

# irrecord --list-namespace

The resulting file, /tmp/my_remote, should then be copied to /etc/lirc/lircd.conf. If you want to use several remotes, you repeat the irrecord step with each remote and different filenames, and then concatenate all the resulting files into /etc/lirc/lircd.conf:

Note: As of lirc-0.8.6 the default location of lircd, lircmd and lircrcd config files was moved to /etc/lirc/lircd.conf, /etc/lirc/lircmd.conf and /etc/lirc/lircrc. If the config files are not found in that location, they are still searched at the old location in /etc/.

Now load the daemons: add "start_lirc" and "lircd" to the daemons list in /etc/rc.conf

Program specific configuration

Generate your own lircrc with Mythbuntu's lircrc-generator

mythbuntu-lircrc-generator is intended to be started from a system with LIRC installed. It requires that you choose a remote via the LIRC package or have a lircd.conf handy prior to running. It will then produce a sane .lircrc for the current user.

Enable LIRC support in xine

Now LIRC works, but you have no program that can communicate with LIRC. This section will explain how to make xine work, but you can use xmms and mplayer (and probably a lot of other programs too) to work with LIRC.

Configure xine to use LIRC

Now, in order to have a functioning xine+lirc, edit the .lircrc file to your preferences.

However, you may choose to configure LIRC to control more than just xine. If this is the case, you will need to manually edit the .lircrc file, and add elements.

Xine-ui
Mplayer
Totem
Vlc
Rhythmbox

All work with LIRC, but you must enable LIRC support in the program in some cases, such as VLC. Simply copy the vlc packagebuild and edit it so that "--enable-lirc" is one of the compile options for VLC not FFMPEG!

Configure Amarok2 to use LIRC

Depending on your controller model, the following configuration works with Amarok2-svn. This configuration file will work with the MCEUSB controller.

4. We still need the default tmpfiles to be created, so copy that config file to /etc/tmpfiles.d/lirc.conf.

# cp -a /usr/lib/tmpfiles.d/lirc.conf /etc/tmpfiles.d/lirc.conf

5. Create a .lircrc file in your home directory for your user or a /etc/lirc/lircrc file for system wide use.

6. Have your service start at boot and then test with a reboot

# systemctl enable lirc.service
# systemctl reboot

or load the module and start the lirc.service.

# modprobe lirc_serial
# systemctl start lirc.service

Receivers that do not depend on a kernel module

Usually, you only need to specify your the device where the receiver is plugged in and the lirc driver. This is an example for pinnacle or miro serial receivers):

LIRC_DEVICE="/dev/ttySX"
LIRC_DRIVER="pinsys"

Then, start lircd daemon and create the remote/s configuration (/etc/lirc/lircd.conf), either by copying one of the configured defaults that comes with lirc-utils or by using irrecord. Even if you find your remote in the list of preconfigured remotes it might not work so you will have to use irrecord anyway.

After this you can use irw to check the remote, create your ~/.lircrc to assign remote buttons to actions and start irexec if you need to run arbitrary commands.

Troubleshooting

Buttons processed several times when pressed

Problem in module ir_core which processes IR commands with LIRC at the same time. Simply blacklist it by creating the following file:

/etc/modprobe.d/remote_blacklist.conf

# Prevent processing button several times when pressed
blacklist ir_core

After upgrading or installing Arch, an existing configuration stopped working

Kernel module change

As of kernel 2.6.36, LIRC modules have been included in the kernel. Arch's lirc package has included the older kernel modules, which work with lircd without any additional configuration. However, a recent update removed those older modules, which results in the stock kernel modules being used. Unfortunately, these kernel modules treat the remote as a keyboard by default, which is incompatible for lircd. To correct this, put the following line to /etc/rc.local:

/etc/rc.local

echo lirc > /sys/class/rc/rc0/protocols

You may also run that command as root to enable LIRC for your current session.

Systemd has moved away from rc.local. It is possible to use tmpfiles.d (read "man tmpfiles.d") to run the command echo lirc > /sys/class/rc/rc0/protocols. Create the file /etc/tmpfiles.d/lirc-protocols.conf:

/etc/tmpfiles.d/lirc-protocols.conf

w /sys/class/rc/rc0/protocols - - - - lirc

Note: It is also a good idea to remove the old LIRC kernel module from your MODULES array in /etc/rc.conf, as it is no longer present.

Problems using default systemd lirc.service file

There is a bug in lirc-utils that makes lirc.service ignore /etc/conf.d/lircd.conf. See FS#31890.

/var/log/lirc shows error finding /dev/lirc:

lircd: could not get file information for /dev/lirc

Workaround: make a symbolic link for /dev/lirc that points to /dev/lirc0 with file