aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-wacom.c
diff options
context:
space:
mode:
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)