Tired of the windows unoperating system, i recently decided to drop it for good and use Linux and free softwares. I must admit i don't regret this choice for i've never been so confident in my pc.
My only regret was that my ati remote control didn't work under this environnement.
I finally succeeded in making it work by finding a way to emulate the windows ati plugins. That's why i propose this little tutorial.

1 - INSTALLATION OF THE ATI_REMOTE MODULE

You first need to grab the sources at :

http://sourceforge.net/project/showfiles.php?group_id=12629

then, go where you have downloaded the file :

# cd /where/is/ati_remote-x.x.x.tgz

uncompress it :
# tar zxvf ati_remote-x.x.x.tgz

go to the created folder :
cd ati_remote

then :
# make

install the module :
# make install

First, you must edit the /etc/rc.d/rc.local file and add the following lines if necessary :

alias usb-controller usb-ohci
alias usbdevfs usbcore

Depending on your distribution, edit /etc/X11/XF86Config or XF86Config-4 to declare your remote control as a new device :

Section "InputDevice"
Identifier "ATI Remote"
Driver "mouse"
Option "Protocol" "PS/2"
Option "Device" "/dev/input/mice"
Option "SendCoreEvents"
EndSection

Again in XF86Config-4 add the following line in the "ServerLayout" section :

InputDevice "ATI Remote" "CorePointer"

If you don't know how to validate these changes, the easiest (but not sharpest) way
is to reboot your computer.

2 - MAPPING THE REMOTE CONTROL

At this point, your remote should be recognized as a keyboard by the keybdev module (to test it, just open a shell and press the "a", "b", "c" ... buttons). Nevertheless, the "play", "Mute" or "Power" buttons can't work because they aren't identified yet. This problem can be resolved with xev and xmodmap : xev will identify the keycode of the unrecognized keys and xmodmap will map them.

If you start xev in a shell and press the "TV" button, for example, you get the keycode 153 on the third line :

KeyRelease event, serial 27, synthetic NO, window 0x1c00001,
    root 0x6e, subw 0x0, time 2755664947, (-551,664), root:(208,717),
    state 0x10, keycode 153 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 characters:  ""

(all the remote control keycodes are listed at the end of this document)

You can now remap the remote buttons by creating a .Xmodap file. Here's an extract from the one i've created for xine (apparently, you cannot attribute two keys such as Ctrl+m to a single keycode, so i've decided to change some hotkeys in xine) :

! QUIT
keycode 222 = q
! PLAY
keycode 168 = Return
! PAUSE
keycode 110 = space
! STOP
keycode 232 = x
! FULLSCREEN
keycode 106 = f
! EJECT
keycode 26 = e
! MUTE
keycode 166 = w
! FASTER
keycode 233 = Up
! SLOWER
keycode 152 = Down
! VOLUME DOWN
keycode 165 = v
! VOLUME UP
keycode 158 = j

NB : the remote control isn't recognized as a new keyboard but as an extension of the existing one, that's why keys like "a", "b" ,"c" ... which can be found on both should not be modified.


In the case of a Redhat 7.3 this file is executed at every start if you put it in your home directory (see /etc/X11/xinit/xinitrc for more details) but i find it more convenient to edit a script for each software so :

i put the xine script in my home directory and i call it .xmodmap_xine then, i start xine with the following command :

xmodmap /$HOME/.xmodmap_xine | xine

which leads to start xine with the right button combination (you can put this line in the desktop shortcut properties).

You can now edit a script for each application (I also did it for mplayer, xmms and ogle) and, this way, emulate the ati windows plugins working.
Being the only one with a good dvd navigation, ogle is very appropriate to using the remote control but its shortcuts are a bit hard to configure (for more details, try man oglerc and see the "bindings" section).


REMOTE CONTROL KEYCODES

(from left to right and up to down)

touche     keycode
-------------------
a             38
b             56
power        222
tv           153
dvd          144
web          178
book         230
hand         126
mouse left        
mouse right
volume -     165
volume +     158
mute         166
channel -     99
channel +    105
1             10
2             11
3             12
4             13
5             14
6             15
7             16
8             17
9             18
list         176
0             19
validation   108
c             54
d             40
?            146
left         100
up            98
ok            36
down         104
right        102
fullscreen   106
e             26
f             41
rewind       152
play         168
forward      233
rec          177
stop         232
pause        110

I hope this little howto will help people who, like me, were missing this perfect tool for lazy boy under Linux.
I repeat it : i am a linux newbie so, if you find mistakes, incoherences or blasphemous words, just write to me :

septentrion@voila.fr