LircHowto

Note

This HOWTO (at least the installation part) does not apply on a more recent Ubuntu version (Gutsy 7.10 and newer). You can just execute 'aptitude install lirc' from a terminal to install it.

Contents

LIRC is a package that allows you to decode and send infra-red signals of many (but not all) commonly used remote controls.

Warning ! due to some bug into lirc-modules-source, lirc-0.7.3pre1 won't compile on dapper. more informations at https://launchpad.net/distros/ubuntu/+source/lirc/+bug/5343

Prepare the kernel source

  • install the kernel source package:
    •    sudo apt-get install linux-source-2.6.12
  • install setserial (this is needed to free the port)
    •    sudo apt-get install setserial
  • run the following command to setup the kernel for compiling the modules:
    •    cd /usr/src
         tar xjvf linux-source-2.6.12.tar.bz2
         ln -s linux-source-2.6.12 linux
         cd linux
         cp /boot/config-2.6.12-9-386 .config
         
         make oldconfig
         make include/linux/version.h
         
         #this line is only need to create the file "/usr/src/linux/include/asm/param.h" that is needed
         # by the installation (and perhaps some more files). You don't have to compile all of the modules, just 
         # hit Ctrl+C after a minute or so.
         make modules

Install Lirc

  • download the lirc source:
    •    wget http://lirc.sourceforge.net/software/snapshots/lirc-0.7.3pre1.tar.bz2
  • install:
    •    cd /usr/src
         tar xjvf ~/downloads/lirc-*.tar.bz2
         cd lirc-0.7.3pre1
         ./setup.sh
  • configuration (inside setup.sh):
    • This is the configuration for a simple DCD serial reciever:
    • 1. Driver Configuration:
      • 1. Home-brew (16x50 UART compatible serial port)
      • 1. COM1 (0x3f8, 4)
      • Driver specific options:
        • 1. With transmitter diode = YES
        • 2. Software generated carrier = YES
        • 3. Igor Cesko's variation = NO
    • 2. Software configuration:
      • 1. Compile tools for X-Windows = YES
    • 3. Save configuration & run configure

  • run make and make install
    •    make
         make install
  • free the serial port: (if your reciever is a serial device)
    •    setserial /dev/ttyS0 uart none

Get configuration files from the lirc ubuntu package

  • download the lirc package:
    •    sudo apt-get -d install lirc
  • extract the package and copy the files to the correct places:
    •    cd /tmp
         dpkg -x /var/cache/apt/archives/lirc_0.7.0.1-1ubuntu3_i386.deb lircdeb
         cd lircdeb/etc
         sudo cp -R * /etc
  • create symlinks for lircd and lircmd:
    •    cd /usr/sbin
         sudo ln -s ../local/sbin/lirc* .
  • create a symlink for lircd.conf:
    •    cd /etc
         sudo ln -s lirc/lircd.conf .

Configuration

  • put the remote control configuration file in /etc/lirc/lircd.conf
  • edit "lirc/hardware.conf" and set these variables: (change "MODULES" to fit the module for your device)
    •    DRIVER="default"
         DEVICE=""
         MODULES="lirc_dev lirc_serial"
  • to make lirc run on startup:
    •    sudo update-rc.d lirc defaults
  • to make irexec run on startup (irexec handles the button mapping):
    • goto System\Preferences\Sessions\Startup_Programs
    • add "irexec" to the list

Test

  • to see if it's working run:
    •    irw
      and try pressing buttons in your remote control, you should see something like this:
         000000000000c230 00 > jvc-lp20337-004-vcr
         000000000000c230 00 > jvc-lp20337-004-vcr
         000000000000c230 01 > jvc-lp20337-004-vcr
         000000000000c230 02 > jvc-lp20337-004-vcr

Map buttons

  • create a file called ~/.lircrc (this file configures what every key does),
    • here is a sample ~/.lircrc file to control mplayer, beep-media-player and volume:
    •    #Mplayer buttons
         begin
              button = VOL+
              prog = mplayer
              config = volume 1
              repeat = 1
         end
         begin
              button = VOL-
              prog = mplayer
              config = volume -1
              repeat = 1
         end
         begin
              button = ||
              prog = mplayer
              config = pause
         end
         begin
              button = Prog+
              prog = mplayer
              config = pt_step 1
         end
         begin
              button = Prog-
              prog = mplayer
              config = pt_step -1
         end
         begin
              button = MENU
              prog = mplayer
              config = vo_fullscreen
         end
         begin
              button = 1
              prog = mplayer
              config = seek -10
         end
         begin
              button = 4
              prog = mplayer
              config = seek -60
         end
         begin
              button = 3
              prog = mplayer
              config = seek 10
         end
         begin
              button = 6
              prog = mplayer
              config = seek 60
         end
         begin
              button = 7
              prog = mplayer
              config = audio_delay +0.1
         end
         begin
              button = 9
              prog = mplayer
              config = audio_delay -0.1
         end
         
         #Beep-Media-Player Control
         begin
             button = >
             prog = irexec
             config = beep-media-player --play-pause
             repeat = 0
         end
         
         begin
             button = >>
             prog = irexec
             config = beep-media-player --fwd
         end
         
         begin
             button = <<
             prog = irexec
             config = beep-media-player --rew
         end
         
         begin
             button = #
             prog = irexec
             config = beep-media-player --stop
         end
         
         #Volume
         begin
             button = Start+
             prog = irexec
             config = aumix -v+5
             repeat = 0
         end
         
         begin
             button = Start-
             prog = irexec
             config = aumix -v-5
             repeat = 0
         end
  • for more information about .lircrc see http://www.lirc.org/html/configure.html


CategoryHardware

LircHowto (last edited 2008-10-23 20:45:15 by 81-234-79-9-no121)