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

"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); } } }

Would you give me a comment on this patch? If not, please apply it.
"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); } } }
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Wed, Jan 30, 2008 at 11:22:16AM +0900, Hiroyuki Kaguchi wrote:
Would you give me a comment on this patch? If not, please apply it.
"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
I have applied a variant on this patch, and also fixed the test suite which was using the wrong SEXPR syntax for USB devices. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Wed, 30 Jan 2008 16:38:49 +0000, Daniel P. Berrange wrote:
I have applied a variant on this patch, and also fixed the test suite which was using the wrong SEXPR syntax for USB devices.
Dan.
Guys, Is there a patch to support USB configurations of 'host:vid:pid' in XML configs of libvirt likely in Fedora9 already ? Can you please provide a quick guidance on the syntax that the final patch settles with. Cheers, Kevin

On Sat, Jun 21, 2008 at 09:42:35PM +0000, Anuj Verma (Kevin) wrote:
On Wed, 30 Jan 2008 16:38:49 +0000, Daniel P. Berrange wrote:
I have applied a variant on this patch, and also fixed the test suite which was using the wrong SEXPR syntax for USB devices.
Dan.
Guys,
Is there a patch to support USB configurations of 'host:vid:pid' in XML configs of libvirt likely in Fedora9 already ?
Nope, host device pass-through is not supported. Only USB mouse or tablet is done via the <input bus='usb' type='tablet'/> (or 'mouse') element
Can you please provide a quick guidance on the syntax that the final patch settles with.
Latest XML docs are always online here http://libvirt.org/formatdomain.html Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (3)
-
Anuj Verma (Kevin)
-
Daniel P. Berrange
-
Hiroyuki Kaguchi