Skip to main content

Module console

Module console 

Source
Expand description

Muting the kernel’s virtual terminal.

A Denise application that owns the display still shares the keyboard with whatever is behind it. On a console-booted kiosk that is a login shell, so every character typed into a Denise text field is also typed at the shell — and reboot<Enter> in a form field does what it says. Holding DRM master stops the console drawing; it does nothing about the keyboard.

Console::mute_keyboard sets KDSKBMODE to K_OFF, which makes the kernel discard console keystrokes entirely. Reading /dev/input/event* is unaffected, because evdev sits below the console layer — which is the whole trick.

§Getting your console back

K_OFF is process-independent kernel state on a shared device. It is restored on Drop, including while a panic unwinds, but nothing runs on SIGKILL or a hard reset, and a muted console has no working Ctrl+Alt+F2 to escape through — K_OFF swallows that too.

So write down the escape hatch before you need it. From SSH, or from another VT if you can still reach one:

kbd_mode -u -C /dev/tty1     # back to Unicode

Do not mute during development on a machine you cannot reach over the network.

Structs§

Console
A handle to the virtual terminal, which restores whatever it changed on drop.

Enums§

ConsoleError
Something went wrong talking to the console.

Constants§

KD_GRAPHICS
KD_GRAPHICS: the console stops drawing text and stops blanking the screen.
KD_TEXT
KD_TEXT: the console draws text. The default.
K_MEDIUMRAW
K_MEDIUMRAW: keycodes rather than scancodes, still untranslated.
K_OFF
K_OFF: the kernel reads the keyboard and throws the result away.
K_RAW
K_RAW: the console delivers raw scancodes.
K_UNICODE
K_UNICODE: translated and UTF-8 encoded. Where a modern console sits.
K_XLATE
K_XLATE: scancodes translated to bytes through the loaded keymap.