On 2013年12月03日 01:43, Nehal J Wani wrote:
+ QEMU_CAPS_DEVICE_USB_KBD = 160, /*-device usb-kbd*/
+
Why this extra newline?
Thanks for your reviewing. :)
Let me remove the blank line in next version.
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 763417f..318f7a1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5280,9 +5280,15 @@ qemuBuildUSBInputDevStr(virDomainDefPtr def,
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- virBufferAsprintf(&buf, "%s,id=%s",
- dev->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ?
- "usb-mouse" : "usb-tablet", dev->info.alias);
+ if (dev->type == VIR_DOMAIN_INPUT_TYPE_MOUSE) {
+ virBufferAsprintf(&buf, "usb-mouse,id=%s", dev->info.alias);
+ } else if (dev->type == VIR_DOMAIN_INPUT_TYPE_TABLET) {
+ virBufferAsprintf(&buf, "usb-tablet,id=%s", dev->info.alias);
+ } else if (dev->type == VIR_DOMAIN_INPUT_TYPE_KBD) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD))
+ goto error;
+ virBufferAsprintf(&buf, "usb-kbd,id=%s", dev->info.alias);
+ }
I would've used switch(dev->type) instead of 'if else', to make it look simple.
OK, I will change it in next version.
Thanks.
--Li
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list