At the moment I'm not able to map keys using kbdcontrol on VT console. When I for example enter:
# kbdcontrol -f 1 'ls'
The command is not assigned to F1 function key. Can you have a look at this?
I'm taking a look at this. Seems to be a problem in CURRENT as well.
(In reply to Arshan Khanifar from comment #1)
There are patches suggested for several files in this thread:
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?
(In reply to Sergey from comment #2)
Thanks for the thread! Yes I'll look into it.
(In reply to Sergey from comment #2)
I don't really think the thread relates to this, however I've tried the same thing having set the system terminal to sc(4), and the function key doesn't work there either.
My suspicion is that this probably is some problem with the keyboard driver. I believe it doesn't emit the proper scan-code. I'll investigate further.
(In reply to Arshan Khanifar from comment #4)
Regarding scan codes you can install kbdscan for that. The problem is that mapping is not working at all, for example I'm not able to map Alt/Ctrl/Shift + Arrow keys to be able to use micro editor on console.
Unfortunately xterm on console doesn't support 256 colors either :(
(In reply to Sergey from comment #5)
It turns out that vt(4) was using teken's keystrings for the function keys, and while the function key strings were in fact getting set, it wasn't using them.
I'm not sure if it was originally the intent for teken to override the keystrings. Manual page of kbdcontrol(1) doesn't seem to suggest so.
Anyways, I've made this patch: D14936 which makes vt(4) to use the function key strings if they have been set. The behavior is same as before if the keys have not been set.
Err, this is the patch review D14936
(In reply to Arshan Khanifar from comment #7)
Will the patch be merged with 11 current?
And another question,
function keys are limited to 65 or I can use up to 108?
Because I'd like to map for example CtrlShiftUp to fkey66 in kbd file and then
kbdcontrol -f 66 '\033[1;6A'
If I'm not mistaken after patching arrow keys and PgUp, PgDn do not work in less anymore.
In FreeBSD 12-RELEASE, I'm still not able to assign commands using kbdcontrol. Hasn't the patch been merged? How can we solve the issue?
A commit references this bug:
Date: Fri Feb 1 16:07:49 UTC 2019
New revision: 343663
Fix function keys for syscons in cons25 mode (vidcontrol -T cons25).
kbd(4) (but only documented in atkbd(4)) maintains a table of strings
for 96 function keys. Using teken broke this 9+ years ago for the
most usable first 12 function keys and for 10 cursor keys, by supplying
its own non-programmable strings so that the keyboard driver's strings
are not used.
Fix this by supplying NULL in the teken layer for syscons in cons25 mode
so that the the strings are found in the kbd(4) layer.
vt needs more changes to use kbd(4)'s tables. Teken's cons25 table is
still needed to supply nonempty strings for vt in cons25 mode.
Keep using teken's xterm tables for both syscons and vt in xterm mode.
Function keys should at least default to xterm values in xterm mode,
and kbd(4) doesn't support this.
teken_set_cons25() sets a sticky flag to ask for the fix, and space is
reserved for another new flag. vt should set this flag when it uses
PR: 226553 (for vt)
(In reply to commit-hook from comment #12)
Patching teken.c file alone as well as together with https://reviews.freebsd.org/D14936 doesn't solve the issue for me( I'm still not able to assign strings to keys... Am I doing something wrong?