Why is Pause/Break key is immediately released? Can that be fixed?
Since the Pause key is useless, I tried to map it to a modifier key. What is straightforward for other keys turned out not to work fine for Pause.
By inspecting the output of xev -event keyboard | grep -E '^Key|state'
for holding Pause and then pressing s,
KeyPress event, serial 28, synthetic NO, window 0x800001,
state 0x0, keycode 127 (keysym 0xffed, Hyper_L), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x800001,
state 0x20, keycode 127 (keysym 0xffed, Hyper_L), same_screen YES,
KeyPress event, serial 28, synthetic NO, window 0x800001,
state 0x0, keycode 39 (keysym 0x73, s), same_screen YES,
KeyRelease event, serial 28, synthetic NO, window 0x800001,
state 0x0, keycode 39 (keysym 0x73, s), same_screen YES,
we see that I succeeded in making Pause an Hyper modifier; However, it can't actually be used as a modifier since the key is immediately released (even though I didn't release it before pressing s).
The same is detected by showkey
: Holding Pause immediately outputs
keycode 119 press
keycode 119 release
whereas holding another key (Insert) spams
keycode 110 press
keycode 110 press
keycode 110 press
keycode 110 press
keycode 110 press
as expected.
Why does this odd behavior happen with the Pause key? Is it a hardware thing (and thus unsolvable) or can it be addressed in the OS level?
1 answer
From Wikipedia: Break key:
The Pause key is different from all other keys in that it sends no scancodes at all on release in PS/2 modes 1 or 2, so it is impossible to determine whether this key is being held down with older devices. In PS/2 mode 3 or USB HID mode, there is a release scancode, so it is possible to determine whether this key is being held down on modern computers.
The claim is backed up by IBM: "Keyboard 101- and 102-Key". PS/2 Hardware Interface Technical Reference.
In Keyboard scancodes, Andries E. Brouwer says:
The latter [Pause/Break key] produces scancode sequence e1 1d 45 e1 9d c5 when pressed (without modifier) and nothing at all upon release.
That is exactly what I get from showkey -s
.
TLDP: The Linux keyboard and console: Unusual keys and keyboards reiterates:
The Pause/Break key is also special in another way: it does not generate key-up scancodes, but generates the entire 6-scancode sequence on key-down.
All in all, Pause/Break really cannot be used as a modifier in my keyboard setup, since this is a hardware limitation.
2 comment threads