This program is a workaround for X11 limitation with 255 keycodes.

Yeech! The problem with keycodes >255 was first reported in 2007:

http://bugs.freedesktop.org/show_bug.cgi?id=x11-keycode-limit

And as of today (may 2010) they still did not fix it. So I wrote a small utility based on kbd's showkey that reads keycodes and uses Xtst to stuff events into X. This hack is ugly as hell and needs suid to be able to read /dev/console. Yikes. But there is no other easy fix.

Installation

In Ubuntu Lucid install from rawkeybind ppa and restart X:

add-apt-repository ppa:rm-isaev/rawkeybind
apt-get update
apt-get install rawkeybind
Otherwise download source code rawkeybind-0.1.tgz, unpack and issue:

./configure && make && sudo make install

then

sudo chmod u+s /usr/local/bin/rawkeybind.
echo /usr/local/bin/rawkeybind -f >> ~/.xsessionrc

and restart X.

Configuration

Right now only Microsoft Natural 4000 zoom up and zoom down are configured. If you have another device, run rawkeybind -dnf to determine keycode that needs to be mapped, then find desired action in /usr/include/X11/keysymdef.h. For example if we want to map Microsoft Natura zoom key down to down arrow, look for XK_Down keysym in the keysymdef.h:
#define XK_Down                          0xff54  /* Move down, down arrow */
run rawkeybind -dnf and press zoom key down, you'l see something like
keycode 0x1a3 press
keycode 0x1a3 release
Then press ^C and add this line
0x1a3:0xff54:Microsoft Natural 4000 key down
to /etc/rawkeybind.conf.

If you create some reasonable translations for your device, email them to me and they will be included in the next version of the program (unless they fix this stupid bug).

Author

Roman V. Isaev (roman@isaev.ru)