This is a game called X Labyrinth - the aMAZEment: it works under any UNIX system with X windows (at least, I have tested it under Linux and SunOS). The goal of the game is to solve a maze with your mouse; but the fun part is that the walls of the maze actually block the mouse. It is distributed under the terms of the GNU General Public License.
I have also written a program called SIMPLE - Simple Is a Macro Processing Language Element. You can learn more about SIMPLE here.
Apart from that, the only thing I have are two programs, called record.c and playback.c which will record and play raw sound files through /dev/dsp.
For my other programs, check my programs page.
To summarize: when the key is pressed, the keyboard sends a scan code on one of the ports, and the CPU receives an interruption (IRQ1 I think). The linux kernel receives the interruption, reads the scan code, and converts it to a key code. Finally, this key code is turned to an ascii character which is read by whatever process is running. Unfortunately, thins aren't that simple. First of all, the keyboard knows three different ways of converting keys to scan codes, called scan tables 1, 2 and 3. Scan table 3 is the most logical one (well... sort of), and it has many advantages (for example, every key has programmable auto-repeat, which is not the case for the other scan tables, and also every key sends one and exactly one byte of scan code); however, this is NOT the table used by the linux kernel: it uses scan table 2. Second, the keyboard can be used in four modes: raw mode (in which /dev/console returns scan codes), semi-raw mode (in which key codes are returned), and translated mode (in which ascii characters are produced). [Note that this has nothing to do with the "raw" and "cooked" modes which refer to the way a process will receive control characters.] The keyboard mode can be read and modified using kbd_mode. Third, X sets the keyboard in raw mode, and does its own three-step translation: from scan codes to key codes, from key codes to keysyms and from keysyms to ascii characters. To make things simpler, the key codes produced by X are NOT the same as those produced by the linux kernel when keyboard is in semi-raw mode (and this is not for compatibility with other X platforms since the keycodes are also different, e.g., on a sun keyboard). Keysyms, however, are universal. The key "a" will have the same keysym on a QWERTY or AZERTY keyboard (if the xmodmap is correctly set, that is...). The list of supported keysyms (16-bit integers) can be found in one of the X11 include files, I never know which. The translation from keysyms to ascii codes is done by XLookupString, but I never understood how this one works. So we can summarize all this with the following picture:
key pressed | [Inside keyboard; 3 possible tables] v scan code [Stops here if keyboard mode is raw] | +----------------------------+ | [Linux kernel] | [X11] v v linux keycode X11 keycode | [loadkeys] | [xmodmap] v v ascii character(s)/action keysym | [running process] | [wm might intercept] v v whatever keysym if not intercepted by wm | [program] v whateverNot very clear, but that's the best I managed to do.
For historical reasons, I guess, there are two control characters which mean "erase the last character": ^H (ascii character 0x08=8) and ^? (ascii character 0x7f=127). There is no control character which says "erase the next character", because erasing the next character (the one under the cursor) implies you were able to move the cursor, so you must have very sophisticated line-editing capabilities, so if you have a convention for sending the arrow keys you can probably use that convention for the delete key too. The VT escape sequence for "delete next char" is ^[[3~ (escape (0x1b) open bracket three tilde). When there are no line editing capabilites, foe example in the primitive shells like the original sh and csh, the only possible action is "erase the character on the left". Exactly which control character will do that is specified using stty (for example stty erase "^H" specifies that ^H should be used). This is not always correctly set: sometimes the backspace key sends ^H whereas the last-character-correction key is ^? (the converse is less frequent). This should be corrected with stty. Unfortunately, some X11 systems correct this by using xmodmap instead, thus assigning the BackSpace keysym to the delete key, and the Delete keysym to the backspace key. Since X-oriented programs like netscape read keysyms and not ascii characters (and even less pay attention to the state of stty), this has the pernicious effect of inverting the backspace and delete keys under these programs. I suggest using ^H for backspace (that is, putting a line like
keycode 14 = BackSpace BackSpacein the keyboard map file used, which is generally found in /usr/lib/kbd/keytables/something.map), specifying it with stty in the /etc/profile (or /etc/zprofile), or whatever file is used), and making sure X is getting all that right with a line like
keycode 22 = BackSpacein the .xmodmaprc file (the .xmodmaprc file should be loaded by the .xinitrc or .Xclients file with something like
if [ -f .xmodmaprc ]; then xmodmap .xmodmaprc & fi). And all should be for the best in the best of all possible worlds.
Key engraving/name | Scan 1 | Scan 2 | Scan 3 | Linux keycode | X keycode |
Escape | 0x76 | 0x01 | 0x08 | 1 | 1 |
F1 | 0x05 | 0x3b | 0x07 | 59 | 67 |
F2 | 0x06 | 0x3c | 0x0f | 60 | 68 |
F3 | 0x04 | 0x3d | 0x17 | 61 | 69 |
F4 | 0x0c | 0x3e | 0x1f | 62 | 70 |
F5 | 0x03 | 0x3f | 0x27 | 63 | 71 |
F6 | 0x0b | 0x40 | 0x2f | 64 | 72 |
F7 | 0x83 | 0x41 | 0x37 | 65 | 73 |
F8 | 0x0a | 0x42 | 0x3f | 66 | 74 |
F9 | 0x01 | 0x43 | 0x47 | 67 | 75 |
F10 | 0x09 | 0x44 | 0x4f | 68 | 76 |
F11 | 0x78 | 0x57 | 0x56 | 87 | 95 |
F12 | 0x07 | 0x58 | 0x5e | 88 | 96 |
Print Screen | 0xe0 0x12 0xe0 0x7c | 0xe0 0x2a 0xe0 0x37 | 0x57 | 99 | 111 |
Scroll Lock | 0x7e | 0x46 | 0x5f | 70 | 78 |
Pause | 0xe1 0x14 0x77 0xe1 | 0xe1 0x1d 0x45 0xe1 | 0x62 | 119/101 | 110 |
`~ | 0x0e | 0x29 | 0x0e | 41 | 49 |
1! | 0x16 | 0x02 | 0x16 | 2 | 10 |
2@ | 0x1e | 0x03 | 0x1e | 3 | 11 |
2@ | 0x1e | 0x03 | 0x1e | 3 | 11 |
3# | 0x26 | 0x04 | 0x26 | 4 | 12 |
4$ | 0x25 | 0x05 | 0x25 | 5 | 13 |
5% | 0x2e | 0x06 | 0x2e | 6 | 14 |
=+ | 0x55 | 0x0d | 0x55 | 13 | 21 |
Backspace | 0x66 | 0x0e | 0x66 | 14 | 22 |
Tab | 0x0d | 0x0f | 0x0d | 15 | 23 |
Q | 0x15 | 0x10 | 0x15 | 16 | 24 |
W | 0x1d | 0x11 | 0x1d | 17 | 25 |
]} | 0x5b | 0x1b | 0x5b | 27 | 35 |
\| | 0x5d | 0x2b | 0x5c | 43 | 51 |
Caps lock | 0x58 | 0x3a | 0x14 | 58 | 66 |
A | 0x1c | 0x1e | 0x1c | 30 | 38 |
'" | 0x52 | 0x28 | 0x52 | 40 | 48 |
Enter | 0x5a | 0x1c | 0x5a | 28 | 36 |
Shift (left) | 0x12 | 0x2a | 0x12 | 42 | 50 |
Z | 0x1a | 0x2c | 0x1a | 86 | 94 |
Shift (right) | 0x59 | 0x36 | 0x59 | 54 | 62 |
Control (l) | 0x14 | 0x1d | 0x11 | 29 | 37 |
Winlogo (l) | ? | ? | ? | 125 | 115 |
Alt (l) | 0x11 | 0x38 | 0x19 | 56 | 64 |
Space bar | 0x29 | 0x39 | 0x29 | 57 | 65 |
Alt (r) | 0xe0 0x11 | 0xe0 0x38 | 0x39 | 100 | 113 |
Winlogo (r) | ? | ? | ? | 126 | 116 |
Winmenu | ? | ? | ? | 127 | 117 |
Control (r) | 0xe0 0x14 | 0xe0 0x1d | 0x58 | 97 | 109 |
I reinstalled Linux on both of my computers recently (I have a PPro200 called ``pleiades'' and a 486DX33 called ``sirius'', connected by a local ethernet - the modem is on sirius and that is its main use). I have kept a log of everything I did as root, and here it is if it can be of use to anyone:
Coming soon on this page: a tar.gz archive of my /etc directories (minus a few confidential files, of course).