SMPlayer, Lirc, and IRExec on Ubuntu Karmic

I used to use lirc with mplayer to allow my Packard Bell crappy remote to work awesomely, but I have since lost that configuration and switched to smplayer, since it’s awesome.  Today, I figured out how to control smplayer using similar means.

  • sudo apt-get install lirc
  • Make your /etc/lirc/lircrc look like this:

##### GLOBAL #####
begin
  flags = startup_mode
  mode = smplayer
end

begin
  remote = PackBell
  button = Aux1
  mode = smplayer
end

begin
  button = Mute
  prog   = irexec
  repeat = 0
  config = amixer sset 'Master' toggle
end
begin
  button = VolUp
  prog   = irexec
  repeat = 2
  delay = 1
  config = amixer sset 'Master' 1+
end
begin
  button = VolDown
  prog   = irexec
  repeat = 2
  delay = 1
  config = amixer sset 'Master' 1-
end

##### MPLAYER #####
begin smplayer
  begin
      remote = PackBell
      prog = irexec
      button = Down
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action rewind2); fi
      repeat = 3
      delay = 1
  end

  begin
      remote = PackBell
      prog = irexec
      button = Up
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action forward2); fi
      repeat = 3
      delay = 1
  end

  begin
      remote = PackBell
      prog = irexec
      button = Right
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action forward1); fi
      repeat = 3
      delay = 1
  end

  begin
      remote = PackBell
      prog = irexec
      button = Left
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action rewind1); fi
      repeat = 3
      delay = 1
  end

  begin
      remote = PackBell
      prog = irexec
      button = Display
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action fullscreen); fi
      repeat = 0
      delay = 0
  end

  begin
      remote = PackBell
      prog = irexec
      button = CHUp
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action next_subtitle); fi
      repeat = 3
      delay = 0
  end

  begin
      remote = PackBell
      prog = irexec
      button = CHDown
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action next_audio); fi
      repeat = 3
      delay = 0
  end

  begin
      remote = PackBell
      prog = irexec
      button = LMB
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action pl_prev); fi
      repeat = 3
      delay = 0
  end

  begin
      remote = PackBell
      prog = irexec
      button = RMB
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action pl_next); fi
      repeat = 3
      delay = 0
  end

  begin
      remote = PackBell
      prog = irexec
      button = Zero
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action next_aspect); fi
      repeat = 3
      delay = 0
  end

  begin
      remote = PackBell
      prog = irexec
      button = One
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action rewind3); fi
      repeat = 3
      delay = 0
  end
  begin
      remote = PackBell
      prog = irexec
      button = Two
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action play_or_pause); fi
      repeat = 3
      delay = 0
  end
  begin
      remote = PackBell
      prog = irexec
      button = Three
      config = if [ $(ps -eo cmd | grep -c ^smplayer) -eq 1 ]; then (smplayer -send-action forward3); fi
      repeat = 3
      delay = 0
  end
end smplayer
  • sudo /etc/init.d/lirc restart
  • You should see the irexec daemon start
  • Start smplayer and make it play something
  • Push the AUX1 button on your Packard Bell remote
  • Now push other buttons.  It should all work.

Thanks to all the blog posts and forum conversations that helped me figure all that out.


Leave a Reply

Your email address will not be published. Required fields are marked *