kbd_mode
Change keyboard mode (raw, virtual console)
SYNOPSIS
kbd_mode [options]
PARAMETERS
(no arguments)
Reports the current keyboard mode in a long, descriptive format.
-s
Reports the current keyboard mode in a short, concise format.
-a, --ascii
Sets the keyboard mode to XLATE (ASCII) mode. This is the default and most common mode for general console use, translating keys to ASCII characters.
-u, --unicode
Sets the keyboard mode to UNICODE mode, allowing input of Unicode characters directly from the keyboard.
-k, --raw
Sets the keyboard mode to RAW mode. In this mode, raw keyboard scancodes are returned directly, bypassing character translation. This is typically used by low-level utilities.
--specl
Sets the keyboard to SPECL (Special) mode. This mode is less common and often used for specific hardware or embedded systems where only function keys might be translated.
DESCRIPTION
The kbd_mode command is used to display or alter the keyboard translation mode for the Linux console. The Linux kernel supports several keyboard modes, each dictating how raw keyboard scancodes are interpreted and translated into characters or events.
The primary modes are XLATE (ASCII), which is the default for most interactive console use and translates keys into their ASCII equivalents; RAW, which provides untranslated scancodes, typically used by low-level utilities like loadkeys or setfont during system boot; and UNICODE, which translates keys into Unicode characters, enabling broader character set support. A less common SPECL mode exists for special keyboard configurations.
Understanding and setting the correct keyboard mode is crucial for proper input handling on the console, especially when dealing with different keyboard layouts, character encodings, or specific system utilities that require direct access to keyboard scancodes.
CAVEATS
Changing the keyboard mode, especially to RAW or SPECL, can significantly alter keyboard behavior, making normal text input difficult or impossible. These modes are typically used by specific utilities or for specialized configurations, not for everyday interactive use. Ensure you know how to revert the mode (e.g., using kbd_mode -a) if unintended behavior occurs.
KEYBOARD MODES EXPLAINED
The Linux kernel supports distinct keyboard translation modes:
XLATE (or ASCII): The default mode, translating key presses into their ASCII equivalents. Suitable for standard text input.
RAW: Provides direct, untranslated scancodes from the keyboard. Essential for utilities that need to program or analyze the keyboard at a low level.
UNICODE: Translates key presses into Unicode characters, enabling support for a wider range of international characters directly from the keyboard.
SPECL: A special mode where only certain keys (like function keys) are translated, with others remaining raw. Less commonly used.
HISTORY
The kbd_mode command is part of the kbd (keyboard utilities) package, which provides various console-specific tools for Linux. These utilities have been fundamental to Linux console management since its early days, evolving alongside kernel keyboard drivers to support different input modes and character sets. Its function reflects the kernel's underlying capabilities for keyboard input translation.