Posts Tagged ‘lirc’

Update to Configuring Your MCE IR Remote

Tuesday, August 11th, 2009

Just made a quick update to the Configuring Your MCE IR Remote post. I have added in Audio Delay + and - to the mplayer lirc config. This allows you to control the audio / video sync with the Blue and Yellow buttons on your MCE remote. I had quite a few films that have the audio out of sync so this can now be sorted without reaching for the keyboard :)

Configuring Your MCE IR Remote

Monday, February 9th, 2009

You can use the keyboard to control absouletly everything in MythTV but it’s not that practical once the lights are out and you’re mid movie. So one of the first things I was looking to do is get my Microsoft MCE remote working just the way I wanted.

For some background info you might want to check out the MCE Remote section of the MythTV wiki here.

MythTV does a pretty good job of setting up some defaults for the buttons but, if like me you’ve come from a Windows MCE system you may fine the lirc config files and associated script below useful.

These configs do four things above the functionality MythTV provides out of the box:

  1. Start / Restart mythfrontend when “the big green button” is pressed (handy if the frontend ever misbehaves)
  2. Cycle through subtitles when watching TV or movies in mplayer
  3. Make the Red button behave as expected for interactive TV. Green, Yellow, Blue and Teletext also act as they should.
  4. Make other buttons behave as a Windows MCE user would expect.

Here’s how all the buttons will function once everything is set up:

MCE Remote Mappings

MCE Remote Mappings


Girlfriend proof it

A small tip which helps with the gf factor is removing the exit and shutdown menu when the back button is pressed from the main menu. To do this, in the frontend go to “Utilities / Setup” -> “Setup” -> “General”. Go to the fourth screen with the title of  “General” and change the “System Exit Key” to “No exit key”. You can always exit the frontend with “alt F4″ if you need to.

Bash script to start / restart the frontend

The first thing to do is setup the bash script which will start or restart the MythTV frontend application when the big green button on your remote is pressed. Copy the script below and put it in a new file in your home directory.  I put mine in ~/mythtv/runmyth

#!/bin/sh
RUNNING=0;
 
for x in `ps -C mythfrontend.re | grep -v PID` end; do
    test $x != 'mythfrontend.re' && continue
    RUNNING=1;
done
 
if [ $RUNNING = 1 ]; then
  #kill the process
   kill -9 `ps -aef | grep 'mythfrontend.re' | grep -v grep | awk '{print $2}'`
  #start it up again
  `mythfrontend &`
else
  `mythfrontend &`
fi

Don’t forget to make it executable

chmod 777 runmyth

lirc config files
Now that’s out the way here follows the lirc files for MythTV and mplayer. They should go into ~/.lirc/mythtv and ~/.lirc/mplayer respectively. Make sure the runmyth script path is defined correctly on line four of the mythtv lirc file.

mythtv

begin
    prog = irexec
    button = Home
    config = /home/colin/mythtv/runmyth &;
end
 
begin
    remote = mceusb
    prog = mythtv
    button = LiveTV
    config = %
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = RecTV
    config = ;
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = DVD
    config = m
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Red
    config = F2
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Green
    config = F3
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Yellow
    config = F4
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Blue
    config = F5
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Teletext
    config = F6
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Clear
    config = w
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Star
    config = T
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Record
    config = R
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Seven
    config = 7
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Right
    config = Right
    repeat = 3
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Mute
    config = |
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Skip
    config = Right
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = One
    config = 1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Down
    config = Down
    repeat = 3
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Zero
    config = 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Replay
    config = Left
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Pause
    config = P
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Six
    config = 6
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Two
    config = 2
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = ChanDown
    config = Down
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = ChanUp
    config = Up
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Rewind
    config = <
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Forward
    config = >
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Play
    config = P
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = VolDown
    config = [
    repeat = 1
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Stop
    config = Escape
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Back
    config = Escape
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = VolUp
    config = ]
    repeat = 1
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Five
    config = 5
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = More
    config = I
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Four
    config = 4
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = OK
    config = Return
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Up
    config = Up
    repeat = 3
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Nine
    config = 9
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Three
    config = 3
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Enter
    config = Enter
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Eight
    config = 8
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Guide
    config = S
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Left
    config = Left
    repeat = 3
    delay = 0
end

mplayer

begin
    remote = mceusb
    prog = mplayer
    button = Play
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Star
    config = sub_select
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Blue
    config = audio_delay 0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Yellow
    config = audio_delay -0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = ChanDown
    config = panscan -0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = ChanUp
    config = panscan +0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Pause
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = OK
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Power
    config = quit
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Mute
    config = mute
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = VolDown
    config = volume -1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Skip
    config = seek +15 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Enter
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Stop
    config = quit
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Up
    config = seek +60 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = VolUp
    config = volume +1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Down
    config = seek -60 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Replay
    config = seek -15 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Right
    config = seek +6 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Rewind
    config = seek -30 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Forward
    config = seek +30 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Home
    config = vo_fullscreen
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Left
    config = seek -6 0
    repeat = 0
    delay = 0
end