pub struct VirtIOConsole<H: Hal, T: Transport> { /* private fields */ }
Expand description
Driver for a VirtIO console device.
Only a single port is allowed since alloc
is disabled. Emergency write and cols/rows are not
implemented.
§Example
use virtio_drivers::device::console::VirtIOConsole;
let mut console = VirtIOConsole::<HalImpl, _>::new(transport)?;
let info = console.info();
println!("VirtIO console {}x{}", info.rows, info.columns);
for &c in b"Hello console!\n" {
console.send(c)?;
}
let c = console.recv(true)?;
println!("Read {:?} from console.", c);
Implementations§
Source§impl<H: Hal, T: Transport> VirtIOConsole<H, T>
impl<H: Hal, T: Transport> VirtIOConsole<H, T>
Sourcepub fn info(&self) -> ConsoleInfo
pub fn info(&self) -> ConsoleInfo
Returns a struct with information about the console device, such as the number of rows and columns.
Sourcepub fn ack_interrupt(&mut self) -> Result<bool>
pub fn ack_interrupt(&mut self) -> Result<bool>
Acknowledges a pending interrupt, if any, and completes the outstanding finished read request if there is one.
Returns true if new data has been received.