tty: add tee

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-17 02:38:00 -04:00
commit 4909482a2e
5 changed files with 88 additions and 10 deletions

View file

@ -31,17 +31,17 @@ static struct tty_serial_ops fbcon_serial_ops = {
.serial_getchar = fbcon_getchar,
};
void fbcon_init(void)
struct tty *fbcon_init(void)
{
if (!fb_res || !fb_res->framebuffer_count)
return;
return NULL;
struct limine_framebuffer *fb = fb_res->framebuffers[0];
size_t fb_size = fb->pitch * fb->height;
void *fb_virt = map_mmio_dev((paddr_t)TO_PHYS(fb->address), fb_size);
if (!fb_virt)
return;
return NULL;
ft_ctx = flanterm_fb_init(
NULL, NULL, fb_virt, fb->width, fb->height, fb->pitch, fb->red_mask_size, fb->red_mask_shift, fb->green_mask_size,
@ -49,7 +49,7 @@ void fbcon_init(void)
0, 0, 0, 0, FLANTERM_FB_ROTATE_0);
if (!ft_ctx)
return;
return NULL;
struct tty *fbtty = tty_create("tty1", NULL);
@ -57,4 +57,6 @@ void fbcon_init(void)
tty_printf = fbtty;
kinfo("fbcon: framebuffer console initialized (%lux%lu)\n", fb->width, fb->height);
return fbtty;
}