Re: [PATCH v2 3/3] qemu: search usb device accurately to improve usb device hotplug

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

 



On 05/03/2012 01:31 AM, Eric Blake wrote:
On 05/01/2012 02:16 AM, Guannan Ren wrote:
One usb device could be allowed to hotplug in at a time. If user
give a xml as follows. Probably there are two usb devices avaiable
s/avaiable/available/

but with different value of "bus, device"

we give a error to let user use<address>  to specify the desired one.

<hostdev mode='subsystem' type='usb' managed='yes'>
   <source>
     <vendor id='0x15e1'/>
     <product id='0x2007'/>
   </source>
</hostdev>
---
  src/qemu/qemu_hotplug.c |   68 +++++++++++++++++++++++++++++++++++++---------
  1 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7cf7b90..15693a0 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1121,6 +1121,9 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver,
                                 virDomainObjPtr vm,
                                 virDomainHostdevDefPtr hostdev)
  {
+    usbDeviceList *list;
+    usbDevice * usb = NULL;
Style: no space after *.

+    if (!(list = usbDeviceListNew()))
+        goto cleanup;
virReportOOMError()

    OOM error will be raised in usbDeviceListNew()
    we get 'NULL' value in that case.


+
+    if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
+        unsigned vendor = hostdev->source.subsys.u.usb.vendor;
+        unsigned product = hostdev->source.subsys.u.usb.product;
+        unsigned bus = hostdev->source.subsys.u.usb.bus;
+        unsigned device = hostdev->source.subsys.u.usb.device;
+
+        if (vendor&&  bus) {
Same question as in 2/3 about valid values for bus.


+            if (usbDeviceListCount(devs)>  1) {
+                qemuReportError(VIR_ERR_XML_ERROR,
+                                _("multiple USB deivces %x:%x, "
s/deivces/devices/


--
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]