diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 8181cc231..f40458274 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -352,6 +352,15 @@ pub enum ConsoleOutputMode { File, } +impl ConsoleOutputMode { + pub fn input_enabled(&self) -> bool { + match self { + ConsoleOutputMode::Tty => true, + _ => false, + } + } +} + pub struct ConsoleConfig<'a> { pub file: Option<&'a Path>, pub mode: ConsoleOutputMode, diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index e3ca92cbf..f1381eb99 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -1489,7 +1489,9 @@ impl<'a> Vm<'a> { .read_raw(&mut out) .map_err(Error::Serial)?; - if self.devices.serial.is_some() { + if self.devices.serial.is_some() + && self.config.serial.mode.input_enabled() + { self.devices .serial .as_ref() @@ -1500,7 +1502,9 @@ impl<'a> Vm<'a> { .map_err(Error::Serial)?; } - if self.devices.console.is_some() { + if self.devices.console.is_some() + && self.config.console.mode.input_enabled() + { self.devices .console .as_ref()