I'm going to assume a few things here. First, I'm going to assume that the ati_remote module is being loaded at boot time. To check, you can open a terminal and type:
$ lsmod
Look over the list and you should see it there. If you have the receiver connected, and booted up with it connected, then it should be there. If not, then you may have a problem with the hardware, either the USB controller or the receiver itself.
One other thing I'm going to assume is that you're using KDE and not Gnome (or anything else). Someone who is a Gnome-ite can adapt this knowledge for Gnome's startup scripts and hotkeys if they want.
If you've gotten this far, then you're using KDE and have the module loaded. Believe it or not, you actually have quite a bit of functionality already. You may know that you can use the direction pad and the two mouse emulation buttons successfully. If not, try it. Works the same as with Windows. But you can also use the numerical pad, and the 6 'unassigned' buttons (the little buttons with the letters on them - a, b, c, d, e ,f). Open a terminal and try those buttons, and they should make the corresponding actions appear in the window, EG. the 'f' key will make the letter f.
What we're going to do is map the rest of the keys to XF86 keysyms, and then attach those keysyms to KDE shortcuts.
First, we have to find out what the keycode numbers are for the keys that have no functionality. Take out a pad and something to write with. Open a terminal and type:
xev
Put the mouse pointer on the small Event Tester window that pops up. Very carefully touch each button and observe the following information in the terminal window:
Record the keycode number for each unused key. For me, the Channel Up/Down keys have no code, and I don't know how to assign them one. The useful keys are Volume +-, Play, Stop, Pause, Forward, Back, Mute. Other keys may or may not work, and you can customize them as you desire. I prefer to leave the keys that already work unchanged.KeyRelease event, serial 27, synthetic NO, window 0x3600001,
root 0x48, subw 0x3600002, time 1163616, (31,30), root1368,63),
state 0x10, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
Now you can close the Even Tester window, which ends the xev command. What we're going to do now is map the keys to known XF86 keysyms and load that map automatically every time KDE is started.
What you'll need to do is create a new config file in your home directory. There are about a million ways to do this, but here's just one. From the terminal:
cd
kwrite .xmodmap
I'm using Kwrite here because I've had intermittent problems with Kate. You could also use Kate, or VI if you're really adventurous. The point is, a simple text editor. The config file is going to be in a format that the xmodmap program can understand. Here is a sample of mine (at least as I'm writing this; I do change it from time to time):
Note that the lines with the exclamation point are comments. Note also the keycode numbers you copied down in the previous step. I think it's a straightforward file and I shouldn't need to go over it in excruciating detail. If the keycode numbers correspond exactly to what your xev information is, then you can simply copy-paste what I've got here into your new .xmodmap file. If not, then modify the keycode numbers accordingly. Save the file. Now we need to load the file. In the terminal:! QUIT
keycode 222 =q
! PLAY
keycode 179 = XF86AudioPlay
! PAUSE
keycode 110 = XF86AudioPause
! STOP
keycode 232 = XF86Stop
! NEXT
keycode 233 = XF86AudioNext
! PREVIOUS
keycode 152 = XF86AudioPrev
! VOLUME DOWN
keycode 174 = XF86AudioLowerVolume
! VOLUME UP
keycode 176 = XF86AudioRaiseVolume
!MUTE
keycode 160 = XF86AudioMute
$ xmodmap .xmodmap
If you got no errors, then you're off to the races. Depending on your hardware, the volume buttons may already control the mixer volume. The others will be assigned later. If you got an error, then you may have made a sloppy mistake somewhere. remember that Linux is case sensitive. Look at the file again carefully.
Next step is to have the file load automatically in the background every time KDE starts. For this, we'll create a painless little script. Whenever you create a script in Linux you need to remember two things: One, the first line needs to point to the executable, such as perl, or sh, or bash. Two, the execute bit needs to be turned on. Don't sweat it - I'll show you how it's done. First, lets create the script. I called it .xmod, but you can name it whatever you want.
$ kate .xmod
The entire script is going to simply consist of:
That's it. Finished. One command.#! /bin/bash
xmodmap .xmodmap
KDE has a special folder called Autostart where scripts or symlinks to applications can be placed that the user wants running at startup (similar to the "startup" folder in Windows). In the terminal:
$ chmod 755 .xmod
$ cd ~/.kde/Autostart
$ ln -s ~/.xmod
Now here's where it gets a bit tricky. Just kidding. Now that you've taken care of the map file starting automatically, you can use KDE's shortcuts to have some fun with applications such as Amarok. Start Amarok and then click Settings --> Configure Global Shortcuts. I believe all KDE applications have a similar feature, and in the same place in the Settings menu. Now select Play, hit Custom and then Alternate Shortcut (Don't screw with the primaries; that's a recipe for a headache). Click that little 'x' box and then press the Play button on the remote. XF86AudioPlay should appear as the alternate shortcut. Repeat steps for the other shortcuts as desired. Note that the remote should control Amarok even if it is not the active window.
Bookmarks