Lirc on Ubuntu Dapper

From MythTV

Jump to: navigation, search

Incomplete, needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page

The LIRC on Ubuntu Dapper HOWTO is a step-by-step guide for installing the Linux Infrared Remote Control drivers on Ubuntu Linux 6.06 LTS. It borrows heavily from the LIRC section of the Ubuntu Hoary Installation HOWTO and the now defunct Abarbaccia HOWTO

Note: See Ubuntu Installation Guides for installing on other Ubuntu versions.

Contents

Supported Hardware

  • Hauppauge WinPVR 150/250/350/500 (non-MCE edition) capture cards.

Confirmed Working Remotes

  • Grey (A415-HPG) Hauppauge remote with the 4 color buttons at the bottom.

Note: Please add your remote to the list above if this HOWTO works for you.

Install LIRC driver

Setup build environment

You already have almost everything needed to build the LIRC modules from when you built the IVTV modules, so if you haven't already built them, go do it now.

 apt-get install ncurses-dev lirc

Now download and install the driver. As of this writing, the latest version is 0.8.1. See the LIRC homepage or the project's Sourceforge download page

 wget http://umn.dl.sourceforge.net/sourceforge/lirc/lirc-0.8.0.tar.bz2
 tar -xjvf lirc-0.8.1.tar.bz2 -C /usr/src
 cd /usr/src/lirc-0.8.1

Compile driver module

Before we can compile, we'll need to tell LIRC which type of IR reciver/blaster we have. Do a

 ./configure

and select 1: Driver Configuration -> 5: TV Card -> g: Hauppage TV card. Scroll down to 3: Save configuration & run configure and wait for configure to finish building the makefiles. Once that's done, do

 make
 make install

Assuming there were no errors, do a

 depmod -a

then look for the following files:

 ls /lib/modules/`uname -r`/misc
 lirc_dev.ko  lirc_i2c.ko

If either file is missing, read through the make output and look for any errors that might explain the problem.

Testing LIRC

Load the driver module into the kernel and make sure it sees your IR hardware.

 modprobe lirc_i2c
 dmesg | grep lirc

On a Hauppauge 150, the output looks like this:

 lirc_i2c: chip found @ 0x71 (Hauppauge IR (PVR150))
 ivtv0: i2c attach to card #0 ok [client=Hauppauge IR (PVR150), addr=71]
 lirc_dev: lirc_register_plugin: sample_rate: 10

Next, we'll check if LIRC can see the raw pulses from your remote. Run the driver test app

 mode2

and push a few buttons on the remote. Don't worry if you get 2 different codes for the same button, the second one means that that button is still down. If everything is working, you should see something like:

 code: 0x17a5
 code: 0x17a5
 code: 0x1fa5
 code: 0x1fa5

Hit CTRL-C to stop mode2.

Loading LIRC at boot

Now it's time to tell the system to load LIRC when it boots. Add lirc after ivtv in your /etc/modules file.

 echo "lirc_i2c" | tee -a /etc/modules

Edit /modprobe/aliases

 nano -w /etc/modprobe.d/aliases

