I was messing around with scancodes and keycodes in Debian Buster and I've found something strange.
Using sudo showkey -s
I discovered that the scancode of the PrintScreen/SysRq key of my USB wired keyboard is
0xe0 0x2a 0xe0 0x37 0xe0 0xaa 0xe0 0xb7
,
that is, 0xe0 0x2a 0xe0 0x37
is the code for pressing it and 0xe0 0xaa 0xe0 0xb7
for releasing it.
My first question is: Why is it using two scancodes (0xe0 0x2a
and 0xe0 0x37
)? Coundn't this conflict with others scancodes? Wouldn't be smarter to use an unused scancode?
Using sudo showkey -k
I discovered that PrintScreen/SysRq is associated with the kernel keycode 99
, but when I run sudo getkeycodes
, there isn't an entry for the X keycode 107
.
The output of sudo getkeycodes
is
Códigos de varredura planos xx (hex) versus códigos de teclas (dec)
0 é um erro; para 1-88 (001-0x58) código de varredura igual a código de tecla
0x58: 88 - - - 185 238 - -
0x60: - - - - - - - -
0x68: - - - 191 - - - -
0x70: - - - - - - - -
0x78: - - - - - - - -
Códigos de varredura escapados e0 xx (hex)
e0 00: - - 212 533 - - - -
e0 08: 238 - - - - - - -
e0 10: - - - - - - - -
e0 18: - - - - - - - -
e0 20: - - - - - - - -
e0 28: - - - - - - - -
e0 30: - - - - - - - -
e0 38: - - - - - 212 - -
e0 40: - - - - - - - -
e0 48: - - - - 227 - - -
e0 50: - - - - - - - -
e0 58: - - - - - - - -
e0 60: 148 184 - - 171 - - -
e0 68: 152 431 - 534 535 536 537 538
e0 70: - - - 139 - 172 1 -
e0 78: - - - - - - - -
My second question is: If there isn't a entry in the above output, how does the mapping of PrintScreen/SysRq from scancode to keycode works?
If necessary, I can provide any additional info.
Thank you all in advance.
EDIT 1: I realized that this combination of scancodes conflicts with pressing Shift+ (Ctrl-PrtScn)
, I confirmed that Shift
's scancode is 0x2a 0xaa
by running sudo showkey -s
and I found (Ctrl-PrtScn)
's code in this documentation.
I've searched /usr/lib/udev/hwdb.d/60-keyboard.hwdb
for this map, but didn't find anything.