[PATCH 8/8] qemu: build command line for virtio-input-host device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<input type='passthrough' bus='virtio'>
  <source evdev='/dev/input/event1234'/>
</input>

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 5815734..02f834e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5774,7 +5774,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 0000000..4be1ef5
--- /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 bad65a6..ac30036 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1750,6 +1750,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);
 
-- 
2.4.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]