From 6fda4ae759f96519037e71ffd3c8b298d388ff0c Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sun, 18 Jun 2017 20:44:58 +0200 Subject: kern/console: add support for scrolling --- kern/console.c | 21 ++++++++++++++++++++- kern/console.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/kern/console.c b/kern/console.c index 00d6e46d..e026ffd5 100644 --- a/kern/console.c +++ b/kern/console.c @@ -66,6 +66,21 @@ console_init(struct console *console, const char *name, strlcpy(console->name, name, sizeof(console->name)); } +static int +console_process_ctrl_char(struct console *console, char c) +{ + switch (c) { + case CONSOLE_SCROLL_UP: + case CONSOLE_SCROLL_DOWN: + break; + default: + return ERROR_INVAL; + } + + console->ops->putc(console, c); + return 0; +} + static void console_putc(struct console *console, char c) { @@ -96,7 +111,11 @@ console_getc(struct console *console) error = cbuf_pop(&console->recvbuf, &c); if (!error) { - break; + error = console_process_ctrl_char(console, c); + + if (error) { + break; + } } thread_sleep(&console->lock, console, "consgetc"); diff --git a/kern/console.h b/kern/console.h index 7455a051..a5aa478d 100644 --- a/kern/console.h +++ b/kern/console.h @@ -26,6 +26,9 @@ #include #include +#define CONSOLE_SCROLL_UP 0x12 /* DC2 */ +#define CONSOLE_SCROLL_DOWN 0x14 /* DC4 */ + struct console; struct console_ops { -- cgit v1.2.3