0001-qemu-Add-missing-wacom-HID-descriptor.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. From 883feb43129dc39b491e492c7ccfe89aefe53c44 Mon Sep 17 00:00:00 2001
  2. From: Richard Purdie <richard.purdie@linuxfoundation.org>
  3. Date: Thu, 27 Nov 2014 14:04:29 +0000
  4. Subject: [PATCH] qemu: Add missing wacom HID descriptor
  5. The USB wacom device is missing a HID descriptor which causes it
  6. to fail to operate with recent kernels (e.g. 3.17).
  7. This patch adds a HID desriptor to the device, based upon one from
  8. real wcom device.
  9. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  10. Upstream-Status: Submitted
  11. 2014/11/27
  12. [update patch context]
  13. Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
  14. ---
  15. hw/usb/dev-wacom.c | 94 +++++++++++++++++++++++++++++++++++++++++++++-
  16. 1 file changed, 93 insertions(+), 1 deletion(-)
  17. Index: qemu-6.0.0/hw/usb/dev-wacom.c
  18. ===================================================================
  19. --- qemu-6.0.0.orig/hw/usb/dev-wacom.c
  20. +++ qemu-6.0.0/hw/usb/dev-wacom.c
  21. @@ -69,6 +69,89 @@ static const USBDescStrings desc_strings
  22. [STR_SERIALNUMBER] = "1",
  23. };
  24. +static const uint8_t qemu_tablet_hid_report_descriptor[] = {
  25. + 0x05, 0x01, /* Usage Page (Generic Desktop) */
  26. + 0x09, 0x02, /* Usage (Mouse) */
  27. + 0xa1, 0x01, /* Collection (Application) */
  28. + 0x85, 0x01, /* Report ID (1) */
  29. + 0x09, 0x01, /* Usage (Pointer) */
  30. + 0xa1, 0x00, /* Collection (Physical) */
  31. + 0x05, 0x09, /* Usage Page (Button) */
  32. + 0x19, 0x01, /* Usage Minimum (1) */
  33. + 0x29, 0x05, /* Usage Maximum (5) */
  34. + 0x15, 0x00, /* Logical Minimum (0) */
  35. + 0x25, 0x01, /* Logical Maximum (1) */
  36. + 0x95, 0x05, /* Report Count (5) */
  37. + 0x75, 0x01, /* Report Size (1) */
  38. + 0x81, 0x02, /* Input (Data, Variable, Absolute) */
  39. + 0x95, 0x01, /* Report Count (1) */
  40. + 0x75, 0x03, /* Report Size (3) */
  41. + 0x81, 0x01, /* Input (Constant) */
  42. + 0x05, 0x01, /* Usage Page (Generic Desktop) */
  43. + 0x09, 0x30, /* Usage (X) */
  44. + 0x09, 0x31, /* Usage (Y) */
  45. + 0x15, 0x81, /* Logical Minimum (-127) */
  46. + 0x25, 0x7f, /* Logical Maximum (127) */
  47. + 0x75, 0x08, /* Report Size (8) */
  48. + 0x95, 0x02, /* Report Count (2) */
  49. + 0x81, 0x06, /* Input (Data, Variable, Relative) */
  50. + 0xc0, /* End Collection */
  51. + 0xc0, /* End Collection */
  52. + 0x05, 0x0d, /* Usage Page (Digitizer) */
  53. + 0x09, 0x01, /* Usage (Digitizer) */
  54. + 0xa1, 0x01, /* Collection (Application) */
  55. + 0x85, 0x02, /* Report ID (2) */
  56. + 0xa1, 0x00, /* Collection (Physical) */
  57. + 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */
  58. + 0x09, 0x01, /* Usage (Digitizer) */
  59. + 0x15, 0x00, /* Logical Minimum (0) */
  60. + 0x26, 0xff, 0x00, /* Logical Maximum (255) */
  61. + 0x75, 0x08, /* Report Size (8) */
  62. + 0x95, 0x08, /* Report Count (8) */
  63. + 0x81, 0x02, /* Input (Data, Variable, Absolute) */
  64. + 0xc0, /* End Collection */
  65. + 0x09, 0x01, /* Usage (Digitizer) */
  66. + 0x85, 0x02, /* Report ID (2) */
  67. + 0x95, 0x01, /* Report Count (1) */
  68. + 0xb1, 0x02, /* FEATURE (2) */
  69. + 0xc0, /* End Collection */
  70. + 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */
  71. + 0x09, 0x01, /* Usage (Digitizer) */
  72. + 0xa1, 0x01, /* Collection (Application) */
  73. + 0x85, 0x02, /* Report ID (2) */
  74. + 0x05, 0x0d, /* Usage Page (Digitizer) */
  75. + 0x09, 0x22, /* Usage (Finger) */
  76. + 0xa1, 0x00, /* Collection (Physical) */
  77. + 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */
  78. + 0x09, 0x01, /* Usage (Digitizer) */
  79. + 0x15, 0x00, /* Logical Minimum (0) */
  80. + 0x26, 0xff, 0x00, /* Logical Maximum */
  81. + 0x75, 0x08, /* Report Size (8) */
  82. + 0x95, 0x02, /* Report Count (2) */
  83. + 0x81, 0x02, /* Input (Data, Variable, Absolute) */
  84. + 0x05, 0x01, /* Usage Page (Generic Desktop) */
  85. + 0x09, 0x30, /* Usage (X) */
  86. + 0x35, 0x00, /* Physical Minimum */
  87. + 0x46, 0xe0, 0x2e, /* Physical Maximum */
  88. + 0x26, 0xe0, 0x01, /* Logical Maximum */
  89. + 0x75, 0x10, /* Report Size (16) */
  90. + 0x95, 0x01, /* Report Count (1) */
  91. + 0x81, 0x02, /* Input (Data, Variable, Absolute) */
  92. + 0x09, 0x31, /* Usage (Y) */
  93. + 0x46, 0x40, 0x1f, /* Physical Maximum */
  94. + 0x26, 0x40, 0x01, /* Logical Maximum */
  95. + 0x81, 0x02, /* Input (Data, Variable, Absolute) */
  96. + 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */
  97. + 0x09, 0x01, /* Usage (Digitizer) */
  98. + 0x26, 0xff, 0x00, /* Logical Maximum */
  99. + 0x75, 0x08, /* Report Size (8) */
  100. + 0x95, 0x0d, /* Report Count (13) */
  101. + 0x81, 0x02, /* Input (Data, Variable, Absolute) */
  102. + 0xc0, /* End Collection */
  103. + 0xc0, /* End Collection */
  104. +};
  105. +
  106. +
  107. static const USBDescIface desc_iface_wacom = {
  108. .bInterfaceNumber = 0,
  109. .bNumEndpoints = 1,
  110. @@ -86,7 +169,7 @@ static const USBDescIface desc_iface_wac
  111. 0x00, /* u8 country_code */
  112. 0x01, /* u8 num_descriptors */
  113. USB_DT_REPORT, /* u8 type: Report */
  114. - 0x6e, 0, /* u16 len */
  115. + sizeof(qemu_tablet_hid_report_descriptor), 0, /* u16 len */
  116. },
  117. },
  118. },
  119. @@ -266,6 +349,15 @@ static void usb_wacom_handle_control(USB
  120. }
  121. switch (request) {
  122. + case InterfaceRequest | USB_REQ_GET_DESCRIPTOR:
  123. + switch (value >> 8) {
  124. + case 0x22:
  125. + memcpy(data, qemu_tablet_hid_report_descriptor,
  126. + sizeof(qemu_tablet_hid_report_descriptor));
  127. + p->actual_length = sizeof(qemu_tablet_hid_report_descriptor);
  128. + break;
  129. + }
  130. + break;
  131. case WACOM_SET_REPORT:
  132. if (s->mouse_grabbed) {
  133. qemu_remove_mouse_event_handler(s->eh_entry);