diff options
author | Ian Moffett <ian@osmora.org> | 2024-02-25 22:28:09 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-02-25 22:30:15 -0500 |
commit | d4372855f00cb47ccfa60db79c5ee35c17f96707 (patch) | |
tree | 6efffc5617fc4c66a38d2e41a7990ddd7534c922 /sys/kern/kern_syslog.c | |
parent | 752ae0d0c23d1edf9b2ce563c4e82283dffd273a (diff) |
kernel: Move video console code
This commit introduces a video console driver to Hyra and replaces
that weird tty.c file used only for video console logic
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_syslog.c')
-rw-r--r-- | sys/kern/kern_syslog.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/kern/kern_syslog.c b/sys/kern/kern_syslog.c index 52bdcca..d8880a9 100644 --- a/sys/kern/kern_syslog.c +++ b/sys/kern/kern_syslog.c @@ -28,29 +28,23 @@ */ #include <sys/syslog.h> -#include <sys/tty.h> #include <sys/machdep.h> +#include <dev/vcons/vcons.h> #include <string.h> -static struct tty syslog_tty; - -/* False if we don't log to a console */ -static bool is_conlog_init = false; +static struct vcons_screen syslog_screen = {0}; static void syslog_write(const char *s, size_t len) { -#if defined(__SERIAL_DEBUG) size_t tmp_len = len; const char *tmp_s = s; while (tmp_len--) { - serial_dbgch(*tmp_s++); - } +#if defined(__SERIAL_DEBUG) + serial_dbgch(*tmp_s); #endif /* defined(__SERIAL_DEBUG) */ - - if (is_conlog_init) { - tty_write(&syslog_tty, s, len); + vcons_putch(&syslog_screen, *tmp_s++); } } @@ -131,8 +125,13 @@ kprintf(const char *fmt, ...) void syslog_init(void) { - is_conlog_init = true; + struct termios termios = {0}; + + termios.c_oflag |= OCRNL; /* Map CR to NL by default */ + + syslog_screen.bg = 0x000000; + syslog_screen.fg = 0x808080; + syslog_screen.termios = termios; - tty_set_defaults(&syslog_tty); - tty_attach(&syslog_tty); + vcons_attach(&syslog_screen); } |