Log on tty (serial and vga)

This commit is contained in:
2026-03-22 16:00:41 +01:00
parent 15ecefb5fb
commit f966a1239e
9 changed files with 129 additions and 96 deletions

View File

@@ -1,26 +1,26 @@
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
use crate::io;
#[path = "unsupported.rs"]
mod unsupported;
pub use self::unsupported::{STDIN_BUF_SIZE, Stderr, Stdin, is_ebadf};
pub use self::unsupported::{STDIN_BUF_SIZE, Stderr, is_ebadf};
pub struct Stdout;
// pub struct Stdin;
pub struct Stdin;
impl Stdout {
pub const fn new() -> Self {
Self
}
}
// impl Stdin {
// pub const fn new() -> Self {
// Self
// }
// }
impl Stdin {
pub const fn new() -> Self {
Self
}
}
impl io::Write for Stdout {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
unsafe { Ok(write(1, buf) as usize) }
Ok(write(1, buf) as usize)
}
fn flush(&mut self) -> io::Result<()> {
@@ -29,12 +29,11 @@ impl io::Write for Stdout {
}
}
// impl io::Read for Stdin {
// fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
// Ok(0)
// // unsafe { Ok(read(0, buf) as usize) }
// }
// }
impl io::Read for Stdin {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
Ok(read(0, buf) as usize)
}
}
pub fn panic_output() -> Option<impl io::Write> {
// Todo, use Stderr