From cb55d617882e7f3d5cea4af30c0881be8ae6e773 Mon Sep 17 00:00:00 2001 From: sbosse Date: Sun, 12 Jan 2025 19:30:17 +0100 Subject: [PATCH] Sun 12 Jan 19:29:58 CET 2025 --- kernel/console.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/kernel/console.c b/kernel/console.c index 91ff7ba..8475e96 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -10,6 +10,13 @@ See the file LICENSE for details. #include "kmalloc.h" #include "string.h" +/* + Switch to serial consol #portnr ? + If not, -1 + else using serial_device_write from serial.c ... +*/ +int console_serial=-1; + struct console { struct window *window; struct graphics *gx; @@ -174,12 +181,18 @@ int console_getchar( struct console *c ) void console_putchar( struct console *c, char ch ) { - console_write(c,&ch,1); + if (console_serial!=-1) + serial_putchar(console_serial,ch); + else + console_write(c,&ch,1); } void console_putstring( struct console *c, const char *str) { - console_write(c,str,strlen(str)); + if (console_serial!=-1) + serial_device_write(console_serial,str,strlen(str),0); + else + console_write(c,str,strlen(str)); } struct console *console_create( struct window *w )