mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
usb core: use qdev for -usbdevice
This patchs adds infrastructure to handle -usbdevice via qdev callbacks. USBDeviceInfo gets a name field (for the -usbdevice driver name) and a callback for -usbdevice parameter parsing. The new usbdevice_create() function walks the qdev driver list and looks for a usb driver with a matching name. When a parameter parsing callback is present it is called, otherwise the device is created via usb_create_simple(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
51edd4e6b5
commit
0958b4cc8f
5 changed files with 59 additions and 1 deletions
5
vl.c
5
vl.c
|
@ -2556,6 +2556,11 @@ static int usb_device_add(const char *devname, int is_hotplug)
|
|||
if (!usb_enabled)
|
||||
return -1;
|
||||
|
||||
/* drivers with .usbdevice_name entry in USBDeviceInfo */
|
||||
dev = usbdevice_create(devname);
|
||||
if (dev)
|
||||
goto done;
|
||||
|
||||
/* simple devices which don't need extra care */
|
||||
for (i = 0; i < ARRAY_SIZE(usbdevs); i++) {
|
||||
if (strcmp(devname, usbdevs[i].name) != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue