mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Send tty input to correct destination
Check the config to find out which device is attached to the tty and then send the input from the user into that device (serial or virtio-console.) Fixes: #3005 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -535,21 +535,6 @@ pub struct Console {
|
||||
}
|
||||
|
||||
impl Console {
|
||||
pub fn queue_input_bytes(&self, out: &[u8]) -> vmm_sys_util::errno::Result<()> {
|
||||
match self.input {
|
||||
Some(ConsoleInput::Serial) => {
|
||||
self.queue_input_bytes_serial(out)?;
|
||||
}
|
||||
|
||||
Some(ConsoleInput::VirtioConsole) => {
|
||||
self.queue_input_bytes_console(out);
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn queue_input_bytes_serial(&self, out: &[u8]) -> vmm_sys_util::errno::Result<()> {
|
||||
if self.serial.is_some() {
|
||||
self.serial
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
use crate::config::NumaConfig;
|
||||
use crate::config::{
|
||||
DeviceConfig, DiskConfig, FsConfig, HotplugMethod, NetConfig, PmemConfig, UserDeviceConfig,
|
||||
ValidationError, VmConfig, VsockConfig,
|
||||
ConsoleOutputMode, DeviceConfig, DiskConfig, FsConfig, HotplugMethod, NetConfig, PmemConfig,
|
||||
UserDeviceConfig, ValidationError, VmConfig, VsockConfig,
|
||||
};
|
||||
use crate::cpu;
|
||||
use crate::device_manager::{
|
||||
@@ -1950,19 +1950,25 @@ impl Vm {
|
||||
out[0] = 0x0d;
|
||||
}
|
||||
|
||||
if self
|
||||
.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.console()
|
||||
.input_enabled()
|
||||
{
|
||||
if matches!(
|
||||
self.config.lock().unwrap().serial.mode,
|
||||
ConsoleOutputMode::Tty
|
||||
) {
|
||||
self.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.console()
|
||||
.queue_input_bytes(&out[..count])
|
||||
.queue_input_bytes_serial(&out[..count])
|
||||
.map_err(Error::Console)?;
|
||||
} else if matches!(
|
||||
self.config.lock().unwrap().console.mode,
|
||||
ConsoleOutputMode::Tty
|
||||
) {
|
||||
self.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.console()
|
||||
.queue_input_bytes_console(&out[..count])
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user