summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-18 20:44:58 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-18 20:44:58 +0200
commit6fda4ae759f96519037e71ffd3c8b298d388ff0c (patch)
tree9c2c8e367b042dd69ede840215e155c7c47efdb1
parent106bb2e3f3e658fcb6af72414f73cc49b32f836d (diff)
kern/console: add support for scrolling
-rw-r--r--kern/console.c21
-rw-r--r--kern/console.h3
2 files changed, 23 insertions, 1 deletions
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 <kern/spinlock.h>
#include <kern/thread.h>
+#define CONSOLE_SCROLL_UP 0x12 /* DC2 */
+#define CONSOLE_SCROLL_DOWN 0x14 /* DC4 */
+
struct console;
struct console_ops {