Setting up ATI remote wonder with evdev

Using the official mythtv wiki I managed to get my ATI remote working without lirc on one of my boxes running Ubuntu 11.10. Unfortunately the trick, for some reason, didn’t work on 12.04.

I found a solution on the mythtvtalk forum, using evdev.conf file instead of a statement in xorg.conf

We need to install a patched evdev-driver that will understand keys greater than 255 by giving access to the “event_key_remap option”.

First the evdev package has to be build. For that reason download the following packages:

sudo apt-get install evtest git-core build-essential xserver-xorg-dev xutils-dev libtool autoconf checkinstall

Download the evdev source:

git clone git://www.thenautilus.net/xf86-input-evdev
cd xf86-input-evdev
git pull git://www.thenautilus.net/xf86-input-evdev code-remap-x.x.x

NB. check the latest code-remap version. Latest as of this writing is 2.8.0

And build the driver:

./autogen.sh
./configure
make
make install

Or build a debian package out of it using the checkinstall-command (apt-get install checkinstall)

NB. I got some errors during the “autogen” part. I had to install some additional packages:

sudo apt-get install build-essential libx11-dev libxi-dev x11proto-input-dev xserver-xorg-dev libxrandr-dev libncurses5-dev autoconf libtool libudev-dev

Backup old evdev driver

cd /usr/lib/xorg/modules/input/
mv evdev_drv.so evdev_drv.so.backup

Copy new driver

sudo cp /usr/local/lib/xorg/modules/input/evdev_drv.so /usr/lib/xorg/modules/input/evdev_drv.so

Instead of backing-up, renaming and copying you could simple add this line to the “Files” section of the xorg.conf (If you have any):

ModulePath “/usr/local/lib/xorg/modules,/usr/lib/xorg/extra-modules,/usr/lib/xorg/modules”

Restart X (Restart the computer, or log-out and in again)

Determine your device/keycodes.

sudo evtest

You’ll now see a list of evdev devices numbered 0-? find one that looks like the device you want to reconfigure and enter it’s number. Now press buttons on your device to ensure you have the right one. It should tell you what buttons you press. Take note of the keycodes of the buttons you want to change. For example, when I press the power button on my remote, I see:

Event: time XXXXXXXXXX.XXXXXX, type 1 (Key), code 116 (Power), value 1

So this means I want to change code 116 to a different keycode. Do this with all the buttons you want to change.

Also, now that you know you have the right device, take note of it’s name. For example, for my ATI Remote Wonder, I saw the following list when i ran “sudo evtest”:

/dev/input/event0: Power Button
/dev/input/event1: Power Button
/dev/input/event2: AT Translated Set 2 keyboard
/dev/input/event3: X10 Wireless Technology Inc USB Receiver

Mine was event 3, so I would make note of “X10….Receiver”
Press CTRL-C to exit evtest.

Okay, we have the device name and the keycodes we want to change FROM.
Now for the keycodes we want to change TO, you can run “sudo evtest” using your keyboard’s event# and pressing the keys to find their keycodes, or download Xmodmap, which contains a list.

Edit your evdev.conf file

vim /usr/share/X11/xorg.conf.d/10-evdev.conf

Section  "InputClass"
Identifier "ATI Remote" # Or whatever you want to call it
MatchProduct "X10 Wireless Technology Inc USB Receiver" # Replace this with your #device name.
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "event_key_remap" "18=26 113=75 115=95 119=33 116=9 128=9 132=25 139=58 156=31 159=102 168=100 207=36 277=156 352=36 389=157 402=98 403=104"
EndSection#

ev  RC    xmod mythtv
#18  E     26   Edit
#113 mute  75   F9
#116 Power 9    Escape
#119 Pause 33   p
#128 Stop  9    Escape
#139 Menu  58   m
#132 scale 25   w
#114 vol-  76   F10
#115 vol+  95   F11
#156 book  31   I Guide
#159 FF    102  Right
#168 RW    100  Left
#207 play  36   Return
#277 TV    156
#352 OK    36   Return
#389 DVD   157
#402 ch+   98   Up
#403 ch-   104  Down

Restart X:

sudo restart lightdm

or restart your computer.

 Source: http://www.mythtvtalk.com/how-i-got-my-ati-remote-work-ubuntu-11-10-a-15257

 

7 thoughts on “Setting up ATI remote wonder with evdev

  1. Ok, I finally got it all working according to your post, but It seems like nothing is actually being remapped.
    I assigned the power button to ESC on the keyboard, and nothing. Same with the center “OK” button, mapped it to . Nada.
    Is there a way to test to see if any remapping is actually happening?

    Thanks!

  2. Well stupid me, I noticed that the “MatchProduct” in all the documentation here and elsewhere has a typo:
    It says MatchProduct “X10 Wireless Techology Inc USB Receiver”
    Technology is missing the N!

    However, after fixing the typo, now my system wont display X nor will the regular keyboard work.

    I’m in the process of looking at the /var/log/Xorg.o.log

    and there is a whole lot of This:
    [ 261.783] (EE) X10 Wireless Technology Inc USB Receiver: output value 116 out of range for option “event_key_remap”, ignoring.

    I don’t get it?

  3. Ok, so Gianni Ceccarelli over at thenautilus.net who wrote the patch for xf86-input-evdev has found a bug as a result of this and fixed it.

    However, I am still not getting this to work, yes it’s remapping, but apparently I am not understanding the correct procedure.

    So let’s say I run evtest, selecting my keyboard.
    I press on the keyboard, and see that the code is whatever (lets say 63)

    Then I run evtest, this time selecting my remote control, and press the button that I WANT to be . I see the code is let’s say 59.

    So if I edit my /usr/share/X11/xorg.conf.d/10-evdev.conf, and put:
    Option “event_key_remap” “59=63″ in there, I would think it would remap that button to issue a 63, and MythTV would think I hit and do what I want!

    This is not happening apparently. It’s remapping, but when I hit the button, nothing happens, or the wrong thing happens.

    I’m confused.

  4. Hmmm, you are right about that “technology-word” issue. I have corrected it now in the original posting. To answer your other questions I need to dive in it later. I do not have the time now.
    I will get back on this soon. Thanks for you comments.

  5. I advise to use the Xmodmap file.
    The only way to test if some keys are remapped succesfully is to test by trial and error. Some settings I have set and which are working:

    #116=Power=9=Escape
    #352=OK=36=Enter
    #139=Menu=58=m
    #119=pause=33=p
    #132=scale=25=w
    #156=guide=39=s
    #113=mute=51

Leave a Reply

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

*