Console function keys and color support:

- if "debug_fkeys" boot monitor variable is set to 0:
  - pass Fn, Shift+Fn, Ctrl+Fn, Shift+Ctrl+Fn to applications
  - don't start IS
- update termcap files with function key, color, end key support
This commit is contained in:
David van Moolenbroek 2009-12-22 23:30:50 +00:00
parent d5471320d9
commit 123683d4a5
4 changed files with 68 additions and 23 deletions

View file

@ -104,6 +104,10 @@ PRIVATE int locks[NR_CONS]; /* per console lock keys state */
PRIVATE char numpad_map[] =
{'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'};
PRIVATE char *fkey_map[] =
{"11", "12", "13", "14", "15", "17", /* F1-F6 */
"18", "19", "20", "21", "23", "24"}; /* F7-F12 */
/* Variables and definition for observed function keys. */
typedef struct observer { int proc_nr; int events; } obs_t;
PRIVATE obs_t fkey_obs[12]; /* observers for F1-F12 */
@ -139,7 +143,8 @@ PRIVATE struct kbd_outack
PRIVATE int kbd_watchdog_set= 0;
PRIVATE int kbd_alive= 1;
PRIVATE int sticky_alt_mode = 0;
PRIVATE long sticky_alt_mode = 0;
PRIVATE long debug_fkeys = 1;
PRIVATE timer_t tmr_kbd_wd;
FORWARD _PROTOTYPE( void handle_req, (struct kbd *kbdp, message *m) );
@ -561,7 +566,7 @@ tty_t *tp;
int try;
{
/* Process characters from the circular keyboard buffer. */
char buf[3];
char buf[7], *p, suffix;
int scode;
unsigned ch;
@ -577,8 +582,8 @@ int try;
if (itail == ibuf + KB_IN_BYTES) itail = ibuf;
icount--;
/* Function keys are being used for debug dumps. */
if (func_key(scode)) continue;
/* Function keys are being used for debug dumps (if enabled). */
if (debug_fkeys && func_key(scode)) continue;
/* Perform make/break processing. */
ch = make_break(scode);
@ -595,6 +600,34 @@ int try;
buf[2] = numpad_map[ch - HOME];
(void) in_process(tp, buf, 3);
} else
if ((F1 <= ch && ch <= F12) || (SF1 <= ch && ch <= SF12) ||
(CF1 <= ch && ch <= CF12 && !debug_fkeys)) {
/* An escape sequence generated by function keys. */
if (F1 <= ch && ch <= F12) {
ch -= F1;
suffix = 0;
} else
if (SF1 <= ch && ch <= SF12) {
ch -= SF1;
suffix = '2';
} else
if (CF1 <= ch && ch <= CF12) {
ch -= CF1;
suffix = shift ? '6' : '5';
}
/* ^[[11~ for F1, ^[[24;5~ for CF12 etc */
buf[0] = ESC;
buf[1] = '[';
buf[2] = fkey_map[ch][0];
buf[3] = fkey_map[ch][1];
p = &buf[4];
if (suffix) {
*p++ = ';';
*p++ = suffix;
}
*p++ = '~';
(void) in_process(tp, buf, p - buf);
} else
if (ch == ALEFT) {
/* Choose lower numbered console as current console. */
select_console(ccurrent - 1);
@ -963,12 +996,9 @@ PUBLIC void kb_init_once(void)
{
int i;
u8_t ccb;
char env[100];
if(env_get_param("sticky_alt", env, sizeof(env)-1) == OK
&& atoi(env) == 1) {
sticky_alt_mode = 1;
}
env_parse("sticky_alt", "d", 0, &sticky_alt_mode, 0, 1);
env_parse("debug_fkeys", "d", 0, &debug_fkeys, 0, 1);
set_leds(); /* turn off numlock led */
scan_keyboard(NULL, NULL); /* discard leftover keystroke */

5
etc/rc
View file

@ -51,7 +51,10 @@ start)
# National keyboard?
test -f /etc/keymap && loadkeys /etc/keymap
up is -period 5HZ
if [ "`sysenv debug_fkeys`" != 0 ]
then
up is -period 5HZ
fi
echo .
# Set timezone.

View file

@ -1,13 +1,15 @@
mx|minix|minix console:\
:am:xn:bs:\
:co#80:li#25:\
:cr=^M:nw=^M^J:\
:bl=^G:\
:is=\E[0m:\
:cd=\E[0J:cl=\E[H\E[0J:\
:so=\E[7m:se=\E[0m:\
:us=\E[4m:ue=\E[0m:\
:mb=\E[5m:md=\E[1m:\
:mr=\E[7m:me=\E[0m:\
:sr=\EM:\
:sr=\EM:sf=^J:\
:cm=\E[%i%d;%dH:\
:ho=\E[H:\
:al=\E[L:AL=\E[%dL:\
@ -16,7 +18,7 @@ mx|minix|minix console:\
:DL=\E[%dM:dl=\E[M:\
:DO=\E[%dB:do=\E[B:\
:IC=\E[%d@:ic=\E[@:\
:it#8:\
:it#8:ta=^I:\
:le=^H:LE=\E[%dD:\
:nd=\E[C:RI=\E[%dC:\
:up=\E[A:UP=\E[%dA:\
@ -24,7 +26,15 @@ mx|minix|minix console:\
:kl=\E[D:kr=\E[C:\
:kh=\E[H:kb=^H:\
:kD=\177:kI=\E[@:\
:kN=\E[U:kP=\E[V:
:kN=\E[U:kP=\E[V:\
:@7=\E[Y:\
:k1=\E[11~:k2=\E[12~:\
:k3=\E[13~:k4=\E[14~:\
:k5=\E[15~:k6=\E[17~:\
:k7=\E[18~:k8=\E[19~:\
:k9=\E[20~:k;=\E[21~:\
:Co#8:pa#64:\
:AB=\E[4%dm:AF=\E[3%dm:
du|dialup|Dialup line:\
:bs:co#80:li#24:
db|dumb|Really dumb terminal:\

View file

@ -12524,7 +12524,7 @@ osexec|Osborne executive:\
:kb=^H:kd=^J:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:nl=^J:se=\Ek:\
:so=\Ej:st=\E1:ue=\Em:up=^K:us=\El:
#### Console types for obsolete UNIX clones
#### Console types for obsolete and not-so-obsolete UNIX clones
#
# Coherent, Minix, Venix, and several lesser-known kin were OSs for 8088
# machines that tried to emulate the UNIX look'n'feel. Coherent and Venix
@ -12538,19 +12538,21 @@ osexec|Osborne executive:\
# even as single processes under SunOS and the Macintosh OS.
#
# This is the entry provided with minix 1.7.4, with bogus :ri: removed.
minix|minix console (v1.7):\
:am:xn:\
# This is the entry provided with MINIX 3.1.6.
minix|minix console:\
:am:xn:bs:\
:co#80:it#8:li#25:\
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:cd=\E[0J:\
:ce=\E[K:cl=\E[H\E[0J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:\
:dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:is=\E[0m:k0=\E[Y:\
:k1=\E[V:k2=\E[U:k3=\E[T:k4=\E[S:k5=\E[G:kb=^H:kd=\E[B:\
:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:l0=End:l1=PgUp:l2=PgDn:\
:l3=Num +:l4=Num -:l5=Num 5:le=^H:mb=\E[5m:md=\E[1m:\
:me=\E[0m:mr=\E[7m:nd=\E[C:nw=^M^J:se=\E[0m:sf=^J:so=\E[7m:\
:sr=\EM:ta=^I:ue=\E[0m:up=\E[A:us=\E[4m:
:dl=\E[M:do=\E[B:ho=\E[H:ic=\E[@:is=\E[0m:k1=\E[11~:\
:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:\
:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kD=\177:\
:kI=\E[@:kN=\E[U:kP=\E[V:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:\
:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[0m:\
:mr=\E[7m:nd=\E[C:nw=^M^J:se=\E[0m:sf=^J:so=\E[7m:\
:sr=\EM:ta=^I:ue=\E[0m:up=\E[A:us=\E[4m:@7=\E[Y:\
:Co#8:pa#64:AB=\E[4%dm:AF=\E[3%dm:
# Corrected Jan 14, 1997 by Vincent Broman <broman@nosc.mil>
minix-old|minix console (v1.5):\
:xo:\