From 0958b4cc8f7889b61770690fa29a1201895cf581 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 26 Oct 2009 15:56:45 +0100 Subject: 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 Signed-off-by: Anthony Liguori --- hw/usb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hw/usb.h') diff --git a/hw/usb.h b/hw/usb.h index be4fcf6d1b..62362a7da1 100644 --- a/hw/usb.h +++ b/hw/usb.h @@ -183,6 +183,10 @@ struct USBDeviceInfo { * Returns length or one of the USB_RET_ codes. */ int (*handle_data)(USBDevice *dev, USBPacket *p); + + /* handle legacy -usbdevice command line options */ + const char *usbdevice_name; + USBDevice *(*usbdevice_init)(const char *params); }; typedef void (*usb_attachfn)(USBPort *port, USBDevice *dev); @@ -309,6 +313,7 @@ void usb_qdev_register(USBDeviceInfo *info); void usb_qdev_register_many(USBDeviceInfo *info); USBDevice *usb_create(USBBus *bus, const char *name); USBDevice *usb_create_simple(USBBus *bus, const char *name); +USBDevice *usbdevice_create(const char *cmdline); void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index, usb_attachfn attach); void usb_unregister_port(USBBus *bus, USBPort *port); -- cgit v1.2.3