Myth TV remote control working

I’ve had an ATI Remote Wonder for years. Bought it whilst at Uni’ for my computer because I couldn’t be bothered to walk the three feet to the computer! I’ve known this has had a linux driver since I compiled the original before it was wound in to the kernel. I had it kicking about the house so wanted to get it working. I’ve read a lot about lirc and using that to set up the Remote Wonder. One drawback to using lirc that I think is unique to the Remote Wonder is that you can’t use the mouse functionality.

The Remote Wonder has a direction wheel and a left and right mouse button on the control. I want this because I may want to use catch up TV, which means running a web browser as well as Myth TV, and typing something in the search box, clicking on a ‘full screen’ button for the video means I need a pointer, and the Remote Wonder gives me that. What I’m then missing would be a keyboard. Happily, there is a Firefox plug in that does just that. I’ve managed to get them all configured and working, so below is how I did it. The only slight downer is the known issue around the TV, DVD, OK and Channel up/down buttons that do not work on Linux because the key codes are greater than 255. There is a patch to fix this I’ve not applied yet to evdev, I’ll update this blog when I’ve done that.

The ATI Remote Wonder is a USB based RF (radio) remote control. Plug it in and the ati_remote kernel module will be automagically loaded. Here’s how to figure out what’s working and get it configured.

Run the following in a terminal to get the right driver for X loaded, and so we can test what devices we have:-

sudo apt-get install evdev evtest

evdev will likely already be there. evtest allows you to see what devices you have attached, so go attach the USB bit now (you don’t need the control to have batteries just yet). Now run this to see if the remote wonder is detected:-

adam@theatre:~$ sudo evtest
[sudo] password for user: 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Power Button
/dev/input/event1:      Power Button
/dev/input/event10:     HDA Intel Rear Mic
/dev/input/event11:     HDA Intel Front Headphone
/dev/input/event12:     HDA Intel Line-Out
/dev/input/event13:     HDA NVidia HDMI/DP,pcm=9
/dev/input/event14:     HDA NVidia HDMI/DP,pcm=8
/dev/input/event15:     HDA NVidia HDMI/DP,pcm=7
/dev/input/event16:     HDA NVidia HDMI/DP,pcm=3
/dev/input/event2:      X10 Wireless Technology Inc USB Receiver
/dev/input/event3:      X10 Wireless Technology Inc USB Receiver mouse
/dev/input/event4:      Microsoft  Microsoft Basic Optical Mouse v2.0 
/dev/input/event5:      em28xx IR (em28xx #0)
/dev/input/event6:      Lite-On Technology USB Productivity Option Keyboard( has the hub in # 1 )
/dev/input/event7:      Lite-On Technology USB Productivity Option Keyboard( has the hub in # 1 )
/dev/input/event8:      HDA Intel Line
/dev/input/event9:      HDA Intel Front Mic
Select the device event number [0-16]:

(Hit Ctrl+c to close the app at this point).

As you can see from the above the Remote Wonder is device /dev/input/event2 . We could configure X to use this but the problem is these event numbers tend to change on reboot, so you have to do something a little unique. Here’s my xorg.conf:-

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
#    InputDevice "Remote0" "SendCoreEvents"
    Option         "Xinerama" "0"

Section "Files"

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"

Section "InputClass"
    Identifier     "Remote0"
MatchProduct "X10 Wireless Techology Inc USB Receiver"
MatchDevicePath "/dev/input/event*"
    Driver         "evdev"
    Option         "event_key_remap" "402=112 403=117 377=156 389=157 352=36"

Section "InputClass"
   Identifier  "RemoteMouse0"
MatchProduct "X10 Wireless Techology Inc USB Receiver mouse"
MatchDevicePath "/dev/input/event*"
   Driver      "mouse"
   Option       "Protocol" "PS/2"
   Option       "SendCoreEvents"

... other stuff about monitors after this...

I’ve used InputClass instead of InputDevice. This means you don’t link to them in the ServerLayout, hence the commented out InputDevice highlighted above in that section. Using InputClass allows you to match by the device product name reported by evtest, and match anything in /dev/input starting with event, which means no matter what event number it gets loaded as this declaration will work.

I have the mouse declared too as a PS/2 mouse. I haven’t customised the mouse Options to simulate a three button mouse, and thus allow autoscrolling in Firefox, but I’ve not tested that yet. I’ll post back when I’ve tried it. For now though the above works great.

The Option event_key_remap line for the keyboard part of the remote is for the future, as yet untested by me, evdev alteration that allows remapping of key codes above 255 to lower key codes so that the X server can handle it.

Once the above is done you need to edit your ~/.Xmodmap so that the relevant keys are mapped to their Myth TV equivalents:-

keycode 164 = S
keycode 123 = F11
keycode 122 = F10
keycode 121 = F9
keycode 147 = M
keycode 104 = I
keycode 160 = F8
keycode 140 = W
keycode 176 = Left
keycode 208 = P
keycode 167 = Right
keycode 175 = R
keycode 136 = Escape
keycode 127 = P

I saved these files, rebooted the machine (sudo reboot) and lo the remote worked fine. Had a few typos originally which caused X not to load. I basically ran the following and you get some useful output to diagnose issues:-

tail -n 50 /var/log/Xorg.0.log

It should give you a line saying there’s an error on line 43 (or similar). From this it should be pretty clear what’s wrong. The error reporting is pretty good.

I then installed a plugin for Firefox called FxKeyboard. I then increased the default font size to 26 and used my normal mouse and keyboard (I’m lazy like that) to add all the catch up TV services, Lovefilm and Netflix sites as tabs to Firefox and pinned them as App Tabs. Then configured Firefox to open up previous tabs on startup. All these are simple options to find and configure in Edit > Preferences in Firefox.

Further information:-

Xorg mouse driver options (for 3 button emulation, etc.) –

evdev modified driver home – – WARNING: Use the following instead of git pull (you may need 2.7.0 for newest Ubuntu or X versions): git checkout -b code-remap-2.6.0 origin/code-remap-2.6.0


About adamfowleruk
Sales Engineer and Author

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: