[Libvir] [PATCH] Fix USB device name mis-conversion from S-Expr to XML

Hiroyuki Kaguchi fj7025cf at aa.jp.fujitsu.com
Thu Jan 24 02:34:13 UTC 2008


"tablet" and "mouse" are set as a value of the
/local/domain/<domid>/image/hvm/usbdevice,
but libvirt expects "usbdevice" and "usbmouse" as a value.
This causes the following.
If a USB device is attached by virt-manager,
the USB device is not seen from virt-manager.

This patch fixes expected value of libvirt

Thanks,
Hiroyuki Kaguchi

Index: xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.162
diff -u -r1.162 xend_internal.c
--- xend_internal.c	21 Jan 2008 16:29:10 -0000	1.162
+++ xend_internal.c	23 Jan 2008 00:37:02 -0000
@@ -1743,11 +1743,9 @@
             node = cur->u.s.car;
             if (sexpr_lookup(node, "usbdevice")) {
                 tmp = sexpr_node(node, "usbdevice");
-                if (tmp && *tmp) {
-                    if (!strcmp(tmp, "usbtablet"))
-                        virBufferAdd(&buf, "    <input type='tablet'
bus='usb'/>\n", 37);
-                    else if (!strcmp(tmp, "usbmouse"))
-                        virBufferAdd(&buf, "    <input type='mouse'
bus='usb'/>\n", 36);
+                if (!strcmp(tmp, "tablet") ||
+                    !strcmp(tmp, "mouse")) {
+                    virBufferVSprintf(&buf, "    <input type='%s'
bus='usb'/>\n", tmp);
                 }
             }
         }







More information about the libvir-list mailing list