08 November 2005

LIRC: installation guide for kernel 2.6.14

OK, after the nightmare of lirc installation last week I decided to write a guide, here it is, if you have any questions, ask me!!

First, download your kernel's source, if your using the plain vanilla kernel from debian's repository:
#apt-get install linux-image-2.6.14-1-k7 linux-headers-2.6.14-1-k7 linux-source-2.6.14

Now go to /usr/src/ and create a symlink (if there's an old one rm it!):
#ln -s /usr/src/linux-headers-2.6.14-1-k7 linux

Download the latest LIRC version (DON'T, I REPEAT, DON'T apt-get lirc, the package is old and doesn't work with newer kernels)

get it here: http://lirc.sourceforge.net/software/snapshots/lirc-0.7.3pre1.tar.bz2

bunzip and untar it, and execute the setup.sh

setup your device (here I use driver:serial io:0x3f8 irq:4)

Now go to "Save configuration & run configure" It must prepare the compilation (if any errors appear, you may have a unconfigured gcc or missing library)

#make

#make install

Perfect.

In order to test the setup, you may have to free the serial port:
#setserial /dev/ttyS0 uart none

Then you have to load the kernel module:
#modprobe lirc_serial

After that, load the deamon:
#lircd

And test the reception of commands:
#irw

Press some buttons on your remote, it must appear on the screen.

If it's ok, you must setup the definitive configuration. There's tons of config files that must be arranged in order to make lirc work in userspace, as well as deamon.
I don't remember which of the following files I edited by hand and which worked right out of the box when I run lirc's setup.
I advise to check them all.

First, there's a file called /etc/lircd.conf which contains all remote control codes for your remote. (mine is a JVC-RM-SED3SU)

Then there's /etc/lirc/hardware.conf:
--------------------------------
#Arguments which will be used when launching lircd
LIRCD_ARGS=""

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE="/dev/lirc"
MODULES="lirc_dev lirc_serial"

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
--------------------------------
/etc/lirc/lirc-modules-source.conf

# lirc-modules-source config file used by Debian GNU/Linux

# Space separated list of lirc kernel drivers to build
LIRC_MODULES="serial"

# Serial module configuration
LIRC_SERIAL_PORT="0x3f8"
LIRC_SERIAL_IRQ="4"
LIRC_SERIAL_CFLAGS=" -DLIRC_SERIAL_SOFTCARRIER"

# Sir module configuration
LIRC_SIR_PORT="UNCONFIGURED"
LIRC_SIR_IRQ="UNCONFIGURED"
LIRC_SIR_CFLAGS="UNCONFIGURED"

# Parallel module configuration
LIRC_PARALLEL_PORT="UNCONFIGURED"
LIRC_PARALLEL_IRQ="UNCONFIGURED"
LIRC_PARALLEL_TIMER="UNCONFIGURED"
--------------------------------
In /etc/modules I added:

lirc_serial
--------------------------------
In /etc/modules.conf:

### update-modules: start processing /etc/modutils/lirc
#This file is modified by lirc's maintainer scripts.
#Any 'options' line asociated with the selected hardware will be replaced.
#However 'add options' lines will be left alone, so you can use that for
#additional module parameters.
# ej:
# add options lirc_serial sense=0

options lirc_serial io=0x3f8 irq=4

### update-modules: start processing /etc/modutils/lirc_serial
alias char-major-61 lirc_serial
--------------------------------
the following is a dirty trick, most people say that this is a nasty practice, but I added to /etc/init.d/bootmisc.sh

setserial /dev/ttyS0 uart none
modprobe lirc_serial
lircd -n &

# the last line is set to "no deamon mode" because in my
# box lirc is not deamonizing well, but it is ok to start
# it in interactive mode
--------------------------------

Now, after all this mess, reboot your computer, go to a terminal:
and run "irw"
if lirc is working, when you press a key in your remote, it must show the remote's code on screen.

Then you're home free, the rest is just a matter of app configuration (mplayer, amarok, xmms, xine, whatever you like)

BUT, it is not working, well, try the following:
1) #cat /dev/lirc
if it shows a blank screen and when you press a button in your remote it dumps garbage on your terminal, well, the module is loaded properly and the problem seems to be the deamon.

2) If #cat /dev/lirc gets you a "cat: /dev/usb/lirc: No such device"
Then the module didn't load, try a #modprobe lirc_serial, and check the error, it may be the serial port busy (hence the setserial line in bootmisc.sh, try re-executing it)
When modprobing the module, you may get a error message indicating that the module is not compatible with your kernel, that's what happened with me, I was using a older version of lirc, and it wouldn't work (then I read this[1] and realized I needed to download the latest version of lirc to work with 2.6.14)

