Keyboard Programming

Terry D. Cudney terry at
Mon Dec 30 11:27:24 EST 2002

Steve and all,

	You can do whatever (anything at all) with your keyboard in linux.

	The trick is to know 1) what codes your keyboard is generating and 2) what you want to do with those key presses.

	"showkey -s" will give you the scancodes of each key, whereas "showkey" without option gives you  the keycodes.

	You can use "setkeycodes" to assign a "keycode" to any key on your keyboard, including any extra keys that your particular keyboard may have.

	In the standard keymaps, there are a number of keycodes that are unassigned, including the Left and Right Windows keys. To make use of these for your particular needs, you don't need to use "setkeycodes", because these keys already are generating the keycodes, the scancodes are immaterial. You just need to tell (in your keymap) what you want those keycodes to do.

	If your extra keys are generating scancodes that linux doesn't recognize, you should get a complaint when you are at a shell propmpt and you press one of those keys, something like "Unrecognized scancode E0 63". You can use "setkeycodes" to assign keycodes to any of those keys.

	It's a two-layer thing. Scancodes are generated by your keyboard, while keycodes are used in your keymap. If the scancodes are all assigned keycodes you don't need the "setkeycodes" command, just adjust your keymap file and "loadkeys <keymapfile>" to customize how your keyboard works.

	I have written a keymap file, which I believe may serve as a universal keymap for speakup. (It's in the goodies directory on the speakup ftp server as "laptop-keymap.tar.bz2"). It can be used whether you  have a 104-key keyboard or a laptop. It preserves the numeric-keypaed functionality that we are used to if you have the numeric keypad present, wile adding the use of the Left Windows key as a modifier key to enable the normal qwerty keys as speakup controlling keys. In the case of a laptop without Windows key, I have provided an additionall little keymap "",  which enables the "Caps_Lock" key as a speakup-enabling key. I have been using these two keymaps together on both my laptop and my full-keyboard for a few weeks now and find the added functionality to be a plus.

	In summary, you can use the command "setkeycodes" and a custom keymap to do anything you want with your keyboard regardless of the type of keyboard you have.




Name:	Terry D. Cudney
Phone:	(705) 422-0039
E-mail:	terry at

Please avoid sending me Word or PowerPoint attachments.

Having a smoking section in a restaurant is like...
having a peeing sectionin a swimming pool.

More information about the Speakup mailing list