From aa47e92291e85e7d2909e2c0d9083d607f501cc8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Oct 2022 13:43:14 +0200 Subject: Omit USB QEMU options if custom options are provided --- bbot/agent/machine.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx index 83e64e5..e7f549d 100644 --- a/bbot/agent/machine.cxx +++ b/bbot/agent/machine.cxx @@ -309,10 +309,10 @@ namespace bbot } else { - auto add = [&os] (string o, string v) + auto add = [&os] (string o, optional v = {}) { os.push_back (move (o)); - os.push_back (move (v)); + if (v) os.push_back (move (*v)); }; // Network. @@ -334,6 +334,17 @@ namespace bbot //"-drive", "if=none,id=disk0,format=raw,file=disk.img" //"-device", "virtio-scsi-pci,id=scsi" //"-device", "scsi-hd,drive=disk0" + + // USB settings. + // + // These options should make graphical VMs usable from VNC. + // + // Note that the "standard" USB bus may not be available on + // architectures other than x86 (e.g., aarch64). + // + add ("-usb"); + add ("-device", "usb-kbd"); + add ("-device", "usb-tablet"); } // Setup QMP (QEMU Machine Protocol) monitor to act as a log. @@ -388,12 +399,6 @@ namespace bbot "-global", "kvm-pit.lost_tick_policy=discard", #endif - // USB settings. - // - // This option should make graphical VMs usable from VNC. - // - "-usb", "-device", "usb-kbd", "-device", "usb-tablet", - // These can override the above but not below. // os, -- cgit v1.1