Remote Control

From MythTV Official Wiki
Jump to: navigation, search


After installing the MythTV software, you need to configure your remote control. Initially, only the keyboard can be used for controlling the frontend. This is fine for testing, but you probably want to use a remote control with your setup.

Options for remote controls are covered in the section Remote controls. here we will describe how to configure each type of remote.

Keyboard Emulation

Check if your remote emulates a keyboard

  1. Open a command window and pressing some keys on the remote (try number keys if possible). See if they echo on the command window.
  2. Run lsusb -v|less. Search the results for "Keyboard" (type /Keyboard). See if that is reported under the heading of your remote (it will be reported for your normal keyboard if that is a USB device).
  3. Install and run ir-keytable. If that reports your remote then it is an ir-keytable remote (see below). If not it is likely a keyboard emulation remote.

(In Fedora ir-keytable is in the v4l-utils package, and it is useful to also install the v4l-utils-devel-tools package. Both are in the fedora repo.)

Modify media keys

Once you are sure that this is a keyboard emulation device, you can configure it. You probably do not want to change any keys that it generates, because those will then affect your real keyboard as well. For example if the remote Fast Forward button generates an F and you change it to generate a '>', then your keyboard F will also generate a greater than sign, not good.

There may be keys on the remote that do not work as normal keys, such as "Play", "Stop", "Next", "Prev". These may attempt to launch the internal music player. Run xev. This opens a window. Click in the window and press a remote key, while watching the output in the command window. It should show a keypress event and inside there show a keycode. It instead it shows a lose focus event, that button is being swallowed up by the Linux system. To fix this run dconf editor. Navigate to Set next, pause, play,prev, stop to empty character strings. These changes will only affect that logged in user. Now running xev will be able to show the keycodes for those keys. At the same time you may identify other keys there that you want to use. Changes you make here affect all keyboards when logged into that user.

Another way to disable these media buttons is to run these commands from the command line:

gsettings set next ''
gsettings set pause ''
gsettings set play ''
gsettings set previous ''
gsettings set stop ''

Now that you have disabled the media buttons, run xev and find the keycode for each button. Create a file that maps these to the desired keystrokes, for example:

keycode 171 = period greater period greater
keycode 172 = p P p P
keycode 173 = comma less comma less
keycode 174 = Escape NoSymbol Escape

The man page for xmodmap explains the syntax. Only map the media keys or special keys. These mappings will affect your keyboard as well, so for example if you have a play button on your keyboard it will generate a "p" character after this. Place this file in /home/{user}/.Xmodmap on Ubuntu systems or /home/{user}/.xmodmaprc in Fedora systems, or place it elsewhere and make sure to run xmodmap {filename} either at login or before you start the frontend.

Map keys

Your remote control will send keystrokes for each button. You will need to make sure that these invoke the correct MythTV functions. The keystrokes generated may be listed in the documentation for your remote. The easiest way to find the key strokes and at the same time program MythTV to recognize them is using the MythTV frontend setup. If you have not yet completed the backend configuration you may need to complete that and come back to this later, if your frontend is not able to start successfully at this time.

Make sure you have a keyboard connected as well as your remote. Start the frontend. Use the keyboard to navigate to Setup->Edit Keys. You can assign keys to MythTV Actions. At this time just concentrate on assigning the important keys. Navigate to an action in the screen, then arrow down to an empty block at the bottom. Up to 4 buttons can be assigned to each action, so I recommend adding extra buttons to the action rather than overwriting a button. Press enter. The system asks you to press the key. At this time press your remote button. The key combination will display. You can then accept it and it will be assigned to the requested action. If the system tells you that you will be deleting another action that was assigned to the key, take a note so that you can address this later if needed.

Some things to bear in mind:

  • For "Stop" (i.e. stop playback) you need to assign the Global ESCAPE action. The same button is also used to escape from menus.
  • If you have a Play/Pause button rather than separate buttons, assign it to the Playback PAUSE action, where it will function as play and pause.
  • On a frontend version prior to v29.1-31-g563a4b829cb, If the key code displays as Shift+Ctrl+{ascii-character}, the assignment will not work. Cancel and redo the operation but press Ctrl+ the key that was identified. MythTV cannot tell the difference between CTRL and SHIFT+CTRL and if you assign SHIFT+CTRL the key will never be recognized.
  • On a frontend verion of v29.1-31-g563a4b829cb or later, the shift key is ignored in combinations that involve normal ascii characters. This is compatible with the way keys are processed in MythTV. and it means that for example Shift-Ctrl-B is considered the same as Ctrl-B.
  • If the key generates certain combinations unexpected things may happen, for example Alt-F1 may invoke the system menu, Ctrl-Alt-F1 will switch you to a command line console, etc. In these cases it is best to avoid using those remote keys.


evdev is a Linux kernel support feature that allows IR remotes to be natively supported. For details and configuration of these see the article User Manual:IR control via evdev.

Linux Infrared Control (LIRC)

If your remote control is not natively supported by Linux you will have to use LIRC. For details see the LIRC article.

Wi-Fi Remote

If you have an Android phone or tablet, you can install mythmote from Google Play. Turn on the option in the frontend to allow network remote control (see Configuring_Frontend#Remote_Control). Configure mythmote with your frontend ip address. Mythmote can also wake up your frontend using wake-on-lan.