Scroll down to the char-major section until you find where char-major-61 would go (it's not there yet) and add the line

 alias char-major-61 lirc_i2c

Unless you want to add the mythtv user to the root group (bad idea), we'll need to modify the UDEV rule that comes with the LIRC source

 nano -w /usr/src/lirc-0.8.1/contrib/lirc.rules

Add the text , MODE="0666" to make the file look like this.

 KERNEL="lirc[0-9]*",    NAME="lirc/%n", MODE="0666"

Copy the UDEV config file to the correct location

 cp /usr/src/lirc-0.8.1/contrib/lirc.rules /etc/udev/rules.d/90-lirc.rules

If you are using LIRC<= 0.8.0, copy the /etc config files to the correct location. Note: 0.8.1 users can skip this step:

 cp /etc/lircmd.conf /etc/lirc/
 cp /etc/lircd.conf /etc/lirc/

And reboot. When the system comes back up, login and run the remote-decoder app

 irw

and push a few buttons on the remote. Don't worry if you get several copies of the same button, this is normal. If everything is working, you should see something like:

 0000000000001794 00 Up Hauppauge_350
 0000000000001794 01 Up Hauppauge_350
 0000000000001794 02 Up Hauppauge_350
 0000000000001797 00 Right Hauppauge_350
 0000000000001797 01 Right Hauppauge_350
 0000000000001797 02 Right Hauppauge_350
 00000000000017a5 00 OK Hauppauge_350

Hit CTRL-C to stop irw.

Configure Remote

Before we can load a remote-control configuration into MythTV, we'll need to finish installing it. Go back to the Main HOWTO and finish installing MythTV.

Now that we have Myth installed and running, it's time to tell it what buttons do what. Getting this exactly right is a matter of personal preference. Copy and paste the following file into your favorite text editor and tweak to your heart's delight.

Example .lircrc Config File

# ~/.mythtv/lircrc
#
# MythTV native LIRC config file for the new grey Hauppauge remote
#
# By Chris Hunter
#
# Modified from Brad Tempelton's which came from Jarod Wilson's 
# which came from Jeff Campbell's
# 


# Here we have the jump point commands.  They only work if you have
# defined function keys for these jump points.  For me the most
# common command is the menu of recordings, so I put that on "videos"
# even though that's counter-intuitive

begin
prog = mythtv
button = TV
repeat = 2
config = F5
end

begin
prog = mythtv
button = Videos
repeat = 2
config = F2
end

# Not yet defined
begin
prog = mythtv
button = Music
repeat = 2
config = Up
end

begin
prog = mythtv
button = Pictures
repeat = 2
config = F
end

begin
prog = mythtv
button = Guide
repeat = 2
config = F3
end

# I stuck the "todo" list on here as Myth has no radio function
begin
prog = mythtv
button = Radio
repeat = 2
config = F4
end

begin
prog = mythtv
button = Up
repeat = 2
config = Up
end

begin
prog = mythtv
button = Down
repeat = 2
config = Down
end

begin
prog = mythtv
button = Left
repeat = 2
config = Left
end

begin
prog = mythtv
button = Right
repeat = 2
config = Right
end

# OK/Select
begin
prog = mythtv
button = Ok
config = Space
end

# Play
begin
prog = mythtv
button = Play
config = Return
end

# Stop
begin
prog = mythtv
button = Stop
config = I
end

# Escape/Exit/Back
begin
prog = mythtv
button = Back/Exit
config = Esc
end

# Bring up Options Menu
begin
prog = mythtv
button = Power
config = M
end

# Pause
begin
prog = mythtv
button = Pause
repeat = 2
config = P
end

# Mute
begin
prog = mythtv
button = Mute
repeat = 2
config = |
end

# Rewind (10 sec default)
begin
prog = mythtv
button = Rewind
repeat = 2
config = <
end

# Fast Forward (30 sec default)
begin
prog = mythtv
button = Forward
repeat = 2
config = >
end

# Skip to next cutpoint
begin
prog = mythtv
button = SkipForward
repeat = 2
config = End
end

# Skip backward (10 min default)
begin
prog = mythtv
button = Replay/SkipBackward
repeat = 2
config = Home
end

# Record
begin
prog = mythtv
button = Record
repeat = 2
config = R
end

# Edit Cutpoints
begin
prog = mythtv
button = Red
repeat = 2
config = E
end

# Decrease play speed
begin
prog = mythtv
button = Green
repeat = 2
config = J
end

# Menu/Info = Info
begin
prog = mythtv
button = Menu/i
repeat = 2
config = I
end

# Scroll up
begin
prog = mythtv
button = Ch+
repeat = 2
config = PgUp
end

# Scroll down
begin
prog = mythtv
button = Ch-
repeat = 2
config = PgDown
end

# Return to the main menu
# Must remap CTRL+M to main menu under Keys for this to work
begin
prog = mythtv
button = Go
repeat = 2
config = Ctrl+M
end

# Change display aspect ratio
begin
prog = mythtv
button = Prev-Channel
repeat = 2
config = W
end

# double speed watch
begin
prog = mythtv
button = Yellow
repeat = 2
config = J
end

# change CC modes 
begin
prog = mythtv
button = #
repeat = 2
config = T
end

# Bring up Time stretch
begin
prog = mythtv
button = Blue
repeat = 2
config = A
end

# Numbers 0-9

begin
prog = mythtv
button = 0
repeat = 2
config = 0
end

begin
prog = mythtv
button = 1
repeat = 2
config = 1
end

begin
prog = mythtv
button = 2
repeat = 2
config = 2
end

begin
prog = mythtv
button = 3
repeat = 2
config = 3
end

begin
prog = mythtv
button = 4
repeat = 2
config = 4
end

begin
prog = mythtv
button = 5
repeat = 2
config = 5
end

begin
prog = mythtv
button = 6
repeat = 2
config = 6
end

begin
prog = mythtv
button = 7
repeat = 2
config = 7
end

begin
prog = mythtv
button = 8
repeat = 2
config = 8
end

begin
prog = mythtv
button = 9
repeat = 2
config = 9
end

begin
prog = mythtv
button = VOL-
repeat = 2
config = [
end

begin
prog = mythtv
button = VOL+
repeat = 2
config = ]
end

### MPlayer lirc setup

# Show OSD
begin
prog = mplayer
button = Menu/i
repeat = 2
config = osd
end

# Pause playback
begin
prog = mplayer
button = PAUSE
repeat = 2
config = pause
end

# Skip ahead a minute if playing
# If paused, resume playing
begin
prog = mplayer
button = PLAY
repeat = 2
config = seek +1
end

# Stop playback and exit
begin
prog = mplayer
button = STOP
repeat = 2
config = quit
end

# Mute
begin
prog = mplayer
button = MUTE
repeat = 2
config = mute
end

# Seek back 10 seconds
begin
prog = mplayer
button = REW
repeat = 2
config = seek -10
end

# Seek forward 30 seconds
begin
prog = mplayer
button = FFW
repeat = 2
config = seek +30
end

# Quit
begin
prog = mplayer
button = BACK/EXIT
repeat = 2
config = quit
end

# Seek forward 10 minutes
begin
prog = mplayer
button = SKIP
repeat = 2
config = seek +600
end

# Seek backward 10 minutes
begin
prog = mplayer
button = REPLAY
repeat = 2
config = seek -600
end

# Toggle full-screen
begin
prog = mplayer
button = FULL
repeat = 2
config = vo_fullscreen
end

### Xine lirc setup

begin
prog = xine
button = Play
repeat = 2
config = Play
end

begin
prog = xine
button = Stop
repeat = 2
config = Stop
end

begin
prog = xine
button = Power
repeat = 2
config = Quit
end

begin
prog = xine
button = Pause
repeat = 2
config = Pause
end

begin
prog = xine
button = Up
repeat = 2
config = EventUp
end

begin
prog = xine
button = Down
repeat = 2
config = EventDown
end

begin
prog = xine
button = Left
repeat = 2
config = EventLeft
end

begin
prog = xine
button = Right
repeat = 2
config = EventRight
end

begin
prog = xine
button = OK
repeat = 2
config = EventSelect
end

begin
prog = xine
button = Back/Exit
repeat = 2
config = Menu
end

begin
prog = xine
button = Forward
repeat = 2
#config = SpeedFaster
config = SeekRelative+60
end

begin
prog = xine
button = Rewind
repeat = 2
#config = SpeedSlower
config = SeekRelative-60
end

begin
prog = xine
button = Vol+
repeat = 2
config = Volume+
end

begin
prog = xine
button = Vol-
repeat = 2
config = Volume-
end

begin
prog = xine
button = Mute
repeat = 2
config = Mute
end

begin
prog = xine
button = Menu/i
repeat = 2
config = RootMenu
end

begin
prog = xine
button = SkipForward
repeat = 2
config = EventNext
end

begin
prog = xine
button = Replay/SkipBackward
repeat = 2
config = EventPrior
end

begin
prog = xine
button = Go
repeat = 2
config = OSDStreamInfos
end

begin
prog = xine
button = Red
repeat = 2
config = Quit
end

begin
prog = xine
button = #
repeat = 2
config = >
end

begin
prog = xine
button = Asterix
repeat = 2
config = <
end
Personal tools