LinuxCommandLibrary

kbd_mode

Change keyboard mode (raw, virtual console)

SYNOPSIS

kbd_mode [-a] [-s] raw|mediumraw|xlate

PARAMETERS

-a
    Apply mode change to all active virtual consoles

-s
    Attempt to store the mode persistently in kernel (obsolete, ignored)

raw
    Set raw scancode passthrough mode

mediumraw
    Set medium-raw mode (keycodes as scancodes)

xlate
    Set translated keycode mode (default)

DESCRIPTION

kbd_mode is a utility from the kbd package that configures the keyboard input mode for the Linux console (virtual terminals). It controls how scancodes from the keyboard are processed and passed to applications.

The three modes are:
- raw: Scancodes are passed directly without translation. Used by applications like Xorg or GPM that handle their own keyboard processing.
- mediumraw: Keycodes (after kernel translation) are passed to the application as if they were scancodes. Suitable for some console mouse/pointer daemons.
- xlate (default): Scancodes are translated into keycodes using the kernel's keymap tables before being passed to applications. This is the standard mode for text consoles.

By default, changes apply only to the current virtual terminal. It requires root privileges and affects only the Linux console layer, not Wayland or X11 sessions running on it. Typically used during boot scripts or to switch modes for specific tools. Without arguments, it reports the current mode.

CAVEATS

Requires root privileges.
Affects only Linux console (VTs), not graphical sessions.
-s option is obsolete and has no effect.
If no mode specified, prints current mode instead of setting.

USAGE EXAMPLE

kbd_mode raw # Switch current VT to raw mode for X
kbd_mode -a xlate # Restore xlate on all VTs

HISTORY

Introduced with early Linux console support (pre-2.0 kernels). Part of kbd package by Risto Kankkunen; maintained for decades with minor updates for new hardware.

SEE ALSO

loadkeys(8), dumpkeys(8), setkeycodes(8), kbd(4)

Copied to clipboard