On 05/03/2012 02:06 AM, Osier Yang wrote:
On 2012年05月01日 16:16, Guannan Ren wrote:
> One usb device could be allowed to hotplug in at a time. If user
> give a xml as follows.
s/give/gives/
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>
> ---
>
> - hostdev->source.subsys.u.usb.bus = usbDeviceGetBus(usb);
> - hostdev->source.subsys.u.usb.device = usbDeviceGetDevno(usb);
> + if (usbDeviceListAdd(list, usb)< 0) {
> + usbFreeDevice(usb);
> + goto cleanup;
> + }
>
> - usbFreeDevice(usb);
> - }
> + if (qemuPrepareHostdevUSBDevices(driver, vm->def->name,
> list)< 0)
> + goto cleanup;
Do we really need a list here? there is only found usb device is , I
guess
the only purpose is to take use of the new helper function
qemuPrepareHostdevUSBDevices, I.e. to use the new helper function,
it create a new list, and the only one usb device is inserted to
and removed from the list. IMO it's a waste.
qemuPrepareHostUSBDevices probably have multiple devices to add
to qemu driver
Usb hotplug shares the function for the job, that's it.
Guannan Ren