From 3c7ddc7f53adacb1864020d9421188b49dc605d6 Mon Sep 17 00:00:00 2001 From: wanyaoqi <18528551+wanyaoqi@users.noreply.github.com> Date: Tue, 27 Sep 2022 09:27:41 +0800 Subject: [PATCH] fix(host): usb kbd command line (#15056) add machine usb command first Signed-off-by: wanyaoqi Signed-off-by: wanyaoqi --- pkg/hostman/guestman/qemu/generate.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pkg/hostman/guestman/qemu/generate.go b/pkg/hostman/guestman/qemu/generate.go index 520e940b18..4dba6109cc 100644 --- a/pkg/hostman/guestman/qemu/generate.go +++ b/pkg/hostman/guestman/qemu/generate.go @@ -650,14 +650,20 @@ func GenerateStartOptions( } opts = append(opts, nicOpts...) - // isolated devices - // USB 3.0 - opts = append(opts, generatePCIDeviceOption(input.GuestDesc.Usb.PCIDevice)) - // enable machine USB emulation - opts = append(opts, drvOpt.USB()) - for _, device := range input.Devices { - opts = append(opts, drvOpt.Device(device)) + if input.QemuArch == Arch_aarch64 { + opts = append(opts, generatePCIDeviceOption(input.GuestDesc.Usb.PCIDevice)) + for _, device := range input.Devices { + opts = append(opts, drvOpt.Device(device)) + } + } else { + opts = append(opts, drvOpt.USB()) + for _, device := range input.Devices { + opts = append(opts, drvOpt.Device(device)) + } + opts = append(opts, generatePCIDeviceOption(input.GuestDesc.Usb.PCIDevice)) } + + // isolated devices if len(input.GuestDesc.IsolatedDevices) > 0 { opts = append(opts, generateIsolatedDeviceOptions(input.GuestDesc)...) }