Q:

Raspberry Pi Keyboard Interface (Key Remapping?)

I am building a Raspberry Pi wearable computer and as a result am not able to hook up a full sized keyboard to the Pi (I don't have one that is not full sized).  Instead I have a numeric keypad USB attachment which functions as a keyboard, but only the numeric keypad part (0-9, a triple 0, +, -, *, - and numlock).
Now my question is: how would one go about writing a script/program to run in the background that will change input keypress(es) to other keypress(es), for example, changing 777 (in rapid succession) to 'c' or 5 to 'x'.  This way I hope to be able to type, albeit slowly at first, using only 16 keys.  What libraries are a good idea and do you have any sample usage of them.
Ideally this should work both in the startup command prompt (RPi doesn't run X immediately) and in the X environment.

A:

You could use evmapd to catch the keyboard keycodes, and modify its source (I assume you're comfortable with C) to wait for multiple keystrokes before outputting a regular keyboard code. For example, send 67 for 'c' to the keyboard buffer, after receiving 97 (numpad 1) three times in quick succession from the physical device.

