Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2 | /* |
Dmitry Torokhov | 4104d13 | 2007-05-07 16:16:29 -0400 | [diff] [blame] | 3 | * drivers/input/tablet/wacom_wac.c |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 4 | * |
Ping Cheng | ee54500 | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 5 | * USB Wacom tablet support - Wacom specific code |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /* |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 9 | */ |
Dmitry Torokhov | 51269fe | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 10 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 11 | #include "wacom_wac.h" |
Dmitry Torokhov | 51269fe | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 12 | #include "wacom.h" |
Henrik Rydberg | 47c78e8 | 2010-11-27 09:16:48 +0100 | [diff] [blame] | 13 | #include <linux/input/mt.h> |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 14 | |
Ping Cheng | e35fb8c | 2011-03-26 21:16:05 -0700 | [diff] [blame] | 15 | /* resolution for penabled devices */ |
| 16 | #define WACOM_PL_RES 20 |
| 17 | #define WACOM_PENPRTN_RES 40 |
| 18 | #define WACOM_VOLITO_RES 50 |
| 19 | #define WACOM_GRAPHIRE_RES 80 |
| 20 | #define WACOM_INTUOS_RES 100 |
| 21 | #define WACOM_INTUOS3_RES 200 |
| 22 | |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 23 | /* Newer Cintiq and DTU have an offset between tablet and screen areas */ |
| 24 | #define WACOM_DTU_OFFSET 200 |
| 25 | #define WACOM_CINTIQ_OFFSET 400 |
| 26 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 27 | /* |
| 28 | * Scale factor relating reported contact size to logical contact area. |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 29 | * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo |
| 30 | */ |
| 31 | #define WACOM_CONTACT_AREA_SCALE 2607 |
| 32 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 33 | static bool touch_arbitration = 1; |
| 34 | module_param(touch_arbitration, bool, 0644); |
| 35 | MODULE_PARM_DESC(touch_arbitration, " on (Y) off (N)"); |
| 36 | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 37 | static void wacom_report_numbered_buttons(struct input_dev *input_dev, |
| 38 | int button_count, int mask); |
| 39 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 40 | static int wacom_numbered_button_to_key(int n); |
| 41 | |
Aaron Armstrong Skomra | 10c55ca | 2017-01-25 12:08:42 -0800 | [diff] [blame] | 42 | static void wacom_update_led(struct wacom *wacom, int button_count, int mask, |
| 43 | int group); |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 44 | /* |
| 45 | * Percent of battery capacity for Graphire. |
| 46 | * 8th value means AC online and show 100% capacity. |
| 47 | */ |
| 48 | static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; |
| 49 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 50 | /* |
| 51 | * Percent of battery capacity for Intuos4 WL, AC has a separate bit. |
| 52 | */ |
| 53 | static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 }; |
| 54 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 55 | static void __wacom_notify_battery(struct wacom_battery *battery, |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 56 | int bat_status, int bat_capacity, |
| 57 | bool bat_charging, bool bat_connected, |
| 58 | bool ps_connected) |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 59 | { |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 60 | bool changed = battery->bat_status != bat_status || |
| 61 | battery->battery_capacity != bat_capacity || |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 62 | battery->bat_charging != bat_charging || |
| 63 | battery->bat_connected != bat_connected || |
| 64 | battery->ps_connected != ps_connected; |
| 65 | |
| 66 | if (changed) { |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 67 | battery->bat_status = bat_status; |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 68 | battery->battery_capacity = bat_capacity; |
| 69 | battery->bat_charging = bat_charging; |
| 70 | battery->bat_connected = bat_connected; |
| 71 | battery->ps_connected = ps_connected; |
| 72 | |
| 73 | if (battery->battery) |
| 74 | power_supply_changed(battery->battery); |
| 75 | } |
| 76 | } |
| 77 | |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 78 | static void wacom_notify_battery(struct wacom_wac *wacom_wac, |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 79 | int bat_status, int bat_capacity, bool bat_charging, |
| 80 | bool bat_connected, bool ps_connected) |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 81 | { |
| 82 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 83 | |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 84 | __wacom_notify_battery(&wacom->battery, bat_status, bat_capacity, |
| 85 | bat_charging, bat_connected, ps_connected); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 86 | } |
| 87 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 88 | static int wacom_penpartner_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 89 | { |
| 90 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 91 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 92 | |
| 93 | switch (data[0]) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 94 | case 1: |
| 95 | if (data[5] & 0x80) { |
| 96 | wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
| 97 | wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 98 | input_report_key(input, wacom->tool[0], 1); |
| 99 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 100 | input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); |
| 101 | input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3])); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 102 | input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127); |
| 103 | input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); |
| 104 | input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 105 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 106 | input_report_key(input, wacom->tool[0], 0); |
| 107 | input_report_abs(input, ABS_MISC, 0); /* report tool id */ |
| 108 | input_report_abs(input, ABS_PRESSURE, -1); |
| 109 | input_report_key(input, BTN_TOUCH, 0); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 110 | } |
| 111 | break; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 112 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 113 | case 2: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 114 | input_report_key(input, BTN_TOOL_PEN, 1); |
| 115 | input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */ |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 116 | input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); |
| 117 | input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3])); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 118 | input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127); |
| 119 | input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); |
| 120 | input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 121 | break; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 122 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 123 | default: |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 124 | dev_dbg(input->dev.parent, |
| 125 | "%s: received unknown report #%d\n", __func__, data[0]); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 126 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 127 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 128 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 129 | return 1; |
| 130 | } |
| 131 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 132 | static int wacom_pl_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 133 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 134 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 135 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 136 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 137 | int prox, pressure; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 138 | |
Ping Cheng | cad7470 | 2009-12-15 00:35:25 -0800 | [diff] [blame] | 139 | if (data[0] != WACOM_REPORT_PENABLED) { |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 140 | dev_dbg(input->dev.parent, |
| 141 | "%s: received unknown report #%d\n", __func__, data[0]); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | prox = data[1] & 0x40; |
| 146 | |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 147 | if (!wacom->id[0]) { |
| 148 | if ((data[0] & 0x10) || (data[4] & 0x20)) { |
| 149 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 150 | wacom->id[0] = ERASER_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 151 | } |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 152 | else { |
| 153 | wacom->tool[0] = BTN_TOOL_PEN; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 154 | wacom->id[0] = STYLUS_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 155 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 156 | } |
| 157 | |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 158 | /* If the eraser is in prox, STYLUS2 is always set. If we |
| 159 | * mis-detected the type and notice that STYLUS2 isn't set |
| 160 | * then force the eraser out of prox and let the pen in. |
| 161 | */ |
| 162 | if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { |
| 163 | input_report_key(input, BTN_TOOL_RUBBER, 0); |
| 164 | input_report_abs(input, ABS_MISC, 0); |
| 165 | input_sync(input); |
| 166 | wacom->tool[0] = BTN_TOOL_PEN; |
| 167 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 168 | } |
| 169 | |
Jason Gerecke | 282e463 | 2017-01-26 09:06:22 -0800 | [diff] [blame] | 170 | if (prox) { |
| 171 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
| 172 | if (features->pressure_max > 255) |
| 173 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
| 174 | pressure += (features->pressure_max + 1) / 2; |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 175 | |
Jason Gerecke | 282e463 | 2017-01-26 09:06:22 -0800 | [diff] [blame] | 176 | input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
| 177 | input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
| 178 | input_report_abs(input, ABS_PRESSURE, pressure); |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 179 | |
Jason Gerecke | 282e463 | 2017-01-26 09:06:22 -0800 | [diff] [blame] | 180 | input_report_key(input, BTN_TOUCH, data[4] & 0x08); |
| 181 | input_report_key(input, BTN_STYLUS, data[4] & 0x10); |
| 182 | /* Only allow the stylus2 button to be reported for the pen tool. */ |
| 183 | input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); |
| 184 | } |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 185 | |
| 186 | if (!prox) |
| 187 | wacom->id[0] = 0; |
| 188 | input_report_key(input, wacom->tool[0], prox); |
| 189 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 190 | return 1; |
| 191 | } |
| 192 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 193 | static int wacom_ptu_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 194 | { |
| 195 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 196 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 197 | |
Ping Cheng | cad7470 | 2009-12-15 00:35:25 -0800 | [diff] [blame] | 198 | if (data[0] != WACOM_REPORT_PENABLED) { |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 199 | dev_dbg(input->dev.parent, |
| 200 | "%s: received unknown report #%d\n", __func__, data[0]); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 201 | return 0; |
| 202 | } |
| 203 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 204 | if (data[1] & 0x04) { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 205 | input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20); |
| 206 | input_report_key(input, BTN_TOUCH, data[1] & 0x08); |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 207 | wacom->id[0] = ERASER_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 208 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 209 | input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20); |
| 210 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 211 | wacom->id[0] = STYLUS_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 212 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 213 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 214 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 215 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
| 216 | input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6])); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 217 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 218 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 219 | return 1; |
| 220 | } |
| 221 | |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 222 | static int wacom_dtu_irq(struct wacom_wac *wacom) |
| 223 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 224 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 225 | struct input_dev *input = wacom->pen_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 226 | int prox = data[1] & 0x20; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 227 | |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 228 | dev_dbg(input->dev.parent, |
| 229 | "%s: received report #%d", __func__, data[0]); |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 230 | |
| 231 | if (prox) { |
| 232 | /* Going into proximity select tool */ |
| 233 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
| 234 | if (wacom->tool[0] == BTN_TOOL_PEN) |
| 235 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 236 | else |
| 237 | wacom->id[0] = ERASER_DEVICE_ID; |
| 238 | } |
| 239 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 240 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
| 241 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 242 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 243 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]); |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 244 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
| 245 | if (!prox) /* out-prox */ |
| 246 | wacom->id[0] = 0; |
| 247 | input_report_key(input, wacom->tool[0], prox); |
| 248 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
| 249 | return 1; |
| 250 | } |
| 251 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 252 | static int wacom_dtus_irq(struct wacom_wac *wacom) |
| 253 | { |
| 254 | char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 255 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 256 | unsigned short prox, pressure = 0; |
| 257 | |
| 258 | if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { |
| 259 | dev_dbg(input->dev.parent, |
| 260 | "%s: received unknown report #%d", __func__, data[0]); |
| 261 | return 0; |
| 262 | } else if (data[0] == WACOM_REPORT_DTUSPAD) { |
Benjamin Tissoires | 422b031 | 2014-07-24 12:50:39 -0700 | [diff] [blame] | 263 | input = wacom->pad_input; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 264 | input_report_key(input, BTN_0, (data[1] & 0x01)); |
| 265 | input_report_key(input, BTN_1, (data[1] & 0x02)); |
| 266 | input_report_key(input, BTN_2, (data[1] & 0x04)); |
| 267 | input_report_key(input, BTN_3, (data[1] & 0x08)); |
| 268 | input_report_abs(input, ABS_MISC, |
| 269 | data[1] & 0x0f ? PAD_DEVICE_ID : 0); |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 270 | return 1; |
| 271 | } else { |
| 272 | prox = data[1] & 0x80; |
| 273 | if (prox) { |
| 274 | switch ((data[1] >> 3) & 3) { |
| 275 | case 1: /* Rubber */ |
| 276 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 277 | wacom->id[0] = ERASER_DEVICE_ID; |
| 278 | break; |
| 279 | |
| 280 | case 2: /* Pen */ |
| 281 | wacom->tool[0] = BTN_TOOL_PEN; |
| 282 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 283 | break; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | input_report_key(input, BTN_STYLUS, data[1] & 0x20); |
| 288 | input_report_key(input, BTN_STYLUS2, data[1] & 0x40); |
| 289 | input_report_abs(input, ABS_X, get_unaligned_be16(&data[3])); |
| 290 | input_report_abs(input, ABS_Y, get_unaligned_be16(&data[5])); |
| 291 | pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff); |
| 292 | input_report_abs(input, ABS_PRESSURE, pressure); |
| 293 | input_report_key(input, BTN_TOUCH, pressure > 10); |
| 294 | |
| 295 | if (!prox) /* out-prox */ |
| 296 | wacom->id[0] = 0; |
| 297 | input_report_key(input, wacom->tool[0], prox); |
| 298 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 299 | return 1; |
| 300 | } |
| 301 | } |
| 302 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 303 | static int wacom_graphire_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 304 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 305 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 306 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 307 | struct input_dev *input = wacom->pen_input; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 308 | struct input_dev *pad_input = wacom->pad_input; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 309 | int battery_capacity, ps_connected; |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 310 | int prox; |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 311 | int rw = 0; |
| 312 | int retval = 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 313 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 314 | if (features->type == GRAPHIRE_BT) { |
| 315 | if (data[0] != WACOM_REPORT_PENABLED_BT) { |
| 316 | dev_dbg(input->dev.parent, |
| 317 | "%s: received unknown report #%d\n", __func__, |
| 318 | data[0]); |
| 319 | goto exit; |
| 320 | } |
| 321 | } else if (data[0] != WACOM_REPORT_PENABLED) { |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 322 | dev_dbg(input->dev.parent, |
| 323 | "%s: received unknown report #%d\n", __func__, data[0]); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 324 | goto exit; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 325 | } |
| 326 | |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 327 | prox = data[1] & 0x80; |
| 328 | if (prox || wacom->id[0]) { |
| 329 | if (prox) { |
| 330 | switch ((data[1] >> 5) & 3) { |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 331 | |
| 332 | case 0: /* Pen */ |
| 333 | wacom->tool[0] = BTN_TOOL_PEN; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 334 | wacom->id[0] = STYLUS_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 335 | break; |
| 336 | |
| 337 | case 1: /* Rubber */ |
| 338 | wacom->tool[0] = BTN_TOOL_RUBBER; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 339 | wacom->id[0] = ERASER_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 340 | break; |
| 341 | |
| 342 | case 2: /* Mouse with wheel */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 343 | input_report_key(input, BTN_MIDDLE, data[1] & 0x04); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 344 | /* fall through */ |
| 345 | |
| 346 | case 3: /* Mouse without wheel */ |
| 347 | wacom->tool[0] = BTN_TOOL_MOUSE; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 348 | wacom->id[0] = CURSOR_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 349 | break; |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 350 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 351 | } |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 352 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 353 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 354 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 355 | if (features->type == GRAPHIRE_BT) |
| 356 | input_report_abs(input, ABS_PRESSURE, data[6] | |
| 357 | (((__u16) (data[1] & 0x08)) << 5)); |
| 358 | else |
| 359 | input_report_abs(input, ABS_PRESSURE, data[6] | |
| 360 | ((data[7] & 0x03) << 8)); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 361 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
| 362 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 363 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); |
Dmitry Torokhov | afb567e | 2010-04-13 23:08:58 -0700 | [diff] [blame] | 364 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 365 | input_report_key(input, BTN_LEFT, data[1] & 0x01); |
| 366 | input_report_key(input, BTN_RIGHT, data[1] & 0x02); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 367 | if (features->type == WACOM_G4 || |
| 368 | features->type == WACOM_MO) { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 369 | input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); |
Mike Auty | d9f66c1 | 2010-08-28 20:35:17 -0700 | [diff] [blame] | 370 | rw = (data[7] & 0x04) - (data[7] & 0x03); |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 371 | } else if (features->type == GRAPHIRE_BT) { |
| 372 | /* Compute distance between mouse and tablet */ |
| 373 | rw = 44 - (data[6] >> 2); |
| 374 | rw = clamp_val(rw, 0, 31); |
| 375 | input_report_abs(input, ABS_DISTANCE, rw); |
| 376 | if (((data[1] >> 5) & 3) == 2) { |
| 377 | /* Mouse with wheel */ |
| 378 | input_report_key(input, BTN_MIDDLE, |
| 379 | data[1] & 0x04); |
| 380 | rw = (data[6] & 0x01) ? -1 : |
| 381 | (data[6] & 0x02) ? 1 : 0; |
| 382 | } else { |
| 383 | rw = 0; |
| 384 | } |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 385 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 386 | input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); |
Mike Auty | d9f66c1 | 2010-08-28 20:35:17 -0700 | [diff] [blame] | 387 | rw = -(signed char)data[6]; |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 388 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 389 | input_report_rel(input, REL_WHEEL, rw); |
Dmitry Torokhov | afb567e | 2010-04-13 23:08:58 -0700 | [diff] [blame] | 390 | } |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 391 | |
| 392 | if (!prox) |
| 393 | wacom->id[0] = 0; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 394 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
| 395 | input_report_key(input, wacom->tool[0], prox); |
| 396 | input_sync(input); /* sync last event */ |
Ping Cheng | 80d4e8e | 2007-02-23 12:22:48 -0800 | [diff] [blame] | 397 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 398 | |
| 399 | /* send pad data */ |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 400 | switch (features->type) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 401 | case WACOM_G4: |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 402 | prox = data[7] & 0xf8; |
| 403 | if (prox || wacom->id[1]) { |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 404 | wacom->id[1] = PAD_DEVICE_ID; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 405 | input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); |
| 406 | input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 407 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 408 | input_report_rel(pad_input, REL_WHEEL, rw); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 409 | if (!prox) |
| 410 | wacom->id[1] = 0; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 411 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
Ping Cheng | ab687b1 | 2010-04-05 23:07:41 -0700 | [diff] [blame] | 412 | retval = 1; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 413 | } |
Ping Cheng | 7ecfbfd | 2007-06-14 23:32:48 -0400 | [diff] [blame] | 414 | break; |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 415 | |
| 416 | case WACOM_MO: |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 417 | prox = (data[7] & 0xf8) || data[8]; |
| 418 | if (prox || wacom->id[1]) { |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 419 | wacom->id[1] = PAD_DEVICE_ID; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 420 | input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); |
| 421 | input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); |
| 422 | input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); |
| 423 | input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); |
| 424 | input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 425 | if (!prox) |
| 426 | wacom->id[1] = 0; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 427 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
Ping Cheng | 8446001 | 2011-07-06 18:05:43 -0700 | [diff] [blame] | 428 | retval = 1; |
Ping Cheng | 7ecfbfd | 2007-06-14 23:32:48 -0400 | [diff] [blame] | 429 | } |
| 430 | break; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 431 | case GRAPHIRE_BT: |
| 432 | prox = data[7] & 0x03; |
| 433 | if (prox || wacom->id[1]) { |
| 434 | wacom->id[1] = PAD_DEVICE_ID; |
| 435 | input_report_key(pad_input, BTN_0, (data[7] & 0x02)); |
| 436 | input_report_key(pad_input, BTN_1, (data[7] & 0x01)); |
| 437 | if (!prox) |
| 438 | wacom->id[1] = 0; |
| 439 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
| 440 | retval = 1; |
| 441 | } |
| 442 | break; |
| 443 | } |
| 444 | |
| 445 | /* Store current battery capacity and power supply state */ |
| 446 | if (features->type == GRAPHIRE_BT) { |
| 447 | rw = (data[7] >> 2 & 0x07); |
| 448 | battery_capacity = batcap_gr[rw]; |
| 449 | ps_connected = rw == 7; |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 450 | wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO, |
| 451 | battery_capacity, ps_connected, 1, |
| 452 | ps_connected); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 453 | } |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 454 | exit: |
| 455 | return retval; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Benjamin Tissoires | 5fcad16 | 2015-03-05 17:36:54 -0500 | [diff] [blame] | 458 | static void wacom_intuos_schedule_prox_event(struct wacom_wac *wacom_wac) |
| 459 | { |
| 460 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 0bbfe28 | 2016-01-06 13:25:53 -0800 | [diff] [blame] | 461 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 5fcad16 | 2015-03-05 17:36:54 -0500 | [diff] [blame] | 462 | struct hid_report *r; |
| 463 | struct hid_report_enum *re; |
| 464 | |
| 465 | re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); |
Jason Gerecke | 0bbfe28 | 2016-01-06 13:25:53 -0800 | [diff] [blame] | 466 | if (features->type == INTUOSHT2) |
| 467 | r = re->report_id_hash[WACOM_REPORT_INTUOSHT2_ID]; |
| 468 | else |
| 469 | r = re->report_id_hash[WACOM_REPORT_INTUOS_ID1]; |
Benjamin Tissoires | 5fcad16 | 2015-03-05 17:36:54 -0500 | [diff] [blame] | 470 | if (r) { |
| 471 | hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); |
| 472 | } |
| 473 | } |
| 474 | |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 475 | static int wacom_intuos_pad(struct wacom_wac *wacom) |
| 476 | { |
| 477 | struct wacom_features *features = &wacom->features; |
| 478 | unsigned char *data = wacom->data; |
| 479 | struct input_dev *input = wacom->pad_input; |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 480 | int i; |
| 481 | int buttons = 0, nbuttons = features->numbered_buttons; |
| 482 | int keys = 0, nkeys = 0; |
| 483 | int ring1 = 0, ring2 = 0; |
| 484 | int strip1 = 0, strip2 = 0; |
| 485 | bool prox = false; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 486 | |
| 487 | /* pad packets. Works as a second tool and is always in prox */ |
| 488 | if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD || |
| 489 | data[0] == WACOM_REPORT_CINTIQPAD)) |
| 490 | return 0; |
| 491 | |
| 492 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 493 | buttons = (data[3] << 1) | (data[2] & 0x01); |
| 494 | ring1 = data[1]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 495 | } else if (features->type == DTK) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 496 | buttons = data[6]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 497 | } else if (features->type == WACOM_13HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 498 | buttons = (data[4] << 1) | (data[3] & 0x01); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 499 | } else if (features->type == WACOM_24HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 500 | buttons = (data[8] << 8) | data[6]; |
| 501 | ring1 = data[1]; |
| 502 | ring2 = data[2]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 503 | |
| 504 | /* |
| 505 | * Three "buttons" are available on the 24HD which are |
| 506 | * physically implemented as a touchstrip. Each button |
| 507 | * is approximately 3 bits wide with a 2 bit spacing. |
| 508 | * The raw touchstrip bits are stored at: |
| 509 | * ((data[3] & 0x1f) << 8) | data[4]) |
| 510 | */ |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 511 | nkeys = 3; |
| 512 | keys = ((data[3] & 0x1C) ? 1<<2 : 0) | |
| 513 | ((data[4] & 0xE0) ? 1<<1 : 0) | |
| 514 | ((data[4] & 0x07) ? 1<<0 : 0); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 515 | } else if (features->type == WACOM_27QHD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 516 | nkeys = 3; |
| 517 | keys = data[2] & 0x07; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 518 | |
| 519 | input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); |
| 520 | input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); |
| 521 | input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 522 | } else if (features->type == CINTIQ_HYBRID) { |
| 523 | /* |
| 524 | * Do not send hardware buttons under Android. They |
| 525 | * are already sent to the system through GPIO (and |
| 526 | * have different meaning). |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 527 | * |
| 528 | * d-pad right -> data[4] & 0x10 |
| 529 | * d-pad up -> data[4] & 0x20 |
| 530 | * d-pad left -> data[4] & 0x40 |
| 531 | * d-pad down -> data[4] & 0x80 |
| 532 | * d-pad center -> data[3] & 0x01 |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 533 | */ |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 534 | buttons = (data[4] << 1) | (data[3] & 0x01); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 535 | } else if (features->type == CINTIQ_COMPANION_2) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 536 | /* d-pad right -> data[4] & 0x10 |
| 537 | * d-pad up -> data[4] & 0x20 |
| 538 | * d-pad left -> data[4] & 0x40 |
| 539 | * d-pad down -> data[4] & 0x80 |
| 540 | * d-pad center -> data[3] & 0x01 |
| 541 | */ |
Jason Gerecke | 0402b6b | 2015-12-16 13:37:36 -0800 | [diff] [blame] | 542 | buttons = ((data[2] >> 4) << 7) | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 543 | ((data[1] & 0x04) << 6) | |
| 544 | ((data[2] & 0x0F) << 2) | |
| 545 | (data[1] & 0x03); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 546 | } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 547 | /* |
| 548 | * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in |
| 549 | * addition to the mechanical switch. Switch data is |
| 550 | * stored in data[4], capacitive data in data[5]. |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 551 | * |
| 552 | * Touch ring mode switch (data[3]) has no capacitive sensor |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 553 | */ |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 554 | buttons = (data[4] << 1) | (data[3] & 0x01); |
| 555 | ring1 = data[2]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 556 | } else { |
| 557 | if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 558 | buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) | |
| 559 | (data[6] << 1) | (data[5] & 0x01); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 560 | |
| 561 | if (features->type == WACOM_22HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 562 | nkeys = 3; |
| 563 | keys = data[9] & 0x07; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 564 | } |
| 565 | } else { |
Ping Cheng | ce06760 | 2017-08-31 15:50:03 -0700 | [diff] [blame] | 566 | buttons = ((data[6] & 0x10) << 5) | |
| 567 | ((data[5] & 0x10) << 4) | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 568 | ((data[6] & 0x0F) << 4) | |
| 569 | (data[5] & 0x0F); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 570 | } |
Jason Gerecke | f73d08d | 2015-12-16 13:37:33 -0800 | [diff] [blame] | 571 | strip1 = ((data[1] & 0x1f) << 8) | data[2]; |
| 572 | strip2 = ((data[3] & 0x1f) << 8) | data[4]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 573 | } |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 574 | |
Dan Carpenter | 8f9cfdd | 2015-12-09 13:22:05 +0300 | [diff] [blame] | 575 | prox = (buttons & ~(~0 << nbuttons)) | (keys & ~(~0 << nkeys)) | |
| 576 | (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 577 | |
| 578 | wacom_report_numbered_buttons(input, nbuttons, buttons); |
| 579 | |
| 580 | for (i = 0; i < nkeys; i++) |
| 581 | input_report_key(input, KEY_PROG1 + i, keys & (1 << i)); |
| 582 | |
| 583 | input_report_abs(input, ABS_RX, strip1); |
Jason Gerecke | 03a0dc5 | 2015-12-16 13:37:34 -0800 | [diff] [blame] | 584 | input_report_abs(input, ABS_RY, strip2); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 585 | |
Jason Gerecke | aaae03e | 2015-12-16 13:37:35 -0800 | [diff] [blame] | 586 | input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0); |
| 587 | input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 588 | |
| 589 | input_report_key(input, wacom->tool[1], prox ? 1 : 0); |
| 590 | input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); |
| 591 | |
| 592 | input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); |
| 593 | |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 594 | return 1; |
| 595 | } |
| 596 | |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 597 | static int wacom_intuos_id_mangle(int tool_id) |
| 598 | { |
| 599 | return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); |
| 600 | } |
| 601 | |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 602 | static int wacom_intuos_get_tool_type(int tool_id) |
| 603 | { |
| 604 | int tool_type; |
| 605 | |
| 606 | switch (tool_id) { |
| 607 | case 0x812: /* Inking pen */ |
| 608 | case 0x801: /* Intuos3 Inking pen */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 609 | case 0x12802: /* Intuos4/5 Inking Pen */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 610 | case 0x012: |
| 611 | tool_type = BTN_TOOL_PENCIL; |
| 612 | break; |
| 613 | |
| 614 | case 0x822: /* Pen */ |
| 615 | case 0x842: |
| 616 | case 0x852: |
| 617 | case 0x823: /* Intuos3 Grip Pen */ |
| 618 | case 0x813: /* Intuos3 Classic Pen */ |
| 619 | case 0x885: /* Intuos3 Marker Pen */ |
| 620 | case 0x802: /* Intuos4/5 13HD/24HD General Pen */ |
| 621 | case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ |
| 622 | case 0x8e2: /* IntuosHT2 pen */ |
| 623 | case 0x022: |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 624 | case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ |
Jason Gerecke | 4e6e7d7 | 2019-02-19 17:58:56 +0000 | [diff] [blame] | 625 | case 0x10842: /* MobileStudio Pro Pro Pen slim */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 626 | case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ |
| 627 | case 0x16802: /* Cintiq 13HD Pro Pen */ |
| 628 | case 0x18802: /* DTH2242 Pen */ |
| 629 | case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 630 | tool_type = BTN_TOOL_PEN; |
| 631 | break; |
| 632 | |
| 633 | case 0x832: /* Stroke pen */ |
| 634 | case 0x032: |
| 635 | tool_type = BTN_TOOL_BRUSH; |
| 636 | break; |
| 637 | |
| 638 | case 0x007: /* Mouse 4D and 2D */ |
| 639 | case 0x09c: |
| 640 | case 0x094: |
| 641 | case 0x017: /* Intuos3 2D Mouse */ |
| 642 | case 0x806: /* Intuos4 Mouse */ |
| 643 | tool_type = BTN_TOOL_MOUSE; |
| 644 | break; |
| 645 | |
| 646 | case 0x096: /* Lens cursor */ |
| 647 | case 0x097: /* Intuos3 Lens cursor */ |
| 648 | case 0x006: /* Intuos4 Lens cursor */ |
| 649 | tool_type = BTN_TOOL_LENS; |
| 650 | break; |
| 651 | |
| 652 | case 0x82a: /* Eraser */ |
Jason Gerecke | 9ce9a12 | 2016-11-11 15:05:52 -0800 | [diff] [blame] | 653 | case 0x84a: |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 654 | case 0x85a: |
| 655 | case 0x91a: |
| 656 | case 0xd1a: |
| 657 | case 0x0fa: |
| 658 | case 0x82b: /* Intuos3 Grip Pen Eraser */ |
| 659 | case 0x81b: /* Intuos3 Classic Pen Eraser */ |
| 660 | case 0x91b: /* Intuos3 Airbrush Eraser */ |
| 661 | case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */ |
| 662 | case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */ |
| 663 | case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 664 | case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */ |
| 665 | case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ |
| 666 | case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */ |
Jason Gerecke | 4e6e7d7 | 2019-02-19 17:58:56 +0000 | [diff] [blame] | 667 | case 0x1084a: /* MobileStudio Pro Pro Pen slim Eraser */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 668 | case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */ |
| 669 | case 0x1880a: /* DTH2242 Eraser */ |
| 670 | case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 671 | tool_type = BTN_TOOL_RUBBER; |
| 672 | break; |
| 673 | |
| 674 | case 0xd12: |
| 675 | case 0x912: |
| 676 | case 0x112: |
| 677 | case 0x913: /* Intuos3 Airbrush */ |
| 678 | case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 679 | case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 680 | tool_type = BTN_TOOL_AIRBRUSH; |
| 681 | break; |
| 682 | |
| 683 | default: /* Unknown tool */ |
| 684 | tool_type = BTN_TOOL_PEN; |
| 685 | break; |
| 686 | } |
| 687 | return tool_type; |
| 688 | } |
| 689 | |
Aaron Armstrong Skomra | 619d3a2 | 2018-04-04 14:24:11 -0700 | [diff] [blame] | 690 | static void wacom_exit_report(struct wacom_wac *wacom) |
| 691 | { |
| 692 | struct input_dev *input = wacom->pen_input; |
| 693 | struct wacom_features *features = &wacom->features; |
| 694 | unsigned char *data = wacom->data; |
| 695 | int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; |
| 696 | |
| 697 | /* |
| 698 | * Reset all states otherwise we lose the initial states |
| 699 | * when in-prox next time |
| 700 | */ |
| 701 | input_report_abs(input, ABS_X, 0); |
| 702 | input_report_abs(input, ABS_Y, 0); |
| 703 | input_report_abs(input, ABS_DISTANCE, 0); |
| 704 | input_report_abs(input, ABS_TILT_X, 0); |
| 705 | input_report_abs(input, ABS_TILT_Y, 0); |
| 706 | if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { |
| 707 | input_report_key(input, BTN_LEFT, 0); |
| 708 | input_report_key(input, BTN_MIDDLE, 0); |
| 709 | input_report_key(input, BTN_RIGHT, 0); |
| 710 | input_report_key(input, BTN_SIDE, 0); |
| 711 | input_report_key(input, BTN_EXTRA, 0); |
| 712 | input_report_abs(input, ABS_THROTTLE, 0); |
| 713 | input_report_abs(input, ABS_RZ, 0); |
| 714 | } else { |
| 715 | input_report_abs(input, ABS_PRESSURE, 0); |
| 716 | input_report_key(input, BTN_STYLUS, 0); |
| 717 | input_report_key(input, BTN_STYLUS2, 0); |
| 718 | input_report_key(input, BTN_TOUCH, 0); |
| 719 | input_report_abs(input, ABS_WHEEL, 0); |
| 720 | if (features->type >= INTUOS3S) |
| 721 | input_report_abs(input, ABS_Z, 0); |
| 722 | } |
| 723 | input_report_key(input, wacom->tool[idx], 0); |
| 724 | input_report_abs(input, ABS_MISC, 0); /* reset tool id */ |
| 725 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
| 726 | wacom->id[idx] = 0; |
| 727 | } |
| 728 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 729 | static int wacom_intuos_inout(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 730 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 731 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 732 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 733 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 734 | int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 735 | |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 736 | if (!(((data[1] & 0xfc) == 0xc0) || /* in prox */ |
| 737 | ((data[1] & 0xfe) == 0x20) || /* in range */ |
| 738 | ((data[1] & 0xfe) == 0x80))) /* out prox */ |
| 739 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 740 | |
| 741 | /* Enter report */ |
| 742 | if ((data[1] & 0xfc) == 0xc0) { |
| 743 | /* serial number of the tool */ |
| 744 | wacom->serial[idx] = ((data[3] & 0x0f) << 28) + |
| 745 | (data[4] << 20) + (data[5] << 12) + |
| 746 | (data[6] << 4) + (data[7] >> 4); |
| 747 | |
Ping Cheng | 493630b | 2010-06-22 11:21:34 -0700 | [diff] [blame] | 748 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 749 | ((data[7] & 0x0f) << 16) | ((data[8] & 0xf0) << 8); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 750 | |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 751 | wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 752 | |
Ping Cheng | eff6ca9 | 2016-05-02 21:17:34 -0700 | [diff] [blame] | 753 | wacom->shared->stylus_in_proximity = true; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 754 | return 1; |
| 755 | } |
| 756 | |
Ping Cheng | c1b03f5 | 2016-01-08 17:16:06 -0800 | [diff] [blame] | 757 | /* in Range */ |
| 758 | if ((data[1] & 0xfe) == 0x20) { |
Ping Cheng | 526d6e7 | 2016-01-08 17:16:25 -0800 | [diff] [blame] | 759 | if (features->type != INTUOSHT2) |
| 760 | wacom->shared->stylus_in_proximity = true; |
Ping Cheng | 486b908 | 2015-02-20 14:25:58 -0800 | [diff] [blame] | 761 | |
Ping Cheng | c1b03f5 | 2016-01-08 17:16:06 -0800 | [diff] [blame] | 762 | /* in Range while exiting */ |
| 763 | if (wacom->reporting_data) { |
| 764 | input_report_key(input, BTN_TOUCH, 0); |
| 765 | input_report_abs(input, ABS_PRESSURE, 0); |
| 766 | input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); |
| 767 | return 2; |
| 768 | } |
| 769 | return 1; |
Jason Gerecke | 4eb1830 | 2013-09-20 09:48:46 -0700 | [diff] [blame] | 770 | } |
| 771 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 772 | /* Exit report */ |
| 773 | if ((data[1] & 0xfe) == 0x80) { |
Ping Cheng | f3586d2 | 2015-03-20 14:57:00 -0700 | [diff] [blame] | 774 | wacom->shared->stylus_in_proximity = false; |
Ping Cheng | b3bd7ef | 2015-01-09 11:05:13 -0800 | [diff] [blame] | 775 | wacom->reporting_data = false; |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 776 | |
Ping Cheng | 373a535 | 2015-01-09 11:04:50 -0800 | [diff] [blame] | 777 | /* don't report exit if we don't know the ID */ |
| 778 | if (!wacom->id[idx]) |
| 779 | return 1; |
| 780 | |
Aaron Armstrong Skomra | 619d3a2 | 2018-04-04 14:24:11 -0700 | [diff] [blame] | 781 | wacom_exit_report(wacom); |
Ping Cheng | 80d4e8e | 2007-02-23 12:22:48 -0800 | [diff] [blame] | 782 | return 2; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 783 | } |
Ping Cheng | 373a535 | 2015-01-09 11:04:50 -0800 | [diff] [blame] | 784 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 785 | return 0; |
| 786 | } |
| 787 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 788 | static inline bool report_touch_events(struct wacom_wac *wacom) |
| 789 | { |
| 790 | return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1); |
| 791 | } |
| 792 | |
| 793 | static inline bool delay_pen_events(struct wacom_wac *wacom) |
| 794 | { |
| 795 | return (wacom->shared->touch_down && touch_arbitration); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 796 | } |
| 797 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 798 | static int wacom_intuos_general(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 799 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 800 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 801 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 802 | struct input_dev *input = wacom->pen_input; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 803 | int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 804 | unsigned char type = (data[1] >> 1) & 0x0F; |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 805 | unsigned int x, y, distance, t; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 806 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 807 | if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_CINTIQ && |
| 808 | data[0] != WACOM_REPORT_INTUOS_PEN) |
| 809 | return 0; |
| 810 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 811 | if (delay_pen_events(wacom)) |
Ping Cheng | c1b03f5 | 2016-01-08 17:16:06 -0800 | [diff] [blame] | 812 | return 1; |
| 813 | |
Ping Cheng | 599b082 | 2016-01-08 17:14:54 -0800 | [diff] [blame] | 814 | /* don't report events if we don't know the tool ID */ |
| 815 | if (!wacom->id[idx]) { |
| 816 | /* but reschedule a read of the current tool */ |
| 817 | wacom_intuos_schedule_prox_event(wacom); |
| 818 | return 1; |
| 819 | } |
| 820 | |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 821 | /* |
| 822 | * don't report events for invalid data |
| 823 | */ |
| 824 | /* older I4 styli don't work with new Cintiqs */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 825 | if ((!((wacom->id[idx] >> 16) & 0x01) && |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 826 | (features->type == WACOM_21UX2)) || |
| 827 | /* Only large Intuos support Lense Cursor */ |
| 828 | (wacom->tool[idx] == BTN_TOOL_LENS && |
| 829 | (features->type == INTUOS3 || |
| 830 | features->type == INTUOS3S || |
| 831 | features->type == INTUOS4 || |
| 832 | features->type == INTUOS4S || |
| 833 | features->type == INTUOS5 || |
| 834 | features->type == INTUOS5S || |
| 835 | features->type == INTUOSPM || |
| 836 | features->type == INTUOSPS)) || |
| 837 | /* Cintiq doesn't send data when RDY bit isn't set */ |
| 838 | (features->type == CINTIQ && !(data[1] & 0x40))) |
| 839 | return 1; |
| 840 | |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 841 | x = (be16_to_cpup((__be16 *)&data[2]) << 1) | ((data[9] >> 1) & 1); |
| 842 | y = (be16_to_cpup((__be16 *)&data[4]) << 1) | (data[9] & 1); |
| 843 | distance = data[9] >> 2; |
| 844 | if (features->type < INTUOS3S) { |
| 845 | x >>= 1; |
| 846 | y >>= 1; |
| 847 | distance >>= 1; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 848 | } |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 849 | input_report_abs(input, ABS_X, x); |
| 850 | input_report_abs(input, ABS_Y, y); |
| 851 | input_report_abs(input, ABS_DISTANCE, distance); |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 852 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 853 | switch (type) { |
| 854 | case 0x00: |
| 855 | case 0x01: |
| 856 | case 0x02: |
| 857 | case 0x03: |
| 858 | /* general pen packet */ |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 859 | t = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | (data[1] & 1); |
| 860 | if (features->pressure_max < 2047) |
| 861 | t >>= 1; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 862 | input_report_abs(input, ABS_PRESSURE, t); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 863 | if (features->type != INTUOSHT2) { |
| 864 | input_report_abs(input, ABS_TILT_X, |
Jason Gerecke | ec5fc1c | 2014-11-18 16:50:08 -0800 | [diff] [blame] | 865 | (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 866 | input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); |
| 867 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 868 | input_report_key(input, BTN_STYLUS, data[1] & 2); |
| 869 | input_report_key(input, BTN_STYLUS2, data[1] & 4); |
| 870 | input_report_key(input, BTN_TOUCH, t > 10); |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 871 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 872 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 873 | case 0x0a: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 874 | /* airbrush second packet */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 875 | input_report_abs(input, ABS_WHEEL, |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 876 | (data[6] << 2) | ((data[7] >> 6) & 3)); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 877 | input_report_abs(input, ABS_TILT_X, |
Jason Gerecke | ec5fc1c | 2014-11-18 16:50:08 -0800 | [diff] [blame] | 878 | (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); |
| 879 | input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 880 | break; |
| 881 | |
| 882 | case 0x05: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 883 | /* Rotation packet */ |
| 884 | if (features->type >= INTUOS3S) { |
| 885 | /* I3 marker pen rotation */ |
| 886 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
| 887 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
| 888 | ((t-1) / 2 + 450)) : (450 - t / 2) ; |
| 889 | input_report_abs(input, ABS_Z, t); |
| 890 | } else { |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 891 | /* 4D mouse 2nd packet */ |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 892 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
| 893 | input_report_abs(input, ABS_RZ, (data[7] & 0x20) ? |
| 894 | ((t - 1) / 2) : -t / 2); |
| 895 | } |
| 896 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 897 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 898 | case 0x04: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 899 | /* 4D mouse 1st packet */ |
| 900 | input_report_key(input, BTN_LEFT, data[8] & 0x01); |
| 901 | input_report_key(input, BTN_MIDDLE, data[8] & 0x02); |
| 902 | input_report_key(input, BTN_RIGHT, data[8] & 0x04); |
| 903 | |
| 904 | input_report_key(input, BTN_SIDE, data[8] & 0x20); |
| 905 | input_report_key(input, BTN_EXTRA, data[8] & 0x10); |
| 906 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
| 907 | input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); |
| 908 | break; |
| 909 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 910 | case 0x06: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 911 | /* I4 mouse */ |
| 912 | input_report_key(input, BTN_LEFT, data[6] & 0x01); |
| 913 | input_report_key(input, BTN_MIDDLE, data[6] & 0x02); |
| 914 | input_report_key(input, BTN_RIGHT, data[6] & 0x04); |
| 915 | input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) |
| 916 | - ((data[7] & 0x40) >> 6)); |
| 917 | input_report_key(input, BTN_SIDE, data[6] & 0x08); |
| 918 | input_report_key(input, BTN_EXTRA, data[6] & 0x10); |
| 919 | |
| 920 | input_report_abs(input, ABS_TILT_X, |
| 921 | (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); |
| 922 | input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); |
| 923 | break; |
| 924 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 925 | case 0x08: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 926 | if (wacom->tool[idx] == BTN_TOOL_MOUSE) { |
| 927 | /* 2D mouse packet */ |
| 928 | input_report_key(input, BTN_LEFT, data[8] & 0x04); |
| 929 | input_report_key(input, BTN_MIDDLE, data[8] & 0x08); |
| 930 | input_report_key(input, BTN_RIGHT, data[8] & 0x10); |
| 931 | input_report_rel(input, REL_WHEEL, (data[8] & 0x01) |
| 932 | - ((data[8] & 0x02) >> 1)); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 933 | |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 934 | /* I3 2D mouse side buttons */ |
| 935 | if (features->type >= INTUOS3S && features->type <= INTUOS3L) { |
| 936 | input_report_key(input, BTN_SIDE, data[8] & 0x40); |
| 937 | input_report_key(input, BTN_EXTRA, data[8] & 0x20); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 938 | } |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 939 | } |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 940 | else if (wacom->tool[idx] == BTN_TOOL_LENS) { |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 941 | /* Lens cursor packets */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 942 | input_report_key(input, BTN_LEFT, data[8] & 0x01); |
| 943 | input_report_key(input, BTN_MIDDLE, data[8] & 0x02); |
| 944 | input_report_key(input, BTN_RIGHT, data[8] & 0x04); |
| 945 | input_report_key(input, BTN_SIDE, data[8] & 0x10); |
| 946 | input_report_key(input, BTN_EXTRA, data[8] & 0x08); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 947 | } |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 948 | break; |
| 949 | |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 950 | case 0x07: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 951 | case 0x09: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 952 | case 0x0b: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 953 | case 0x0c: |
| 954 | case 0x0d: |
| 955 | case 0x0e: |
| 956 | case 0x0f: |
| 957 | /* unhandled */ |
| 958 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 959 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 960 | |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 961 | input_report_abs(input, ABS_MISC, |
| 962 | wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 963 | input_report_key(input, wacom->tool[idx], 1); |
| 964 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
Ping Cheng | b3bd7ef | 2015-01-09 11:05:13 -0800 | [diff] [blame] | 965 | wacom->reporting_data = true; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 966 | return 2; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 967 | } |
| 968 | |
| 969 | static int wacom_intuos_irq(struct wacom_wac *wacom) |
| 970 | { |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 971 | unsigned char *data = wacom->data; |
| 972 | struct input_dev *input = wacom->pen_input; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 973 | int result; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 974 | |
| 975 | if (data[0] != WACOM_REPORT_PENABLED && |
Jason Gerecke | 0610999 | 2015-11-30 17:13:52 -0800 | [diff] [blame] | 976 | data[0] != WACOM_REPORT_INTUOS_ID1 && |
| 977 | data[0] != WACOM_REPORT_INTUOS_ID2 && |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 978 | data[0] != WACOM_REPORT_INTUOSPAD && |
| 979 | data[0] != WACOM_REPORT_INTUOS_PEN && |
| 980 | data[0] != WACOM_REPORT_CINTIQ && |
| 981 | data[0] != WACOM_REPORT_CINTIQPAD && |
| 982 | data[0] != WACOM_REPORT_INTUOS5PAD) { |
| 983 | dev_dbg(input->dev.parent, |
| 984 | "%s: received unknown report #%d\n", __func__, data[0]); |
| 985 | return 0; |
| 986 | } |
| 987 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 988 | /* process pad events */ |
| 989 | result = wacom_intuos_pad(wacom); |
| 990 | if (result) |
| 991 | return result; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 992 | |
| 993 | /* process in/out prox events */ |
| 994 | result = wacom_intuos_inout(wacom); |
| 995 | if (result) |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 996 | return result - 1; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 997 | |
| 998 | /* process general packets */ |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 999 | result = wacom_intuos_general(wacom); |
| 1000 | if (result) |
| 1001 | return result - 1; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1002 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1003 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1004 | } |
| 1005 | |
Jason Gerecke | 149f6f6 | 2017-03-31 10:02:05 -0700 | [diff] [blame] | 1006 | static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) |
| 1007 | { |
| 1008 | unsigned char *data = wacom_wac->data; |
| 1009 | struct input_dev *input; |
| 1010 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
| 1011 | struct wacom_remote *remote = wacom->remote; |
| 1012 | int bat_charging, bat_percent, touch_ring_mode; |
| 1013 | __u32 serial; |
| 1014 | int i, index = -1; |
| 1015 | unsigned long flags; |
| 1016 | |
| 1017 | if (data[0] != WACOM_REPORT_REMOTE) { |
| 1018 | hid_dbg(wacom->hdev, "%s: received unknown report #%d", |
| 1019 | __func__, data[0]); |
| 1020 | return 0; |
| 1021 | } |
| 1022 | |
| 1023 | serial = data[3] + (data[4] << 8) + (data[5] << 16); |
| 1024 | wacom_wac->id[0] = PAD_DEVICE_ID; |
| 1025 | |
| 1026 | spin_lock_irqsave(&remote->remote_lock, flags); |
| 1027 | |
| 1028 | for (i = 0; i < WACOM_MAX_REMOTES; i++) { |
| 1029 | if (remote->remotes[i].serial == serial) { |
| 1030 | index = i; |
| 1031 | break; |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | if (index < 0 || !remote->remotes[index].registered) |
| 1036 | goto out; |
| 1037 | |
| 1038 | input = remote->remotes[index].input; |
| 1039 | |
| 1040 | input_report_key(input, BTN_0, (data[9] & 0x01)); |
| 1041 | input_report_key(input, BTN_1, (data[9] & 0x02)); |
| 1042 | input_report_key(input, BTN_2, (data[9] & 0x04)); |
| 1043 | input_report_key(input, BTN_3, (data[9] & 0x08)); |
| 1044 | input_report_key(input, BTN_4, (data[9] & 0x10)); |
| 1045 | input_report_key(input, BTN_5, (data[9] & 0x20)); |
| 1046 | input_report_key(input, BTN_6, (data[9] & 0x40)); |
| 1047 | input_report_key(input, BTN_7, (data[9] & 0x80)); |
| 1048 | |
| 1049 | input_report_key(input, BTN_8, (data[10] & 0x01)); |
| 1050 | input_report_key(input, BTN_9, (data[10] & 0x02)); |
| 1051 | input_report_key(input, BTN_A, (data[10] & 0x04)); |
| 1052 | input_report_key(input, BTN_B, (data[10] & 0x08)); |
| 1053 | input_report_key(input, BTN_C, (data[10] & 0x10)); |
| 1054 | input_report_key(input, BTN_X, (data[10] & 0x20)); |
| 1055 | input_report_key(input, BTN_Y, (data[10] & 0x40)); |
| 1056 | input_report_key(input, BTN_Z, (data[10] & 0x80)); |
| 1057 | |
| 1058 | input_report_key(input, BTN_BASE, (data[11] & 0x01)); |
| 1059 | input_report_key(input, BTN_BASE2, (data[11] & 0x02)); |
| 1060 | |
| 1061 | if (data[12] & 0x80) |
| 1062 | input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f)); |
| 1063 | else |
| 1064 | input_report_abs(input, ABS_WHEEL, 0); |
| 1065 | |
| 1066 | bat_percent = data[7] & 0x7f; |
| 1067 | bat_charging = !!(data[7] & 0x80); |
| 1068 | |
| 1069 | if (data[9] | data[10] | (data[11] & 0x03) | data[12]) |
| 1070 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
| 1071 | else |
| 1072 | input_report_abs(input, ABS_MISC, 0); |
| 1073 | |
| 1074 | input_event(input, EV_MSC, MSC_SERIAL, serial); |
| 1075 | |
| 1076 | input_sync(input); |
| 1077 | |
| 1078 | /*Which mode select (LED light) is currently on?*/ |
| 1079 | touch_ring_mode = (data[11] & 0xC0) >> 6; |
| 1080 | |
| 1081 | for (i = 0; i < WACOM_MAX_REMOTES; i++) { |
| 1082 | if (remote->remotes[i].serial == serial) |
| 1083 | wacom->led.groups[i].select = touch_ring_mode; |
| 1084 | } |
| 1085 | |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 1086 | __wacom_notify_battery(&remote->remotes[index].battery, |
| 1087 | WACOM_POWER_SUPPLY_STATUS_AUTO, bat_percent, |
Jason Gerecke | 149f6f6 | 2017-03-31 10:02:05 -0700 | [diff] [blame] | 1088 | bat_charging, 1, bat_charging); |
| 1089 | |
| 1090 | out: |
| 1091 | spin_unlock_irqrestore(&remote->remote_lock, flags); |
| 1092 | return 0; |
| 1093 | } |
| 1094 | |
| 1095 | static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) |
| 1096 | { |
| 1097 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
| 1098 | unsigned char *data = wacom_wac->data; |
| 1099 | struct wacom_remote *remote = wacom->remote; |
| 1100 | struct wacom_remote_data remote_data; |
| 1101 | unsigned long flags; |
| 1102 | int i, ret; |
| 1103 | |
| 1104 | if (data[0] != WACOM_REPORT_DEVICE_LIST) |
| 1105 | return; |
| 1106 | |
| 1107 | memset(&remote_data, 0, sizeof(struct wacom_remote_data)); |
| 1108 | |
| 1109 | for (i = 0; i < WACOM_MAX_REMOTES; i++) { |
| 1110 | int j = i * 6; |
| 1111 | int serial = (data[j+6] << 16) + (data[j+5] << 8) + data[j+4]; |
| 1112 | bool connected = data[j+2]; |
| 1113 | |
| 1114 | remote_data.remote[i].serial = serial; |
| 1115 | remote_data.remote[i].connected = connected; |
| 1116 | } |
| 1117 | |
| 1118 | spin_lock_irqsave(&remote->remote_lock, flags); |
| 1119 | |
| 1120 | ret = kfifo_in(&remote->remote_fifo, &remote_data, sizeof(remote_data)); |
| 1121 | if (ret != sizeof(remote_data)) { |
| 1122 | spin_unlock_irqrestore(&remote->remote_lock, flags); |
| 1123 | hid_err(wacom->hdev, "Can't queue Remote status event.\n"); |
| 1124 | return; |
| 1125 | } |
| 1126 | |
| 1127 | spin_unlock_irqrestore(&remote->remote_lock, flags); |
| 1128 | |
| 1129 | wacom_schedule_work(wacom_wac, WACOM_WORKER_REMOTE); |
| 1130 | } |
| 1131 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1132 | static int int_dist(int x1, int y1, int x2, int y2) |
| 1133 | { |
| 1134 | int x = x2 - x1; |
| 1135 | int y = y2 - y1; |
| 1136 | |
| 1137 | return int_sqrt(x*x + y*y); |
| 1138 | } |
| 1139 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1140 | static void wacom_intuos_bt_process_data(struct wacom_wac *wacom, |
| 1141 | unsigned char *data) |
| 1142 | { |
| 1143 | memcpy(wacom->data, data, 10); |
| 1144 | wacom_intuos_irq(wacom); |
| 1145 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1146 | input_sync(wacom->pen_input); |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1147 | if (wacom->pad_input) |
| 1148 | input_sync(wacom->pad_input); |
| 1149 | } |
| 1150 | |
| 1151 | static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len) |
| 1152 | { |
| 1153 | unsigned char data[WACOM_PKGLEN_MAX]; |
| 1154 | int i = 1; |
| 1155 | unsigned power_raw, battery_capacity, bat_charging, ps_connected; |
| 1156 | |
| 1157 | memcpy(data, wacom->data, len); |
| 1158 | |
| 1159 | switch (data[0]) { |
| 1160 | case 0x04: |
| 1161 | wacom_intuos_bt_process_data(wacom, data + i); |
| 1162 | i += 10; |
| 1163 | /* fall through */ |
| 1164 | case 0x03: |
| 1165 | wacom_intuos_bt_process_data(wacom, data + i); |
| 1166 | i += 10; |
| 1167 | wacom_intuos_bt_process_data(wacom, data + i); |
| 1168 | i += 10; |
| 1169 | power_raw = data[i]; |
| 1170 | bat_charging = (power_raw & 0x08) ? 1 : 0; |
| 1171 | ps_connected = (power_raw & 0x10) ? 1 : 0; |
| 1172 | battery_capacity = batcap_i4[power_raw & 0x07]; |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 1173 | wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO, |
| 1174 | battery_capacity, bat_charging, |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 1175 | battery_capacity || bat_charging, |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 1176 | ps_connected); |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1177 | break; |
| 1178 | default: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1179 | dev_dbg(wacom->pen_input->dev.parent, |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1180 | "Unknown report: %d,%d size:%zu\n", |
| 1181 | data[0], data[1], len); |
| 1182 | return 0; |
| 1183 | } |
| 1184 | return 0; |
| 1185 | } |
| 1186 | |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1187 | static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) |
| 1188 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1189 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1190 | unsigned touch_max = wacom->features.touch_max; |
| 1191 | int count = 0; |
| 1192 | int i; |
| 1193 | |
Ping Cheng | 26ba61f | 2015-05-19 17:42:02 -0700 | [diff] [blame] | 1194 | if (!touch_max) |
| 1195 | return 0; |
| 1196 | |
Jason Gerecke | 71b5c47 | 2015-04-15 17:22:32 -0700 | [diff] [blame] | 1197 | if (touch_max == 1) |
| 1198 | return test_bit(BTN_TOUCH, input->key) && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1199 | report_touch_events(wacom); |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1200 | |
| 1201 | for (i = 0; i < input->mt->num_slots; i++) { |
| 1202 | struct input_mt_slot *ps = &input->mt->slots[i]; |
| 1203 | int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID); |
| 1204 | if (id >= 0) |
| 1205 | count++; |
| 1206 | } |
| 1207 | |
| 1208 | return count; |
| 1209 | } |
| 1210 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1211 | static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom) |
| 1212 | { |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1213 | int pen_frame_len, pen_frames; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1214 | |
| 1215 | struct input_dev *pen_input = wacom->pen_input; |
| 1216 | unsigned char *data = wacom->data; |
| 1217 | int i; |
| 1218 | |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 1219 | if (wacom->features.type == INTUOSP2_BT || |
| 1220 | wacom->features.type == INTUOSP2S_BT) { |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1221 | wacom->serial[0] = get_unaligned_le64(&data[99]); |
| 1222 | wacom->id[0] = get_unaligned_le16(&data[107]); |
| 1223 | pen_frame_len = 14; |
| 1224 | pen_frames = 7; |
| 1225 | } else { |
| 1226 | wacom->serial[0] = get_unaligned_le64(&data[33]); |
| 1227 | wacom->id[0] = get_unaligned_le16(&data[41]); |
| 1228 | pen_frame_len = 8; |
| 1229 | pen_frames = 4; |
| 1230 | } |
| 1231 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1232 | if (wacom->serial[0] >> 52 == 1) { |
| 1233 | /* Add back in missing bits of ID for non-USI pens */ |
| 1234 | wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF; |
| 1235 | } |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1236 | |
| 1237 | for (i = 0; i < pen_frames; i++) { |
| 1238 | unsigned char *frame = &data[i*pen_frame_len + 1]; |
Jason Gerecke | a48324d | 2017-02-10 16:14:07 -0800 | [diff] [blame] | 1239 | bool valid = frame[0] & 0x80; |
| 1240 | bool prox = frame[0] & 0x40; |
| 1241 | bool range = frame[0] & 0x20; |
Jason Gerecke | 2cc0880 | 2019-04-24 15:12:57 -0700 | [diff] [blame] | 1242 | bool invert = frame[0] & 0x10; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1243 | |
Jason Gerecke | a48324d | 2017-02-10 16:14:07 -0800 | [diff] [blame] | 1244 | if (!valid) |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1245 | continue; |
| 1246 | |
Aaron Armstrong Skomra | 619d3a2 | 2018-04-04 14:24:11 -0700 | [diff] [blame] | 1247 | if (!prox) { |
| 1248 | wacom->shared->stylus_in_proximity = false; |
| 1249 | wacom_exit_report(wacom); |
| 1250 | input_sync(pen_input); |
Jason Gerecke | 2cc0880 | 2019-04-24 15:12:57 -0700 | [diff] [blame] | 1251 | |
| 1252 | wacom->tool[0] = 0; |
| 1253 | wacom->id[0] = 0; |
| 1254 | wacom->serial[0] = 0; |
Aaron Armstrong Skomra | 619d3a2 | 2018-04-04 14:24:11 -0700 | [diff] [blame] | 1255 | return; |
| 1256 | } |
Jason Gerecke | 2cc0880 | 2019-04-24 15:12:57 -0700 | [diff] [blame] | 1257 | |
Jason Gerecke | a48324d | 2017-02-10 16:14:07 -0800 | [diff] [blame] | 1258 | if (range) { |
Jason Gerecke | 2cc0880 | 2019-04-24 15:12:57 -0700 | [diff] [blame] | 1259 | if (!wacom->tool[0]) { /* first in range */ |
| 1260 | /* Going into range select tool */ |
| 1261 | if (invert) |
| 1262 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 1263 | else if (wacom->id[0]) |
| 1264 | wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]); |
| 1265 | else |
| 1266 | wacom->tool[0] = BTN_TOOL_PEN; |
| 1267 | } |
| 1268 | |
Jason Gerecke | a48324d | 2017-02-10 16:14:07 -0800 | [diff] [blame] | 1269 | input_report_abs(pen_input, ABS_X, get_unaligned_le16(&frame[1])); |
| 1270 | input_report_abs(pen_input, ABS_Y, get_unaligned_le16(&frame[3])); |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1271 | |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 1272 | if (wacom->features.type == INTUOSP2_BT || |
| 1273 | wacom->features.type == INTUOSP2S_BT) { |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1274 | /* Fix rotation alignment: userspace expects zero at left */ |
| 1275 | int16_t rotation = |
| 1276 | (int16_t)get_unaligned_le16(&frame[9]); |
| 1277 | rotation += 1800/4; |
| 1278 | |
| 1279 | if (rotation > 899) |
| 1280 | rotation -= 1800; |
| 1281 | |
| 1282 | input_report_abs(pen_input, ABS_TILT_X, |
| 1283 | (char)frame[7]); |
| 1284 | input_report_abs(pen_input, ABS_TILT_Y, |
| 1285 | (char)frame[8]); |
| 1286 | input_report_abs(pen_input, ABS_Z, rotation); |
| 1287 | input_report_abs(pen_input, ABS_WHEEL, |
| 1288 | get_unaligned_le16(&frame[11])); |
| 1289 | } |
Jason Gerecke | a48324d | 2017-02-10 16:14:07 -0800 | [diff] [blame] | 1290 | } |
Jason Gerecke | e92a7be | 2019-04-24 15:12:58 -0700 | [diff] [blame] | 1291 | if (wacom->tool[0]) { |
| 1292 | input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5])); |
| 1293 | if (wacom->features.type == INTUOSP2_BT) { |
| 1294 | input_report_abs(pen_input, ABS_DISTANCE, |
| 1295 | range ? frame[13] : wacom->features.distance_max); |
| 1296 | } else { |
| 1297 | input_report_abs(pen_input, ABS_DISTANCE, |
| 1298 | range ? frame[7] : wacom->features.distance_max); |
| 1299 | } |
| 1300 | |
Jason Gerecke | fe7f8d7 | 2019-05-07 11:53:20 -0700 | [diff] [blame] | 1301 | input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x09); |
Jason Gerecke | e92a7be | 2019-04-24 15:12:58 -0700 | [diff] [blame] | 1302 | input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02); |
| 1303 | input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04); |
| 1304 | |
| 1305 | input_report_key(pen_input, wacom->tool[0], prox); |
| 1306 | input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]); |
| 1307 | input_report_abs(pen_input, ABS_MISC, |
| 1308 | wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */ |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1309 | } |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1310 | |
Jason Gerecke | a48324d | 2017-02-10 16:14:07 -0800 | [diff] [blame] | 1311 | wacom->shared->stylus_in_proximity = prox; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1312 | |
| 1313 | input_sync(pen_input); |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | static void wacom_intuos_pro2_bt_touch(struct wacom_wac *wacom) |
| 1318 | { |
| 1319 | const int finger_touch_len = 8; |
| 1320 | const int finger_frames = 4; |
| 1321 | const int finger_frame_len = 43; |
| 1322 | |
| 1323 | struct input_dev *touch_input = wacom->touch_input; |
| 1324 | unsigned char *data = wacom->data; |
| 1325 | int num_contacts_left = 5; |
| 1326 | int i, j; |
| 1327 | |
| 1328 | for (i = 0; i < finger_frames; i++) { |
| 1329 | unsigned char *frame = &data[i*finger_frame_len + 109]; |
| 1330 | int current_num_contacts = frame[0] & 0x7F; |
| 1331 | int contacts_to_send; |
| 1332 | |
| 1333 | if (!(frame[0] & 0x80)) |
| 1334 | continue; |
| 1335 | |
| 1336 | /* |
| 1337 | * First packet resets the counter since only the first |
| 1338 | * packet in series will have non-zero current_num_contacts. |
| 1339 | */ |
| 1340 | if (current_num_contacts) |
| 1341 | wacom->num_contacts_left = current_num_contacts; |
| 1342 | |
| 1343 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); |
| 1344 | |
| 1345 | for (j = 0; j < contacts_to_send; j++) { |
| 1346 | unsigned char *touch = &frame[j*finger_touch_len + 1]; |
| 1347 | int slot = input_mt_get_slot_by_key(touch_input, touch[0]); |
| 1348 | int x = get_unaligned_le16(&touch[2]); |
| 1349 | int y = get_unaligned_le16(&touch[4]); |
| 1350 | int w = touch[6] * input_abs_get_res(touch_input, ABS_MT_POSITION_X); |
| 1351 | int h = touch[7] * input_abs_get_res(touch_input, ABS_MT_POSITION_Y); |
| 1352 | |
| 1353 | if (slot < 0) |
| 1354 | continue; |
| 1355 | |
| 1356 | input_mt_slot(touch_input, slot); |
| 1357 | input_mt_report_slot_state(touch_input, MT_TOOL_FINGER, touch[1] & 0x01); |
| 1358 | input_report_abs(touch_input, ABS_MT_POSITION_X, x); |
| 1359 | input_report_abs(touch_input, ABS_MT_POSITION_Y, y); |
| 1360 | input_report_abs(touch_input, ABS_MT_TOUCH_MAJOR, max(w, h)); |
| 1361 | input_report_abs(touch_input, ABS_MT_TOUCH_MINOR, min(w, h)); |
| 1362 | input_report_abs(touch_input, ABS_MT_ORIENTATION, w > h); |
| 1363 | } |
| 1364 | |
| 1365 | input_mt_sync_frame(touch_input); |
| 1366 | |
| 1367 | wacom->num_contacts_left -= contacts_to_send; |
| 1368 | if (wacom->num_contacts_left <= 0) { |
| 1369 | wacom->num_contacts_left = 0; |
| 1370 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Jason Gerecke | 69dbdff | 2019-05-07 11:53:22 -0700 | [diff] [blame] | 1371 | input_sync(touch_input); |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1372 | } |
| 1373 | } |
| 1374 | |
Jason Gerecke | 69dbdff | 2019-05-07 11:53:22 -0700 | [diff] [blame] | 1375 | if (wacom->num_contacts_left == 0) { |
| 1376 | // Be careful that we don't accidentally call input_sync with |
| 1377 | // only a partial set of fingers of processed |
| 1378 | input_report_switch(touch_input, SW_MUTE_DEVICE, !(data[281] >> 7)); |
| 1379 | input_sync(touch_input); |
| 1380 | } |
| 1381 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1382 | } |
| 1383 | |
| 1384 | static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom) |
| 1385 | { |
| 1386 | struct input_dev *pad_input = wacom->pad_input; |
| 1387 | unsigned char *data = wacom->data; |
| 1388 | |
Jason Gerecke | 6441fc7 | 2019-05-07 11:53:21 -0700 | [diff] [blame] | 1389 | int buttons = data[282] | ((data[281] & 0x40) << 2); |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 1390 | int ring = data[285] & 0x7F; |
| 1391 | bool ringstatus = data[285] & 0x80; |
| 1392 | bool prox = buttons || ringstatus; |
| 1393 | |
| 1394 | /* Fix touchring data: userspace expects 0 at left and increasing clockwise */ |
| 1395 | ring = 71 - ring; |
| 1396 | ring += 3*72/16; |
| 1397 | if (ring > 71) |
| 1398 | ring -= 72; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1399 | |
| 1400 | wacom_report_numbered_buttons(pad_input, 9, buttons); |
| 1401 | |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 1402 | input_report_abs(pad_input, ABS_WHEEL, ringstatus ? ring : 0); |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1403 | |
| 1404 | input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0); |
| 1405 | input_report_abs(pad_input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); |
| 1406 | input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); |
| 1407 | |
| 1408 | input_sync(pad_input); |
| 1409 | } |
| 1410 | |
| 1411 | static void wacom_intuos_pro2_bt_battery(struct wacom_wac *wacom) |
| 1412 | { |
| 1413 | unsigned char *data = wacom->data; |
| 1414 | |
| 1415 | bool chg = data[284] & 0x80; |
| 1416 | int battery_status = data[284] & 0x7F; |
| 1417 | |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 1418 | wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO, |
| 1419 | battery_status, chg, 1, chg); |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1420 | } |
| 1421 | |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1422 | static void wacom_intuos_gen3_bt_pad(struct wacom_wac *wacom) |
| 1423 | { |
| 1424 | struct input_dev *pad_input = wacom->pad_input; |
| 1425 | unsigned char *data = wacom->data; |
| 1426 | |
| 1427 | int buttons = data[44]; |
| 1428 | |
| 1429 | wacom_report_numbered_buttons(pad_input, 4, buttons); |
| 1430 | |
| 1431 | input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0); |
| 1432 | input_report_abs(pad_input, ABS_MISC, buttons ? PAD_DEVICE_ID : 0); |
| 1433 | input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); |
| 1434 | |
| 1435 | input_sync(pad_input); |
| 1436 | } |
| 1437 | |
| 1438 | static void wacom_intuos_gen3_bt_battery(struct wacom_wac *wacom) |
| 1439 | { |
| 1440 | unsigned char *data = wacom->data; |
| 1441 | |
| 1442 | bool chg = data[45] & 0x80; |
| 1443 | int battery_status = data[45] & 0x7F; |
| 1444 | |
| 1445 | wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO, |
| 1446 | battery_status, chg, 1, chg); |
| 1447 | } |
| 1448 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1449 | static int wacom_intuos_pro2_bt_irq(struct wacom_wac *wacom, size_t len) |
| 1450 | { |
| 1451 | unsigned char *data = wacom->data; |
| 1452 | |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1453 | if (data[0] != 0x80 && data[0] != 0x81) { |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1454 | dev_dbg(wacom->pen_input->dev.parent, |
| 1455 | "%s: received unknown report #%d\n", __func__, data[0]); |
| 1456 | return 0; |
| 1457 | } |
| 1458 | |
| 1459 | wacom_intuos_pro2_bt_pen(wacom); |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 1460 | if (wacom->features.type == INTUOSP2_BT || |
| 1461 | wacom->features.type == INTUOSP2S_BT) { |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 1462 | wacom_intuos_pro2_bt_touch(wacom); |
| 1463 | wacom_intuos_pro2_bt_pad(wacom); |
| 1464 | wacom_intuos_pro2_bt_battery(wacom); |
| 1465 | } else { |
| 1466 | wacom_intuos_gen3_bt_pad(wacom); |
| 1467 | wacom_intuos_gen3_bt_battery(wacom); |
| 1468 | } |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1469 | return 0; |
| 1470 | } |
| 1471 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1472 | static int wacom_24hdt_irq(struct wacom_wac *wacom) |
| 1473 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1474 | struct input_dev *input = wacom->touch_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1475 | unsigned char *data = wacom->data; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1476 | int i; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1477 | int current_num_contacts = data[61]; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1478 | int contacts_to_send = 0; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1479 | int num_contacts_left = 4; /* maximum contacts per packet */ |
| 1480 | int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; |
| 1481 | int y_offset = 2; |
| 1482 | |
| 1483 | if (wacom->features.type == WACOM_27QHDT) { |
| 1484 | current_num_contacts = data[63]; |
| 1485 | num_contacts_left = 10; |
| 1486 | byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; |
| 1487 | y_offset = 0; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1488 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1489 | |
| 1490 | /* |
| 1491 | * First packet resets the counter since only the first |
| 1492 | * packet in series will have non-zero current_num_contacts. |
| 1493 | */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1494 | if (current_num_contacts) |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1495 | wacom->num_contacts_left = current_num_contacts; |
| 1496 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1497 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1498 | |
| 1499 | for (i = 0; i < contacts_to_send; i++) { |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1500 | int offset = (byte_per_packet * i) + 1; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1501 | bool touch = (data[offset] & 0x1) && report_touch_events(wacom); |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 1502 | int slot = input_mt_get_slot_by_key(input, data[offset + 1]); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1503 | |
| 1504 | if (slot < 0) |
| 1505 | continue; |
| 1506 | input_mt_slot(input, slot); |
| 1507 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1508 | |
| 1509 | if (touch) { |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1510 | int t_x = get_unaligned_le16(&data[offset + 2]); |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1511 | int t_y = get_unaligned_le16(&data[offset + 4 + y_offset]); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1512 | |
| 1513 | input_report_abs(input, ABS_MT_POSITION_X, t_x); |
| 1514 | input_report_abs(input, ABS_MT_POSITION_Y, t_y); |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1515 | |
| 1516 | if (wacom->features.type != WACOM_27QHDT) { |
| 1517 | int c_x = get_unaligned_le16(&data[offset + 4]); |
| 1518 | int c_y = get_unaligned_le16(&data[offset + 8]); |
| 1519 | int w = get_unaligned_le16(&data[offset + 10]); |
| 1520 | int h = get_unaligned_le16(&data[offset + 12]); |
| 1521 | |
| 1522 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); |
| 1523 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, |
| 1524 | min(w, h) + int_dist(t_x, t_y, c_x, c_y)); |
| 1525 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); |
| 1526 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); |
| 1527 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1528 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1529 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1530 | input_mt_sync_frame(input); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1531 | |
| 1532 | wacom->num_contacts_left -= contacts_to_send; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1533 | if (wacom->num_contacts_left <= 0) { |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1534 | wacom->num_contacts_left = 0; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1535 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1536 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1537 | return 1; |
| 1538 | } |
| 1539 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1540 | static int wacom_mt_touch(struct wacom_wac *wacom) |
| 1541 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1542 | struct input_dev *input = wacom->touch_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1543 | unsigned char *data = wacom->data; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1544 | int i; |
| 1545 | int current_num_contacts = data[2]; |
| 1546 | int contacts_to_send = 0; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1547 | int x_offset = 0; |
| 1548 | |
| 1549 | /* MTTPC does not support Height and Width */ |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1550 | if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1551 | x_offset = -4; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1552 | |
| 1553 | /* |
| 1554 | * First packet resets the counter since only the first |
| 1555 | * packet in series will have non-zero current_num_contacts. |
| 1556 | */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1557 | if (current_num_contacts) |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1558 | wacom->num_contacts_left = current_num_contacts; |
| 1559 | |
| 1560 | /* There are at most 5 contacts per packet */ |
| 1561 | contacts_to_send = min(5, wacom->num_contacts_left); |
| 1562 | |
| 1563 | for (i = 0; i < contacts_to_send; i++) { |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1564 | int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1565 | bool touch = (data[offset] & 0x1) && report_touch_events(wacom); |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1566 | int id = get_unaligned_le16(&data[offset + 1]); |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 1567 | int slot = input_mt_get_slot_by_key(input, id); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1568 | |
| 1569 | if (slot < 0) |
| 1570 | continue; |
| 1571 | |
| 1572 | input_mt_slot(input, slot); |
| 1573 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1574 | if (touch) { |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1575 | int x = get_unaligned_le16(&data[offset + x_offset + 7]); |
| 1576 | int y = get_unaligned_le16(&data[offset + x_offset + 9]); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1577 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1578 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 1579 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1580 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1581 | input_mt_sync_frame(input); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1582 | |
| 1583 | wacom->num_contacts_left -= contacts_to_send; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1584 | if (wacom->num_contacts_left <= 0) { |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1585 | wacom->num_contacts_left = 0; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1586 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1587 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1588 | return 1; |
| 1589 | } |
| 1590 | |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1591 | static int wacom_tpc_mt_touch(struct wacom_wac *wacom) |
| 1592 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1593 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1594 | unsigned char *data = wacom->data; |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1595 | int i; |
| 1596 | |
| 1597 | for (i = 0; i < 2; i++) { |
| 1598 | int p = data[1] & (1 << i); |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1599 | bool touch = p && report_touch_events(wacom); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1600 | |
| 1601 | input_mt_slot(input, i); |
| 1602 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1603 | if (touch) { |
| 1604 | int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; |
| 1605 | int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; |
| 1606 | |
| 1607 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1608 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1609 | } |
| 1610 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1611 | input_mt_sync_frame(input); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1612 | |
| 1613 | /* keep touch state for pen event */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1614 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1615 | |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1616 | return 1; |
| 1617 | } |
| 1618 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1619 | static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1620 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1621 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1622 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1623 | bool prox = report_touch_events(wacom); |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1624 | int x = 0, y = 0; |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1625 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1626 | if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) |
| 1627 | return 0; |
| 1628 | |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1629 | if (len == WACOM_PKGLEN_TPC1FG) { |
| 1630 | prox = prox && (data[0] & 0x01); |
| 1631 | x = get_unaligned_le16(&data[1]); |
| 1632 | y = get_unaligned_le16(&data[3]); |
| 1633 | } else if (len == WACOM_PKGLEN_TPC1FG_B) { |
| 1634 | prox = prox && (data[2] & 0x01); |
| 1635 | x = get_unaligned_le16(&data[3]); |
| 1636 | y = get_unaligned_le16(&data[5]); |
| 1637 | } else { |
| 1638 | prox = prox && (data[1] & 0x01); |
| 1639 | x = le16_to_cpup((__le16 *)&data[2]); |
| 1640 | y = le16_to_cpup((__le16 *)&data[4]); |
| 1641 | } |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1642 | |
| 1643 | if (prox) { |
| 1644 | input_report_abs(input, ABS_X, x); |
| 1645 | input_report_abs(input, ABS_Y, y); |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1646 | } |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1647 | input_report_key(input, BTN_TOUCH, prox); |
| 1648 | |
| 1649 | /* keep touch state for pen events */ |
| 1650 | wacom->shared->touch_down = prox; |
| 1651 | |
| 1652 | return 1; |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1653 | } |
| 1654 | |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1655 | static int wacom_tpc_pen(struct wacom_wac *wacom) |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1656 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1657 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1658 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1659 | bool prox = data[1] & 0x20; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1660 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1661 | if (!wacom->shared->stylus_in_proximity) /* first in prox */ |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1662 | /* Going into proximity select tool */ |
| 1663 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1664 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1665 | /* keep pen state for touch events */ |
| 1666 | wacom->shared->stylus_in_proximity = prox; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1667 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1668 | /* send pen events only when touch is up or forced out |
| 1669 | * or touch arbitration is off |
| 1670 | */ |
| 1671 | if (!delay_pen_events(wacom)) { |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1672 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 1673 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
| 1674 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 1675 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Jason Gerecke | 0b335ca | 2014-07-24 13:15:31 -0700 | [diff] [blame] | 1676 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1677 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
| 1678 | input_report_key(input, wacom->tool[0], prox); |
| 1679 | return 1; |
| 1680 | } |
| 1681 | |
| 1682 | return 0; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1683 | } |
| 1684 | |
| 1685 | static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) |
| 1686 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1687 | unsigned char *data = wacom->data; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1688 | |
Jason Gerecke | 2ac97f0 | 2017-04-25 11:29:56 -0700 | [diff] [blame] | 1689 | if (wacom->pen_input) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1690 | dev_dbg(wacom->pen_input->dev.parent, |
| 1691 | "%s: received report #%d\n", __func__, data[0]); |
Jason Gerecke | 2ac97f0 | 2017-04-25 11:29:56 -0700 | [diff] [blame] | 1692 | |
| 1693 | if (len == WACOM_PKGLEN_PENABLED || |
| 1694 | data[0] == WACOM_REPORT_PENABLED) |
| 1695 | return wacom_tpc_pen(wacom); |
| 1696 | } |
| 1697 | else if (wacom->touch_input) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1698 | dev_dbg(wacom->touch_input->dev.parent, |
| 1699 | "%s: received report #%d\n", __func__, data[0]); |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1700 | |
Jason Gerecke | 2ac97f0 | 2017-04-25 11:29:56 -0700 | [diff] [blame] | 1701 | switch (len) { |
| 1702 | case WACOM_PKGLEN_TPC1FG: |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1703 | return wacom_tpc_single_touch(wacom, len); |
| 1704 | |
Jason Gerecke | 2ac97f0 | 2017-04-25 11:29:56 -0700 | [diff] [blame] | 1705 | case WACOM_PKGLEN_TPC2FG: |
| 1706 | return wacom_tpc_mt_touch(wacom); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1707 | |
Jason Gerecke | 2ac97f0 | 2017-04-25 11:29:56 -0700 | [diff] [blame] | 1708 | default: |
| 1709 | switch (data[0]) { |
| 1710 | case WACOM_REPORT_TPC1FG: |
| 1711 | case WACOM_REPORT_TPCHID: |
| 1712 | case WACOM_REPORT_TPCST: |
| 1713 | case WACOM_REPORT_TPC1FGE: |
| 1714 | return wacom_tpc_single_touch(wacom, len); |
| 1715 | |
| 1716 | case WACOM_REPORT_TPCMT: |
| 1717 | case WACOM_REPORT_TPCMT2: |
| 1718 | return wacom_mt_touch(wacom); |
| 1719 | |
| 1720 | } |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1721 | } |
| 1722 | } |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1723 | |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1724 | return 0; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1725 | } |
| 1726 | |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 1727 | static int wacom_offset_rotation(struct input_dev *input, struct hid_usage *usage, |
| 1728 | int value, int num, int denom) |
| 1729 | { |
| 1730 | struct input_absinfo *abs = &input->absinfo[usage->code]; |
| 1731 | int range = (abs->maximum - abs->minimum + 1); |
| 1732 | |
| 1733 | value += num*range/denom; |
| 1734 | if (value > abs->maximum) |
| 1735 | value -= range; |
| 1736 | else if (value < abs->minimum) |
| 1737 | value += range; |
| 1738 | return value; |
| 1739 | } |
| 1740 | |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 1741 | int wacom_equivalent_usage(int usage) |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1742 | { |
| 1743 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) { |
| 1744 | int subpage = (usage & 0xFF00) << 8; |
| 1745 | int subusage = (usage & 0xFF); |
| 1746 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1747 | if (subpage == WACOM_HID_SP_PAD || |
| 1748 | subpage == WACOM_HID_SP_BUTTON || |
| 1749 | subpage == WACOM_HID_SP_DIGITIZER || |
Jason Gerecke | b5c921e | 2016-10-19 18:03:44 -0700 | [diff] [blame] | 1750 | subpage == WACOM_HID_SP_DIGITIZERINFO || |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1751 | usage == WACOM_HID_WD_SENSE || |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1752 | usage == WACOM_HID_WD_SERIALHI || |
| 1753 | usage == WACOM_HID_WD_TOOLTYPE || |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1754 | usage == WACOM_HID_WD_DISTANCE || |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1755 | usage == WACOM_HID_WD_TOUCHSTRIP || |
| 1756 | usage == WACOM_HID_WD_TOUCHSTRIP2 || |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1757 | usage == WACOM_HID_WD_TOUCHRING || |
Aaron Armstrong Skomra | b1f466a | 2018-03-06 10:48:35 -0800 | [diff] [blame] | 1758 | usage == WACOM_HID_WD_TOUCHRINGSTATUS || |
| 1759 | usage == WACOM_HID_WD_REPORT_VALID) { |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1760 | return usage; |
| 1761 | } |
| 1762 | |
| 1763 | if (subpage == HID_UP_UNDEFINED) |
| 1764 | subpage = HID_UP_DIGITIZER; |
| 1765 | |
| 1766 | return subpage | subusage; |
| 1767 | } |
| 1768 | |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 1769 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMTOUCH) { |
| 1770 | int subpage = (usage & 0xFF00) << 8; |
| 1771 | int subusage = (usage & 0xFF); |
| 1772 | |
Aaron Armstrong Skomra | f4e11d5 | 2019-06-12 14:19:30 -0700 | [diff] [blame] | 1773 | if (usage == WACOM_HID_WT_REPORT_VALID) |
| 1774 | return usage; |
| 1775 | |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 1776 | if (subpage == HID_UP_UNDEFINED) |
| 1777 | subpage = WACOM_HID_SP_DIGITIZER; |
| 1778 | |
| 1779 | return subpage | subusage; |
| 1780 | } |
| 1781 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1782 | return usage; |
| 1783 | } |
| 1784 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1785 | static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1786 | struct hid_field *field, __u8 type, __u16 code, int fuzz) |
| 1787 | { |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1788 | struct wacom *wacom = input_get_drvdata(input); |
| 1789 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1790 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1791 | int fmin = field->logical_minimum; |
| 1792 | int fmax = field->logical_maximum; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1793 | unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1794 | int resolution_code = code; |
| 1795 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1796 | if (equivalent_usage == HID_DG_TWIST) { |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1797 | resolution_code = ABS_RZ; |
| 1798 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1799 | |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1800 | if (equivalent_usage == HID_GD_X) { |
| 1801 | fmin += features->offset_left; |
| 1802 | fmax -= features->offset_right; |
| 1803 | } |
| 1804 | if (equivalent_usage == HID_GD_Y) { |
| 1805 | fmin += features->offset_top; |
| 1806 | fmax -= features->offset_bottom; |
| 1807 | } |
| 1808 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1809 | usage->type = type; |
| 1810 | usage->code = code; |
| 1811 | |
| 1812 | set_bit(type, input->evbit); |
| 1813 | |
| 1814 | switch (type) { |
| 1815 | case EV_ABS: |
| 1816 | input_set_abs_params(input, code, fmin, fmax, fuzz, 0); |
| 1817 | input_abs_set_res(input, code, |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1818 | hidinput_calc_abs_res(field, resolution_code)); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1819 | break; |
| 1820 | case EV_KEY: |
| 1821 | input_set_capability(input, EV_KEY, code); |
| 1822 | break; |
| 1823 | case EV_MSC: |
| 1824 | input_set_capability(input, EV_MSC, code); |
| 1825 | break; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1826 | case EV_SW: |
| 1827 | input_set_capability(input, EV_SW, code); |
| 1828 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1829 | } |
| 1830 | } |
| 1831 | |
Jason Gerecke | 5ac3d4a | 2017-04-28 09:25:34 -0700 | [diff] [blame] | 1832 | static void wacom_wac_battery_usage_mapping(struct hid_device *hdev, |
| 1833 | struct hid_field *field, struct hid_usage *usage) |
| 1834 | { |
| 1835 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1836 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1837 | struct wacom_features *features = &wacom_wac->features; |
| 1838 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1839 | |
| 1840 | switch (equivalent_usage) { |
| 1841 | case HID_DG_BATTERYSTRENGTH: |
| 1842 | case WACOM_HID_WD_BATTERY_LEVEL: |
| 1843 | case WACOM_HID_WD_BATTERY_CHARGING: |
| 1844 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 1845 | break; |
| 1846 | } |
| 1847 | } |
| 1848 | |
| 1849 | static void wacom_wac_battery_event(struct hid_device *hdev, struct hid_field *field, |
| 1850 | struct hid_usage *usage, __s32 value) |
| 1851 | { |
| 1852 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1853 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1854 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1855 | |
| 1856 | switch (equivalent_usage) { |
| 1857 | case HID_DG_BATTERYSTRENGTH: |
| 1858 | if (value == 0) { |
| 1859 | wacom_wac->hid_data.bat_status = POWER_SUPPLY_STATUS_UNKNOWN; |
| 1860 | } |
| 1861 | else { |
| 1862 | value = value * 100 / (field->logical_maximum - field->logical_minimum); |
| 1863 | wacom_wac->hid_data.battery_capacity = value; |
| 1864 | wacom_wac->hid_data.bat_connected = 1; |
| 1865 | wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; |
| 1866 | } |
| 1867 | break; |
| 1868 | case WACOM_HID_WD_BATTERY_LEVEL: |
| 1869 | value = value * 100 / (field->logical_maximum - field->logical_minimum); |
| 1870 | wacom_wac->hid_data.battery_capacity = value; |
| 1871 | wacom_wac->hid_data.bat_connected = 1; |
| 1872 | wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; |
| 1873 | break; |
| 1874 | case WACOM_HID_WD_BATTERY_CHARGING: |
| 1875 | wacom_wac->hid_data.bat_charging = value; |
| 1876 | wacom_wac->hid_data.ps_connected = value; |
| 1877 | wacom_wac->hid_data.bat_connected = 1; |
| 1878 | wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; |
| 1879 | break; |
| 1880 | } |
| 1881 | } |
| 1882 | |
| 1883 | static void wacom_wac_battery_pre_report(struct hid_device *hdev, |
| 1884 | struct hid_report *report) |
| 1885 | { |
| 1886 | return; |
| 1887 | } |
| 1888 | |
| 1889 | static void wacom_wac_battery_report(struct hid_device *hdev, |
| 1890 | struct hid_report *report) |
| 1891 | { |
| 1892 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1893 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1894 | struct wacom_features *features = &wacom_wac->features; |
| 1895 | |
| 1896 | if (features->quirks & WACOM_QUIRK_BATTERY) { |
| 1897 | int status = wacom_wac->hid_data.bat_status; |
| 1898 | int capacity = wacom_wac->hid_data.battery_capacity; |
| 1899 | bool charging = wacom_wac->hid_data.bat_charging; |
| 1900 | bool connected = wacom_wac->hid_data.bat_connected; |
| 1901 | bool powered = wacom_wac->hid_data.ps_connected; |
| 1902 | |
| 1903 | wacom_notify_battery(wacom_wac, status, capacity, charging, |
| 1904 | connected, powered); |
| 1905 | } |
| 1906 | } |
| 1907 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1908 | static void wacom_wac_pad_usage_mapping(struct hid_device *hdev, |
| 1909 | struct hid_field *field, struct hid_usage *usage) |
| 1910 | { |
| 1911 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1912 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1913 | struct wacom_features *features = &wacom_wac->features; |
| 1914 | struct input_dev *input = wacom_wac->pad_input; |
| 1915 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1916 | |
| 1917 | switch (equivalent_usage) { |
| 1918 | case WACOM_HID_WD_ACCELEROMETER_X: |
| 1919 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1920 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1921 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1922 | break; |
| 1923 | case WACOM_HID_WD_ACCELEROMETER_Y: |
| 1924 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1925 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1926 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1927 | break; |
| 1928 | case WACOM_HID_WD_ACCELEROMETER_Z: |
| 1929 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1930 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1931 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1932 | break; |
Aaron Armstrong Skomra | 10c55ca | 2017-01-25 12:08:42 -0800 | [diff] [blame] | 1933 | case WACOM_HID_WD_BUTTONCENTER: |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1934 | case WACOM_HID_WD_BUTTONHOME: |
| 1935 | case WACOM_HID_WD_BUTTONUP: |
| 1936 | case WACOM_HID_WD_BUTTONDOWN: |
| 1937 | case WACOM_HID_WD_BUTTONLEFT: |
| 1938 | case WACOM_HID_WD_BUTTONRIGHT: |
| 1939 | wacom_map_usage(input, usage, field, EV_KEY, |
| 1940 | wacom_numbered_button_to_key(features->numbered_buttons), |
| 1941 | 0); |
| 1942 | features->numbered_buttons++; |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1943 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1944 | break; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1945 | case WACOM_HID_WD_TOUCHONOFF: |
Ping Cheng | d793ff8 | 2017-02-14 21:27:45 -0800 | [diff] [blame] | 1946 | case WACOM_HID_WD_MUTE_DEVICE: |
Aaron Armstrong Skomra | d2ec58a | 2017-01-25 12:08:41 -0800 | [diff] [blame] | 1947 | /* |
| 1948 | * This usage, which is used to mute touch events, comes |
| 1949 | * from the pad packet, but is reported on the touch |
| 1950 | * interface. Because the touch interface may not have |
| 1951 | * been created yet, we cannot call wacom_map_usage(). In |
| 1952 | * order to process this usage when we receive it, we set |
| 1953 | * the usage type and code directly. |
| 1954 | */ |
| 1955 | wacom_wac->has_mute_touch_switch = true; |
| 1956 | usage->type = EV_SW; |
| 1957 | usage->code = SW_MUTE_DEVICE; |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1958 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1959 | break; |
| 1960 | case WACOM_HID_WD_TOUCHSTRIP: |
| 1961 | wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1962 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1963 | break; |
| 1964 | case WACOM_HID_WD_TOUCHSTRIP2: |
| 1965 | wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1966 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1967 | break; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1968 | case WACOM_HID_WD_TOUCHRING: |
| 1969 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1970 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1971 | break; |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 1972 | case WACOM_HID_WD_TOUCHRINGSTATUS: |
Jason Gerecke | 8d411cb | 2017-08-04 15:35:14 -0700 | [diff] [blame] | 1973 | /* |
| 1974 | * Only set up type/code association. Completely mapping |
| 1975 | * this usage may overwrite the axis resolution and range. |
| 1976 | */ |
| 1977 | usage->type = EV_ABS; |
| 1978 | usage->code = ABS_WHEEL; |
| 1979 | set_bit(EV_ABS, input->evbit); |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 1980 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 1981 | break; |
Ping Cheng | 4eb220c | 2017-02-14 21:26:21 -0800 | [diff] [blame] | 1982 | case WACOM_HID_WD_BUTTONCONFIG: |
| 1983 | wacom_map_usage(input, usage, field, EV_KEY, KEY_BUTTONCONFIG, 0); |
| 1984 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 1985 | break; |
| 1986 | case WACOM_HID_WD_ONSCREEN_KEYBOARD: |
| 1987 | wacom_map_usage(input, usage, field, EV_KEY, KEY_ONSCREEN_KEYBOARD, 0); |
| 1988 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 1989 | break; |
| 1990 | case WACOM_HID_WD_CONTROLPANEL: |
| 1991 | wacom_map_usage(input, usage, field, EV_KEY, KEY_CONTROLPANEL, 0); |
| 1992 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 1993 | break; |
Benjamin Tissoires | 4082da8 | 2017-02-14 21:27:18 -0800 | [diff] [blame] | 1994 | case WACOM_HID_WD_MODE_CHANGE: |
| 1995 | /* do not overwrite previous data */ |
| 1996 | if (!wacom_wac->has_mode_change) { |
| 1997 | wacom_wac->has_mode_change = true; |
| 1998 | wacom_wac->is_direct_mode = true; |
| 1999 | } |
| 2000 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2001 | break; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2002 | } |
| 2003 | |
| 2004 | switch (equivalent_usage & 0xfffffff0) { |
| 2005 | case WACOM_HID_WD_EXPRESSKEY00: |
| 2006 | wacom_map_usage(input, usage, field, EV_KEY, |
| 2007 | wacom_numbered_button_to_key(features->numbered_buttons), |
| 2008 | 0); |
| 2009 | features->numbered_buttons++; |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 2010 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2011 | break; |
| 2012 | } |
| 2013 | } |
| 2014 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2015 | static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field, |
| 2016 | struct hid_usage *usage, __s32 value) |
| 2017 | { |
| 2018 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2019 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2020 | struct input_dev *input = wacom_wac->pad_input; |
| 2021 | struct wacom_features *features = &wacom_wac->features; |
| 2022 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Aaron Armstrong Skomra | 10c55ca | 2017-01-25 12:08:42 -0800 | [diff] [blame] | 2023 | int i; |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2024 | bool do_report = false; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2025 | |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 2026 | /* |
| 2027 | * Avoid reporting this event and setting inrange_state if this usage |
| 2028 | * hasn't been mapped. |
| 2029 | */ |
Benjamin Tissoires | 4082da8 | 2017-02-14 21:27:18 -0800 | [diff] [blame] | 2030 | if (!usage->type && equivalent_usage != WACOM_HID_WD_MODE_CHANGE) |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 2031 | return; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2032 | |
| 2033 | if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 2034 | if (usage->hid != WACOM_HID_WD_TOUCHRING) |
| 2035 | wacom_wac->hid_data.inrange_state |= value; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2036 | } |
| 2037 | |
| 2038 | switch (equivalent_usage) { |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2039 | case WACOM_HID_WD_TOUCHRING: |
| 2040 | /* |
| 2041 | * Userspace expects touchrings to increase in value with |
| 2042 | * clockwise gestures and have their zero point at the |
| 2043 | * tablet's left. HID events "should" be clockwise- |
| 2044 | * increasing and zero at top, though the MobileStudio |
| 2045 | * Pro and 2nd-gen Intuos Pro don't do this... |
| 2046 | */ |
| 2047 | if (hdev->vendor == 0x56a && |
| 2048 | (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ |
Ping Cheng | 384225c | 2019-06-23 16:52:43 -0700 | [diff] [blame] | 2049 | hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ |
Aaron Armstrong Skomra | 6e2abc6 | 2019-06-26 15:48:48 -0700 | [diff] [blame] | 2050 | hdev->product == 0x392 || /* Intuos Pro 2 */ |
Ping Cheng | 384225c | 2019-06-23 16:52:43 -0700 | [diff] [blame] | 2051 | hdev->product == 0x399)) { /* MobileStudio Pro */ |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2052 | value = (field->logical_maximum - value); |
| 2053 | |
Aaron Armstrong Skomra | 6e2abc6 | 2019-06-26 15:48:48 -0700 | [diff] [blame] | 2054 | if (hdev->product == 0x357 || hdev->product == 0x358 || |
| 2055 | hdev->product == 0x392) |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2056 | value = wacom_offset_rotation(input, usage, value, 3, 16); |
Ping Cheng | 384225c | 2019-06-23 16:52:43 -0700 | [diff] [blame] | 2057 | else if (hdev->product == 0x34d || hdev->product == 0x34e || |
| 2058 | hdev->product == 0x399) |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2059 | value = wacom_offset_rotation(input, usage, value, 1, 2); |
| 2060 | } |
| 2061 | else { |
| 2062 | value = wacom_offset_rotation(input, usage, value, 1, 4); |
| 2063 | } |
| 2064 | do_report = true; |
| 2065 | break; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 2066 | case WACOM_HID_WD_TOUCHRINGSTATUS: |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 2067 | if (!value) |
| 2068 | input_event(input, usage->type, usage->code, 0); |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2069 | break; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 2070 | |
Ping Cheng | d793ff8 | 2017-02-14 21:27:45 -0800 | [diff] [blame] | 2071 | case WACOM_HID_WD_MUTE_DEVICE: |
Aaron Armstrong Skomra | d2ec58a | 2017-01-25 12:08:41 -0800 | [diff] [blame] | 2072 | case WACOM_HID_WD_TOUCHONOFF: |
| 2073 | if (wacom_wac->shared->touch_input) { |
Jason Gerecke | 403c0f6 | 2017-12-26 14:53:55 -0800 | [diff] [blame] | 2074 | bool *is_touch_on = &wacom_wac->shared->is_touch_on; |
| 2075 | |
| 2076 | if (equivalent_usage == WACOM_HID_WD_MUTE_DEVICE && value) |
| 2077 | *is_touch_on = !(*is_touch_on); |
| 2078 | else if (equivalent_usage == WACOM_HID_WD_TOUCHONOFF) |
| 2079 | *is_touch_on = value; |
| 2080 | |
Aaron Armstrong Skomra | d2ec58a | 2017-01-25 12:08:41 -0800 | [diff] [blame] | 2081 | input_report_switch(wacom_wac->shared->touch_input, |
Jason Gerecke | 403c0f6 | 2017-12-26 14:53:55 -0800 | [diff] [blame] | 2082 | SW_MUTE_DEVICE, !(*is_touch_on)); |
Aaron Armstrong Skomra | d2ec58a | 2017-01-25 12:08:41 -0800 | [diff] [blame] | 2083 | input_sync(wacom_wac->shared->touch_input); |
| 2084 | } |
| 2085 | break; |
Aaron Armstrong Skomra | 10c55ca | 2017-01-25 12:08:42 -0800 | [diff] [blame] | 2086 | |
Benjamin Tissoires | 4082da8 | 2017-02-14 21:27:18 -0800 | [diff] [blame] | 2087 | case WACOM_HID_WD_MODE_CHANGE: |
| 2088 | if (wacom_wac->is_direct_mode != value) { |
| 2089 | wacom_wac->is_direct_mode = value; |
| 2090 | wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE); |
| 2091 | } |
| 2092 | break; |
| 2093 | |
Aaron Armstrong Skomra | 10c55ca | 2017-01-25 12:08:42 -0800 | [diff] [blame] | 2094 | case WACOM_HID_WD_BUTTONCENTER: |
| 2095 | for (i = 0; i < wacom->led.count; i++) |
| 2096 | wacom_update_led(wacom, features->numbered_buttons, |
| 2097 | value, i); |
| 2098 | /* fall through*/ |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 2099 | default: |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2100 | do_report = true; |
| 2101 | break; |
| 2102 | } |
| 2103 | |
| 2104 | if (do_report) { |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2105 | input_event(input, usage->type, usage->code, value); |
Ping Cheng | ed1fa73 | 2017-04-04 12:31:07 -0700 | [diff] [blame] | 2106 | if (value) |
| 2107 | wacom_wac->hid_data.pad_input_event_flag = true; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 2108 | } |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2109 | } |
| 2110 | |
| 2111 | static void wacom_wac_pad_pre_report(struct hid_device *hdev, |
| 2112 | struct hid_report *report) |
| 2113 | { |
| 2114 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2115 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2116 | |
| 2117 | wacom_wac->hid_data.inrange_state = 0; |
| 2118 | } |
| 2119 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2120 | static void wacom_wac_pad_report(struct hid_device *hdev, |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2121 | struct hid_report *report, struct hid_field *field) |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2122 | { |
| 2123 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2124 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2125 | struct input_dev *input = wacom_wac->pad_input; |
| 2126 | bool active = wacom_wac->hid_data.inrange_state != 0; |
| 2127 | |
| 2128 | /* report prox for expresskey events */ |
Aaron Armstrong Skomra | d4b8efe | 2019-05-10 15:34:17 -0700 | [diff] [blame] | 2129 | if (wacom_wac->hid_data.pad_input_event_flag) { |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2130 | input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2131 | input_sync(input); |
Ping Cheng | ed1fa73 | 2017-04-04 12:31:07 -0700 | [diff] [blame] | 2132 | if (!active) |
| 2133 | wacom_wac->hid_data.pad_input_event_flag = false; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2134 | } |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2135 | } |
| 2136 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2137 | static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, |
| 2138 | struct hid_field *field, struct hid_usage *usage) |
| 2139 | { |
| 2140 | struct wacom *wacom = hid_get_drvdata(hdev); |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2141 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2142 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2143 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2144 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2145 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2146 | switch (equivalent_usage) { |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2147 | case HID_GD_X: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2148 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2149 | break; |
| 2150 | case HID_GD_Y: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2151 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2152 | break; |
Jason Gerecke | b5c921e | 2016-10-19 18:03:44 -0700 | [diff] [blame] | 2153 | case WACOM_HID_WD_DISTANCE: |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 2154 | case HID_GD_Z: |
| 2155 | wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); |
| 2156 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2157 | case HID_DG_TIPPRESSURE: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2158 | wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2159 | break; |
| 2160 | case HID_DG_INRANGE: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2161 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2162 | break; |
| 2163 | case HID_DG_INVERT: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2164 | wacom_map_usage(input, usage, field, EV_KEY, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2165 | BTN_TOOL_RUBBER, 0); |
| 2166 | break; |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 2167 | case HID_DG_TILT_X: |
| 2168 | wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); |
| 2169 | break; |
| 2170 | case HID_DG_TILT_Y: |
| 2171 | wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); |
| 2172 | break; |
| 2173 | case HID_DG_TWIST: |
| 2174 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); |
| 2175 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2176 | case HID_DG_ERASER: |
| 2177 | case HID_DG_TIPSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2178 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2179 | break; |
| 2180 | case HID_DG_BARRELSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2181 | wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2182 | break; |
| 2183 | case HID_DG_BARRELSWITCH2: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2184 | wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2185 | break; |
| 2186 | case HID_DG_TOOLSERIALNUMBER: |
Jason Gerecke | 8341720 | 2017-11-10 11:50:01 -0800 | [diff] [blame] | 2187 | features->quirks |= WACOM_QUIRK_TOOLSERIAL; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2188 | wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2189 | break; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2190 | case WACOM_HID_WD_SENSE: |
| 2191 | features->quirks |= WACOM_QUIRK_SENSE; |
| 2192 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); |
| 2193 | break; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2194 | case WACOM_HID_WD_SERIALHI: |
| 2195 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); |
Jason Gerecke | 99aceda | 2017-11-10 11:50:00 -0800 | [diff] [blame] | 2196 | |
| 2197 | if (!(features->quirks & WACOM_QUIRK_AESPEN)) { |
| 2198 | set_bit(EV_KEY, input->evbit); |
| 2199 | input_set_capability(input, EV_KEY, BTN_TOOL_PEN); |
| 2200 | input_set_capability(input, EV_KEY, BTN_TOOL_RUBBER); |
| 2201 | input_set_capability(input, EV_KEY, BTN_TOOL_BRUSH); |
| 2202 | input_set_capability(input, EV_KEY, BTN_TOOL_PENCIL); |
| 2203 | input_set_capability(input, EV_KEY, BTN_TOOL_AIRBRUSH); |
| 2204 | if (!(features->device_type & WACOM_DEVICETYPE_DIRECT)) { |
| 2205 | input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE); |
| 2206 | input_set_capability(input, EV_KEY, BTN_TOOL_LENS); |
| 2207 | } |
Ping Cheng | 6e5364f | 2017-03-14 17:08:16 -0700 | [diff] [blame] | 2208 | } |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2209 | break; |
Jason Gerecke | 929d6d5 | 2016-10-19 18:03:45 -0700 | [diff] [blame] | 2210 | case WACOM_HID_WD_FINGERWHEEL: |
| 2211 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
| 2212 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2213 | } |
| 2214 | } |
| 2215 | |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2216 | static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2217 | struct hid_usage *usage, __s32 value) |
| 2218 | { |
| 2219 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2220 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2221 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2222 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2223 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2224 | |
Aaron Armstrong Skomra | b1f466a | 2018-03-06 10:48:35 -0800 | [diff] [blame] | 2225 | if (wacom_wac->is_invalid_bt_frame) |
| 2226 | return; |
| 2227 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2228 | switch (equivalent_usage) { |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 2229 | case HID_GD_Z: |
| 2230 | /* |
| 2231 | * HID_GD_Z "should increase as the control's position is |
| 2232 | * moved from high to low", while ABS_DISTANCE instead |
| 2233 | * increases in value as the tool moves from low to high. |
| 2234 | */ |
| 2235 | value = field->logical_maximum - value; |
| 2236 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2237 | case HID_DG_INRANGE: |
| 2238 | wacom_wac->hid_data.inrange_state = value; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2239 | if (!(features->quirks & WACOM_QUIRK_SENSE)) |
| 2240 | wacom_wac->hid_data.sense_state = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2241 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2242 | case HID_DG_INVERT: |
| 2243 | wacom_wac->hid_data.invert_state = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2244 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2245 | case HID_DG_ERASER: |
| 2246 | case HID_DG_TIPSWITCH: |
| 2247 | wacom_wac->hid_data.tipswitch |= value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2248 | return; |
Jason Gerecke | 9e429d5 | 2017-11-07 08:25:17 -0800 | [diff] [blame] | 2249 | case HID_DG_BARRELSWITCH: |
| 2250 | wacom_wac->hid_data.barrelswitch = value; |
| 2251 | return; |
| 2252 | case HID_DG_BARRELSWITCH2: |
| 2253 | wacom_wac->hid_data.barrelswitch2 = value; |
| 2254 | return; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2255 | case HID_DG_TOOLSERIALNUMBER: |
Jason Gerecke | 993f0d9 | 2017-09-07 17:44:12 -0700 | [diff] [blame] | 2256 | if (value) { |
| 2257 | wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); |
| 2258 | wacom_wac->serial[0] |= (__u32)value; |
| 2259 | } |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2260 | return; |
Jason Gerecke | d252f4a | 2017-08-30 15:13:26 -0700 | [diff] [blame] | 2261 | case HID_DG_TWIST: |
| 2262 | /* |
| 2263 | * Userspace expects pen twist to have its zero point when |
| 2264 | * the buttons/finger is on the tablet's left. HID values |
| 2265 | * are zero when buttons are toward the top. |
| 2266 | */ |
| 2267 | value = wacom_offset_rotation(input, usage, value, 1, 4); |
| 2268 | break; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2269 | case WACOM_HID_WD_SENSE: |
| 2270 | wacom_wac->hid_data.sense_state = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2271 | return; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2272 | case WACOM_HID_WD_SERIALHI: |
Jason Gerecke | 993f0d9 | 2017-09-07 17:44:12 -0700 | [diff] [blame] | 2273 | if (value) { |
| 2274 | wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); |
| 2275 | wacom_wac->serial[0] |= ((__u64)value) << 32; |
| 2276 | /* |
| 2277 | * Non-USI EMR devices may contain additional tool type |
| 2278 | * information here. See WACOM_HID_WD_TOOLTYPE case for |
| 2279 | * more details. |
| 2280 | */ |
| 2281 | if (value >> 20 == 1) { |
| 2282 | wacom_wac->id[0] |= value & 0xFFFFF; |
| 2283 | } |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2284 | } |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2285 | return; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2286 | case WACOM_HID_WD_TOOLTYPE: |
| 2287 | /* |
| 2288 | * Some devices (MobileStudio Pro, and possibly later |
| 2289 | * devices as well) do not return the complete tool |
| 2290 | * type in their WACOM_HID_WD_TOOLTYPE usage. Use a |
| 2291 | * bitwise OR so the complete value can be built |
| 2292 | * up over time :( |
| 2293 | */ |
| 2294 | wacom_wac->id[0] |= value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2295 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2296 | case WACOM_HID_WD_OFFSETLEFT: |
| 2297 | if (features->offset_left && value != features->offset_left) |
Colin Ian King | 75a5f3a | 2017-06-26 20:35:38 +0100 | [diff] [blame] | 2298 | hid_warn(hdev, "%s: overriding existing left offset " |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2299 | "%d -> %d\n", __func__, value, |
| 2300 | features->offset_left); |
| 2301 | features->offset_left = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2302 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2303 | case WACOM_HID_WD_OFFSETRIGHT: |
| 2304 | if (features->offset_right && value != features->offset_right) |
Colin Ian King | 75a5f3a | 2017-06-26 20:35:38 +0100 | [diff] [blame] | 2305 | hid_warn(hdev, "%s: overriding existing right offset " |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2306 | "%d -> %d\n", __func__, value, |
| 2307 | features->offset_right); |
| 2308 | features->offset_right = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2309 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2310 | case WACOM_HID_WD_OFFSETTOP: |
| 2311 | if (features->offset_top && value != features->offset_top) |
Colin Ian King | 75a5f3a | 2017-06-26 20:35:38 +0100 | [diff] [blame] | 2312 | hid_warn(hdev, "%s: overriding existing top offset " |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2313 | "%d -> %d\n", __func__, value, |
| 2314 | features->offset_top); |
| 2315 | features->offset_top = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2316 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2317 | case WACOM_HID_WD_OFFSETBOTTOM: |
| 2318 | if (features->offset_bottom && value != features->offset_bottom) |
Colin Ian King | 75a5f3a | 2017-06-26 20:35:38 +0100 | [diff] [blame] | 2319 | hid_warn(hdev, "%s: overriding existing bottom offset " |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 2320 | "%d -> %d\n", __func__, value, |
| 2321 | features->offset_bottom); |
| 2322 | features->offset_bottom = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2323 | return; |
Aaron Armstrong Skomra | b1f466a | 2018-03-06 10:48:35 -0800 | [diff] [blame] | 2324 | case WACOM_HID_WD_REPORT_VALID: |
| 2325 | wacom_wac->is_invalid_bt_frame = !value; |
| 2326 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2327 | } |
| 2328 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2329 | /* send pen events only when touch is up or forced out |
| 2330 | * or touch arbitration is off |
| 2331 | */ |
| 2332 | if (!usage->type || delay_pen_events(wacom_wac)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2333 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2334 | |
Jason Gerecke | 4affc23 | 2017-09-07 17:49:50 -0700 | [diff] [blame] | 2335 | /* send pen events only when the pen is in range */ |
Jason Gerecke | 5b40104 | 2017-09-07 17:52:15 -0700 | [diff] [blame] | 2336 | if (wacom_wac->hid_data.inrange_state) |
| 2337 | input_event(input, usage->type, usage->code, value); |
| 2338 | else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) |
| 2339 | input_event(input, usage->type, usage->code, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2340 | } |
| 2341 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2342 | static void wacom_wac_pen_pre_report(struct hid_device *hdev, |
| 2343 | struct hid_report *report) |
| 2344 | { |
Aaron Armstrong Skomra | b1f466a | 2018-03-06 10:48:35 -0800 | [diff] [blame] | 2345 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2346 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2347 | |
| 2348 | wacom_wac->is_invalid_bt_frame = false; |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2349 | return; |
| 2350 | } |
| 2351 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2352 | static void wacom_wac_pen_report(struct hid_device *hdev, |
| 2353 | struct hid_report *report) |
| 2354 | { |
| 2355 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2356 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2357 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | 7690dd1 | 2017-09-07 17:48:55 -0700 | [diff] [blame] | 2358 | bool range = wacom_wac->hid_data.inrange_state; |
| 2359 | bool sense = wacom_wac->hid_data.sense_state; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2360 | |
Aaron Armstrong Skomra | b1f466a | 2018-03-06 10:48:35 -0800 | [diff] [blame] | 2361 | if (wacom_wac->is_invalid_bt_frame) |
| 2362 | return; |
| 2363 | |
Jason Gerecke | 7690dd1 | 2017-09-07 17:48:55 -0700 | [diff] [blame] | 2364 | if (!wacom_wac->tool[0] && range) { /* first in range */ |
| 2365 | /* Going into range select tool */ |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2366 | if (wacom_wac->hid_data.invert_state) |
| 2367 | wacom_wac->tool[0] = BTN_TOOL_RUBBER; |
| 2368 | else if (wacom_wac->id[0]) |
| 2369 | wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); |
| 2370 | else |
| 2371 | wacom_wac->tool[0] = BTN_TOOL_PEN; |
| 2372 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2373 | |
| 2374 | /* keep pen state for touch events */ |
Jason Gerecke | 7690dd1 | 2017-09-07 17:48:55 -0700 | [diff] [blame] | 2375 | wacom_wac->shared->stylus_in_proximity = sense; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2376 | |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2377 | if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2378 | int id = wacom_wac->id[0]; |
Jason Gerecke | 9e429d5 | 2017-11-07 08:25:17 -0800 | [diff] [blame] | 2379 | int sw_state = wacom_wac->hid_data.barrelswitch | |
| 2380 | (wacom_wac->hid_data.barrelswitch2 << 1); |
| 2381 | |
| 2382 | input_report_key(input, BTN_STYLUS, sw_state == 1); |
| 2383 | input_report_key(input, BTN_STYLUS2, sw_state == 2); |
| 2384 | input_report_key(input, BTN_STYLUS3, sw_state == 3); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2385 | |
| 2386 | /* |
| 2387 | * Non-USI EMR tools should have their IDs mangled to |
| 2388 | * match the legacy behavior of wacom_intuos_general |
| 2389 | */ |
| 2390 | if (wacom_wac->serial[0] >> 52 == 1) |
| 2391 | id = wacom_intuos_id_mangle(id); |
| 2392 | |
| 2393 | /* |
| 2394 | * To ensure compatibility with xf86-input-wacom, we should |
| 2395 | * report the BTN_TOOL_* event prior to the ABS_MISC or |
| 2396 | * MSC_SERIAL events. |
| 2397 | */ |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2398 | input_report_key(input, BTN_TOUCH, |
| 2399 | wacom_wac->hid_data.tipswitch); |
Jason Gerecke | 4affc23 | 2017-09-07 17:49:50 -0700 | [diff] [blame] | 2400 | input_report_key(input, wacom_wac->tool[0], sense); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2401 | if (wacom_wac->serial[0]) { |
| 2402 | input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); |
Jason Gerecke | 4affc23 | 2017-09-07 17:49:50 -0700 | [diff] [blame] | 2403 | input_report_abs(input, ABS_MISC, sense ? id : 0); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2404 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2405 | |
| 2406 | wacom_wac->hid_data.tipswitch = false; |
| 2407 | |
| 2408 | input_sync(input); |
| 2409 | } |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2410 | |
Jason Gerecke | 4affc23 | 2017-09-07 17:49:50 -0700 | [diff] [blame] | 2411 | if (!sense) { |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2412 | wacom_wac->tool[0] = 0; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2413 | wacom_wac->id[0] = 0; |
Jason Gerecke | 993f0d9 | 2017-09-07 17:44:12 -0700 | [diff] [blame] | 2414 | wacom_wac->serial[0] = 0; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2415 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2416 | } |
| 2417 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2418 | static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, |
| 2419 | struct hid_field *field, struct hid_usage *usage) |
| 2420 | { |
| 2421 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2422 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2423 | struct input_dev *input = wacom_wac->touch_input; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2424 | unsigned touch_max = wacom_wac->features.touch_max; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2425 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2426 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2427 | switch (equivalent_usage) { |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2428 | case HID_GD_X: |
| 2429 | if (touch_max == 1) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2430 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2431 | else |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2432 | wacom_map_usage(input, usage, field, EV_ABS, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2433 | ABS_MT_POSITION_X, 4); |
| 2434 | break; |
| 2435 | case HID_GD_Y: |
| 2436 | if (touch_max == 1) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2437 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2438 | else |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2439 | wacom_map_usage(input, usage, field, EV_ABS, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2440 | ABS_MT_POSITION_Y, 4); |
| 2441 | break; |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2442 | case HID_DG_WIDTH: |
| 2443 | case HID_DG_HEIGHT: |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2444 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); |
| 2445 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); |
| 2446 | input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); |
| 2447 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2448 | case HID_DG_TIPSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2449 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2450 | break; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2451 | case HID_DG_CONTACTCOUNT: |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2452 | wacom_wac->hid_data.cc_report = field->report->id; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2453 | wacom_wac->hid_data.cc_index = field->index; |
| 2454 | wacom_wac->hid_data.cc_value_index = usage->usage_index; |
| 2455 | break; |
Jason Gerecke | 6f107fa | 2017-04-19 14:47:24 -0700 | [diff] [blame] | 2456 | case HID_DG_CONTACTID: |
| 2457 | if ((field->logical_maximum - field->logical_minimum) < touch_max) { |
| 2458 | /* |
| 2459 | * The HID descriptor for G11 sensors leaves logical |
| 2460 | * maximum set to '1' despite it being a multitouch |
| 2461 | * device. Override to a sensible number. |
| 2462 | */ |
| 2463 | field->logical_maximum = 255; |
| 2464 | } |
| 2465 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2466 | } |
| 2467 | } |
| 2468 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2469 | static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, |
| 2470 | struct input_dev *input) |
| 2471 | { |
| 2472 | struct hid_data *hid_data = &wacom_wac->hid_data; |
| 2473 | bool mt = wacom_wac->features.touch_max > 1; |
| 2474 | bool prox = hid_data->tipswitch && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2475 | report_touch_events(wacom_wac); |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2476 | |
Ping Cheng | d793ff8 | 2017-02-14 21:27:45 -0800 | [diff] [blame] | 2477 | if (wacom_wac->shared->has_mute_touch_switch && |
| 2478 | !wacom_wac->shared->is_touch_on) { |
| 2479 | if (!wacom_wac->shared->touch_down) |
| 2480 | return; |
| 2481 | prox = 0; |
| 2482 | } |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2483 | |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2484 | wacom_wac->hid_data.num_received++; |
| 2485 | if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) |
| 2486 | return; |
| 2487 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2488 | if (mt) { |
| 2489 | int slot; |
| 2490 | |
| 2491 | slot = input_mt_get_slot_by_key(input, hid_data->id); |
| 2492 | input_mt_slot(input, slot); |
| 2493 | input_mt_report_slot_state(input, MT_TOOL_FINGER, prox); |
| 2494 | } |
| 2495 | else { |
| 2496 | input_report_key(input, BTN_TOUCH, prox); |
| 2497 | } |
| 2498 | |
| 2499 | if (prox) { |
| 2500 | input_report_abs(input, mt ? ABS_MT_POSITION_X : ABS_X, |
| 2501 | hid_data->x); |
| 2502 | input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, |
| 2503 | hid_data->y); |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2504 | |
| 2505 | if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { |
| 2506 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); |
| 2507 | input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); |
| 2508 | if (hid_data->width != hid_data->height) |
| 2509 | input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); |
| 2510 | } |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2511 | } |
| 2512 | } |
| 2513 | |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2514 | static void wacom_wac_finger_event(struct hid_device *hdev, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2515 | struct hid_field *field, struct hid_usage *usage, __s32 value) |
| 2516 | { |
| 2517 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2518 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2519 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Aaron Armstrong Skomra | 184eccd | 2019-06-12 14:19:29 -0700 | [diff] [blame] | 2520 | struct wacom_features *features = &wacom->wacom_wac.features; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2521 | |
Aaron Armstrong Skomra | f4e11d5 | 2019-06-12 14:19:30 -0700 | [diff] [blame] | 2522 | if (wacom_wac->is_invalid_bt_frame) |
| 2523 | return; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2524 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2525 | switch (equivalent_usage) { |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2526 | case HID_GD_X: |
| 2527 | wacom_wac->hid_data.x = value; |
| 2528 | break; |
| 2529 | case HID_GD_Y: |
| 2530 | wacom_wac->hid_data.y = value; |
| 2531 | break; |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2532 | case HID_DG_WIDTH: |
| 2533 | wacom_wac->hid_data.width = value; |
| 2534 | break; |
| 2535 | case HID_DG_HEIGHT: |
| 2536 | wacom_wac->hid_data.height = value; |
| 2537 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2538 | case HID_DG_CONTACTID: |
| 2539 | wacom_wac->hid_data.id = value; |
| 2540 | break; |
| 2541 | case HID_DG_TIPSWITCH: |
| 2542 | wacom_wac->hid_data.tipswitch = value; |
| 2543 | break; |
Aaron Armstrong Skomra | f4e11d5 | 2019-06-12 14:19:30 -0700 | [diff] [blame] | 2544 | case WACOM_HID_WT_REPORT_VALID: |
| 2545 | wacom_wac->is_invalid_bt_frame = !value; |
| 2546 | return; |
Aaron Armstrong Skomra | 184eccd | 2019-06-12 14:19:29 -0700 | [diff] [blame] | 2547 | case HID_DG_CONTACTMAX: |
| 2548 | features->touch_max = value; |
| 2549 | return; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2550 | } |
| 2551 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2552 | if (usage->usage_index + 1 == field->report_count) { |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2553 | if (equivalent_usage == wacom_wac->hid_data.last_slot_field) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2554 | wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2555 | } |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2556 | } |
| 2557 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2558 | static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
| 2559 | struct hid_report *report) |
| 2560 | { |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2561 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2562 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2563 | struct hid_data* hid_data = &wacom_wac->hid_data; |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2564 | int i; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2565 | |
Aaron Armstrong Skomra | f4e11d5 | 2019-06-12 14:19:30 -0700 | [diff] [blame] | 2566 | wacom_wac->is_invalid_bt_frame = false; |
| 2567 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2568 | for (i = 0; i < report->maxfield; i++) { |
| 2569 | struct hid_field *field = report->field[i]; |
| 2570 | int j; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2571 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2572 | for (j = 0; j < field->maxusage; j++) { |
| 2573 | struct hid_usage *usage = &field->usage[j]; |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 2574 | unsigned int equivalent_usage = |
| 2575 | wacom_equivalent_usage(usage->hid); |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2576 | |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 2577 | switch (equivalent_usage) { |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2578 | case HID_GD_X: |
| 2579 | case HID_GD_Y: |
| 2580 | case HID_DG_WIDTH: |
| 2581 | case HID_DG_HEIGHT: |
| 2582 | case HID_DG_CONTACTID: |
| 2583 | case HID_DG_INRANGE: |
| 2584 | case HID_DG_INVERT: |
| 2585 | case HID_DG_TIPSWITCH: |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 2586 | hid_data->last_slot_field = equivalent_usage; |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2587 | break; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2588 | } |
| 2589 | } |
| 2590 | } |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2591 | } |
| 2592 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2593 | static void wacom_wac_finger_report(struct hid_device *hdev, |
| 2594 | struct hid_report *report) |
| 2595 | { |
| 2596 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2597 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2598 | struct input_dev *input = wacom_wac->touch_input; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2599 | unsigned touch_max = wacom_wac->features.touch_max; |
Aaron Armstrong Skomra | 15893fa | 2019-06-12 14:19:31 -0700 | [diff] [blame] | 2600 | struct hid_data *hid_data = &wacom_wac->hid_data; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2601 | |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2602 | /* If more packets of data are expected, give us a chance to |
| 2603 | * process them rather than immediately syncing a partial |
| 2604 | * update. |
| 2605 | */ |
| 2606 | if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) |
| 2607 | return; |
| 2608 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2609 | if (touch_max > 1) |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2610 | input_mt_sync_frame(input); |
| 2611 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2612 | input_sync(input); |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2613 | wacom_wac->hid_data.num_received = 0; |
Aaron Armstrong Skomra | 15893fa | 2019-06-12 14:19:31 -0700 | [diff] [blame] | 2614 | hid_data->num_expected = 0; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2615 | |
| 2616 | /* keep touch state for pen event */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2617 | wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2618 | } |
| 2619 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2620 | void wacom_wac_usage_mapping(struct hid_device *hdev, |
| 2621 | struct hid_field *field, struct hid_usage *usage) |
| 2622 | { |
| 2623 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2624 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2625 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2626 | |
Aaron Armstrong Skomra | ac2423c | 2017-01-25 12:08:40 -0800 | [diff] [blame] | 2627 | if (WACOM_DIRECT_DEVICE(field)) |
| 2628 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2629 | |
Jason Gerecke | 5ac3d4a | 2017-04-28 09:25:34 -0700 | [diff] [blame] | 2630 | /* usage tests must precede field tests */ |
| 2631 | if (WACOM_BATTERY_USAGE(usage)) |
| 2632 | wacom_wac_battery_usage_mapping(hdev, field, usage); |
| 2633 | else if (WACOM_PAD_FIELD(field)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2634 | wacom_wac_pad_usage_mapping(hdev, field, usage); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2635 | else if (WACOM_PEN_FIELD(field)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2636 | wacom_wac_pen_usage_mapping(hdev, field, usage); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2637 | else if (WACOM_FINGER_FIELD(field)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2638 | wacom_wac_finger_usage_mapping(hdev, field, usage); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2639 | } |
| 2640 | |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2641 | void wacom_wac_event(struct hid_device *hdev, struct hid_field *field, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2642 | struct hid_usage *usage, __s32 value) |
| 2643 | { |
| 2644 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2645 | |
| 2646 | if (wacom->wacom_wac.features.type != HID_GENERIC) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2647 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2648 | |
Aaron Armstrong Skomra | 60a2218 | 2017-01-25 12:08:39 -0800 | [diff] [blame] | 2649 | if (value > field->logical_maximum || value < field->logical_minimum) |
| 2650 | return; |
| 2651 | |
Jason Gerecke | 5ac3d4a | 2017-04-28 09:25:34 -0700 | [diff] [blame] | 2652 | /* usage tests must precede field tests */ |
| 2653 | if (WACOM_BATTERY_USAGE(usage)) |
| 2654 | wacom_wac_battery_event(hdev, field, usage, value); |
| 2655 | else if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) |
| 2656 | wacom_wac_pad_event(hdev, field, usage, value); |
| 2657 | else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2658 | wacom_wac_pen_event(hdev, field, usage, value); |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2659 | else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2660 | wacom_wac_finger_event(hdev, field, usage, value); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2661 | } |
| 2662 | |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2663 | static void wacom_report_events(struct hid_device *hdev, |
| 2664 | struct hid_report *report, int collection_index, |
| 2665 | int field_index) |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2666 | { |
| 2667 | int r; |
| 2668 | |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2669 | for (r = field_index; r < report->maxfield; r++) { |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2670 | struct hid_field *field; |
| 2671 | unsigned count, n; |
| 2672 | |
| 2673 | field = report->field[r]; |
| 2674 | count = field->report_count; |
| 2675 | |
| 2676 | if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) |
| 2677 | continue; |
| 2678 | |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2679 | for (n = 0 ; n < count; n++) { |
| 2680 | if (field->usage[n].collection_index == collection_index) |
| 2681 | wacom_wac_event(hdev, field, &field->usage[n], |
| 2682 | field->value[n]); |
| 2683 | else |
| 2684 | return; |
| 2685 | } |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2686 | } |
| 2687 | } |
| 2688 | |
Aaron Armstrong Skomra | 15893fa | 2019-06-12 14:19:31 -0700 | [diff] [blame] | 2689 | static void wacom_set_num_expected(struct hid_device *hdev, |
| 2690 | struct hid_report *report, |
| 2691 | int collection_index, |
| 2692 | struct hid_field *field, |
| 2693 | int field_index) |
| 2694 | { |
| 2695 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2696 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2697 | struct hid_data *hid_data = &wacom_wac->hid_data; |
| 2698 | unsigned int original_collection_level = |
| 2699 | hdev->collection[collection_index].level; |
| 2700 | bool end_collection = false; |
| 2701 | int i; |
| 2702 | |
| 2703 | if (hid_data->num_expected) |
| 2704 | return; |
| 2705 | |
| 2706 | // find the contact count value for this segment |
| 2707 | for (i = field_index; i < report->maxfield && !end_collection; i++) { |
| 2708 | struct hid_field *field = report->field[i]; |
| 2709 | unsigned int field_level = |
| 2710 | hdev->collection[field->usage[0].collection_index].level; |
| 2711 | unsigned int j; |
| 2712 | |
| 2713 | if (field_level != original_collection_level) |
| 2714 | continue; |
| 2715 | |
| 2716 | for (j = 0; j < field->maxusage; j++) { |
| 2717 | struct hid_usage *usage = &field->usage[j]; |
| 2718 | |
| 2719 | if (usage->collection_index != collection_index) { |
| 2720 | end_collection = true; |
| 2721 | break; |
| 2722 | } |
| 2723 | if (wacom_equivalent_usage(usage->hid) == HID_DG_CONTACTCOUNT) { |
| 2724 | hid_data->cc_report = report->id; |
| 2725 | hid_data->cc_index = i; |
| 2726 | hid_data->cc_value_index = j; |
| 2727 | |
| 2728 | if (hid_data->cc_report != 0 && |
| 2729 | hid_data->cc_index >= 0) { |
| 2730 | |
| 2731 | struct hid_field *field = |
| 2732 | report->field[hid_data->cc_index]; |
| 2733 | int value = |
| 2734 | field->value[hid_data->cc_value_index]; |
| 2735 | |
| 2736 | if (value) |
| 2737 | hid_data->num_expected = value; |
| 2738 | } |
| 2739 | } |
| 2740 | } |
| 2741 | } |
| 2742 | |
| 2743 | if (hid_data->cc_report == 0 || hid_data->cc_index < 0) |
| 2744 | hid_data->num_expected = wacom_wac->features.touch_max; |
| 2745 | } |
| 2746 | |
Jiri Kosina | 7ba8fc0 | 2018-03-07 15:34:51 +0100 | [diff] [blame] | 2747 | static int wacom_wac_collection(struct hid_device *hdev, struct hid_report *report, |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2748 | int collection_index, struct hid_field *field, |
| 2749 | int field_index) |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2750 | { |
| 2751 | struct wacom *wacom = hid_get_drvdata(hdev); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2752 | |
Aaron Armstrong Skomra | 15893fa | 2019-06-12 14:19:31 -0700 | [diff] [blame] | 2753 | if (WACOM_FINGER_FIELD(field)) |
| 2754 | wacom_set_num_expected(hdev, report, collection_index, field, |
| 2755 | field_index); |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2756 | wacom_report_events(hdev, report, collection_index, field_index); |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2757 | |
Jason Gerecke | a9ce785 | 2017-01-17 15:38:58 -0800 | [diff] [blame] | 2758 | /* |
| 2759 | * Non-input reports may be sent prior to the device being |
| 2760 | * completely initialized. Since only their events need |
| 2761 | * to be processed, exit after 'wacom_report_events' has |
| 2762 | * been called to prevent potential crashes in the report- |
| 2763 | * processing functions. |
| 2764 | */ |
| 2765 | if (report->type != HID_INPUT_REPORT) |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2766 | return -1; |
Jason Gerecke | 5ac3d4a | 2017-04-28 09:25:34 -0700 | [diff] [blame] | 2767 | |
Aaron Armstrong Skomra | d4b8efe | 2019-05-10 15:34:17 -0700 | [diff] [blame] | 2768 | if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2769 | wacom_wac_pen_report(hdev, report); |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2770 | else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2771 | wacom_wac_finger_report(hdev, report); |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2772 | |
| 2773 | return 0; |
| 2774 | } |
| 2775 | |
| 2776 | void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) |
| 2777 | { |
| 2778 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2779 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2780 | struct hid_field *field; |
| 2781 | bool pad_in_hid_field = false, pen_in_hid_field = false, |
Aaron Armstrong Skomra | d4b8efe | 2019-05-10 15:34:17 -0700 | [diff] [blame] | 2782 | finger_in_hid_field = false, true_pad = false; |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2783 | int r; |
| 2784 | int prev_collection = -1; |
| 2785 | |
| 2786 | if (wacom_wac->features.type != HID_GENERIC) |
| 2787 | return; |
| 2788 | |
| 2789 | for (r = 0; r < report->maxfield; r++) { |
| 2790 | field = report->field[r]; |
| 2791 | |
| 2792 | if (WACOM_PAD_FIELD(field)) |
| 2793 | pad_in_hid_field = true; |
| 2794 | if (WACOM_PEN_FIELD(field)) |
| 2795 | pen_in_hid_field = true; |
| 2796 | if (WACOM_FINGER_FIELD(field)) |
| 2797 | finger_in_hid_field = true; |
Aaron Armstrong Skomra | d4b8efe | 2019-05-10 15:34:17 -0700 | [diff] [blame] | 2798 | if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) |
| 2799 | true_pad = true; |
Aaron Armstrong Skomra | f8b6a74 | 2018-03-06 10:48:34 -0800 | [diff] [blame] | 2800 | } |
| 2801 | |
| 2802 | wacom_wac_battery_pre_report(hdev, report); |
| 2803 | |
| 2804 | if (pad_in_hid_field && wacom->wacom_wac.pad_input) |
| 2805 | wacom_wac_pad_pre_report(hdev, report); |
| 2806 | if (pen_in_hid_field && wacom->wacom_wac.pen_input) |
| 2807 | wacom_wac_pen_pre_report(hdev, report); |
| 2808 | if (finger_in_hid_field && wacom->wacom_wac.touch_input) |
| 2809 | wacom_wac_finger_pre_report(hdev, report); |
| 2810 | |
| 2811 | for (r = 0; r < report->maxfield; r++) { |
| 2812 | field = report->field[r]; |
| 2813 | |
| 2814 | if (field->usage[0].collection_index != prev_collection) { |
| 2815 | if (wacom_wac_collection(hdev, report, |
| 2816 | field->usage[0].collection_index, field, r) < 0) |
| 2817 | return; |
| 2818 | prev_collection = field->usage[0].collection_index; |
| 2819 | } |
| 2820 | } |
| 2821 | |
| 2822 | wacom_wac_battery_report(hdev, report); |
Aaron Armstrong Skomra | d4b8efe | 2019-05-10 15:34:17 -0700 | [diff] [blame] | 2823 | |
| 2824 | if (true_pad && wacom->wacom_wac.pad_input) |
| 2825 | wacom_wac_pad_report(hdev, report, field); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2826 | } |
| 2827 | |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2828 | static int wacom_bpt_touch(struct wacom_wac *wacom) |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2829 | { |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2830 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2831 | struct input_dev *input = wacom->touch_input; |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2832 | struct input_dev *pad_input = wacom->pad_input; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2833 | unsigned char *data = wacom->data; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2834 | int i; |
| 2835 | |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2836 | if (data[0] != 0x02) |
| 2837 | return 0; |
| 2838 | |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2839 | for (i = 0; i < 2; i++) { |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2840 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2841 | bool touch = report_touch_events(wacom) |
| 2842 | && (data[offset + 3] & 0x80); |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2843 | |
| 2844 | input_mt_slot(input, i); |
| 2845 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
Henrik Rydberg | c5f4dec | 2010-12-15 13:50:34 +0100 | [diff] [blame] | 2846 | if (touch) { |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2847 | int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; |
| 2848 | int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2849 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { |
| 2850 | x <<= 5; |
| 2851 | y <<= 5; |
| 2852 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2853 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2854 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2855 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2856 | } |
| 2857 | |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 2858 | input_mt_sync_frame(input); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2859 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2860 | input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 2861 | input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); |
| 2862 | input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); |
| 2863 | input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2864 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2865 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2866 | return 1; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2867 | } |
| 2868 | |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2869 | static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2870 | { |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2871 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2872 | struct input_dev *input = wacom->touch_input; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2873 | bool touch = data[1] & 0x80; |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 2874 | int slot = input_mt_get_slot_by_key(input, data[0]); |
| 2875 | |
| 2876 | if (slot < 0) |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2877 | return; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2878 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2879 | touch = touch && report_touch_events(wacom); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2880 | |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 2881 | input_mt_slot(input, slot); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2882 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 2883 | |
| 2884 | if (touch) { |
| 2885 | int x = (data[2] << 4) | (data[4] >> 4); |
| 2886 | int y = (data[3] << 4) | (data[4] & 0x0f); |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2887 | int width, height; |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 2888 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2889 | if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { |
Jason Gerecke | 0b279da | 2013-11-25 18:43:16 -0800 | [diff] [blame] | 2890 | width = data[5] * 100; |
| 2891 | height = data[6] * 100; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2892 | } else { |
| 2893 | /* |
| 2894 | * "a" is a scaled-down area which we assume is |
| 2895 | * roughly circular and which can be described as: |
| 2896 | * a=(pi*r^2)/C. |
| 2897 | */ |
| 2898 | int a = data[5]; |
Ping Cheng | d7da3a3 | 2014-06-13 13:37:33 -0700 | [diff] [blame] | 2899 | int x_res = input_abs_get_res(input, ABS_MT_POSITION_X); |
| 2900 | int y_res = input_abs_get_res(input, ABS_MT_POSITION_Y); |
| 2901 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2902 | height = width * y_res / x_res; |
| 2903 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2904 | |
| 2905 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2906 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 2907 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); |
| 2908 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2909 | } |
| 2910 | } |
| 2911 | |
| 2912 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) |
| 2913 | { |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2914 | struct input_dev *input = wacom->pad_input; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2915 | struct wacom_features *features = &wacom->features; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2916 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2917 | if (features->type == INTUOSHT || features->type == INTUOSHT2) { |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2918 | input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); |
| 2919 | input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); |
| 2920 | } else { |
| 2921 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); |
| 2922 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 2923 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2924 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2925 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); |
| 2926 | } |
| 2927 | |
| 2928 | static int wacom_bpt3_touch(struct wacom_wac *wacom) |
| 2929 | { |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2930 | unsigned char *data = wacom->data; |
Jason Gerecke | 19d57d3 | 2012-03-06 10:19:19 -0800 | [diff] [blame] | 2931 | int count = data[1] & 0x07; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2932 | int touch_changed = 0, i; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2933 | |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2934 | if (data[0] != 0x02) |
| 2935 | return 0; |
| 2936 | |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2937 | /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ |
| 2938 | for (i = 0; i < count; i++) { |
| 2939 | int offset = (8 * i) + 2; |
| 2940 | int msg_id = data[offset]; |
| 2941 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2942 | if (msg_id >= 2 && msg_id <= 17) { |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2943 | wacom_bpt3_touch_msg(wacom, data + offset); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2944 | touch_changed++; |
| 2945 | } else if (msg_id == 128) |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2946 | wacom_bpt3_button_msg(wacom, data + offset); |
| 2947 | |
| 2948 | } |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2949 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2950 | /* only update touch if we actually have a touchpad and touch data changed */ |
Benjamin Tissoires | 84dfbd7 | 2016-07-13 18:05:55 +0200 | [diff] [blame] | 2951 | if (wacom->touch_input && touch_changed) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2952 | input_mt_sync_frame(wacom->touch_input); |
| 2953 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
| 2954 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2955 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2956 | return 1; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2957 | } |
| 2958 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2959 | static int wacom_bpt_pen(struct wacom_wac *wacom) |
| 2960 | { |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2961 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2962 | struct input_dev *input = wacom->pen_input; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2963 | unsigned char *data = wacom->data; |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 2964 | int x = 0, y = 0, p = 0, d = 0; |
| 2965 | bool pen = false, btn1 = false, btn2 = false; |
| 2966 | bool range, prox, rdy; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2967 | |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2968 | if (data[0] != WACOM_REPORT_PENABLED) |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2969 | return 0; |
| 2970 | |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 2971 | range = (data[1] & 0x80) == 0x80; |
| 2972 | prox = (data[1] & 0x40) == 0x40; |
| 2973 | rdy = (data[1] & 0x20) == 0x20; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2974 | |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 2975 | wacom->shared->stylus_in_proximity = range; |
| 2976 | if (delay_pen_events(wacom)) |
| 2977 | return 0; |
| 2978 | |
| 2979 | if (rdy) { |
| 2980 | p = le16_to_cpup((__le16 *)&data[6]); |
| 2981 | pen = data[1] & 0x01; |
| 2982 | btn1 = data[1] & 0x02; |
| 2983 | btn2 = data[1] & 0x04; |
| 2984 | } |
| 2985 | if (prox) { |
| 2986 | x = le16_to_cpup((__le16 *)&data[2]); |
| 2987 | y = le16_to_cpup((__le16 *)&data[4]); |
| 2988 | |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2989 | if (data[1] & 0x08) { |
| 2990 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 2991 | wacom->id[0] = ERASER_DEVICE_ID; |
| 2992 | } else { |
| 2993 | wacom->tool[0] = BTN_TOOL_PEN; |
| 2994 | wacom->id[0] = STYLUS_DEVICE_ID; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2995 | } |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 2996 | wacom->reporting_data = true; |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2997 | } |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 2998 | if (range) { |
Chris Bagwell | c18c2ce | 2011-10-10 08:52:13 -0700 | [diff] [blame] | 2999 | /* |
| 3000 | * Convert distance from out prox to distance from tablet. |
| 3001 | * distance will be greater than distance_max once |
| 3002 | * touching and applying pressure; do not report negative |
| 3003 | * distance. |
| 3004 | */ |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 3005 | if (data[8] <= features->distance_max) |
| 3006 | d = features->distance_max - data[8]; |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 3007 | } else { |
| 3008 | wacom->id[0] = 0; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 3009 | } |
| 3010 | |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 3011 | if (wacom->reporting_data) { |
| 3012 | input_report_key(input, BTN_TOUCH, pen); |
| 3013 | input_report_key(input, BTN_STYLUS, btn1); |
| 3014 | input_report_key(input, BTN_STYLUS2, btn2); |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 3015 | |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 3016 | if (prox || !range) { |
| 3017 | input_report_abs(input, ABS_X, x); |
| 3018 | input_report_abs(input, ABS_Y, y); |
| 3019 | } |
| 3020 | input_report_abs(input, ABS_PRESSURE, p); |
| 3021 | input_report_abs(input, ABS_DISTANCE, d); |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 3022 | |
Jason Gerecke | 8947b0c | 2018-05-18 07:17:18 -0700 | [diff] [blame] | 3023 | input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */ |
| 3024 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ |
| 3025 | } |
| 3026 | |
| 3027 | if (!range) { |
| 3028 | wacom->reporting_data = false; |
| 3029 | } |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 3030 | |
| 3031 | return 1; |
| 3032 | } |
| 3033 | |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 3034 | static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) |
| 3035 | { |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3036 | struct wacom_features *features = &wacom->features; |
| 3037 | |
| 3038 | if ((features->type == INTUOSHT2) && |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3039 | (features->device_type & WACOM_DEVICETYPE_PEN)) |
| 3040 | return wacom_intuos_irq(wacom); |
| 3041 | else if (len == WACOM_PKGLEN_BBTOUCH) |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 3042 | return wacom_bpt_touch(wacom); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3043 | else if (len == WACOM_PKGLEN_BBTOUCH3) |
| 3044 | return wacom_bpt3_touch(wacom); |
| 3045 | else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 3046 | return wacom_bpt_pen(wacom); |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 3047 | |
| 3048 | return 0; |
| 3049 | } |
| 3050 | |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3051 | static void wacom_bamboo_pad_pen_event(struct wacom_wac *wacom, |
| 3052 | unsigned char *data) |
| 3053 | { |
| 3054 | unsigned char prefix; |
| 3055 | |
| 3056 | /* |
| 3057 | * We need to reroute the event from the debug interface to the |
| 3058 | * pen interface. |
| 3059 | * We need to add the report ID to the actual pen report, so we |
| 3060 | * temporary overwrite the first byte to prevent having to kzalloc/kfree |
| 3061 | * and memcpy the report. |
| 3062 | */ |
| 3063 | prefix = data[0]; |
| 3064 | data[0] = WACOM_REPORT_BPAD_PEN; |
| 3065 | |
| 3066 | /* |
| 3067 | * actually reroute the event. |
| 3068 | * No need to check if wacom->shared->pen is valid, hid_input_report() |
| 3069 | * will check for us. |
| 3070 | */ |
| 3071 | hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, |
| 3072 | WACOM_PKGLEN_PENABLED, 1); |
| 3073 | |
| 3074 | data[0] = prefix; |
| 3075 | } |
| 3076 | |
| 3077 | static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom, |
| 3078 | unsigned char *data) |
| 3079 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 3080 | struct input_dev *input = wacom->touch_input; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3081 | unsigned char *finger_data, prefix; |
| 3082 | unsigned id; |
| 3083 | int x, y; |
| 3084 | bool valid; |
| 3085 | |
| 3086 | prefix = data[0]; |
| 3087 | |
| 3088 | for (id = 0; id < wacom->features.touch_max; id++) { |
| 3089 | valid = !!(prefix & BIT(id)) && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 3090 | report_touch_events(wacom); |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3091 | |
| 3092 | input_mt_slot(input, id); |
| 3093 | input_mt_report_slot_state(input, MT_TOOL_FINGER, valid); |
| 3094 | |
| 3095 | if (!valid) |
| 3096 | continue; |
| 3097 | |
| 3098 | finger_data = data + 1 + id * 3; |
| 3099 | x = finger_data[0] | ((finger_data[1] & 0x0f) << 8); |
| 3100 | y = (finger_data[2] << 4) | (finger_data[1] >> 4); |
| 3101 | |
| 3102 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 3103 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 3104 | } |
| 3105 | |
| 3106 | input_mt_sync_frame(input); |
| 3107 | |
| 3108 | input_report_key(input, BTN_LEFT, prefix & 0x40); |
| 3109 | input_report_key(input, BTN_RIGHT, prefix & 0x80); |
| 3110 | |
| 3111 | /* keep touch state for pen event */ |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 3112 | wacom->shared->touch_down = !!prefix && report_touch_events(wacom); |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3113 | |
| 3114 | return 1; |
| 3115 | } |
| 3116 | |
| 3117 | static int wacom_bamboo_pad_irq(struct wacom_wac *wacom, size_t len) |
| 3118 | { |
| 3119 | unsigned char *data = wacom->data; |
| 3120 | |
| 3121 | if (!((len == WACOM_PKGLEN_BPAD_TOUCH) || |
| 3122 | (len == WACOM_PKGLEN_BPAD_TOUCH_USB)) || |
| 3123 | (data[0] != WACOM_REPORT_BPAD_TOUCH)) |
| 3124 | return 0; |
| 3125 | |
| 3126 | if (data[1] & 0x01) |
| 3127 | wacom_bamboo_pad_pen_event(wacom, &data[1]); |
| 3128 | |
| 3129 | if (data[1] & 0x02) |
| 3130 | return wacom_bamboo_pad_touch_event(wacom, &data[9]); |
| 3131 | |
| 3132 | return 0; |
| 3133 | } |
| 3134 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3135 | static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) |
| 3136 | { |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3137 | unsigned char *data = wacom->data; |
| 3138 | int connected; |
| 3139 | |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3140 | if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL) |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3141 | return 0; |
| 3142 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3143 | connected = data[1] & 0x01; |
| 3144 | if (connected) { |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 3145 | int pid, battery, charging; |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3146 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3147 | if ((wacom->shared->type == INTUOSHT || |
| 3148 | wacom->shared->type == INTUOSHT2) && |
Ping Cheng | 44b9683 | 2014-11-06 17:30:51 -0800 | [diff] [blame] | 3149 | wacom->shared->touch_input && |
| 3150 | wacom->shared->touch_max) { |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 3151 | input_report_switch(wacom->shared->touch_input, |
| 3152 | SW_MUTE_DEVICE, data[5] & 0x40); |
| 3153 | input_sync(wacom->shared->touch_input); |
| 3154 | } |
| 3155 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3156 | pid = get_unaligned_be16(&data[6]); |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 3157 | battery = (data[5] & 0x3f) * 100 / 31; |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 3158 | charging = !!(data[5] & 0x80); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3159 | if (wacom->pid != pid) { |
| 3160 | wacom->pid = pid; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 3161 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3162 | } |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 3163 | |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 3164 | wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO, |
| 3165 | battery, charging, 1, 0); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 3166 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3167 | } else if (wacom->pid != 0) { |
| 3168 | /* disconnected while previously connected */ |
| 3169 | wacom->pid = 0; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 3170 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 3171 | wacom_notify_battery(wacom, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 3172 | } |
| 3173 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3174 | return 0; |
| 3175 | } |
| 3176 | |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 3177 | static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len) |
| 3178 | { |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3179 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 3180 | struct wacom_features *features = &wacom_wac->features; |
| 3181 | unsigned char *data = wacom_wac->data; |
| 3182 | |
| 3183 | if (data[0] != WACOM_REPORT_USB) |
| 3184 | return 0; |
| 3185 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3186 | if ((features->type == INTUOSHT || |
| 3187 | features->type == INTUOSHT2) && |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 3188 | wacom_wac->shared->touch_input && |
| 3189 | features->touch_max) { |
| 3190 | input_report_switch(wacom_wac->shared->touch_input, |
| 3191 | SW_MUTE_DEVICE, data[8] & 0x40); |
| 3192 | input_sync(wacom_wac->shared->touch_input); |
| 3193 | } |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3194 | |
| 3195 | if (data[9] & 0x02) { /* wireless module is attached */ |
| 3196 | int battery = (data[8] & 0x3f) * 100 / 31; |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 3197 | bool charging = !!(data[8] & 0x80); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3198 | |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 3199 | wacom_notify_battery(wacom_wac, WACOM_POWER_SUPPLY_STATUS_AUTO, |
| 3200 | battery, charging, battery || charging, 1); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3201 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 3202 | if (!wacom->battery.battery && |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3203 | !(features->quirks & WACOM_QUIRK_BATTERY)) { |
| 3204 | features->quirks |= WACOM_QUIRK_BATTERY; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 3205 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3206 | } |
| 3207 | } |
| 3208 | else if ((features->quirks & WACOM_QUIRK_BATTERY) && |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 3209 | wacom->battery.battery) { |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3210 | features->quirks &= ~WACOM_QUIRK_BATTERY; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 3211 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
Jason Gerecke | 16e4598 | 2017-04-28 09:25:33 -0700 | [diff] [blame] | 3212 | wacom_notify_battery(wacom_wac, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 3213 | } |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 3214 | return 0; |
| 3215 | } |
| 3216 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3217 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3218 | { |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3219 | bool sync; |
| 3220 | |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 3221 | switch (wacom_wac->features.type) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3222 | case PENPARTNER: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3223 | sync = wacom_penpartner_irq(wacom_wac); |
| 3224 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 3225 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3226 | case PL: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3227 | sync = wacom_pl_irq(wacom_wac); |
| 3228 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 3229 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3230 | case WACOM_G4: |
| 3231 | case GRAPHIRE: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3232 | case GRAPHIRE_BT: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3233 | case WACOM_MO: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3234 | sync = wacom_graphire_irq(wacom_wac); |
| 3235 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 3236 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3237 | case PTU: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3238 | sync = wacom_ptu_irq(wacom_wac); |
| 3239 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 3240 | |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3241 | case DTU: |
| 3242 | sync = wacom_dtu_irq(wacom_wac); |
| 3243 | break; |
| 3244 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3245 | case DTUS: |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3246 | case DTUSX: |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3247 | sync = wacom_dtus_irq(wacom_wac); |
| 3248 | break; |
| 3249 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3250 | case INTUOS: |
| 3251 | case INTUOS3S: |
| 3252 | case INTUOS3: |
| 3253 | case INTUOS3L: |
| 3254 | case INTUOS4S: |
| 3255 | case INTUOS4: |
| 3256 | case INTUOS4L: |
| 3257 | case CINTIQ: |
| 3258 | case WACOM_BEE: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3259 | case WACOM_13HD: |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3260 | case WACOM_21UX2: |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 3261 | case WACOM_22HD: |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 3262 | case WACOM_24HD: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3263 | case WACOM_27QHD: |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3264 | case DTK: |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 3265 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3266 | case CINTIQ_COMPANION_2: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3267 | sync = wacom_intuos_irq(wacom_wac); |
| 3268 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 3269 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 3270 | case INTUOS4WL: |
| 3271 | sync = wacom_intuos_bt_irq(wacom_wac, len); |
| 3272 | break; |
| 3273 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 3274 | case WACOM_24HDT: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3275 | case WACOM_27QHDT: |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 3276 | sync = wacom_24hdt_irq(wacom_wac); |
| 3277 | break; |
| 3278 | |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3279 | case INTUOS5S: |
| 3280 | case INTUOS5: |
| 3281 | case INTUOS5L: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3282 | case INTUOSPS: |
| 3283 | case INTUOSPM: |
| 3284 | case INTUOSPL: |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3285 | if (len == WACOM_PKGLEN_BBTOUCH3) |
| 3286 | sync = wacom_bpt3_touch(wacom_wac); |
Jason Gerecke | 2d13a43 | 2015-03-06 11:47:42 -0800 | [diff] [blame] | 3287 | else if (wacom_wac->data[0] == WACOM_REPORT_USB) |
| 3288 | sync = wacom_status_irq(wacom_wac, len); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3289 | else |
| 3290 | sync = wacom_intuos_irq(wacom_wac); |
| 3291 | break; |
| 3292 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3293 | case INTUOSP2_BT: |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 3294 | case INTUOSP2S_BT: |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 3295 | case INTUOSHT3_BT: |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3296 | sync = wacom_intuos_pro2_bt_irq(wacom_wac, len); |
| 3297 | break; |
| 3298 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3299 | case TABLETPC: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3300 | case TABLETPCE: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3301 | case TABLETPC2FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3302 | case MTSCREEN: |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3303 | case MTTPC: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3304 | case MTTPC_B: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3305 | sync = wacom_tpc_irq(wacom_wac, len); |
| 3306 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 3307 | |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3308 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3309 | case BAMBOO_PEN: |
| 3310 | case BAMBOO_TOUCH: |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3311 | case INTUOSHT: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3312 | case INTUOSHT2: |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 3313 | if (wacom_wac->data[0] == WACOM_REPORT_USB) |
| 3314 | sync = wacom_status_irq(wacom_wac, len); |
| 3315 | else |
| 3316 | sync = wacom_bpt_irq(wacom_wac, len); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3317 | break; |
| 3318 | |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3319 | case BAMBOO_PAD: |
| 3320 | sync = wacom_bamboo_pad_irq(wacom_wac, len); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3321 | break; |
| 3322 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3323 | case WIRELESS: |
| 3324 | sync = wacom_wireless_irq(wacom_wac, len); |
| 3325 | break; |
| 3326 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3327 | case REMOTE: |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 3328 | sync = false; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3329 | if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 3330 | wacom_remote_status_irq(wacom_wac, len); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3331 | else |
| 3332 | sync = wacom_remote_irq(wacom_wac, len); |
| 3333 | break; |
| 3334 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3335 | default: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3336 | sync = false; |
| 3337 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3338 | } |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3339 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3340 | if (sync) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 3341 | if (wacom_wac->pen_input) |
| 3342 | input_sync(wacom_wac->pen_input); |
| 3343 | if (wacom_wac->touch_input) |
| 3344 | input_sync(wacom_wac->touch_input); |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3345 | if (wacom_wac->pad_input) |
| 3346 | input_sync(wacom_wac->pad_input); |
| 3347 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3348 | } |
| 3349 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3350 | static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3351 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 3352 | struct input_dev *input_dev = wacom_wac->pen_input; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3353 | |
| 3354 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3355 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3356 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3357 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3358 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 3359 | |
| 3360 | input_set_abs_params(input_dev, ABS_DISTANCE, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3361 | 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3362 | } |
| 3363 | |
| 3364 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) |
| 3365 | { |
| 3366 | struct input_dev *input_dev = wacom_wac->pen_input; |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3367 | struct wacom_features *features = &wacom_wac->features; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3368 | |
| 3369 | wacom_setup_basic_pro_pen(wacom_wac); |
| 3370 | |
| 3371 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 3372 | __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); |
| 3373 | __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); |
| 3374 | __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); |
| 3375 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3376 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3377 | input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3378 | input_abs_set_res(input_dev, ABS_TILT_X, 57); |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3379 | input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3380 | input_abs_set_res(input_dev, ABS_TILT_Y, 57); |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 3381 | } |
| 3382 | |
| 3383 | static void wacom_setup_intuos(struct wacom_wac *wacom_wac) |
| 3384 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 3385 | struct input_dev *input_dev = wacom_wac->pen_input; |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 3386 | |
| 3387 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 3388 | |
| 3389 | wacom_setup_cintiq(wacom_wac); |
| 3390 | |
| 3391 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3392 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3393 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 3394 | __set_bit(BTN_SIDE, input_dev->keybit); |
| 3395 | __set_bit(BTN_EXTRA, input_dev->keybit); |
| 3396 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 3397 | __set_bit(BTN_TOOL_LENS, input_dev->keybit); |
| 3398 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3399 | input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3400 | input_abs_set_res(input_dev, ABS_RZ, 287); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3401 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); |
| 3402 | } |
| 3403 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3404 | void wacom_setup_device_quirks(struct wacom *wacom) |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 3405 | { |
Jason Gerecke | 11db817 | 2018-10-10 13:40:26 -0700 | [diff] [blame] | 3406 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3407 | struct wacom_features *features = &wacom->wacom_wac.features; |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 3408 | |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3409 | /* The pen and pad share the same interface on most devices */ |
| 3410 | if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3411 | features->type == DTUS || |
| 3412 | (features->type >= INTUOS3S && features->type <= WACOM_MO)) { |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3413 | if (features->device_type & WACOM_DEVICETYPE_PEN) |
| 3414 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 3415 | } |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 3416 | |
| 3417 | /* touch device found but size is not defined. use default */ |
Jason Gerecke | aa86b18 | 2015-06-15 18:01:42 -0700 | [diff] [blame] | 3418 | if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 3419 | features->x_max = 1023; |
| 3420 | features->y_max = 1023; |
| 3421 | } |
| 3422 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3423 | /* |
| 3424 | * Intuos5/Pro and Bamboo 3rd gen have no useful data about its |
| 3425 | * touch interface in its HID descriptor. If this is the touch |
| 3426 | * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the |
| 3427 | * tablet values. |
| 3428 | */ |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3429 | if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || |
| 3430 | (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3431 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3432 | if (features->touch_max) |
| 3433 | features->device_type |= WACOM_DEVICETYPE_TOUCH; |
Jiri Kosina | a3088ab | 2015-11-17 00:24:14 +0100 | [diff] [blame] | 3434 | if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3435 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3436 | |
Jason Gerecke | 3b8d573 | 2018-06-26 09:58:02 -0700 | [diff] [blame] | 3437 | if (features->type == INTUOSHT2) { |
| 3438 | features->x_max = features->x_max / 10; |
| 3439 | features->y_max = features->y_max / 10; |
| 3440 | } |
| 3441 | else { |
| 3442 | features->x_max = 4096; |
| 3443 | features->y_max = 4096; |
| 3444 | } |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3445 | } |
Jason Gerecke | 9633920 | 2015-07-01 13:01:00 -0700 | [diff] [blame] | 3446 | else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
| 3447 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 3448 | } |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3449 | } |
| 3450 | |
| 3451 | /* |
Benjamin Tissoires | 580549e | 2016-03-25 15:26:55 +0100 | [diff] [blame] | 3452 | * Hack for the Bamboo One: |
| 3453 | * the device presents a PAD/Touch interface as most Bamboos and even |
| 3454 | * sends ghosts PAD data on it. However, later, we must disable this |
| 3455 | * ghost interface, and we can not detect it unless we set it here |
| 3456 | * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH. |
| 3457 | */ |
| 3458 | if (features->type == BAMBOO_PEN && |
| 3459 | features->pktlen == WACOM_PKGLEN_BBTOUCH3) |
| 3460 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 3461 | |
| 3462 | /* |
Jason Gerecke | 042628a | 2015-04-30 17:51:54 -0700 | [diff] [blame] | 3463 | * Raw Wacom-mode pen and touch events both come from interface |
| 3464 | * 0, whose HID descriptor has an application usage of 0xFF0D |
Jason Gerecke | 8de8228 | 2016-10-19 18:03:37 -0700 | [diff] [blame] | 3465 | * (i.e., WACOM_HID_WD_DIGITIZER). We route pen packets back |
Jason Gerecke | 042628a | 2015-04-30 17:51:54 -0700 | [diff] [blame] | 3466 | * out through the HID_GENERIC device created for interface 1, |
Benjamin Tissoires | 70caee0 | 2015-07-09 14:11:51 -0400 | [diff] [blame] | 3467 | * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH. |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3468 | */ |
| 3469 | if (features->type == BAMBOO_PAD) |
Benjamin Tissoires | 70caee0 | 2015-07-09 14:11:51 -0400 | [diff] [blame] | 3470 | features->device_type = WACOM_DEVICETYPE_TOUCH; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3471 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3472 | if (features->type == REMOTE) |
| 3473 | features->device_type = WACOM_DEVICETYPE_PAD; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3474 | |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 3475 | if (features->type == INTUOSP2_BT || |
| 3476 | features->type == INTUOSP2S_BT) { |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3477 | features->device_type |= WACOM_DEVICETYPE_PEN | |
| 3478 | WACOM_DEVICETYPE_PAD | |
| 3479 | WACOM_DEVICETYPE_TOUCH; |
| 3480 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 3481 | } |
| 3482 | |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 3483 | if (features->type == INTUOSHT3_BT) { |
| 3484 | features->device_type |= WACOM_DEVICETYPE_PEN | |
| 3485 | WACOM_DEVICETYPE_PAD; |
| 3486 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 3487 | } |
| 3488 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3489 | switch (features->type) { |
| 3490 | case PL: |
| 3491 | case DTU: |
| 3492 | case DTUS: |
| 3493 | case DTUSX: |
| 3494 | case WACOM_21UX2: |
| 3495 | case WACOM_22HD: |
| 3496 | case DTK: |
| 3497 | case WACOM_24HD: |
| 3498 | case WACOM_27QHD: |
| 3499 | case CINTIQ_HYBRID: |
| 3500 | case CINTIQ_COMPANION_2: |
| 3501 | case CINTIQ: |
| 3502 | case WACOM_BEE: |
| 3503 | case WACOM_13HD: |
| 3504 | case WACOM_24HDT: |
| 3505 | case WACOM_27QHDT: |
| 3506 | case TABLETPC: |
| 3507 | case TABLETPCE: |
| 3508 | case TABLETPC2FG: |
| 3509 | case MTSCREEN: |
| 3510 | case MTTPC: |
| 3511 | case MTTPC_B: |
| 3512 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
| 3513 | break; |
| 3514 | } |
| 3515 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3516 | if (wacom->hdev->bus == BUS_BLUETOOTH) |
| 3517 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 3518 | |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3519 | /* quirk for bamboo touch with 2 low res touches */ |
Jason Gerecke | be853fd | 2015-12-04 14:45:27 -0800 | [diff] [blame] | 3520 | if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3521 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 3522 | features->x_max <<= 5; |
| 3523 | features->y_max <<= 5; |
| 3524 | features->x_fuzz <<= 5; |
| 3525 | features->y_fuzz <<= 5; |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 3526 | features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3527 | } |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3528 | |
| 3529 | if (features->type == WIRELESS) { |
Jason Gerecke | ccad85c | 2015-08-03 10:17:04 -0700 | [diff] [blame] | 3530 | if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 3531 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 3532 | } |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3533 | } |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 3534 | |
| 3535 | if (features->type == REMOTE) |
| 3536 | features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; |
Jason Gerecke | 11db817 | 2018-10-10 13:40:26 -0700 | [diff] [blame] | 3537 | |
| 3538 | /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots |
| 3539 | * of things it shouldn't. Lets fix up the damage... |
| 3540 | */ |
| 3541 | if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) { |
| 3542 | features->quirks &= ~WACOM_QUIRK_TOOLSERIAL; |
| 3543 | __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit); |
| 3544 | __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit); |
| 3545 | __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit); |
| 3546 | __clear_bit(ABS_Z, wacom_wac->pen_input->absbit); |
| 3547 | __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit); |
| 3548 | __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit); |
| 3549 | __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit); |
| 3550 | __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit); |
| 3551 | __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit); |
| 3552 | __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit); |
| 3553 | __clear_bit(EV_MSC, wacom_wac->pen_input->evbit); |
| 3554 | } |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 3555 | } |
| 3556 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3557 | int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3558 | struct wacom_wac *wacom_wac) |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3559 | { |
| 3560 | struct wacom_features *features = &wacom_wac->features; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3561 | |
| 3562 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3563 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3564 | if (!(features->device_type & WACOM_DEVICETYPE_PEN)) |
| 3565 | return -ENODEV; |
| 3566 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3567 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
| 3568 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 3569 | else |
| 3570 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 3571 | |
Jason Gerecke | 9e429d5 | 2017-11-07 08:25:17 -0800 | [diff] [blame] | 3572 | if (features->type == HID_GENERIC) { |
| 3573 | /* setup has already been done; apply otherwise-undetectible quirks */ |
| 3574 | input_set_capability(input_dev, EV_KEY, BTN_STYLUS3); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 3575 | return 0; |
Jason Gerecke | 9e429d5 | 2017-11-07 08:25:17 -0800 | [diff] [blame] | 3576 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 3577 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3578 | __set_bit(BTN_TOUCH, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3579 | __set_bit(ABS_MISC, input_dev->absbit); |
| 3580 | |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3581 | input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, |
| 3582 | features->x_max - features->offset_right, |
| 3583 | features->x_fuzz, 0); |
| 3584 | input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, |
| 3585 | features->y_max - features->offset_bottom, |
| 3586 | features->y_fuzz, 0); |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3587 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, |
| 3588 | features->pressure_max, features->pressure_fuzz, 0); |
| 3589 | |
| 3590 | /* penabled devices have fixed resolution for each model */ |
| 3591 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
| 3592 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
| 3593 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3594 | switch (features->type) { |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3595 | case GRAPHIRE_BT: |
| 3596 | __clear_bit(ABS_MISC, input_dev->absbit); |
Gustavo A. R. Silva | 1da92d4 | 2019-02-11 16:04:22 -0600 | [diff] [blame] | 3597 | /* fall through */ |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3598 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3599 | case WACOM_MO: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3600 | case WACOM_G4: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3601 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 3602 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3603 | features->distance_fuzz, 0); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3604 | /* fall through */ |
| 3605 | |
| 3606 | case GRAPHIRE: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3607 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 3608 | |
| 3609 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3610 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3611 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 3612 | |
| 3613 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 3614 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 3615 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 3616 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3617 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3618 | break; |
| 3619 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3620 | case WACOM_27QHD: |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 3621 | case WACOM_24HD: |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3622 | case DTK: |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 3623 | case WACOM_22HD: |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3624 | case WACOM_21UX2: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3625 | case WACOM_BEE: |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 3626 | case CINTIQ: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3627 | case WACOM_13HD: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3628 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3629 | case CINTIQ_COMPANION_2: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3630 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3631 | input_abs_set_res(input_dev, ABS_Z, 287); |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3632 | wacom_setup_cintiq(wacom_wac); |
| 3633 | break; |
| 3634 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3635 | case INTUOS3: |
| 3636 | case INTUOS3L: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3637 | case INTUOS3S: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3638 | case INTUOS4: |
| 3639 | case INTUOS4WL: |
| 3640 | case INTUOS4L: |
| 3641 | case INTUOS4S: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3642 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3643 | input_abs_set_res(input_dev, ABS_Z, 287); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3644 | /* fall through */ |
| 3645 | |
| 3646 | case INTUOS: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3647 | wacom_setup_intuos(wacom_wac); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3648 | break; |
| 3649 | |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3650 | case INTUOS5: |
| 3651 | case INTUOS5L: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3652 | case INTUOSPM: |
| 3653 | case INTUOSPL: |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3654 | case INTUOS5S: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3655 | case INTUOSPS: |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3656 | case INTUOSP2_BT: |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 3657 | case INTUOSP2S_BT: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3658 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 3659 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3660 | features->distance_fuzz, 0); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3661 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3662 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 3663 | input_abs_set_res(input_dev, ABS_Z, 287); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3664 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3665 | wacom_setup_intuos(wacom_wac); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3666 | break; |
| 3667 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 3668 | case WACOM_24HDT: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3669 | case WACOM_27QHDT: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3670 | case MTSCREEN: |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3671 | case MTTPC: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3672 | case MTTPC_B: |
Ping Cheng | 6795a52 | 2012-06-28 16:49:00 -0700 | [diff] [blame] | 3673 | case TABLETPC2FG: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3674 | case TABLETPC: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3675 | case TABLETPCE: |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 3676 | __clear_bit(ABS_MISC, input_dev->absbit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3677 | /* fall through */ |
| 3678 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3679 | case DTUS: |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3680 | case DTUSX: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3681 | case PL: |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3682 | case DTU: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3683 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Jason Gerecke | 3512069 | 2011-09-08 09:38:14 -0700 | [diff] [blame] | 3684 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3685 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3686 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
Jason Gerecke | 3512069 | 2011-09-08 09:38:14 -0700 | [diff] [blame] | 3687 | break; |
| 3688 | |
| 3689 | case PTU: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3690 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 3691 | /* fall through */ |
| 3692 | |
| 3693 | case PENPARTNER: |
Jason Gerecke | 1fab84a | 2011-08-26 23:18:22 -0700 | [diff] [blame] | 3694 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3695 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
Jason Gerecke | 1fab84a | 2011-08-26 23:18:22 -0700 | [diff] [blame] | 3696 | __set_bit(BTN_STYLUS, input_dev->keybit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3697 | break; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3698 | |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3699 | case INTUOSHT: |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3700 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3701 | case BAMBOO_PEN: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3702 | case INTUOSHT2: |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 3703 | case INTUOSHT3_BT: |
| 3704 | if (features->type == INTUOSHT2 || |
| 3705 | features->type == INTUOSHT3_BT) { |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3706 | wacom_setup_basic_pro_pen(wacom_wac); |
| 3707 | } else { |
| 3708 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 3709 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 3710 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 3711 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3712 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 3713 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3714 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3715 | features->distance_fuzz, 0); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3716 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3717 | break; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3718 | case BAMBOO_PAD: |
| 3719 | __clear_bit(ABS_MISC, input_dev->absbit); |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3720 | break; |
| 3721 | } |
| 3722 | return 0; |
| 3723 | } |
| 3724 | |
| 3725 | int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, |
| 3726 | struct wacom_wac *wacom_wac) |
| 3727 | { |
| 3728 | struct wacom_features *features = &wacom_wac->features; |
| 3729 | |
| 3730 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3731 | |
| 3732 | if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) |
| 3733 | return -ENODEV; |
| 3734 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3735 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
| 3736 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 3737 | else |
| 3738 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 3739 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3740 | if (features->type == HID_GENERIC) |
| 3741 | /* setup has already been done */ |
| 3742 | return 0; |
| 3743 | |
| 3744 | __set_bit(BTN_TOUCH, input_dev->keybit); |
| 3745 | |
| 3746 | if (features->touch_max == 1) { |
| 3747 | input_set_abs_params(input_dev, ABS_X, 0, |
| 3748 | features->x_max, features->x_fuzz, 0); |
| 3749 | input_set_abs_params(input_dev, ABS_Y, 0, |
| 3750 | features->y_max, features->y_fuzz, 0); |
| 3751 | input_abs_set_res(input_dev, ABS_X, |
| 3752 | features->x_resolution); |
| 3753 | input_abs_set_res(input_dev, ABS_Y, |
| 3754 | features->y_resolution); |
| 3755 | } |
| 3756 | else if (features->touch_max > 1) { |
| 3757 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, |
| 3758 | features->x_max, features->x_fuzz, 0); |
| 3759 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, |
| 3760 | features->y_max, features->y_fuzz, 0); |
| 3761 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, |
| 3762 | features->x_resolution); |
| 3763 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, |
| 3764 | features->y_resolution); |
| 3765 | } |
| 3766 | |
| 3767 | switch (features->type) { |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3768 | case INTUOSP2_BT: |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 3769 | case INTUOSP2S_BT: |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3770 | input_dev->evbit[0] |= BIT_MASK(EV_SW); |
| 3771 | __set_bit(SW_MUTE_DEVICE, input_dev->swbit); |
| 3772 | |
| 3773 | if (wacom_wac->shared->touch->product == 0x361) { |
| 3774 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| 3775 | 0, 12440, 4, 0); |
| 3776 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
| 3777 | 0, 8640, 4, 0); |
| 3778 | } |
| 3779 | else if (wacom_wac->shared->touch->product == 0x360) { |
| 3780 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| 3781 | 0, 8960, 4, 0); |
| 3782 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
| 3783 | 0, 5920, 4, 0); |
| 3784 | } |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 3785 | else if (wacom_wac->shared->touch->product == 0x393) { |
| 3786 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| 3787 | 0, 6400, 4, 0); |
| 3788 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
| 3789 | 0, 4000, 4, 0); |
| 3790 | } |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3791 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, 40); |
Aaron Armstrong Skomra | 68c20cc | 2019-05-10 15:34:18 -0700 | [diff] [blame] | 3792 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 40); |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3793 | |
| 3794 | /* fall through */ |
| 3795 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3796 | case INTUOS5: |
| 3797 | case INTUOS5L: |
| 3798 | case INTUOSPM: |
| 3799 | case INTUOSPL: |
| 3800 | case INTUOS5S: |
| 3801 | case INTUOSPS: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3802 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); |
| 3803 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); |
| 3804 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 3805 | break; |
| 3806 | |
| 3807 | case WACOM_24HDT: |
| 3808 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); |
| 3809 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); |
| 3810 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); |
| 3811 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); |
| 3812 | /* fall through */ |
| 3813 | |
| 3814 | case WACOM_27QHDT: |
| 3815 | case MTSCREEN: |
| 3816 | case MTTPC: |
| 3817 | case MTTPC_B: |
| 3818 | case TABLETPC2FG: |
| 3819 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); |
| 3820 | /*fall through */ |
| 3821 | |
| 3822 | case TABLETPC: |
| 3823 | case TABLETPCE: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3824 | break; |
| 3825 | |
| 3826 | case INTUOSHT: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3827 | case INTUOSHT2: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3828 | input_dev->evbit[0] |= BIT_MASK(EV_SW); |
| 3829 | __set_bit(SW_MUTE_DEVICE, input_dev->swbit); |
| 3830 | /* fall through */ |
| 3831 | |
| 3832 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3833 | case BAMBOO_TOUCH: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3834 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
| 3835 | input_set_abs_params(input_dev, |
| 3836 | ABS_MT_TOUCH_MAJOR, |
| 3837 | 0, features->x_max, 0, 0); |
| 3838 | input_set_abs_params(input_dev, |
| 3839 | ABS_MT_TOUCH_MINOR, |
| 3840 | 0, features->y_max, 0, 0); |
| 3841 | } |
| 3842 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 3843 | break; |
| 3844 | |
| 3845 | case BAMBOO_PAD: |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3846 | input_mt_init_slots(input_dev, features->touch_max, |
| 3847 | INPUT_MT_POINTER); |
| 3848 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3849 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3850 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3851 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3852 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3853 | } |
| 3854 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3855 | static int wacom_numbered_button_to_key(int n) |
| 3856 | { |
| 3857 | if (n < 10) |
| 3858 | return BTN_0 + n; |
| 3859 | else if (n < 16) |
| 3860 | return BTN_A + (n-10); |
| 3861 | else if (n < 18) |
| 3862 | return BTN_BASE + (n-16); |
| 3863 | else |
| 3864 | return 0; |
| 3865 | } |
| 3866 | |
Jiri Kosina | 5397df1 | 2015-08-28 20:46:42 +0200 | [diff] [blame] | 3867 | static void wacom_setup_numbered_buttons(struct input_dev *input_dev, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3868 | int button_count) |
| 3869 | { |
| 3870 | int i; |
| 3871 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3872 | for (i = 0; i < button_count; i++) { |
| 3873 | int key = wacom_numbered_button_to_key(i); |
| 3874 | |
| 3875 | if (key) |
| 3876 | __set_bit(key, input_dev->keybit); |
| 3877 | } |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3878 | } |
| 3879 | |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3880 | static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group) |
| 3881 | { |
| 3882 | struct wacom_led *led; |
| 3883 | int i; |
| 3884 | bool updated = false; |
| 3885 | |
| 3886 | /* |
| 3887 | * 24HD has LED group 1 to the left and LED group 0 to the right. |
| 3888 | * So group 0 matches the second half of the buttons and thus the mask |
| 3889 | * needs to be shifted. |
| 3890 | */ |
| 3891 | if (group == 0) |
| 3892 | mask >>= 8; |
| 3893 | |
| 3894 | for (i = 0; i < 3; i++) { |
| 3895 | led = wacom_led_find(wacom, group, i); |
| 3896 | if (!led) { |
| 3897 | hid_err(wacom->hdev, "can't find LED %d in group %d\n", |
| 3898 | i, group); |
| 3899 | continue; |
| 3900 | } |
| 3901 | if (!updated && mask & BIT(i)) { |
| 3902 | led->held = true; |
| 3903 | led_trigger_event(&led->trigger, LED_FULL); |
| 3904 | } else { |
| 3905 | led->held = false; |
| 3906 | } |
| 3907 | } |
| 3908 | } |
| 3909 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3910 | static bool wacom_is_led_toggled(struct wacom *wacom, int button_count, |
| 3911 | int mask, int group) |
| 3912 | { |
Jason Gerecke | 6441fc7 | 2019-05-07 11:53:21 -0700 | [diff] [blame] | 3913 | int group_button; |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3914 | |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3915 | /* |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3916 | * 21UX2 has LED group 1 to the left and LED group 0 |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3917 | * to the right. We need to reverse the group to match this |
| 3918 | * historical behavior. |
| 3919 | */ |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3920 | if (wacom->wacom_wac.features.type == WACOM_21UX2) |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3921 | group = 1 - group; |
| 3922 | |
Jason Gerecke | 6441fc7 | 2019-05-07 11:53:21 -0700 | [diff] [blame] | 3923 | group_button = group * (button_count/wacom->led.count); |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3924 | |
Jason Gerecke | 6441fc7 | 2019-05-07 11:53:21 -0700 | [diff] [blame] | 3925 | if (wacom->wacom_wac.features.type == INTUOSP2_BT) |
| 3926 | group_button = 8; |
| 3927 | |
| 3928 | return mask & (1 << group_button); |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3929 | } |
| 3930 | |
| 3931 | static void wacom_update_led(struct wacom *wacom, int button_count, int mask, |
| 3932 | int group) |
| 3933 | { |
| 3934 | struct wacom_led *led, *next_led; |
| 3935 | int cur; |
| 3936 | bool pressed; |
| 3937 | |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3938 | if (wacom->wacom_wac.features.type == WACOM_24HD) |
| 3939 | return wacom_24hd_update_leds(wacom, mask, group); |
| 3940 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3941 | pressed = wacom_is_led_toggled(wacom, button_count, mask, group); |
| 3942 | cur = wacom->led.groups[group].select; |
| 3943 | |
| 3944 | led = wacom_led_find(wacom, group, cur); |
| 3945 | if (!led) { |
| 3946 | hid_err(wacom->hdev, "can't find current LED %d in group %d\n", |
| 3947 | cur, group); |
| 3948 | return; |
| 3949 | } |
| 3950 | |
| 3951 | if (!pressed) { |
| 3952 | led->held = false; |
| 3953 | return; |
| 3954 | } |
| 3955 | |
| 3956 | if (led->held && pressed) |
| 3957 | return; |
| 3958 | |
| 3959 | next_led = wacom_led_next(wacom, led); |
| 3960 | if (!next_led) { |
| 3961 | hid_err(wacom->hdev, "can't find next LED in group %d\n", |
| 3962 | group); |
| 3963 | return; |
| 3964 | } |
| 3965 | if (next_led == led) |
| 3966 | return; |
| 3967 | |
| 3968 | next_led->held = true; |
| 3969 | led_trigger_event(&next_led->trigger, |
| 3970 | wacom_leds_brightness_get(next_led)); |
| 3971 | } |
| 3972 | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3973 | static void wacom_report_numbered_buttons(struct input_dev *input_dev, |
| 3974 | int button_count, int mask) |
| 3975 | { |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3976 | struct wacom *wacom = input_get_drvdata(input_dev); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3977 | int i; |
| 3978 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3979 | for (i = 0; i < wacom->led.count; i++) |
| 3980 | wacom_update_led(wacom, button_count, mask, i); |
| 3981 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3982 | for (i = 0; i < button_count; i++) { |
| 3983 | int key = wacom_numbered_button_to_key(i); |
| 3984 | |
| 3985 | if (key) |
| 3986 | input_report_key(input_dev, key, mask & (1 << i)); |
| 3987 | } |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3988 | } |
| 3989 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3990 | int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, |
| 3991 | struct wacom_wac *wacom_wac) |
| 3992 | { |
| 3993 | struct wacom_features *features = &wacom_wac->features; |
| 3994 | |
Ping Cheng | e7deb15 | 2017-01-30 15:40:49 -0800 | [diff] [blame] | 3995 | if ((features->type == HID_GENERIC) && features->numbered_buttons > 0) |
| 3996 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 3997 | |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3998 | if (!(features->device_type & WACOM_DEVICETYPE_PAD)) |
| 3999 | return -ENODEV; |
| 4000 | |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 4001 | if (features->type == REMOTE && input_dev == wacom_wac->pad_input) |
| 4002 | return -ENODEV; |
| 4003 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 4004 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 4005 | |
| 4006 | /* kept for making legacy xf86-input-wacom working with the wheels */ |
| 4007 | __set_bit(ABS_MISC, input_dev->absbit); |
| 4008 | |
| 4009 | /* kept for making legacy xf86-input-wacom accepting the pad */ |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 4010 | if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || |
| 4011 | input_dev->absinfo[ABS_X].maximum))) |
| 4012 | input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); |
| 4013 | if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || |
| 4014 | input_dev->absinfo[ABS_Y].maximum))) |
| 4015 | input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 4016 | |
Benjamin Tissoires | 12969e3 | 2014-09-11 13:14:04 -0400 | [diff] [blame] | 4017 | /* kept for making udev and libwacom accepting the pad */ |
| 4018 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 4019 | |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4020 | wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); |
| 4021 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 4022 | switch (features->type) { |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4023 | |
| 4024 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4025 | case CINTIQ_COMPANION_2: |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4026 | case DTK: |
| 4027 | case DTUS: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4028 | case GRAPHIRE_BT: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4029 | break; |
| 4030 | |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 4031 | case WACOM_MO: |
| 4032 | __set_bit(BTN_BACK, input_dev->keybit); |
| 4033 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 4034 | __set_bit(BTN_FORWARD, input_dev->keybit); |
| 4035 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 4036 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 4037 | break; |
| 4038 | |
| 4039 | case WACOM_G4: |
| 4040 | __set_bit(BTN_BACK, input_dev->keybit); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 4041 | __set_bit(BTN_FORWARD, input_dev->keybit); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 4042 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 4043 | break; |
| 4044 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4045 | case WACOM_24HD: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4046 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 4047 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 4048 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 4049 | |
| 4050 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 4051 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
| 4052 | break; |
| 4053 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4054 | case WACOM_27QHD: |
| 4055 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 4056 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 4057 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 4058 | input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); |
| 4059 | input_abs_set_res(input_dev, ABS_X, 1024); /* points/g */ |
| 4060 | input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); |
| 4061 | input_abs_set_res(input_dev, ABS_Y, 1024); |
| 4062 | input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); |
| 4063 | input_abs_set_res(input_dev, ABS_Z, 1024); |
| 4064 | __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); |
| 4065 | break; |
| 4066 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4067 | case WACOM_22HD: |
| 4068 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 4069 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 4070 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 4071 | /* fall through */ |
| 4072 | |
| 4073 | case WACOM_21UX2: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4074 | case WACOM_BEE: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4075 | case CINTIQ: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4076 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 4077 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
| 4078 | break; |
| 4079 | |
| 4080 | case WACOM_13HD: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4081 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 4082 | break; |
| 4083 | |
| 4084 | case INTUOS3: |
| 4085 | case INTUOS3L: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4086 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
| 4087 | /* fall through */ |
| 4088 | |
| 4089 | case INTUOS3S: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4090 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 4091 | break; |
| 4092 | |
| 4093 | case INTUOS5: |
| 4094 | case INTUOS5L: |
| 4095 | case INTUOSPM: |
| 4096 | case INTUOSPL: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4097 | case INTUOS5S: |
| 4098 | case INTUOSPS: |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 4099 | case INTUOSP2_BT: |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 4100 | case INTUOSP2S_BT: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4101 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 4102 | break; |
| 4103 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 4104 | case INTUOS4WL: |
| 4105 | /* |
| 4106 | * For Bluetooth devices, the udev rule does not work correctly |
| 4107 | * for pads unless we add a stylus capability, which forces |
| 4108 | * ID_INPUT_TABLET to be set. |
| 4109 | */ |
| 4110 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 4111 | /* fall through */ |
| 4112 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4113 | case INTUOS4: |
| 4114 | case INTUOS4L: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4115 | case INTUOS4S: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 4116 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 4117 | break; |
| 4118 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 4119 | case INTUOSHT: |
| 4120 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4121 | case BAMBOO_TOUCH: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 4122 | case INTUOSHT2: |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 4123 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 4124 | |
| 4125 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 4126 | __set_bit(BTN_FORWARD, input_dev->keybit); |
| 4127 | __set_bit(BTN_BACK, input_dev->keybit); |
| 4128 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 4129 | |
| 4130 | break; |
| 4131 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4132 | case REMOTE: |
| 4133 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
| 4134 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 4135 | break; |
| 4136 | |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 4137 | case INTUOSHT3_BT: |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 4138 | case HID_GENERIC: |
| 4139 | break; |
| 4140 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 4141 | default: |
| 4142 | /* no pad supported */ |
Ping Cheng | b3c8e93 | 2014-11-18 13:27:48 -0800 | [diff] [blame] | 4143 | return -ENODEV; |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 4144 | } |
| 4145 | return 0; |
| 4146 | } |
| 4147 | |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4148 | static const struct wacom_features wacom_features_0x00 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4149 | { "Wacom Penpartner", 5040, 3780, 255, 0, |
| 4150 | PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4151 | static const struct wacom_features wacom_features_0x10 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4152 | { "Wacom Graphire", 10206, 7422, 511, 63, |
| 4153 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4154 | static const struct wacom_features wacom_features_0x81 = |
| 4155 | { "Wacom Graphire BT", 16704, 12064, 511, 32, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4156 | GRAPHIRE_BT, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES, 2 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4157 | static const struct wacom_features wacom_features_0x11 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4158 | { "Wacom Graphire2 4x5", 10206, 7422, 511, 63, |
| 4159 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4160 | static const struct wacom_features wacom_features_0x12 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4161 | { "Wacom Graphire2 5x7", 13918, 10206, 511, 63, |
| 4162 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4163 | static const struct wacom_features wacom_features_0x13 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4164 | { "Wacom Graphire3", 10208, 7424, 511, 63, |
| 4165 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4166 | static const struct wacom_features wacom_features_0x14 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4167 | { "Wacom Graphire3 6x8", 16704, 12064, 511, 63, |
| 4168 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4169 | static const struct wacom_features wacom_features_0x15 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4170 | { "Wacom Graphire4 4x5", 10208, 7424, 511, 63, |
| 4171 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4172 | static const struct wacom_features wacom_features_0x16 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4173 | { "Wacom Graphire4 6x8", 16704, 12064, 511, 63, |
| 4174 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4175 | static const struct wacom_features wacom_features_0x17 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4176 | { "Wacom BambooFun 4x5", 14760, 9225, 511, 63, |
| 4177 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4178 | static const struct wacom_features wacom_features_0x18 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4179 | { "Wacom BambooFun 6x8", 21648, 13530, 511, 63, |
| 4180 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4181 | static const struct wacom_features wacom_features_0x19 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4182 | { "Wacom Bamboo1 Medium", 16704, 12064, 511, 63, |
| 4183 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4184 | static const struct wacom_features wacom_features_0x60 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4185 | { "Wacom Volito", 5104, 3712, 511, 63, |
| 4186 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4187 | static const struct wacom_features wacom_features_0x61 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4188 | { "Wacom PenStation2", 3250, 2320, 255, 63, |
| 4189 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4190 | static const struct wacom_features wacom_features_0x62 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4191 | { "Wacom Volito2 4x5", 5104, 3712, 511, 63, |
| 4192 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4193 | static const struct wacom_features wacom_features_0x63 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4194 | { "Wacom Volito2 2x3", 3248, 2320, 511, 63, |
| 4195 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4196 | static const struct wacom_features wacom_features_0x64 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4197 | { "Wacom PenPartner2", 3250, 2320, 511, 63, |
| 4198 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4199 | static const struct wacom_features wacom_features_0x65 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4200 | { "Wacom Bamboo", 14760, 9225, 511, 63, |
| 4201 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4202 | static const struct wacom_features wacom_features_0x69 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4203 | { "Wacom Bamboo1", 5104, 3712, 511, 63, |
| 4204 | GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 4205 | static const struct wacom_features wacom_features_0x6A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4206 | { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63, |
| 4207 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 4208 | static const struct wacom_features wacom_features_0x6B = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4209 | { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63, |
| 4210 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4211 | static const struct wacom_features wacom_features_0x20 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4212 | { "Wacom Intuos 4x5", 12700, 10600, 1023, 31, |
| 4213 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4214 | static const struct wacom_features wacom_features_0x21 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4215 | { "Wacom Intuos 6x8", 20320, 16240, 1023, 31, |
| 4216 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4217 | static const struct wacom_features wacom_features_0x22 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4218 | { "Wacom Intuos 9x12", 30480, 24060, 1023, 31, |
| 4219 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4220 | static const struct wacom_features wacom_features_0x23 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4221 | { "Wacom Intuos 12x12", 30480, 31680, 1023, 31, |
| 4222 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4223 | static const struct wacom_features wacom_features_0x24 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4224 | { "Wacom Intuos 12x18", 45720, 31680, 1023, 31, |
| 4225 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4226 | static const struct wacom_features wacom_features_0x30 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4227 | { "Wacom PL400", 5408, 4056, 255, 0, |
| 4228 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4229 | static const struct wacom_features wacom_features_0x31 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4230 | { "Wacom PL500", 6144, 4608, 255, 0, |
| 4231 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4232 | static const struct wacom_features wacom_features_0x32 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4233 | { "Wacom PL600", 6126, 4604, 255, 0, |
| 4234 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4235 | static const struct wacom_features wacom_features_0x33 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4236 | { "Wacom PL600SX", 6260, 5016, 255, 0, |
| 4237 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4238 | static const struct wacom_features wacom_features_0x34 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4239 | { "Wacom PL550", 6144, 4608, 511, 0, |
| 4240 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4241 | static const struct wacom_features wacom_features_0x35 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4242 | { "Wacom PL800", 7220, 5780, 511, 0, |
| 4243 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4244 | static const struct wacom_features wacom_features_0x37 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4245 | { "Wacom PL700", 6758, 5406, 511, 0, |
| 4246 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4247 | static const struct wacom_features wacom_features_0x38 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4248 | { "Wacom PL510", 6282, 4762, 511, 0, |
| 4249 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4250 | static const struct wacom_features wacom_features_0x39 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4251 | { "Wacom DTU710", 34080, 27660, 511, 0, |
| 4252 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4253 | static const struct wacom_features wacom_features_0xC4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4254 | { "Wacom DTF521", 6282, 4762, 511, 0, |
| 4255 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4256 | static const struct wacom_features wacom_features_0xC0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4257 | { "Wacom DTF720", 6858, 5506, 511, 0, |
| 4258 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4259 | static const struct wacom_features wacom_features_0xC2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4260 | { "Wacom DTF720a", 6858, 5506, 511, 0, |
| 4261 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4262 | static const struct wacom_features wacom_features_0x03 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4263 | { "Wacom Cintiq Partner", 20480, 15360, 511, 0, |
| 4264 | PTU, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4265 | static const struct wacom_features wacom_features_0x41 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4266 | { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31, |
| 4267 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4268 | static const struct wacom_features wacom_features_0x42 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4269 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 4270 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4271 | static const struct wacom_features wacom_features_0x43 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4272 | { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31, |
| 4273 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4274 | static const struct wacom_features wacom_features_0x44 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4275 | { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31, |
| 4276 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4277 | static const struct wacom_features wacom_features_0x45 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4278 | { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31, |
| 4279 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4280 | static const struct wacom_features wacom_features_0xB0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4281 | { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4282 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4283 | static const struct wacom_features wacom_features_0xB1 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4284 | { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4285 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4286 | static const struct wacom_features wacom_features_0xB2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4287 | { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4288 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4289 | static const struct wacom_features wacom_features_0xB3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4290 | { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4291 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4292 | static const struct wacom_features wacom_features_0xB4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4293 | { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4294 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4295 | static const struct wacom_features wacom_features_0xB5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4296 | { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4297 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4298 | static const struct wacom_features wacom_features_0xB7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4299 | { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4300 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4301 | static const struct wacom_features wacom_features_0xB8 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4302 | { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4303 | INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4304 | static const struct wacom_features wacom_features_0xB9 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4305 | { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4306 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4307 | static const struct wacom_features wacom_features_0xBA = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4308 | { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4309 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4310 | static const struct wacom_features wacom_features_0xBB = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4311 | { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4312 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 4313 | static const struct wacom_features wacom_features_0xBC = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4314 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4315 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 4316 | static const struct wacom_features wacom_features_0xBD = |
| 4317 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4318 | INTUOS4WL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 4319 | static const struct wacom_features wacom_features_0x26 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4320 | { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4321 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 4322 | static const struct wacom_features wacom_features_0x27 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4323 | { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4324 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 4325 | static const struct wacom_features wacom_features_0x28 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4326 | { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4327 | INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 4328 | static const struct wacom_features wacom_features_0x29 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4329 | { "Wacom Intuos5 S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4330 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 4331 | static const struct wacom_features wacom_features_0x2A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4332 | { "Wacom Intuos5 M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4333 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 4334 | static const struct wacom_features wacom_features_0x314 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4335 | { "Wacom Intuos Pro S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4336 | INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4337 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 4338 | static const struct wacom_features wacom_features_0x315 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4339 | { "Wacom Intuos Pro M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4340 | INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4341 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 4342 | static const struct wacom_features wacom_features_0x317 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4343 | { "Wacom Intuos Pro L", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4344 | INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4345 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 4346 | static const struct wacom_features wacom_features_0xF4 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4347 | { "Wacom Cintiq 24HD", 104480, 65600, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4348 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4349 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4350 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Jason Gerecke | 6f4d038 | 2012-08-21 22:11:59 -0700 | [diff] [blame] | 4351 | static const struct wacom_features wacom_features_0xF8 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4352 | { "Wacom Cintiq 24HD touch", 104480, 65600, 2047, 63, /* Pen */ |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4353 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4354 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4355 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 3bd1f7e | 2013-05-23 10:22:33 -0700 | [diff] [blame] | 4356 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 4357 | static const struct wacom_features wacom_features_0xF6 = |
| 4358 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4359 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, |
| 4360 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4361 | static const struct wacom_features wacom_features_0x32A = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4362 | { "Wacom Cintiq 27QHD", 120140, 67920, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4363 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4364 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | a7e6645 | 2015-02-04 16:01:54 -0800 | [diff] [blame] | 4365 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4366 | static const struct wacom_features wacom_features_0x32B = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4367 | { "Wacom Cintiq 27QHD touch", 120140, 67920, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4368 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4369 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4370 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4371 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C }; |
| 4372 | static const struct wacom_features wacom_features_0x32C = |
| 4373 | { "Wacom Cintiq 27QHD touch", .type = WACOM_27QHDT, |
| 4374 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4375 | static const struct wacom_features wacom_features_0x3F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4376 | { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4377 | CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4378 | static const struct wacom_features wacom_features_0xC5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4379 | { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4380 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4381 | static const struct wacom_features wacom_features_0xC6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4382 | { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4383 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4384 | static const struct wacom_features wacom_features_0x304 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4385 | { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4386 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4387 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4388 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 4389 | static const struct wacom_features wacom_features_0x333 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4390 | { "Wacom Cintiq 13HD touch", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4391 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 4392 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4393 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 4394 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 }; |
| 4395 | static const struct wacom_features wacom_features_0x335 = |
| 4396 | { "Wacom Cintiq 13HD touch", .type = WACOM_24HDT, /* Touch */ |
| 4397 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x333, .touch_max = 10, |
| 4398 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4399 | static const struct wacom_features wacom_features_0xC7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4400 | { "Wacom DTU1931", 37832, 30305, 511, 0, |
| 4401 | PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 4402 | static const struct wacom_features wacom_features_0xCE = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4403 | { "Wacom DTU2231", 47864, 27011, 511, 0, |
| 4404 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4405 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBMOUSE }; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 4406 | static const struct wacom_features wacom_features_0xF0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4407 | { "Wacom DTU1631", 34623, 19553, 511, 0, |
| 4408 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 4409 | static const struct wacom_features wacom_features_0xFB = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4410 | { "Wacom DTU1031", 22096, 13960, 511, 0, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4411 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4412 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4413 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 4414 | static const struct wacom_features wacom_features_0x32F = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4415 | { "Wacom DTU1031X", 22672, 12928, 511, 0, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4416 | DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4417 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 4418 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Aaron Skomra | 007760c | 2015-04-16 15:01:14 -0700 | [diff] [blame] | 4419 | static const struct wacom_features wacom_features_0x336 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4420 | { "Wacom DTU1141", 23672, 13403, 1023, 0, |
Ping Cheng | ff38e82 | 2015-11-12 17:21:14 -0800 | [diff] [blame] | 4421 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4422 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | ff38e82 | 2015-11-12 17:21:14 -0800 | [diff] [blame] | 4423 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4424 | static const struct wacom_features wacom_features_0x57 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4425 | { "Wacom DTK2241", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4426 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4427 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4428 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 4429 | static const struct wacom_features wacom_features_0x59 = /* Pen */ |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4430 | { "Wacom DTH2242", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4431 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4432 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4433 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 4434 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; |
| 4435 | static const struct wacom_features wacom_features_0x5D = /* Touch */ |
| 4436 | { "Wacom DTH2242", .type = WACOM_24HDT, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4437 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10, |
| 4438 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 4439 | static const struct wacom_features wacom_features_0xCC = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4440 | { "Wacom Cintiq 21UX2", 87200, 65600, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4441 | WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4442 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4443 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 4444 | static const struct wacom_features wacom_features_0xFA = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4445 | { "Wacom Cintiq 22HD", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4446 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4447 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4448 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4449 | static const struct wacom_features wacom_features_0x5B = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4450 | { "Wacom Cintiq 22HDT", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4451 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4452 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4453 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 3bd1f7e | 2013-05-23 10:22:33 -0700 | [diff] [blame] | 4454 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4455 | static const struct wacom_features wacom_features_0x5E = |
| 4456 | { "Wacom Cintiq 22HDT", .type = WACOM_24HDT, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4457 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10, |
| 4458 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4459 | static const struct wacom_features wacom_features_0x90 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4460 | { "Wacom ISDv4 90", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4461 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4462 | static const struct wacom_features wacom_features_0x93 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4463 | { "Wacom ISDv4 93", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4464 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 4465 | static const struct wacom_features wacom_features_0x97 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4466 | { "Wacom ISDv4 97", 26202, 16325, 511, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4467 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4468 | static const struct wacom_features wacom_features_0x9A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4469 | { "Wacom ISDv4 9A", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4470 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4471 | static const struct wacom_features wacom_features_0x9F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4472 | { "Wacom ISDv4 9F", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4473 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4474 | static const struct wacom_features wacom_features_0xE2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4475 | { "Wacom ISDv4 E2", 26202, 16325, 255, 0, |
| 4476 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4477 | static const struct wacom_features wacom_features_0xE3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4478 | { "Wacom ISDv4 E3", 26202, 16325, 255, 0, |
| 4479 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 4480 | static const struct wacom_features wacom_features_0xE5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4481 | { "Wacom ISDv4 E5", 26202, 16325, 255, 0, |
| 4482 | MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Manoj Iyer | 26fcd2a | 2011-03-31 22:39:43 -0700 | [diff] [blame] | 4483 | static const struct wacom_features wacom_features_0xE6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4484 | { "Wacom ISDv4 E6", 27760, 15694, 255, 0, |
| 4485 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Chris Bagwell | 0d0e306 | 2011-12-11 23:50:59 -0800 | [diff] [blame] | 4486 | static const struct wacom_features wacom_features_0xEC = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4487 | { "Wacom ISDv4 EC", 25710, 14500, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4488 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 4489 | static const struct wacom_features wacom_features_0xED = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4490 | { "Wacom ISDv4 ED", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4491 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 4492 | static const struct wacom_features wacom_features_0xEF = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4493 | { "Wacom ISDv4 EF", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4494 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 4495 | static const struct wacom_features wacom_features_0x100 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4496 | { "Wacom ISDv4 100", 26202, 16325, 255, 0, |
| 4497 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 4498 | static const struct wacom_features wacom_features_0x101 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4499 | { "Wacom ISDv4 101", 26202, 16325, 255, 0, |
| 4500 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Stephan Frank | 5869483 | 2013-03-07 14:08:50 -0800 | [diff] [blame] | 4501 | static const struct wacom_features wacom_features_0x10D = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4502 | { "Wacom ISDv4 10D", 26202, 16325, 255, 0, |
| 4503 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 2d3163f | 2013-10-22 15:35:30 -0700 | [diff] [blame] | 4504 | static const struct wacom_features wacom_features_0x10E = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4505 | { "Wacom ISDv4 10E", 27760, 15694, 255, 0, |
| 4506 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 9b4f60e | 2013-10-15 23:46:34 -0700 | [diff] [blame] | 4507 | static const struct wacom_features wacom_features_0x10F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4508 | { "Wacom ISDv4 10F", 27760, 15694, 255, 0, |
| 4509 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 61616ed | 2014-05-14 11:42:22 -0700 | [diff] [blame] | 4510 | static const struct wacom_features wacom_features_0x116 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4511 | { "Wacom ISDv4 116", 26202, 16325, 255, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4512 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; |
Jason Gerecke | aeaf50d | 2014-07-28 10:53:16 -0700 | [diff] [blame] | 4513 | static const struct wacom_features wacom_features_0x12C = |
| 4514 | { "Wacom ISDv4 12C", 27848, 15752, 2047, 0, |
Jason Gerecke | 29b9e14 | 2018-06-25 13:24:34 -0700 | [diff] [blame] | 4515 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ |
Ping Cheng | edbe265 | 2012-11-21 13:12:50 -0800 | [diff] [blame] | 4516 | static const struct wacom_features wacom_features_0x4001 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4517 | { "Wacom ISDv4 4001", 26202, 16325, 255, 0, |
| 4518 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 4519 | static const struct wacom_features wacom_features_0x4004 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4520 | { "Wacom ISDv4 4004", 11060, 6220, 255, 0, |
| 4521 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 4522 | static const struct wacom_features wacom_features_0x5000 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4523 | { "Wacom ISDv4 5000", 27848, 15752, 1023, 0, |
| 4524 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 4525 | static const struct wacom_features wacom_features_0x5002 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4526 | { "Wacom ISDv4 5002", 29576, 16724, 1023, 0, |
| 4527 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4528 | static const struct wacom_features wacom_features_0x47 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4529 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 4530 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 4531 | static const struct wacom_features wacom_features_0x84 = |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4532 | { "Wacom Wireless Receiver", .type = WIRELESS, .touch_max = 16 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4533 | static const struct wacom_features wacom_features_0xD0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4534 | { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4535 | BAMBOO_TOUCH, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4536 | static const struct wacom_features wacom_features_0xD1 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4537 | { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31, |
| 4538 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4539 | static const struct wacom_features wacom_features_0xD2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4540 | { "Wacom Bamboo Craft", 14720, 9200, 1023, 31, |
| 4541 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4542 | static const struct wacom_features wacom_features_0xD3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4543 | { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31, |
| 4544 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Kevin Granade | 57a7872 | 2010-12-10 23:04:02 -0800 | [diff] [blame] | 4545 | static const struct wacom_features wacom_features_0xD4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4546 | { "Wacom Bamboo Pen", 14720, 9200, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4547 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Gerard Braad | 18adad1 | 2011-08-16 00:17:56 -0700 | [diff] [blame] | 4548 | static const struct wacom_features wacom_features_0xD5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4549 | { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4550 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4551 | static const struct wacom_features wacom_features_0xD6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4552 | { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31, |
| 4553 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4554 | static const struct wacom_features wacom_features_0xD7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4555 | { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31, |
| 4556 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4557 | static const struct wacom_features wacom_features_0xD8 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4558 | { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31, |
| 4559 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4560 | static const struct wacom_features wacom_features_0xDA = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4561 | { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31, |
| 4562 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4563 | static const struct wacom_features wacom_features_0xDB = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4564 | { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31, |
| 4565 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4566 | static const struct wacom_features wacom_features_0xDD = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4567 | { "Wacom Bamboo Connect", 14720, 9200, 1023, 31, |
| 4568 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4569 | static const struct wacom_features wacom_features_0xDE = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4570 | { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31, |
| 4571 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4572 | static const struct wacom_features wacom_features_0xDF = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4573 | { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31, |
| 4574 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4575 | static const struct wacom_features wacom_features_0x300 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4576 | { "Wacom Bamboo One S", 14720, 9225, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4577 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4578 | static const struct wacom_features wacom_features_0x301 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4579 | { "Wacom Bamboo One M", 21648, 13530, 1023, 31, |
Aaron Armstrong Skomra | b79cbc5 | 2017-03-29 13:07:36 -0700 | [diff] [blame] | 4580 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 4581 | static const struct wacom_features wacom_features_0x302 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4582 | { "Wacom Intuos PT S", 15200, 9500, 1023, 31, |
| 4583 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4584 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 4585 | static const struct wacom_features wacom_features_0x303 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4586 | { "Wacom Intuos PT M", 21600, 13500, 1023, 31, |
| 4587 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4588 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 4589 | static const struct wacom_features wacom_features_0x30E = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4590 | { "Wacom Intuos S", 15200, 9500, 1023, 31, |
| 4591 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4592 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 4593 | static const struct wacom_features wacom_features_0x6004 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4594 | { "ISD-V4", 12800, 8000, 255, 0, |
| 4595 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4596 | static const struct wacom_features wacom_features_0x307 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4597 | { "Wacom ISDv5 307", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4598 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4599 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4600 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 4601 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4602 | static const struct wacom_features wacom_features_0x309 = |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 4603 | { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4604 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10, |
| 4605 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4606 | static const struct wacom_features wacom_features_0x30A = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4607 | { "Wacom ISDv5 30A", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4608 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4609 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4610 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4611 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C }; |
| 4612 | static const struct wacom_features wacom_features_0x30C = |
| 4613 | { "Wacom ISDv5 30C", .type = WACOM_24HDT, /* Touch */ |
| 4614 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10, |
| 4615 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 4616 | static const struct wacom_features wacom_features_0x318 = |
| 4617 | { "Wacom USB Bamboo PAD", 4095, 4095, /* Touch */ |
| 4618 | .type = BAMBOO_PAD, 35, 48, .touch_max = 4 }; |
| 4619 | static const struct wacom_features wacom_features_0x319 = |
| 4620 | { "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */ |
| 4621 | .type = BAMBOO_PAD, 35, 48, .touch_max = 4 }; |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4622 | static const struct wacom_features wacom_features_0x325 = |
| 4623 | { "Wacom ISDv5 325", 59552, 33848, 2047, 63, |
| 4624 | CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11, |
| 4625 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4626 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4627 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 }; |
| 4628 | static const struct wacom_features wacom_features_0x326 = /* Touch */ |
| 4629 | { "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM, |
| 4630 | .oPid = 0x325 }; |
Ping Cheng | fefb391 | 2014-11-11 12:52:08 -0800 | [diff] [blame] | 4631 | static const struct wacom_features wacom_features_0x323 = |
| 4632 | { "Wacom Intuos P M", 21600, 13500, 1023, 31, |
| 4633 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 4634 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4635 | static const struct wacom_features wacom_features_0x331 = |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4636 | { "Wacom Express Key Remote", .type = REMOTE, |
| 4637 | .numbered_buttons = 18, .check_for_hid_type = true, |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4638 | .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 4639 | static const struct wacom_features wacom_features_0x33B = |
| 4640 | { "Wacom Intuos S 2", 15200, 9500, 2047, 63, |
| 4641 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 4642 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 4643 | static const struct wacom_features wacom_features_0x33C = |
| 4644 | { "Wacom Intuos PT S 2", 15200, 9500, 2047, 63, |
| 4645 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 4646 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 4647 | static const struct wacom_features wacom_features_0x33D = |
| 4648 | { "Wacom Intuos P M 2", 21600, 13500, 2047, 63, |
| 4649 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 4650 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 4651 | static const struct wacom_features wacom_features_0x33E = |
| 4652 | { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63, |
| 4653 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 4654 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4655 | static const struct wacom_features wacom_features_0x343 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4656 | { "Wacom DTK1651", 34816, 19759, 1023, 0, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4657 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4658 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4659 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 4660 | static const struct wacom_features wacom_features_0x360 = |
| 4661 | { "Wacom Intuos Pro M", 44800, 29600, 8191, 63, |
Aaron Armstrong Skomra | 49cc4c2 | 2017-03-06 10:54:57 -0800 | [diff] [blame] | 4662 | INTUOSP2_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 }; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 4663 | static const struct wacom_features wacom_features_0x361 = |
| 4664 | { "Wacom Intuos Pro L", 62200, 43200, 8191, 63, |
Aaron Armstrong Skomra | 49cc4c2 | 2017-03-06 10:54:57 -0800 | [diff] [blame] | 4665 | INTUOSP2_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 }; |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 4666 | static const struct wacom_features wacom_features_0x377 = |
| 4667 | { "Wacom Intuos BT S", 15200, 9500, 4095, 63, |
| 4668 | INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 }; |
| 4669 | static const struct wacom_features wacom_features_0x379 = |
| 4670 | { "Wacom Intuos BT M", 21600, 13500, 4095, 63, |
| 4671 | INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 }; |
Jason Gerecke | c947218 | 2017-12-26 15:50:18 -0800 | [diff] [blame] | 4672 | static const struct wacom_features wacom_features_0x37A = |
| 4673 | { "Wacom One by Wacom S", 15200, 9500, 2047, 63, |
| 4674 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 4675 | static const struct wacom_features wacom_features_0x37B = |
| 4676 | { "Wacom One by Wacom M", 21600, 13500, 2047, 63, |
| 4677 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 4678 | static const struct wacom_features wacom_features_0x393 = |
| 4679 | { "Wacom Intuos Pro S", 31920, 19950, 8191, 63, |
| 4680 | INTUOSP2S_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, |
| 4681 | .touch_max = 10 }; |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4682 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 4683 | static const struct wacom_features wacom_features_HID_ANY_ID = |
Jason Gerecke | 41372d5 | 2016-08-08 12:06:30 -0700 | [diff] [blame] | 4684 | { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID }; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 4685 | |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4686 | #define USB_DEVICE_WACOM(prod) \ |
| 4687 | HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 4688 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4689 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4690 | #define BT_DEVICE_WACOM(prod) \ |
| 4691 | HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 4692 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Aristeu Rozanski | 1483f55 | 2011-06-22 01:17:17 -0700 | [diff] [blame] | 4693 | |
Mika Westerberg | eef23a8 | 2015-02-23 15:52:43 +0200 | [diff] [blame] | 4694 | #define I2C_DEVICE_WACOM(prod) \ |
| 4695 | HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 4696 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
| 4697 | |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 4698 | #define USB_DEVICE_LENOVO(prod) \ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4699 | HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ |
| 4700 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 4701 | |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4702 | const struct hid_device_id wacom_ids[] = { |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4703 | { USB_DEVICE_WACOM(0x00) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4704 | { USB_DEVICE_WACOM(0x03) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4705 | { USB_DEVICE_WACOM(0x10) }, |
| 4706 | { USB_DEVICE_WACOM(0x11) }, |
| 4707 | { USB_DEVICE_WACOM(0x12) }, |
| 4708 | { USB_DEVICE_WACOM(0x13) }, |
| 4709 | { USB_DEVICE_WACOM(0x14) }, |
| 4710 | { USB_DEVICE_WACOM(0x15) }, |
| 4711 | { USB_DEVICE_WACOM(0x16) }, |
| 4712 | { USB_DEVICE_WACOM(0x17) }, |
| 4713 | { USB_DEVICE_WACOM(0x18) }, |
| 4714 | { USB_DEVICE_WACOM(0x19) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4715 | { USB_DEVICE_WACOM(0x20) }, |
| 4716 | { USB_DEVICE_WACOM(0x21) }, |
| 4717 | { USB_DEVICE_WACOM(0x22) }, |
| 4718 | { USB_DEVICE_WACOM(0x23) }, |
| 4719 | { USB_DEVICE_WACOM(0x24) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4720 | { USB_DEVICE_WACOM(0x26) }, |
| 4721 | { USB_DEVICE_WACOM(0x27) }, |
| 4722 | { USB_DEVICE_WACOM(0x28) }, |
| 4723 | { USB_DEVICE_WACOM(0x29) }, |
| 4724 | { USB_DEVICE_WACOM(0x2A) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4725 | { USB_DEVICE_WACOM(0x30) }, |
| 4726 | { USB_DEVICE_WACOM(0x31) }, |
| 4727 | { USB_DEVICE_WACOM(0x32) }, |
| 4728 | { USB_DEVICE_WACOM(0x33) }, |
| 4729 | { USB_DEVICE_WACOM(0x34) }, |
| 4730 | { USB_DEVICE_WACOM(0x35) }, |
| 4731 | { USB_DEVICE_WACOM(0x37) }, |
| 4732 | { USB_DEVICE_WACOM(0x38) }, |
| 4733 | { USB_DEVICE_WACOM(0x39) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4734 | { USB_DEVICE_WACOM(0x3F) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4735 | { USB_DEVICE_WACOM(0x41) }, |
| 4736 | { USB_DEVICE_WACOM(0x42) }, |
| 4737 | { USB_DEVICE_WACOM(0x43) }, |
| 4738 | { USB_DEVICE_WACOM(0x44) }, |
| 4739 | { USB_DEVICE_WACOM(0x45) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4740 | { USB_DEVICE_WACOM(0x47) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4741 | { USB_DEVICE_WACOM(0x57) }, |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 4742 | { USB_DEVICE_WACOM(0x59) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4743 | { USB_DEVICE_WACOM(0x5B) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4744 | { USB_DEVICE_WACOM(0x5D) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4745 | { USB_DEVICE_WACOM(0x5E) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4746 | { USB_DEVICE_WACOM(0x60) }, |
| 4747 | { USB_DEVICE_WACOM(0x61) }, |
| 4748 | { USB_DEVICE_WACOM(0x62) }, |
| 4749 | { USB_DEVICE_WACOM(0x63) }, |
| 4750 | { USB_DEVICE_WACOM(0x64) }, |
| 4751 | { USB_DEVICE_WACOM(0x65) }, |
| 4752 | { USB_DEVICE_WACOM(0x69) }, |
| 4753 | { USB_DEVICE_WACOM(0x6A) }, |
| 4754 | { USB_DEVICE_WACOM(0x6B) }, |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4755 | { BT_DEVICE_WACOM(0x81) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4756 | { USB_DEVICE_WACOM(0x84) }, |
| 4757 | { USB_DEVICE_WACOM(0x90) }, |
| 4758 | { USB_DEVICE_WACOM(0x93) }, |
| 4759 | { USB_DEVICE_WACOM(0x97) }, |
| 4760 | { USB_DEVICE_WACOM(0x9A) }, |
| 4761 | { USB_DEVICE_WACOM(0x9F) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4762 | { USB_DEVICE_WACOM(0xB0) }, |
| 4763 | { USB_DEVICE_WACOM(0xB1) }, |
| 4764 | { USB_DEVICE_WACOM(0xB2) }, |
| 4765 | { USB_DEVICE_WACOM(0xB3) }, |
| 4766 | { USB_DEVICE_WACOM(0xB4) }, |
| 4767 | { USB_DEVICE_WACOM(0xB5) }, |
| 4768 | { USB_DEVICE_WACOM(0xB7) }, |
| 4769 | { USB_DEVICE_WACOM(0xB8) }, |
| 4770 | { USB_DEVICE_WACOM(0xB9) }, |
| 4771 | { USB_DEVICE_WACOM(0xBA) }, |
| 4772 | { USB_DEVICE_WACOM(0xBB) }, |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 4773 | { USB_DEVICE_WACOM(0xBC) }, |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 4774 | { BT_DEVICE_WACOM(0xBD) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4775 | { USB_DEVICE_WACOM(0xC0) }, |
| 4776 | { USB_DEVICE_WACOM(0xC2) }, |
| 4777 | { USB_DEVICE_WACOM(0xC4) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4778 | { USB_DEVICE_WACOM(0xC5) }, |
| 4779 | { USB_DEVICE_WACOM(0xC6) }, |
| 4780 | { USB_DEVICE_WACOM(0xC7) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4781 | { USB_DEVICE_WACOM(0xCC) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4782 | { USB_DEVICE_WACOM(0xCE) }, |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 4783 | { USB_DEVICE_WACOM(0xD0) }, |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 4784 | { USB_DEVICE_WACOM(0xD1) }, |
| 4785 | { USB_DEVICE_WACOM(0xD2) }, |
| 4786 | { USB_DEVICE_WACOM(0xD3) }, |
Kevin Granade | 57a7872 | 2010-12-10 23:04:02 -0800 | [diff] [blame] | 4787 | { USB_DEVICE_WACOM(0xD4) }, |
Gerard Braad | 18adad1 | 2011-08-16 00:17:56 -0700 | [diff] [blame] | 4788 | { USB_DEVICE_WACOM(0xD5) }, |
Ping Cheng | d38acb4 | 2011-01-24 09:32:50 -0800 | [diff] [blame] | 4789 | { USB_DEVICE_WACOM(0xD6) }, |
| 4790 | { USB_DEVICE_WACOM(0xD7) }, |
David Foley | a318e6b | 2010-11-30 23:45:46 -0800 | [diff] [blame] | 4791 | { USB_DEVICE_WACOM(0xD8) }, |
| 4792 | { USB_DEVICE_WACOM(0xDA) }, |
David Foley | 47d0923 | 2010-12-07 21:05:59 -0800 | [diff] [blame] | 4793 | { USB_DEVICE_WACOM(0xDB) }, |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4794 | { USB_DEVICE_WACOM(0xDD) }, |
| 4795 | { USB_DEVICE_WACOM(0xDE) }, |
| 4796 | { USB_DEVICE_WACOM(0xDF) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4797 | { USB_DEVICE_WACOM(0xE2) }, |
| 4798 | { USB_DEVICE_WACOM(0xE3) }, |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 4799 | { USB_DEVICE_WACOM(0xE5) }, |
Manoj Iyer | 26fcd2a | 2011-03-31 22:39:43 -0700 | [diff] [blame] | 4800 | { USB_DEVICE_WACOM(0xE6) }, |
Chris Bagwell | 0d0e306 | 2011-12-11 23:50:59 -0800 | [diff] [blame] | 4801 | { USB_DEVICE_WACOM(0xEC) }, |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 4802 | { USB_DEVICE_WACOM(0xED) }, |
| 4803 | { USB_DEVICE_WACOM(0xEF) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4804 | { USB_DEVICE_WACOM(0xF0) }, |
| 4805 | { USB_DEVICE_WACOM(0xF4) }, |
| 4806 | { USB_DEVICE_WACOM(0xF6) }, |
| 4807 | { USB_DEVICE_WACOM(0xF8) }, |
| 4808 | { USB_DEVICE_WACOM(0xFA) }, |
| 4809 | { USB_DEVICE_WACOM(0xFB) }, |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 4810 | { USB_DEVICE_WACOM(0x100) }, |
| 4811 | { USB_DEVICE_WACOM(0x101) }, |
Stephan Frank | 5869483 | 2013-03-07 14:08:50 -0800 | [diff] [blame] | 4812 | { USB_DEVICE_WACOM(0x10D) }, |
Jason Gerecke | 2d3163f | 2013-10-22 15:35:30 -0700 | [diff] [blame] | 4813 | { USB_DEVICE_WACOM(0x10E) }, |
Jason Gerecke | 9b4f60e | 2013-10-15 23:46:34 -0700 | [diff] [blame] | 4814 | { USB_DEVICE_WACOM(0x10F) }, |
Jason Gerecke | 61616ed | 2014-05-14 11:42:22 -0700 | [diff] [blame] | 4815 | { USB_DEVICE_WACOM(0x116) }, |
Jason Gerecke | aeaf50d | 2014-07-28 10:53:16 -0700 | [diff] [blame] | 4816 | { USB_DEVICE_WACOM(0x12C) }, |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4817 | { USB_DEVICE_WACOM(0x300) }, |
| 4818 | { USB_DEVICE_WACOM(0x301) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4819 | { USB_DEVICE_WACOM(0x302) }, |
| 4820 | { USB_DEVICE_WACOM(0x303) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4821 | { USB_DEVICE_WACOM(0x304) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4822 | { USB_DEVICE_WACOM(0x307) }, |
| 4823 | { USB_DEVICE_WACOM(0x309) }, |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4824 | { USB_DEVICE_WACOM(0x30A) }, |
| 4825 | { USB_DEVICE_WACOM(0x30C) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4826 | { USB_DEVICE_WACOM(0x30E) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4827 | { USB_DEVICE_WACOM(0x314) }, |
| 4828 | { USB_DEVICE_WACOM(0x315) }, |
| 4829 | { USB_DEVICE_WACOM(0x317) }, |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 4830 | { USB_DEVICE_WACOM(0x318) }, |
| 4831 | { USB_DEVICE_WACOM(0x319) }, |
Ping Cheng | fefb391 | 2014-11-11 12:52:08 -0800 | [diff] [blame] | 4832 | { USB_DEVICE_WACOM(0x323) }, |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4833 | { USB_DEVICE_WACOM(0x325) }, |
| 4834 | { USB_DEVICE_WACOM(0x326) }, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4835 | { USB_DEVICE_WACOM(0x32A) }, |
| 4836 | { USB_DEVICE_WACOM(0x32B) }, |
| 4837 | { USB_DEVICE_WACOM(0x32C) }, |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 4838 | { USB_DEVICE_WACOM(0x32F) }, |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4839 | { USB_DEVICE_WACOM(0x331) }, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 4840 | { USB_DEVICE_WACOM(0x333) }, |
| 4841 | { USB_DEVICE_WACOM(0x335) }, |
Aaron Skomra | 007760c | 2015-04-16 15:01:14 -0700 | [diff] [blame] | 4842 | { USB_DEVICE_WACOM(0x336) }, |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 4843 | { USB_DEVICE_WACOM(0x33B) }, |
| 4844 | { USB_DEVICE_WACOM(0x33C) }, |
| 4845 | { USB_DEVICE_WACOM(0x33D) }, |
| 4846 | { USB_DEVICE_WACOM(0x33E) }, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4847 | { USB_DEVICE_WACOM(0x343) }, |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 4848 | { BT_DEVICE_WACOM(0x360) }, |
| 4849 | { BT_DEVICE_WACOM(0x361) }, |
Aaron Armstrong Skomra | 87046b6 | 2018-03-06 10:48:33 -0800 | [diff] [blame] | 4850 | { BT_DEVICE_WACOM(0x377) }, |
| 4851 | { BT_DEVICE_WACOM(0x379) }, |
Jason Gerecke | c947218 | 2017-12-26 15:50:18 -0800 | [diff] [blame] | 4852 | { USB_DEVICE_WACOM(0x37A) }, |
| 4853 | { USB_DEVICE_WACOM(0x37B) }, |
Aaron Armstrong Skomra | 912c6aa | 2019-06-12 14:19:28 -0700 | [diff] [blame] | 4854 | { BT_DEVICE_WACOM(0x393) }, |
Ping Cheng | edbe265 | 2012-11-21 13:12:50 -0800 | [diff] [blame] | 4855 | { USB_DEVICE_WACOM(0x4001) }, |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 4856 | { USB_DEVICE_WACOM(0x4004) }, |
| 4857 | { USB_DEVICE_WACOM(0x5000) }, |
| 4858 | { USB_DEVICE_WACOM(0x5002) }, |
Benjamin Tissoires | 00d6f227 | 2014-12-01 11:52:39 -0500 | [diff] [blame] | 4859 | { USB_DEVICE_LENOVO(0x6004) }, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 4860 | |
| 4861 | { USB_DEVICE_WACOM(HID_ANY_ID) }, |
Mika Westerberg | eef23a8 | 2015-02-23 15:52:43 +0200 | [diff] [blame] | 4862 | { I2C_DEVICE_WACOM(HID_ANY_ID) }, |
Jason Gerecke | b9e0625 | 2017-01-25 12:08:35 -0800 | [diff] [blame] | 4863 | { BT_DEVICE_WACOM(HID_ANY_ID) }, |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 4864 | { } |
| 4865 | }; |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4866 | MODULE_DEVICE_TABLE(hid, wacom_ids); |