2007-06-10 21:21:04 +02:00
|
|
|
/*
|
|
|
|
* Wacom PenPartner USB tablet emulation.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 Openedhand Ltd.
|
|
|
|
* Author: Andrzej Zaborowski <balrog@zabor.org>
|
|
|
|
*
|
|
|
|
* Based on hw/usb-hid.c:
|
|
|
|
* Copyright (c) 2005 Fabrice Bellard
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2019-05-23 16:35:07 +02:00
|
|
|
|
2016-01-26 19:17:12 +01:00
|
|
|
#include "qemu/osdep.h"
|
2012-11-28 12:06:30 +01:00
|
|
|
#include "ui/console.h"
|
2012-03-07 14:55:18 +01:00
|
|
|
#include "hw/usb.h"
|
2020-08-12 11:41:23 +02:00
|
|
|
#include "hw/usb/hid.h"
|
2019-08-12 07:23:45 +02:00
|
|
|
#include "migration/vmstate.h"
|
2019-05-23 16:35:07 +02:00
|
|
|
#include "qemu/module.h"
|
2018-05-03 21:50:48 +02:00
|
|
|
#include "desc.h"
|
2007-06-10 21:21:04 +02:00
|
|
|
|
|
|
|
/* Interface requests */
|
|
|
|
#define WACOM_GET_REPORT 0x2101
|
|
|
|
#define WACOM_SET_REPORT 0x2109
|
|
|
|
|
|
|
|
typedef struct USBWacomState {
|
|
|
|
USBDevice dev;
|
2012-11-17 12:47:14 +01:00
|
|
|
USBEndpoint *intr;
|
2007-06-10 21:21:04 +02:00
|
|
|
QEMUPutMouseEntry *eh_entry;
|
|
|
|
int dx, dy, dz, buttons_state;
|
|
|
|
int x, y;
|
|
|
|
int mouse_grabbed;
|
|
|
|
enum {
|
|
|
|
WACOM_MODE_HID = 1,
|
|
|
|
WACOM_MODE_WACOM = 2,
|
|
|
|
} mode;
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
uint8_t idle;
|
|
|
|
int changed;
|
2007-06-10 21:21:04 +02:00
|
|
|
} USBWacomState;
|
|
|
|
|
2015-05-06 14:55:34 +02:00
|
|
|
#define TYPE_USB_WACOM "usb-wacom-tablet"
|
|
|
|
#define USB_WACOM(obj) OBJECT_CHECK(USBWacomState, (obj), TYPE_USB_WACOM)
|
|
|
|
|
2010-11-25 16:12:06 +01:00
|
|
|
enum {
|
|
|
|
STR_MANUFACTURER = 1,
|
|
|
|
STR_PRODUCT,
|
|
|
|
STR_SERIALNUMBER,
|
|
|
|
};
|
2007-06-10 21:21:04 +02:00
|
|
|
|
2010-11-25 16:12:06 +01:00
|
|
|
static const USBDescStrings desc_strings = {
|
2012-05-30 05:35:51 +02:00
|
|
|
[STR_MANUFACTURER] = "QEMU",
|
2010-11-25 16:12:06 +01:00
|
|
|
[STR_PRODUCT] = "Wacom PenPartner",
|
|
|
|
[STR_SERIALNUMBER] = "1",
|
|
|
|
};
|
2007-06-10 21:21:04 +02:00
|
|
|
|
2010-11-25 16:12:06 +01:00
|
|
|
static const USBDescIface desc_iface_wacom = {
|
|
|
|
.bInterfaceNumber = 0,
|
|
|
|
.bNumEndpoints = 1,
|
|
|
|
.bInterfaceClass = USB_CLASS_HID,
|
|
|
|
.bInterfaceSubClass = 0x01, /* boot */
|
|
|
|
.bInterfaceProtocol = 0x02,
|
|
|
|
.ndesc = 1,
|
|
|
|
.descs = (USBDescOther[]) {
|
|
|
|
{
|
|
|
|
/* HID descriptor */
|
|
|
|
.data = (uint8_t[]) {
|
|
|
|
0x09, /* u8 bLength */
|
2020-08-12 11:41:23 +02:00
|
|
|
USB_DT_HID, /* u8 bDescriptorType */
|
2010-11-25 16:12:06 +01:00
|
|
|
0x01, 0x10, /* u16 HID_class */
|
|
|
|
0x00, /* u8 country_code */
|
|
|
|
0x01, /* u8 num_descriptors */
|
2020-08-12 11:41:23 +02:00
|
|
|
USB_DT_REPORT, /* u8 type: Report */
|
2010-11-25 16:12:06 +01:00
|
|
|
0x6e, 0, /* u16 len */
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.eps = (USBDescEndpoint[]) {
|
|
|
|
{
|
|
|
|
.bEndpointAddress = USB_DIR_IN | 0x01,
|
|
|
|
.bmAttributes = USB_ENDPOINT_XFER_INT,
|
|
|
|
.wMaxPacketSize = 8,
|
|
|
|
.bInterval = 0x0a,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2007-06-10 21:21:04 +02:00
|
|
|
|
2010-11-25 16:12:06 +01:00
|
|
|
static const USBDescDevice desc_device_wacom = {
|
|
|
|
.bcdUSB = 0x0110,
|
|
|
|
.bMaxPacketSize0 = 8,
|
|
|
|
.bNumConfigurations = 1,
|
|
|
|
.confs = (USBDescConfig[]) {
|
|
|
|
{
|
|
|
|
.bNumInterfaces = 1,
|
|
|
|
.bConfigurationValue = 1,
|
2013-12-16 08:42:49 +01:00
|
|
|
.bmAttributes = USB_CFG_ATT_ONE,
|
2010-11-25 16:12:06 +01:00
|
|
|
.bMaxPower = 40,
|
2011-04-03 07:33:19 +02:00
|
|
|
.nif = 1,
|
2010-11-25 16:12:06 +01:00
|
|
|
.ifs = &desc_iface_wacom,
|
|
|
|
},
|
|
|
|
},
|
2007-06-10 21:21:04 +02:00
|
|
|
};
|
|
|
|
|
2010-11-25 16:12:06 +01:00
|
|
|
static const USBDesc desc_wacom = {
|
|
|
|
.id = {
|
|
|
|
.idVendor = 0x056a,
|
|
|
|
.idProduct = 0x0000,
|
|
|
|
.bcdDevice = 0x4210,
|
|
|
|
.iManufacturer = STR_MANUFACTURER,
|
|
|
|
.iProduct = STR_PRODUCT,
|
|
|
|
.iSerialNumber = STR_SERIALNUMBER,
|
|
|
|
},
|
|
|
|
.full = &desc_device_wacom,
|
|
|
|
.str = desc_strings,
|
2007-06-10 21:21:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void usb_mouse_event(void *opaque,
|
|
|
|
int dx1, int dy1, int dz1, int buttons_state)
|
|
|
|
{
|
|
|
|
USBWacomState *s = opaque;
|
|
|
|
|
|
|
|
s->dx += dx1;
|
|
|
|
s->dy += dy1;
|
|
|
|
s->dz += dz1;
|
|
|
|
s->buttons_state = buttons_state;
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
s->changed = 1;
|
2013-01-29 12:44:35 +01:00
|
|
|
usb_wakeup(s->intr, 0);
|
2007-06-10 21:21:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void usb_wacom_event(void *opaque,
|
|
|
|
int x, int y, int dz, int buttons_state)
|
|
|
|
{
|
|
|
|
USBWacomState *s = opaque;
|
|
|
|
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
/* scale to Penpartner resolution */
|
|
|
|
s->x = (x * 5040 / 0x7FFF);
|
|
|
|
s->y = (y * 3780 / 0x7FFF);
|
2007-06-10 21:21:04 +02:00
|
|
|
s->dz += dz;
|
|
|
|
s->buttons_state = buttons_state;
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
s->changed = 1;
|
2013-01-29 12:44:35 +01:00
|
|
|
usb_wakeup(s->intr, 0);
|
2007-06-10 21:21:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int int_clamp(int val, int vmin, int vmax)
|
|
|
|
{
|
|
|
|
if (val < vmin)
|
|
|
|
return vmin;
|
|
|
|
else if (val > vmax)
|
|
|
|
return vmax;
|
|
|
|
else
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int usb_mouse_poll(USBWacomState *s, uint8_t *buf, int len)
|
|
|
|
{
|
|
|
|
int dx, dy, dz, b, l;
|
|
|
|
|
|
|
|
if (!s->mouse_grabbed) {
|
|
|
|
s->eh_entry = qemu_add_mouse_event_handler(usb_mouse_event, s, 0,
|
|
|
|
"QEMU PenPartner tablet");
|
2010-10-08 12:30:14 +02:00
|
|
|
qemu_activate_mouse_event_handler(s->eh_entry);
|
2007-06-10 21:21:04 +02:00
|
|
|
s->mouse_grabbed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
dx = int_clamp(s->dx, -128, 127);
|
|
|
|
dy = int_clamp(s->dy, -128, 127);
|
|
|
|
dz = int_clamp(s->dz, -128, 127);
|
|
|
|
|
|
|
|
s->dx -= dx;
|
|
|
|
s->dy -= dy;
|
|
|
|
s->dz -= dz;
|
|
|
|
|
|
|
|
b = 0;
|
|
|
|
if (s->buttons_state & MOUSE_EVENT_LBUTTON)
|
|
|
|
b |= 0x01;
|
|
|
|
if (s->buttons_state & MOUSE_EVENT_RBUTTON)
|
|
|
|
b |= 0x02;
|
|
|
|
if (s->buttons_state & MOUSE_EVENT_MBUTTON)
|
|
|
|
b |= 0x04;
|
|
|
|
|
|
|
|
buf[0] = b;
|
|
|
|
buf[1] = dx;
|
|
|
|
buf[2] = dy;
|
|
|
|
l = 3;
|
|
|
|
if (len >= 4) {
|
|
|
|
buf[3] = dz;
|
|
|
|
l = 4;
|
|
|
|
}
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int usb_wacom_poll(USBWacomState *s, uint8_t *buf, int len)
|
|
|
|
{
|
|
|
|
int b;
|
|
|
|
|
|
|
|
if (!s->mouse_grabbed) {
|
|
|
|
s->eh_entry = qemu_add_mouse_event_handler(usb_wacom_event, s, 1,
|
|
|
|
"QEMU PenPartner tablet");
|
2010-10-08 12:30:14 +02:00
|
|
|
qemu_activate_mouse_event_handler(s->eh_entry);
|
2007-06-10 21:21:04 +02:00
|
|
|
s->mouse_grabbed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
b = 0;
|
|
|
|
if (s->buttons_state & MOUSE_EVENT_LBUTTON)
|
|
|
|
b |= 0x01;
|
|
|
|
if (s->buttons_state & MOUSE_EVENT_RBUTTON)
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
b |= 0x40;
|
2007-06-10 21:21:04 +02:00
|
|
|
if (s->buttons_state & MOUSE_EVENT_MBUTTON)
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
b |= 0x20; /* eraser */
|
2007-06-10 21:21:04 +02:00
|
|
|
|
|
|
|
if (len < 7)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
buf[0] = s->mode;
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
buf[5] = 0x00 | (b & 0xf0);
|
|
|
|
buf[1] = s->x & 0xff;
|
|
|
|
buf[2] = s->x >> 8;
|
|
|
|
buf[3] = s->y & 0xff;
|
|
|
|
buf[4] = s->y >> 8;
|
|
|
|
if (b & 0x3f) {
|
2007-06-10 21:21:04 +02:00
|
|
|
buf[6] = 0;
|
|
|
|
} else {
|
|
|
|
buf[6] = (unsigned char) -127;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void usb_wacom_handle_reset(USBDevice *dev)
|
|
|
|
{
|
|
|
|
USBWacomState *s = (USBWacomState *) dev;
|
|
|
|
|
|
|
|
s->dx = 0;
|
|
|
|
s->dy = 0;
|
|
|
|
s->dz = 0;
|
|
|
|
s->x = 0;
|
|
|
|
s->y = 0;
|
|
|
|
s->buttons_state = 0;
|
|
|
|
s->mode = WACOM_MODE_HID;
|
|
|
|
}
|
|
|
|
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
static void usb_wacom_handle_control(USBDevice *dev, USBPacket *p,
|
2011-02-02 16:33:13 +01:00
|
|
|
int request, int value, int index, int length, uint8_t *data)
|
2007-06-10 21:21:04 +02:00
|
|
|
{
|
|
|
|
USBWacomState *s = (USBWacomState *) dev;
|
2010-11-25 16:12:06 +01:00
|
|
|
int ret;
|
|
|
|
|
2011-02-02 16:33:13 +01:00
|
|
|
ret = usb_desc_handle_control(dev, p, request, value, index, length, data);
|
2010-11-25 16:12:06 +01:00
|
|
|
if (ret >= 0) {
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
return;
|
2010-11-25 16:12:06 +01:00
|
|
|
}
|
2007-06-10 21:21:04 +02:00
|
|
|
|
|
|
|
switch (request) {
|
|
|
|
case WACOM_SET_REPORT:
|
2010-10-08 12:30:14 +02:00
|
|
|
if (s->mouse_grabbed) {
|
|
|
|
qemu_remove_mouse_event_handler(s->eh_entry);
|
|
|
|
s->mouse_grabbed = 0;
|
|
|
|
}
|
2007-06-10 21:21:04 +02:00
|
|
|
s->mode = data[0];
|
|
|
|
break;
|
|
|
|
case WACOM_GET_REPORT:
|
|
|
|
data[0] = 0;
|
|
|
|
data[1] = s->mode;
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
p->actual_length = 2;
|
2007-06-10 21:21:04 +02:00
|
|
|
break;
|
|
|
|
/* USB HID requests */
|
|
|
|
case HID_GET_REPORT:
|
|
|
|
if (s->mode == WACOM_MODE_HID)
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
p->actual_length = usb_mouse_poll(s, data, length);
|
2007-06-10 21:21:04 +02:00
|
|
|
else if (s->mode == WACOM_MODE_WACOM)
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
p->actual_length = usb_wacom_poll(s, data, length);
|
2007-06-10 21:21:04 +02:00
|
|
|
break;
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
case HID_GET_IDLE:
|
|
|
|
data[0] = s->idle;
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
p->actual_length = 1;
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
break;
|
2007-06-10 21:21:04 +02:00
|
|
|
case HID_SET_IDLE:
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
s->idle = (uint8_t) (value >> 8);
|
2007-06-10 21:21:04 +02:00
|
|
|
break;
|
|
|
|
default:
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
p->status = USB_RET_STALL;
|
2007-06-10 21:21:04 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
static void usb_wacom_handle_data(USBDevice *dev, USBPacket *p)
|
2007-06-10 21:21:04 +02:00
|
|
|
{
|
|
|
|
USBWacomState *s = (USBWacomState *) dev;
|
2011-07-12 15:22:25 +02:00
|
|
|
uint8_t buf[p->iov.size];
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
int len = 0;
|
2007-06-10 21:21:04 +02:00
|
|
|
|
|
|
|
switch (p->pid) {
|
|
|
|
case USB_TOKEN_IN:
|
2012-01-12 13:23:01 +01:00
|
|
|
if (p->ep->nr == 1) {
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
if (!(s->changed || s->idle)) {
|
|
|
|
p->status = USB_RET_NAK;
|
|
|
|
return;
|
|
|
|
}
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
s->changed = 0;
|
2007-06-10 21:21:04 +02:00
|
|
|
if (s->mode == WACOM_MODE_HID)
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
len = usb_mouse_poll(s, buf, p->iov.size);
|
2007-06-10 21:21:04 +02:00
|
|
|
else if (s->mode == WACOM_MODE_WACOM)
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
len = usb_wacom_poll(s, buf, p->iov.size);
|
|
|
|
usb_packet_copy(p, buf, len);
|
2007-06-10 21:21:04 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Fall through. */
|
|
|
|
case USB_TOKEN_OUT:
|
|
|
|
default:
|
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.
An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.
While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.
This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.
This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.
Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 17:15:01 +01:00
|
|
|
p->status = USB_RET_STALL;
|
2007-06-10 21:21:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
qdev: Unrealize must not fail
Devices may have component devices and buses.
Device realization may fail. Realization is recursive: a device's
realize() method realizes its components, and device_set_realized()
realizes its buses (which should in turn realize the devices on that
bus, except bus_set_realized() doesn't implement that, yet).
When realization of a component or bus fails, we need to roll back:
unrealize everything we realized so far. If any of these unrealizes
failed, the device would be left in an inconsistent state. Must not
happen.
device_set_realized() lets it happen: it ignores errors in the roll
back code starting at label child_realize_fail.
Since realization is recursive, unrealization must be recursive, too.
But how could a partly failed unrealize be rolled back? We'd have to
re-realize, which can fail. This design is fundamentally broken.
device_set_realized() does not roll back at all. Instead, it keeps
unrealizing, ignoring further errors.
It can screw up even for a device with no buses: if the lone
dc->unrealize() fails, it still unregisters vmstate, and calls
listeners' unrealize() callback.
bus_set_realized() does not roll back either. Instead, it stops
unrealizing.
Fortunately, no unrealize method can fail, as we'll see below.
To fix the design error, drop parameter @errp from all the unrealize
methods.
Any unrealize method that uses @errp now needs an update. This leads
us to unrealize() methods that can fail. Merely passing it to another
unrealize method cannot cause failure, though. Here are the ones that
do other things with @errp:
* virtio_serial_device_unrealize()
Fails when qbus_set_hotplug_handler() fails, but still does all the
other work. On failure, the device would stay realized with its
resources completely gone. Oops. Can't happen, because
qbus_set_hotplug_handler() can't actually fail here. Pass
&error_abort to qbus_set_hotplug_handler() instead.
* hw/ppc/spapr_drc.c's unrealize()
Fails when object_property_del() fails, but all the other work is
already done. On failure, the device would stay realized with its
vmstate registration gone. Oops. Can't happen, because
object_property_del() can't actually fail here. Pass &error_abort
to object_property_del() instead.
* spapr_phb_unrealize()
Fails and bails out when remove_drcs() fails, but other work is
already done. On failure, the device would stay realized with some
of its resources gone. Oops. remove_drcs() fails only when
chassis_from_bus()'s object_property_get_uint() fails, and it can't
here. Pass &error_abort to remove_drcs() instead.
Therefore, no unrealize method can fail before this patch.
device_set_realized()'s recursive unrealization via bus uses
object_property_set_bool(). Can't drop @errp there, so pass
&error_abort.
We similarly unrealize with object_property_set_bool() elsewhere,
always ignoring errors. Pass &error_abort instead.
Several unrealize methods no longer handle errors from other unrealize
methods: virtio_9p_device_unrealize(),
virtio_input_device_unrealize(), scsi_qdev_unrealize(), ...
Much of the deleted error handling looks wrong anyway.
One unrealize methods no longer ignore such errors:
usb_ehci_pci_exit().
Several realize methods no longer ignore errors when rolling back:
v9fs_device_realize_common(), pci_qdev_unrealize(),
spapr_phb_realize(), usb_qdev_realize(), vfio_ccw_realize(),
virtio_device_realize().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200505152926.18877-17-armbru@redhat.com>
2020-05-05 17:29:24 +02:00
|
|
|
static void usb_wacom_unrealize(USBDevice *dev)
|
2007-06-10 21:21:04 +02:00
|
|
|
{
|
|
|
|
USBWacomState *s = (USBWacomState *) dev;
|
|
|
|
|
2010-10-08 12:30:14 +02:00
|
|
|
if (s->mouse_grabbed) {
|
|
|
|
qemu_remove_mouse_event_handler(s->eh_entry);
|
|
|
|
s->mouse_grabbed = 0;
|
|
|
|
}
|
2007-06-10 21:21:04 +02:00
|
|
|
}
|
|
|
|
|
2014-09-19 08:48:37 +02:00
|
|
|
static void usb_wacom_realize(USBDevice *dev, Error **errp)
|
2007-06-10 21:21:04 +02:00
|
|
|
{
|
2015-05-06 14:55:34 +02:00
|
|
|
USBWacomState *s = USB_WACOM(dev);
|
2012-04-20 12:33:30 +02:00
|
|
|
usb_desc_create_serial(dev);
|
2010-11-26 20:20:41 +01:00
|
|
|
usb_desc_init(dev);
|
2012-11-17 12:47:14 +01:00
|
|
|
s->intr = usb_ep_get(dev, USB_TOKEN_IN, 1);
|
Fixed wacom emulation
- for absolute mode, scale coordinates to the real device maximum values,
since some drivers (on Haiku and Linux at least) need them as such,
and the HID descriptor is boggus on some models anyway,
- keep the coordinates even when no button is pressed, on real tablet
the pen is sensed on the surface even without direct contact,
and drivers expect this,
- map left button to pressure according to what the Haiku driver wants,
- map the right button to the pen button,
- map the middle button to the eraser,
- use asynchronous reporting as the hid code does, stops the Haiku driver
(and probably others) from spending 50% cpu polling for changes.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-25 11:14:10 +02:00
|
|
|
s->changed = 1;
|
2009-08-31 14:23:59 +02:00
|
|
|
}
|
2007-06-10 21:21:04 +02:00
|
|
|
|
2011-07-20 10:00:51 +02:00
|
|
|
static const VMStateDescription vmstate_usb_wacom = {
|
|
|
|
.name = "usb-wacom",
|
|
|
|
.unmigratable = 1,
|
|
|
|
};
|
|
|
|
|
2011-12-08 04:34:16 +01:00
|
|
|
static void usb_wacom_class_init(ObjectClass *klass, void *data)
|
2011-12-15 21:53:10 +01:00
|
|
|
{
|
2011-12-08 04:34:16 +01:00
|
|
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
|
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
2011-12-15 21:53:10 +01:00
|
|
|
|
|
|
|
uc->product_desc = "QEMU PenPartner Tablet";
|
|
|
|
uc->usb_desc = &desc_wacom;
|
2014-09-19 08:48:37 +02:00
|
|
|
uc->realize = usb_wacom_realize;
|
2011-12-15 21:53:10 +01:00
|
|
|
uc->handle_reset = usb_wacom_handle_reset;
|
|
|
|
uc->handle_control = usb_wacom_handle_control;
|
|
|
|
uc->handle_data = usb_wacom_handle_data;
|
2017-02-21 15:14:45 +01:00
|
|
|
uc->unrealize = usb_wacom_unrealize;
|
2013-07-29 16:17:45 +02:00
|
|
|
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
2011-12-08 04:34:16 +01:00
|
|
|
dc->desc = "QEMU PenPartner Tablet";
|
|
|
|
dc->vmsd = &vmstate_usb_wacom;
|
2011-12-15 21:53:10 +01:00
|
|
|
}
|
|
|
|
|
2013-01-10 16:19:07 +01:00
|
|
|
static const TypeInfo wacom_info = {
|
2015-05-06 14:55:34 +02:00
|
|
|
.name = TYPE_USB_WACOM,
|
2011-12-08 04:34:16 +01:00
|
|
|
.parent = TYPE_USB_DEVICE,
|
|
|
|
.instance_size = sizeof(USBWacomState),
|
|
|
|
.class_init = usb_wacom_class_init,
|
2009-08-31 14:23:59 +02:00
|
|
|
};
|
2007-06-10 21:21:04 +02:00
|
|
|
|
2012-02-09 15:20:55 +01:00
|
|
|
static void usb_wacom_register_types(void)
|
2009-08-31 14:23:59 +02:00
|
|
|
{
|
2011-12-08 04:34:16 +01:00
|
|
|
type_register_static(&wacom_info);
|
2015-05-06 14:55:34 +02:00
|
|
|
usb_legacy_register(TYPE_USB_WACOM, "wacom-tablet", NULL);
|
2007-06-10 21:21:04 +02:00
|
|
|
}
|
2012-02-09 15:20:55 +01:00
|
|
|
|
|
|
|
type_init(usb_wacom_register_types)
|