wiki:HowTo/RemoteLinux

Configuring a Remote Control for Linux

(Updated 2016-8)

Remote controls on Linux use the 'lirc' package. The steps to getting a remote control working with linux are:

  • Acquire a remote control and IR receiver
  • Install the 'lirc' package.
  • Configure the 'lirc' package.
  • Configure X to ignore the remote.
  • Test the remote control with the 'irw' program.
  • Configure the $HOME/.lircrc file
  • Start the irexec program when using BallroomDJ.

The xorg.conf configuration file

(This section may not be necessary -- try using the remote without it first)

This file is usually located in /etc/X11. If there is no xorg.conf file there, one must be created using X -configure (which can only be run when X is not running).

Add the following section to the xorg.conf file and restart X. Note that you will have to substitute the USB ID for your IR receiver. This can probably be found in one of the log files.

  Section "InputClass"
    Identifier  "Remote"
    MatchUSBID  "147a:e03e"      # substitute your usb id 
    Option      "Ignore" "True"
  EndSection

X key mapping

X also maps the computer's media keys to special keynames. See Special Keys. The X keys should already be set up in BallroomDJ. The X keys (for Xfree86) are:

XF86AudioMute
XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86AudioPlay
XF86AudioPause
XF86AudioStop
XF86AudioPrev
XF86AudioNext

The .lircrc file

The .lircrc file controls which buttons are mapped to which commands. Use the 'irw' program from the 'lirc' package to determine the actual button names for your computer and remote. The file below is a sample and the keys may be mapped to BallroomDJ or computer functions however you wish.

Documentation on bdjcli.tcl commands can be found in the 'READMEremote.txt' file.

Also see the 'linux/lircrc-example1' and 'linux/lircrc-example2' files that come with the BallroomDJ distribution.

irexec

I found recent versions of the irexec -d command to have bugs, so instead, nohup irexec > /dev/null 2>&1 & works fine.

Which remote configuration that lirc uses seems to be random and can change. I have had two different computers, same IR hardware, and lirc would choose different configuration files. After lirc updates, the remote configuration may change.

Sample .lircrc file

begin
  button  = KEY_MUTE
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl volmute
end
begin
  button  = KEY_VOLUMEUP
  prog    = irexec
  repeat  = 1
  config  = $HOME/ballroomdj/bdjcli.tcl volup
end
begin
  button  = KEY_VOLUMEDOWN
  prog    = irexec
  repeat  = 1
  config  = $HOME/ballroomdj/bdjcli.tcl voldown
end
begin
  button  = KEY_PAUSE
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl pause
end
begin
  button  = KEY_PLAY
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl play
end
begin
  button  = KEY_STOP
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl pauseatend
end
begin
  button  = KEY_NEXT
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl fade
end
begin
  button  = KEY_CHANNELUP
  prog    = irexec
  repeat  = 1
  config  = $HOME/ballroomdj/bdjcli.tcl spdup
end
begin
  button  = KEY_CHANNELDOWN
  prog    = irexec
  repeat  = 1
  config  = $HOME/ballroomdj/bdjcli.tcl spddown
end
begin
  button  = KEY_OK
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl spdnormal
end
begin
  button  = KEY_REWIND
  prog    = irexec
  repeat  = 1
  config  = $HOME/ballroomdj/bdjcli.tcl posback
end
begin
  button  = KEY_FORWARD
  prog    = irexec
  repeat  = 1
  config  = $HOME/ballroomdj/bdjcli.tcl posfwd
end
begin
  button  = KEY_AGAIN
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl repeat
end
begin
  button  = KEY_UP
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl selup
end
begin
  button  = KEY_DOWN
  prog    = irexec
  repeat  = 0
  config  = $HOME/ballroomdj/bdjcli.tcl seldown
end
begin
  button  = KEY_2
  prog    = irexec
  repeat  = 0
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl selup
end
begin
  button  = KEY_8
  prog    = irexec
  repeat  = 0
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl seldown
end
begin
  button  = KEY_1
  prog    = irexec
  repeat  = 0
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl seltop
end
begin
  button  = KEY_7
  prog    = irexec
  repeat  = 0
  delay   = 3
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl selbottom
end
begin
  button  = KEY_3
  prog    = irexec
  repeat  = 0
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl moveup
end
begin
  button  = KEY_9
  prog    = irexec
  repeat  = 0
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl movedown
end
begin
  button  = CLEAR
  prog    = irexec
  repeat  = 0
  delay   = 3
  config  = $HOME/ballroomdj/bdjcli.tcl remove
end

Last modified 18 months ago Last modified on 2016-08-05T06:12:32-08:00