LIRC is very nice package that lets any Linux box be controlled by almost any IR remote control.

Unfortunatly LIRC is a large package with many different parts, so there is a huge amount of documentation to read to get started, this is a ultra quick guide to get you started.

LIRC stack

  1. Application, typically configured via ~/.lircrc
  2. lircd, delivering data via /dev/lircd, configured in /etc/lircd.conf
  3. Hardware+Driver

The /etc/lircd.conf is what maps the IR signal timings returned by the hardware into remote control keys, it is generated using irrecord or fetched from the /usr/share/lirc/remotes/ tree if the remote is well known.

Perl application

There are a number of utilities to act on lirc events (irxevent and irexec) but I've found that configuring them is much harder than simply writing a perl application to what is needed when events come in:

use IO::Select;
use IO::Socket;

my $lirc = IO::Socket->new(Domain => &AF_UNIX,
			   Type    => SOCK_STREAM,
			   Peer    => '/dev/lircd' )
    or croak "couldn't connect to /dev/lircd: $!";
my $select = IO::Select->new();
$select->add($lirc);

while (1) {
    while ($select->can_read(0)) {
	my $line = <$lirc>;
	my ($hex, $repeat, $button, $remote) = split /\s+/, $line;
	
	lircHandler($button, $repeat);
    }
}
© Flemming Frandsen