3) If cat /dev/lirc goes well:
then "modprobe lirc_serial", and if it goes well, then execute "lircd -n". Now try "irw" and press a button on your remote, it should dump information on your terminal.



[1] - Thank you Gavin!!!

From: Gavin Hamill
Subject: LIRC with 2.6.14 - 'Unknown symbol verify_area' in lirc_serial
Newsgroups: gmane.comp.hardware.lirc
Date: 2005-11-03 20:47:19 GMT

Hi :) Just installed 2.6.14 which has solved a problem I was having, but
needed to grab the lirc_serial.c from CVS to deal with the verify_area
issue.

May I suggest that a 0.7.2.1 release be made to avoid lots of 'I can't
get lirc working!!' messages in the near future? :)

Cheers,
Gavin.

07 November 2005

Kernel Upgrade.

Yes, finally I upgraded my kernel (I was using 2.6.8!) [1]

Well, the kernel migration went perfectly:

#apt-get install linux-image-2.6.14-1-k7 linux-headers-2.6.14-1-k7 linux-source-2.6.14

#vim /boot/grub/menu.lst (organized the entries, adding a vga=791 at the end of each kernel line, so I get a usable terminal at boot time)

reboot

OK.

uhm, lirc is not working, neither is X.

Lirc is expected to break everytime something changes the kernel (because, frankly speaking, lirc is a mess[2] of integration of kernel, deamon, device, and userspace binary)

Uh, X is not working, It may be a buggy driver, so I downloaded the driver from Nvidia's site (http://download.nvidia.com/XFree86/Linux-x86/1.0-7676/NVIDIA-Linux-x86-1.0-7676-pkg1.run). Executed it and went smoothly (I heard the old versions doesn't work with kernel 2.6.14)

Now getting back to lirc: I spend some 4 hours trying to make it work in several ways, with different sources, packages, methods and so on, but what I learned is that I need to get the last version of everything[3].

Now I just have to reinstall vmware, the rest seems to be working very well (remembered another thing, my USB is still using 1.1, because it is corrupting my thumbdrive every now and then, I have to update my BIOS and try with the new kernel)

[1] For reasons I may tell in the future.

[2] I'm no kernel specialist, but I find very frustrating trying to make lirc work, is it really necessary to integrate lirc and kernel so tightly?

[3] I will post a lirc installation soon (I Already wrote it, but I need to test again and see if the procedure is ok).

The SID's experience.

Sure, if you decide to use a unstable distribution you should expect it to break things every once in a while, but I was getting used to stability in Sid, so when things break I don't get very happy.

For instance, last week I did a "apt-get update && apt-get dist-upgrade" to keep my system up-to-date...

When I rebooted the computer, 3 things stopped working...

1) fancontrol:
Fancontrol is the program to reduce the coolers rotation when the cpu is cool enough.
It simply started pointing to the default temp and rotation sensors (the wrong ones), well, I just "pwmconfig" and it is ok again.

2) Lircd:
It seems that the deamon is stoping as soon as I start it, several tests later and I understood that is not the program that is not working but the deamonizing process.
So if I run "lircd" it doesn't work, but if I use "lircd -n" (nodeamon) it works perfectly, I checked the /etc/init.d/lircd and every configuration file I could remember. No hints whatsoever on what is wrong, google doesn´t know either, or I´m asking the wrong questions.

STILL UNSOLVED
I'm running it interactively.

3) SSHd;
Oddly enough, the problem is exacly the same as with lirc, the deamon just runs in interactive mode (nodeamon) [#/usr/sbin/sshd -D]

STILL UNSOLVED
I'm running it interactively.


That's why I upgraded the kernel...