[Bug 226553] kbdcontrol doesn't map function keys

Bruce Evans brde at optusnet.com.au
Wed Mar 28 16:13:19 UTC 2018


On Wed, 28 Mar 2018 a bug that doesn't want replies at freebsd.org wrote:

> --- Comment #2 from Sergey <kpect at protonmail.com> ---
> (In reply to Arshan Khanifar from comment #1)
> Hello Arshan,
> There are patches suggested for several files in this thread:
> https://forums.freebsd.org/threads/kbdmap-and-keyboard-mapping-files.57444/post-328546
>
> I tried to edit keymap file and added escape controls to
> usr.sbin/kbdcontrol/kbdcontrol.c, but looks that is not enough. Additional
> files needs to be patched also.
>
> Can you take a look at the thread and possibly add those fixes to upstream?

Programmable function keys were never supported by vt, and are broken for
syscons.  I will fix them for syscons soon.

All keys are mapped by kbd(4undoc) (see atkbd(4) for some documentation).
The mappings are syscons-centric, so all of the standard function key
sequences are unusable for xterm mode.  Teken overrides these and some
others to support xterm mode, and fails to not override them in sysons
mode.  This loses all function key programmability -- function key
programming changes the standard sequences in kbd(4), but teken never
uses either the standard sequences or the changed sequences.

Keymaps only provide 1 layer of converting keys to sequences of bytes.
The full conversion is approximately:

scan codes -> logical keys (mostly hard-coded)
logical keys -> logical keys2 (keymaps; keys2 has some ASCII and func. keys)
logical keys2 -> sequences of bytes (defaults hard-coded in kbd(4) and teken)
sequences of bytes -> sequences of bytes (change the defaults for func. keys)

It's actually even more complicated than that.  Some logical keys2 give
actions and never generate sequences of bytes, except you can use keympaps
to remap an action logical key to a normal logical key2 (e.g., the 'a'
key to F65 instead of to 'a').

Oops, I forgot that teken only overrides the first 12 function keys.
Programming of the other 84 still works, at least for syscons.  The
next 36 are fairly easy to find.  They are Ctrl and/or Alt combinations
of the 12 AT-standard function keys.  The next 16 are mostly on the
numeric and other special keypads.  Their mappings are hard to remember.
The next 32 are not mapped in most keymaps, and it is hard to find
enough physical keys for useful use of them.  However, you can use
keymaps to map any logical key to a function key.

So the problem has the workaround of messing up keymaps to map the
standard F1-F12 to somwhere that teken can't see, e.g., F85-F96; then
program the keys in their new place.  This loses the normal xterm
sequences for these keys.  You can use keymaps to map some other keys
to F1-F12.  This would be hard to remember.  The easiest to rememeber
is probably permuting F1-F48.

Bruce


More information about the freebsd-bugs mailing list