LIRC on Debian Etch

From MythTV Official Wiki
Revision as of 03:53, 21 March 2008 by Lindylex (talk | contribs) (Manually building LIRC from source)

Jump to: navigation, search

Install Debian GNU/Linux 4.0

First, you can read about installing MythTV on Debian Etch here: Installing MythTV on Debian Etch

Add LIRC to Debian GNU/Linux 4.0

Using the Debian packages

The out-of-the-box packages from Debian GNU/Linux 4.0 do not provide a complete set to start LIRC. In fact, a pre-compiled lirc-modules-XXX.deb package is missing in the distribution. Therefor, we are going to build this one ourselves using the Debian tooling.

First step: install the base LIRC packages:

apt-get install lirc lirc-modules-source

Now extract the source in the linux source tree:

cd /usr/src
tar -xvzf lirc-modules.tar.gz

If you don't have your linux kernel sources available install them as well:

apt-get install linux-source-$(uname -r) linux-headers-$(uname -r)

This should provide you with the kernel sources for your running kernel. Now proceed with the installation of the linux kernel build tooling from Debian:

apt-get install kernel-package

This will insure you have your debian system correctly setup to build modules, it also creates the symlink /usr/src/linux to the correct header directory. if you don't have m-a command, install it using apt-get install module-assistant

m-a update,prepare

Now you have everything you need to build the required lirc-modules package. Proceed with configuring your required lirc modules using:

dpkg-reconfigure lirc-modules-source

As example, for a MCE remote you need to check 'gpio', 'i2c' and 'mceusb'. The tool will give the opportunity to build the modules automagically. Re-run the step above if you need to change the required modules, or need to build modules for a newer kernel revision.

To build modules:

m-a a-i lirc

Wait for the build to complete and see in /usr/src for the resulting lirc-modules-XXX.deb package. Install that one using:

dpkg -i /usr/src/lirc-modules-*.deb

Now load the base module:

modprobe lirc_i2c

And try to start the LIRC daemon:

/etc/init.d/lirc start

and you have a complete LIRC installation on your system. You may need to add the 'lirc_i2c' module to the file /etc/modules to make it auto-load.

Manually building LIRC from source

Download lirc from http://www.lirc.org/software.html then follow the instructions in the INSTALL file. As of 0.8.2, the steps are to run the following commands in the extracted directory (I have added the command to install the required 'dialog' package):

You need to download the latest LIRC source, it will be the first link at the top. As of 2008/March/20 it is lirc-0.8.2.tar.bz2. Download it and save it to /tmp directory.

You will need to uncompress the .bz2

 cd /tmp
 tar -xvjf lirc-0.8.2.tar.bz2
 cd /tmp/lirc*

The folder name lirc-0.8.2 will changes as they release newer versions.

 apt-get install dialog
 ./setup.sh && make install

You will then need to load the module:

 depmod -a
 modprobe lirc_i2c

You will then need to make a device file usable by the mythtv user:

chmod 666 /dev/lircd

You will then need to start lircd (the first command checks to make sure the device files are there, and the second command may require you to add '-d /dev/lirc0' substituting the ? with a number, which will probably be 0)

ls /dev/lirc*
/dev/lirc  /dev/lirc0  /dev/lircd  /dev/lircm

Testing

To test your work, run (include the '-d /dev/lirc0' if you needed to include this in running lircd):

 mode2

Now press a few buttons on your remote while aiming it at the receiver. You should see some text spit out on your screen. If you don't, then something isn't working.

You will then need to get a lircrc file, and a lircd.conf:. These files will reside in the following locations:

 /home/mythtv/.lircrc
 /home/mythtv/.mythtv/lircrc
 /etc/lirc/lircrc
 /etc/lirc/lircd.conf

There is a complete collection of all supported configs available at http://lirc.org/remotes.tar.bz2 and there is also a site that will help you create these files at http://lircconfig.commandir.com/