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:
+39
-9
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user