[Midnightbsd-cvs] [MidnightBSD/src] 9e95f6: Fix translation of the PrintScreen/SysRq and Pause...
Lucas Holt
noreply at github.com
Sun Nov 15 01:35:01 EST 2020
Branch: refs/heads/master
Home: https://github.com/MidnightBSD/src
Commit: 9e95f6c17abdbf141098f0e4573029b984031e37
https://github.com/MidnightBSD/src/commit/9e95f6c17abdbf141098f0e4573029b984031e37
Author: Lucas Holt <luke at foolishgames.com>
Date: 2020-11-15 (Sun, 15 Nov 2020)
Changed paths:
M sys/dev/usb/input/ukbd.c
Log Message:
-----------
Fix translation of the PrintScreen/SysRq and Pause/Break keys. Almost
everything was broken. The cases that I noticed were Ctrl-PrintScreen
not being mapped to the virtual scancode 0x5c (debug) and Pause not being
mapped to the physical/virtual scancode 0x46 (slock).
These keys are the most complicated ones due to kludges to give some
compatibility back to before AT keyboards.
Alt-PrintScreen must pretend to be a separate key from PrintScreen
even at the "raw" level. The (unique) usb code for it is 0x8a and we
just have to map this to our unique virtual scancode 0x54, but we
mapped it first to the internal code 0x7e and then to 0x79 which is a
key on the Japanese 106/109 keyboard. This fix is under the
UKBD_EMULATE_ATASCANCODE option which shouldn't be used for non-AT
keyboards. If it is, then the syscons Japanese keymaps have nothing
of importance for code 0x79 and can easily be changed. 0x54 is also
unimportant in Japanese and US keymaps.
NonAlt-PrintScreen and NonCtl-Pause/Break had many much larger bugs with
smaller compatibility problems from fixing them. The details are too
ugly to give here. Summary of the changed (hex) codes:
K_RAW PrintScreen (Ctl, Shift, Ctl-Shift): E0-2A-E0-37 -> E0-37
K_RAW Alt-PrintScreen (all shift states): 79 -> 54
K_RAW Pause/Break (unshifted, Shift, Alt, Alt-Shift)): E0-46 -> E1-1D-45
K_CODE ALT-PrintScreen (all shift states): 79 -> 54
That is 15 of 32 shift combinations for 2 keys fixed, with 8 easy cases
from the 79 -> 54 remapping.
The difference is only large and with no workaround using a keymap for
for K_RAW, but this affects other modes when ukbd is layered under kbmux
because kbmux keeps all subdevices in K_RAW mode and translates. Oops.
I used kbdmux to generate the above table of changes.
Obtained from: FreeBSD
Commit: 82477fd3b04bf1336ca89a5698e843cdee3cc735
https://github.com/MidnightBSD/src/commit/82477fd3b04bf1336ca89a5698e843cdee3cc735
Author: Lucas Holt <luke at foolishgames.com>
Date: 2020-11-15 (Sun, 15 Nov 2020)
Changed paths:
M sys/dev/usb/input/ukbd.c
Log Message:
-----------
Further fixes for translation of PrintScreen/SysRq.
The previous fix was tested mainly on 3 AT keyboards with USB adaptors where
it works. 1 USB keyboard doesn't translate Alt-PrintScreen, so the software
has to do it.
Reorganize a little to share some code and to not translate the unusual usb
scan code0x8a unless an Alt modified is set. Remove redundant check of Alt
modifiers. Translation now more clearly filters out Alt-PrintScreen before
the check.
The table of errors fixed in the previous commit had many bugs. Correct
table:
K_RAW Ctl-PrintScreen: E0-2A-E0-37 -> E0-37
K_RAW Alt-PrintScreen (with 4 comb. of Ctl/Shift): 79 -> 54
K_RAW Pause/Break (with 4 comb. of Alt/Shift): E0-46 -> E1-1D-45
K_CODE PrintScreen (with 4 comb. of Ctl/Shift): 54 -> 5c
K_CODE Alt-PrintScreen (with 4 comb. of Ctl/Shift): 7e -> 54
K_CODE Pause/Break (with 8 comb. of Ctl/Alt/Shift): 6c -> 68
That is 25 of 32 shift combinations for 2 keys fixed. All 16 combinations
were broken for K_CODE and thus also for K_XLATE.
Obtained from: FreeBSD
Compare: https://github.com/MidnightBSD/src/compare/e9a8e3bb07b0...82477fd3b04b
More information about the Midnightbsd-cvs
mailing list