Linux: What is Scancode, Keycode, Keysym

By Xah Lee. Date: .

To work with keys in Linux X11, you must understand {scancode, keycode, keysym} because many key tools use their concept and syntax.

Scancode
A number the keyboard send to computer. For USB keyboards, it's defined by the USB standard. [see Linux: Find Keyboard Key Scancode]
Keycode
A number used by Linux kernel to represent key (or mouse button/wheel). The Linux kernel translates scancode to keycode.
Keysym
(key symbol) A name for a key. Keysym is received by X11 applications. [see Linux: X11 Keyboard Key Names]

Linux: Scancode, Keycode, Keysym