aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-wacom.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-31 14:23:59 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-09 14:55:17 -0500
commit806b60248218bd5f74a8b070f5a99a864e8e51c6 (patch)
treeef5ebf0b2f0aebb33cfbb6a3c7b58de8092a079c /hw/usb-wacom.c
parent755700885432a8692c53549dd177d7d52d5cdd17 (diff)
qdev/usb: add usb bus support to qdev, convert drivers.
* Add USBBus. * Add USBDeviceInfo, move device callbacks here. * Add usb-qdev helper functions. * Switch drivers to qdev. TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs added by this patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb-wacom.c')
-rw-r--r--hw/usb-wacom.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index eaf0d29eb3..a5abb98f5c 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -392,21 +392,31 @@ static void usb_wacom_handle_destroy(USBDevice *dev)
qemu_free(s);
}
-USBDevice *usb_wacom_init(void)
+static int usb_wacom_initfn(USBDevice *dev)
{
- USBWacomState *s;
-
- s = qemu_mallocz(sizeof(USBWacomState));
+ USBWacomState *s = DO_UPCAST(USBWacomState, dev, dev);
s->dev.speed = USB_SPEED_FULL;
- s->dev.handle_packet = usb_generic_handle_packet;
+ return 0;
+}
- s->dev.handle_reset = usb_wacom_handle_reset;
- s->dev.handle_control = usb_wacom_handle_control;
- s->dev.handle_data = usb_wacom_handle_data;
- s->dev.handle_destroy = usb_wacom_handle_destroy;
+USBDevice *usb_wacom_init(void)
+{
+ return usb_create_simple(NULL /* FIXME */, "QEMU PenPartner Tablet");
+}
- pstrcpy(s->dev.devname, sizeof(s->dev.devname),
- "QEMU PenPartner Tablet");
+static struct USBDeviceInfo wacom_info = {
+ .qdev.name = "QEMU PenPartner Tablet",
+ .qdev.size = sizeof(USBWacomState),
+ .init = usb_wacom_initfn,
+ .handle_packet = usb_generic_handle_packet,
+ .handle_reset = usb_wacom_handle_reset,
+ .handle_control = usb_wacom_handle_control,
+ .handle_data = usb_wacom_handle_data,
+ .handle_destroy = usb_wacom_handle_destroy,
+};
- return (USBDevice *) s;
+static void usb_wacom_register_devices(void)
+{
+ usb_qdev_register(&wacom_info);
}
+device_init(usb_wacom_register_devices)