Re: keyboard.h

Vern Hoxie (
Sat, 5 Dec 1998 13:01:34 -0700

Paul Barton-Davis wrote:
> 1) Why does keyboard.h define NR_KEYS to be 128 ? Is it just so that
> its the the nearest power of 2 to a likely limit ?
> 2) Why does keyboard.h stick the macros for K_FIND thru K_PAUSE right
> in the middle of those for K_Fnn, thus preventing a nice simple
> macro like:
> #define K_FNUM(k) KVAL(k)+1
> and requires instead:
> #define K_FNUM(k) k <= K_F20 ? KVAL(k)+1 : \
> k > K_PAUSE(k) ? : KVAL(k)-9 : -1

I have forgotten but you can read the blurbs in the "kbd-0.91" ( or
whatever the current version is ) tarball on sunsite.

> 3) Whats the rationale for the keycodes assigned to various escaped
> scancodes (E0_KPENTER etc.) ? I.e why is E0_KPENTER assigned keycode
> 96, instead of, say, 102 or 83. The comments say:
> * The keycodes 1-88,96-111,119 are fairly standard, and
> * should probably not be changed - changing might confuse X.
> * X also interprets scancode 0x5d (KEY_Begin).
> is this the only reason ?

The keycodes are the electronic codes generated in the keyboard when a
key is either pressed or released. Try running "showkey" to find
out the specific codes. Then read the blurbs in "kbd-0.**" to find
out how these can be used. After writing a new keymap, you will have
to run it through one of the utilities to generate a machine readable
version. This is also explained in the blurbs.


Vernon C. Hoxie                           
3975 W. 29th Ave.                                        uucp: 303-455-2670
Denver, Colo., 80212                                    voice: 303-477-1780
       Manners are just a formal expression of how to treat people.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at