In the magic sysrq key combinations, there is the combination alt+sysrq+r
which, according to wikipedia, does the following:
Switch the keyboard from raw mode, the mode used by programs such as
X11 and svgalib, to XLATE mode
What is raw mode? and what is XLATE mode?
Can I switch back to raw mode once I have switched to XLATE mode?
How can I tell which mode my keyboard is in?
Best Answer
When you press a key on your keyboard, it sends a numeric code to the computer, called a scan code. The scan code tells the computer which key was pressed; for example, on a typical US keyboard, the A key sends the scan code 30 when you press it (and 158 when you release it). The keyboard driver reports these codes directly to applications when the keyboard is in raw mode (“raw” means unprocessed, straight off-the-keyboard). A few programs use raw mode and do their own keyboard processing; the X server is the most prominent one.
Most programs expect that when you press the A key, the program reads the character
a
(ASCII 97), and that when you press Shift+A the program readsA
(ASCII 65), and when you press Ctrl+A the program reads theCtrl+A
character (ASCII 1). Keys that don't have associated characters send escape sequences, e.g.\e[A
for Left, where\e
is the ESC character (ASCII 27). The keyboard driver performs this translation when the keyboard is in ASCII mode, also called XLATE mode (short for “translate”). XLATE mode lets applications do character input, at the cost of not having access to such nuances as “Left Shift key pressed” or Ctrl+Shift+A as distinct from Ctrl+A.The
kbd_mode
lets you switch between modes, and shows the current mode if you invoke it without any argument.The magic SysRq key combinations are meant to recover from various nasty situations. One of the key combinations is
Alt+SysRq+K
to kill all programs on the current virtual console; if that program put the keyboard in raw mode, then you won't be able to type at the login prompt (which will often appear, depending on your system configuration). PressingAlt+SysRq+R
restores the usual (outside X) ASCII mode where you can type characters.