mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-25 18:33:24 +00:00
Support virtio console device
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
e9544d489f
commit
01e485b96e
@ -12,6 +12,7 @@ pod = { git = "https://github.com/jinzhao-dev/pod", rev = "d7dba56" }
|
||||
jinux-input = { path = "../../comps/input" }
|
||||
jinux-block = { path = "../../comps/block" }
|
||||
jinux-network = { path = "../../comps/network" }
|
||||
jinux-console = { path = "../../comps/console" }
|
||||
jinux-time = { path = "../../comps/time" }
|
||||
jinux-virtio = { path = "../../comps/virtio" }
|
||||
jinux-rights = { path = "../jinux-rights" }
|
||||
|
@ -9,7 +9,9 @@ use crate::{
|
||||
pub static TTY_DRIVER: Once<Arc<TtyDriver>> = Once::new();
|
||||
|
||||
pub(super) fn init() {
|
||||
register_console_input_callback(&serial_input_callback);
|
||||
for (_, device) in jinux_console::all_devices() {
|
||||
device.register_callback(&console_input_callback)
|
||||
}
|
||||
let tty_driver = Arc::new(TtyDriver::new());
|
||||
// FIXME: install n_tty into tty_driver?
|
||||
let n_tty = get_n_tty();
|
||||
@ -66,6 +68,13 @@ impl TtyDriver {
|
||||
}
|
||||
}
|
||||
|
||||
fn console_input_callback(items: &[u8]) {
|
||||
let tty_driver = get_tty_driver();
|
||||
for item in items {
|
||||
tty_driver.receive_char(*item);
|
||||
}
|
||||
}
|
||||
|
||||
fn serial_input_callback(item: u8) {
|
||||
let tty_driver = get_tty_driver();
|
||||
tty_driver.receive_char(item);
|
||||
|
Reference in New Issue
Block a user