GNU / Linux text console, X11 not involved, not even installed. Keyboard - American layout, default keyboard layout. kernel version 2.20.x or later.
An application written in C receives keyboard input in translation mode, i.e. XLATEor UNICODE. When a key is pressed, the application receives the corresponding KeyString. For example, you press F1, the application reads "\033[[A".
Before the kernel sends the key to the application, it must know which key is pressed, i.e. he must know his scan code. In the above example, F1 scancode for the key is pressed 59 or 0x3b.
To say it, even when the keyboard is in translation mode, scancodes are stored somewhere in memory. How can applications access them without switching the keyboard to
RAWor MEDIUMRAW? The code snippet will help.
frank
source
share