Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Configuring extra keys on USB keyboards

To understand how to configure the additional keys that are provided on some USB keyboards, it helps to understand they way in which key processing works under Linux and X.

The most fundamental level of keyboard processing is a scancode. The USB keyboard driver pipes scancodes into the normal kernel keyboard driver. Depending on the mode in which the keyboard is operated, these can either be sent to the application directly (known as scancode or raw mode) or translated using a keyboard mapping table (known as the keymap) before being sent to the application (known as keycode or intepreted mode).

X uses the raw scancodes, which are known as keycodes in X documentation. These are translated inside the X server to a functional equivalent, known as a key symbol or keysym using a mapping table, although this is not the same format and performs a subtly different function. This means that translations in console mode and under X are not the same.

Console mode keyboard mappings

To be completed, but basically you use the showkey -s to get the raw scancodes, and then use setkeycodes to modify the keymap or loadkeys to load a new keymap. Then you can assign the translated keycode to whatever makes sense for the application program.

X keyboard mappings

To be completed, but basically you use the showkey -s or xev to get the raw scancodes, and then use xmodmap to modify the keyboard map.