Skip to content

Commit e4f70b4

Browse files
committed
devices/console: Remove requirement for first console port to be a console
Remove the assertion that the first port must have terminal properties. This is not actually enforced by the spec, the only problem is you can't use such virtio console for as the kernel argument. Signed-off-by: Matej Hrica <[email protected]>
1 parent f9f9159 commit e4f70b4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/devices/src/virtio/console/device.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub struct Console {
7272
impl Console {
7373
pub fn new(ports: Vec<PortDescription>) -> super::Result<Console> {
7474
assert!(!ports.is_empty(), "Expected at least 1 port");
75-
assert!(ports[0].terminal.is_some(), "First port must be a console");
7675

7776
let num_queues = num_queues(ports.len());
7877
let queues = vec![VirtQueue::new(QUEUE_SIZE); num_queues];
@@ -89,8 +88,8 @@ impl Console {
8988

9089
let (cols, rows) = ports[0]
9190
.terminal()
92-
.expect("Port 0 should always be a terminal")
93-
.get_win_size();
91+
.map(|t| t.get_win_size())
92+
.unwrap_or((0, 0));
9493
let config = VirtioConsoleConfig::new(cols, rows, ports.len() as u32);
9594

9695
Ok(Console {

0 commit comments

Comments
 (0)