[DIGImend-devel] Waltop Mars A graphics tablet patch
Brought to you by:
spb_nick
|
From: Rüdiger S. <r.s...@go...> - 2016-11-01 09:02:10
|
Hi,
added a little patch to hid-waltop.c for Mars A graphics tablet.
Problem was:
Both stylus buttons report the same event.
Fixed by looking at already fixed Waltop devices report descriptors and
changing them to match the Mars A tablet.
Thanks Rüdiger
hid-core.c:
- Add Mars A ID to "hid_have_special_driver" array
hid-ids.h:
- Add Mars A ID
hid-waltop.c:
- Add patched report descriptor to make the 2 stylus buttons report
button presses correctly
Signed-off-by: Rüdiger Schneider <r.s...@go...>
diff -uprN linux-source-4.7/drivers/hid/hid-core.c
linux-source-4.7-patch/drivers/hid/hid-core.c
--- linux-source-4.7/drivers/hid/hid-core.c 2016-10-16
17:51:39.000000000 +0200
+++ linux-source-4.7-patch/drivers/hid/hid-core.c 2016-10-26
17:20:54.403803069 +0200
@@ -2087,6 +2087,7 @@ static const struct hid_device_id hid_ha
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_MARS_A_12_1_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) },
diff -uprN linux-source-4.7/drivers/hid/hid-ids.h
linux-source-4.7-patch/drivers/hid/hid-ids.h
--- linux-source-4.7/drivers/hid/hid-ids.h 2016-10-16 17:51:39.000000000
+0200
+++ linux-source-4.7-patch/drivers/hid/hid-ids.h 2016-10-22
06:53:52.359242645 +0200
@@ -1009,6 +1009,7 @@
#define USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH 0x0034
#define USB_DEVICE_ID_WALTOP_Q_PAD 0x0037
#define USB_DEVICE_ID_WALTOP_PID_0038 0x0038
+#define USB_DEVICE_ID_WALTOP_MARS_A_12_1_INCH 0x0047
#define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501
#define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500
#define USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET 0x0502
diff -uprN linux-source-4.7/drivers/hid/hid-waltop.c
linux-source-4.7-patch/drivers/hid/hid-waltop.c
--- linux-source-4.7/drivers/hid/hid-waltop.c 2016-10-16
17:51:39.000000000 +0200
+++ linux-source-4.7-patch/drivers/hid/hid-waltop.c 2016-11-01
08:40:37.042676691 +0100
@@ -268,6 +268,55 @@ static __u8 pid_0038_rdesc_fixed[] = {
0xC0 /* End Collection */
};
+/* Size of the original report descriptor of tablet with PID 0047 */
+#define MARS_A_12_1_INCH_RDESC_ORIG_SIZE 269
+
+/* Fixed Mars A 12.1 inch descriptor */
+static __u8 mars_a_12_1_inch_rdesc_fixed[] = {
+ 0x05, 0x0D, /* Usage Page (Digitizer), */
+ 0x09, 0x02, /* Usage (Pen), */
+ 0xA1, 0x01, /* Collection (Application), */
+ 0x85, 0x10, /* Report ID (16), */
+ 0x09, 0x20, /* Usage (Stylus), */
+ 0xA0, /* Collection (Physical), */
+ 0x09, 0x42, /* Usage (Tip Switch), */
+ 0x09, 0x44, /* Usage (Barrel Switch), */
+ 0x09, 0x46, /* Usage (Tablet Pick), */
+ 0x15, 0x01, /* Logical Minimum (1), */
+ 0x25, 0x03, /* Logical Maximum (3), */
+ 0x75, 0x04, /* Report Size (4), */
+ 0x95, 0x01, /* Report Count (1), */
+ 0x80, /* Input, */
+ 0x09, 0x32, /* Usage (In Range), */
+ 0x14, /* Logical Minimum (0), */
+ 0x25, 0x01, /* Logical Maximum (1), */
+ 0x75, 0x01, /* Report Size (1), */
+ 0x95, 0x01, /* Report Count (1), */
+ 0x81, 0x02, /* Input (Variable), */
+ 0x95, 0x03, /* Report Count (3), */
+ 0x81, 0x03, /* Input (Constant, Variable), */
+ 0x75, 0x10, /* Report Size (16), */
+ 0x95, 0x01, /* Report Count (1), */
+ 0x14, /* Logical Minimum (0), */
+ 0xA4, /* Push, */
+ 0x05, 0x01, /* Usage Page (Desktop), */
+ 0x65, 0x13, /* Unit (Inch), */
+ 0x55, 0xFD, /* Unit Exponent (-3), */
+ 0x34, /* Physical Minimum (0), */
+ 0x09, 0x30, /* Usage (X), */
+ 0x26, 0x20, 0x4E, /* Logical Maximum (20000), */
+ 0x81, 0x02, /* Input (Variable), */
+ 0x09, 0x31, /* Usage (Y), */
+ 0x26, 0xD4, 0x30, /* Logical Maximum (12500), */
+ 0x81, 0x02, /* Input (Variable), */
+ 0xB4, /* Pop, */
+ 0x09, 0x30, /* Usage (Tip Pressure), */
+ 0x26, 0xFF, 0x07, /* Logical Maximum (2047) */
+ 0x81, 0x02, /* Input (Variable), */
+ 0xC0, /* End Collection, */
+ 0xC0 /* End Collection */
+};
+
/*
* See Media Tablet 10.6 inch description, device and HID report
descriptors at
*
http://sf.net/apps/mediawiki/digimend/?title=Waltop_Media_Tablet_10.6%22
@@ -666,6 +715,12 @@ static __u8 *waltop_report_fixup(struct
*rsize = sizeof(pid_0038_rdesc_fixed);
}
break;
+ case USB_DEVICE_ID_WALTOP_MARS_A_12_1_INCH:
+ if (*rsize == MARS_A_12_1_INCH_RDESC_ORIG_SIZE) {
+ rdesc = mars_a_12_1_inch_rdesc_fixed;
+ *rsize = sizeof(mars_a_12_1_inch_rdesc_fixed);
+ }
+ break;
case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
rdesc = media_tablet_10_6_inch_rdesc_fixed;
@@ -764,6 +819,8 @@ static const struct hid_device_id waltop
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_PID_0038) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
+ USB_DEVICE_ID_WALTOP_MARS_A_12_1_INCH) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
|