
On 05/01/2012 02:16 AM, Guannan Ren wrote:
refactor qemuPrepareHostdevUSBDevices function, make it focus on adding usb device to activeUsbHostdevs after check. After that, the usb hotplug function qemuDomainAttachHostDevice also could use it.
expand qemuPrepareHostUSBDevices to perform the usb search, rollback on failure. ---
+ if (vendor && bus) { + usb = usbFindDevice(vendor, product, bus, device);
Can bus be 0, or does the USB bus numbering start with 1? If 0 is a valid bus number, then you need to know whether bus was specified, not whether it is non-zero.
+ } else if (vendor && !bus) { + usbDeviceList *devs = usbFindDevByVendor(vendor, product); + if (!devs) + goto cleanup; + + if (usbDeviceListCount(devs) > 1) { + qemuReportError(VIR_ERR_XML_ERROR, + _("multiple USB deivces %x:%x, "
s/deivces/devices/ -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org