Skip to main content

Making MythTV work with MCE Remote Mouse Emulation

After a long series of unsuccessful attempts to make XBox 360 play all the videos we had without resorting to a Windows VM, I decided to connect my existing home server running Ubuntu to the TV and install mythbuntu-desktop.

/galleries/mythtv/mythtv-screen.thumbnail.jpg

Everything went quite well, I added the startup of mythfrontend to autostart and purchased a cheap USB HID remote (detected as 073a:2230 Chaplet Systems, Inc. infrared dongle for remote, here’s the MythTV Wiki page on these) without looking closely at the design of the device itself.

/galleries/mythtv/usb-hid-remote.thumbnail.jpg

The receiver emulates a USB HID keyboard with media keys and in order for MythTV to receive these keys one needs to do the following:

  • Disable xfce4-volumed — copy the /etc/xdg/autostart/xfce4-volumed.desktop to ~/.config/autostart and add Hidden=true to the section. That way the XF86AudioLowerVolume, XF86AudioRaiseVolume and XF86AudioMute events can reach the application. Alternatively, you can just uninstall xfce4-volumed package

  • Disable multimedia plugin of gnome-settings-daemon — it will also capture the media key presses and also prevent the application from receiving XF86Audio{Next,Prev,Pause}events:

  • $ gsettings set org.gnome.settings-daemon.plugins.media-keys active false

  • Configure the keys in MythTV interface.

/galleries/mythtv/keys.thumbnail.jpg

The remote I purchased features a large “Mouse” directional pad while the regular keyboard keys actually used in MythTV were inconveniently located at the bottom of the remote. It was not comfortable to navigate through the menu so I decided to make this mouse-emulating “joystick” send regular keyboard events.

The receiver feeds USB HID data to the system and it does not look like it can give raw data for lirc. So I took python-xlib, googled for various parts I did not know about and came up with the following script: mythtv-mouse2kbd.py, which monitors the active window and performs the mouse movements into key presses translation if “MythTV Frontend” is the active window. Also left mouse button emits “Return” key and the right one emits “Escape”.

So now I can navigate around MythTV using this large joystick as if it was originally designed to be used this way.

The only issue the script has is that grabbing the pointer for some reason prevents Alt+Tab from working but once you exit MythTV (or switch to another workspace) the pointer will be released, so that looks like a minor issue.

Please note that this remote will not work in BIOS configuration screen because the device is emulating mouse.