From 971f5f229dc4b36a4ad62fdeef67f209b875822e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 20 Nov 2015 08:57:16 +0100 Subject: [PATCH] qemu: build command line for virtio-input-host device results in: -device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234 https://bugzilla.redhat.com/show_bug.cgi?id=1231114 --- src/qemu/qemu_command.c | 9 +++++++- ...qemuxml2argv-virtio-input-passthrough.args | 22 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-input-passthrough.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 394cec7000..4ff31dc071 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5778,7 +5778,14 @@ qemuBuildVirtioInputDevStr(virDomainDefPtr def, virBufferAsprintf(&buf, "virtio-keyboard%s,id=%s", suffix, dev->info.alias); break; case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: - /* TBD */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_INPUT_HOST)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio-input-host is not supported by this QEMU binary")); + goto error; + } + virBufferAsprintf(&buf, "virtio-input-host%s,id=%s,evdev=", suffix, dev->info.alias); + virBufferEscape(&buf, ',', ",", "%s", dev->source.evdev); + break; case VIR_DOMAIN_INPUT_TYPE_LAST: break; } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-input-passthrough.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-input-passthrough.args new file mode 100644 index 0000000000..4be1ef5e46 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-input-passthrough.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.0,\ +addr=0x4 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0ad9d5a64f..6513651853 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1760,6 +1760,7 @@ mymain(void) DO_TEST("virtio-input", QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_KEYBOARD, QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET); + DO_TEST("virtio-input-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_INPUT_HOST); qemuTestDriverFree(&driver); -- GitLab