All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Trimarchi <michael@amarulasolutions.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [PATCH] hw: dev-wacom: Support wacom tablet emulation in linux qemu
Date: Wed, 12 Aug 2020 17:21:49 +0200	[thread overview]
Message-ID: <20200812152149.260163-1-michael@amarulasolutions.com> (raw)

Linux need to fill up the hid descriptor in order to let
the driver be emulated. This patch was tested on top of
qemu 4.2.0 and recent linux kernel.

modprobe wacom.ko
evtest tool

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 hw/usb/dev-wacom.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c
index 8aba44b8bc..fe95699672 100644
--- a/hw/usb/dev-wacom.c
+++ b/hw/usb/dev-wacom.c
@@ -259,6 +259,64 @@ static void usb_wacom_handle_reset(USBDevice *dev)
     s->mode = WACOM_MODE_HID;
 }
 
+static const uint8_t qemu_wacom_hid_report_descriptor[] = {
+	0x05, 0x01,
+	0x09, 0x02,
+	0xa1, 0x01,
+	0x85, 0x01,
+	0x09, 0x01,
+	0xa1, 0x00,
+	0x05, 0x09,
+	0x19, 0x01,
+	0x29, 0x03,
+	0x15, 0x00,
+	0x25, 0x01,
+	0x95, 0x03,
+	0x75, 0x01,
+	0x81, 0x02,
+	0x95, 0x01,
+	0x75, 0x05,
+	0x81, 0x01,
+	0x05, 0x01,
+	0x09, 0x30,
+	0x09, 0x31,
+	0x09, 0x38,
+	0x15, 0x81,
+	0x25, 0x7f,
+	0x75, 0x08,
+	0x95, 0x03,
+	0x81, 0x06,
+	0x95, 0x03,
+	0x81, 0x01,
+	0xc0, 0xc0,
+	0x05, 0x0d,
+	0x09, 0x01,
+	0xa1, 0x01,
+	0x85, 0x02,
+	0xa1, 0x00,
+	0x06, 0x00,
+	0xff, 0x09,
+	0x01, 0x15,
+	0x00, 0x26,
+	0xff, 0x00,
+	0x75, 0x08,
+	0x95, 0x07,
+	0x81, 0x02,
+	0xc0, 0x09,
+	0x01, 0x85,
+	0x63, 0x95,
+	0x07, 0x81,
+	0x02, 0x09,
+	0x01, 0x85,
+	0x02, 0x95,
+	0x01, 0xb1,
+	0x02, 0x09,
+	0x01, 0x85,
+	0x03, 0x95,
+	0x01, 0xb1,
+	0x02, 0xc0,
+};
+
 static void usb_wacom_handle_control(USBDevice *dev, USBPacket *p,
                int request, int value, int index, int length, uint8_t *data)
 {
@@ -271,6 +329,18 @@ static void usb_wacom_handle_control(USBDevice *dev, USBPacket *p,
     }
 
     switch (request) {
+    case InterfaceRequest | USB_REQ_GET_DESCRIPTOR:
+        switch (value >> 8) {
+        case 0x22:
+                memcpy(data, qemu_wacom_hid_report_descriptor,
+                       sizeof(qemu_wacom_hid_report_descriptor));
+                p->actual_length = sizeof(qemu_wacom_hid_report_descriptor);
+            break;
+        default:
+            goto fail;
+        }
+        break;
+
     case WACOM_SET_REPORT:
         if (s->mouse_grabbed) {
             qemu_remove_mouse_event_handler(s->eh_entry);
-- 
2.25.1



             reply	other threads:[~2020-08-12 15:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 15:21 Michael Trimarchi [this message]
2020-08-17  6:47 ` [PATCH] hw: dev-wacom: Support wacom tablet emulation in linux qemu Gerd Hoffmann
2020-08-17  6:48   ` Michael Nazzareno Trimarchi
2020-08-17  7:28     ` Gerd Hoffmann
2020-08-17 16:42       ` Michael Nazzareno Trimarchi
2020-08-18  6:02         ` Gerd Hoffmann
2020-08-18  8:23           ` Michael Nazzareno Trimarchi
2020-08-19  5:52             ` Gerd Hoffmann
2020-08-21 16:24               ` Michael Nazzareno Trimarchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200812152149.260163-1-michael@amarulasolutions.com \
    --to=michael@amarulasolutions.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.