kernel: tty: support printing output from printk()

This commit is contained in:
2023-06-11 14:55:47 +01:00
parent 0245d2254b
commit 3cc72f1f24
3 changed files with 47 additions and 9 deletions

View File

@@ -6,6 +6,7 @@
#include <socks/test.h>
#include <socks/printk.h>
#include <socks/device.h>
#include <socks/tty.h>
#include <socks/kext.h>
#include <socks/object.h>
#include <socks/sched.h>
@@ -192,9 +193,25 @@ void kernel_init(uintptr_t arg)
struct object *fb;
status = object_get("/dev/video/fb0", &fb);
if (status == KERN_OK) {
#if 0
struct framebuffer_varinfo fb_mode;
struct device *fbdev = cast_to_device(fb);
framebuffer_get_varinfo(fbdev, &fb_mode);
fb_mode.fb_xres = 1024;
fb_mode.fb_yres = 768;
fb_mode.fb_bpp = 24;
fb_mode.fb_flags = FB_MODE_RGB;
framebuffer_set_varinfo(fbdev, &fb_mode);
#endif
start_console_on_framebuffer(cast_to_device(fb));
}
#endif
struct object *tty0;
status = object_get("/dev/tty/tty0", &tty0);
if (status == KERN_OK) {
tty_set_printk_output(cast_to_device(tty0));
}
create_kernel_thread(background_thread);
@@ -202,15 +219,6 @@ void kernel_init(uintptr_t arg)
run_all_tests();
struct object *tty0;
status = object_get("/dev/tty/tty0", &tty0);
if (status == KERN_OK) {
size_t q;
object_write(tty0, "hello", 5, &q, 0);
} else {
printk("tty: unavailable");
}
status = object_get("/dev/input/input0", &kbd);
if (status != KERN_OK) {
printk("no keyboard available");