]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vt: add fallback to plain map for modifier-aware key types
authorNicolas Pitre <npitre@baylibre.com>
Tue, 3 Feb 2026 04:52:48 +0000 (23:52 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2026 14:07:51 +0000 (15:07 +0100)
commitc1d2deb6492fbd900392f4ebd47572ca4903d0fe
tree171ebb01187298f21d4d2e5173a1bc4215e762b1
parent5cba06c71c713a5beb4aafab7973287d8a248ddb
vt: add fallback to plain map for modifier-aware key types

When a key is pressed with modifiers (Shift, Ctrl, Alt, etc.) and the
modifier-specific keymap has no binding (K_HOLE) or doesn't exist, fall
back to the plain keymap if the plain entry is a modifier-aware type
(KT_CUR or KT_CSI).

This allows arrow keys and CSI navigation keys to automatically handle
all modifier combinations with just a single plain map entry. The key
handlers (k_cur and k_csi) read the modifier state at runtime and encode
it into the output sequence.

For example, with just:
    keycode 103 = Up
    keycode 104 = Csi_Home

All these combinations now work automatically:
    Up         -> ESC [ A
    Shift+Up   -> ESC [ 1 ; 2 A
    Ctrl+Up    -> ESC [ 1 ; 5 A
    Home       -> ESC [ 1 ~
    Shift+Home -> ESC [ 1 ; 2 ~
    Ctrl+Home  -> ESC [ 1 ; 5 ~

Previously, each modifier combination required an explicit keymap entry,
which was tedious and consumed keymap slots.

Explicit modifier bindings still take precedence - the fallback only
triggers when the modifier-specific entry is empty.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Link: https://patch.msgid.link/20260203045457.1049793-4-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/keyboard.c