You'll need a configuration file for your remote control placed at /etc/lirc/lircd.conf. A number of devices have already been included, they can be found in /usr/share/lirc/remotes. If your specific device is not included, look on the LIRC site: [http://lirc.sourceforge.net/remotes/ list of remotes on the LIRC site]

+

You need a configuration file for your remote control placed at /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, look on the LIRC site for more devices: [http://lirc.sourceforge.net/remotes/ list of remotes on the LIRC site]

−

If so, download your file and save it as {{filename|/etc/lirc/lircd.conf}}

+

If you found a suitable configuration file, download and save it as {{filename|/etc/lirc/lircd.conf}}

−

If your device doesn't have already a config file, you'll have to create the file yourself with the command:

+

If your device doesn't have already a config file, you can create it yourself with the command:

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

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

Revision as of 17:03, 30 July 2011

LIRC stands for "Linux Infrared Remote Control", a program to use infrared devices (like your remote control from your TV) with linux.

Installation

First install LIRC with pacman:

# pacman -S lirc

This will also install the lirc-utils package as a dependency.

Serial receivers

Now there might be a problem: the module lirc_serial is build to use ttyS0 (COM1), if your device isn't connected to ttyS0, you'll 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 Template:Filename 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's build into the kernel you'll have to do the following (remember that it is build into the kernel, you will need to make some changes later too)

You'll 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 shouldn't 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 Template:Filename file. So start irw, point your remote and start pressing buttons.

The above procedure however has been simplified and probably won't work that easily. If you get errors in the above try the following:

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 Template:Filename. 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 Template:Filename 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 Template:Filename.

Making a configuration file

You need a configuration file for your remote control placed at /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, look on the LIRC site for more devices: list of remotes on the LIRC site

If you found a suitable configuration file, download and save it as Template:Filename

If your device doesn't have already a config file, you can create it yourself with the command:

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

Just follow the instructions. The resulting file, Template:Filename, should then be copied to Template:Filename. 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 Template:Filename:

Now load the daemons: add "start_lirc" and "lircd" to the daemons list in Template:Filename

Program specific

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 Template:Filename handy prior to running. It will then produce a sane Template:Filename 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 Template:Filename 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 Template:Filename 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.

Troubleshooting

Buttons processed several times when pressed

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 Template:Filename:
Template:File
You may also run that command as root to enable LIRC for your current session.

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

Configuration change

With a recent update, the configuration file for mceusb uses different names for the buttons. Existing lircrc configurations will fail as they are expecting different file names. If you don't want to change your button mappings in lircrc, then simply replace the contents of Template:Filename with the following configuration:
Template:File