Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1 | /* |
Dmitry Torokhov | 4104d13 | 2007-05-07 16:16:29 -0400 | [diff] [blame] | 2 | * drivers/input/tablet/wacom_wac.c |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3 | * |
Ping Cheng | ee54500 | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 4 | * USB Wacom tablet support - Wacom specific code |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 5 | * |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | */ |
Dmitry Torokhov | 51269fe | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 14 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 15 | #include "wacom_wac.h" |
Dmitry Torokhov | 51269fe | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 16 | #include "wacom.h" |
Henrik Rydberg | 47c78e8 | 2010-11-27 09:16:48 +0100 | [diff] [blame] | 17 | #include <linux/input/mt.h> |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 18 | |
Ping Cheng | e35fb8c | 2011-03-26 21:16:05 -0700 | [diff] [blame] | 19 | /* resolution for penabled devices */ |
| 20 | #define WACOM_PL_RES 20 |
| 21 | #define WACOM_PENPRTN_RES 40 |
| 22 | #define WACOM_VOLITO_RES 50 |
| 23 | #define WACOM_GRAPHIRE_RES 80 |
| 24 | #define WACOM_INTUOS_RES 100 |
| 25 | #define WACOM_INTUOS3_RES 200 |
| 26 | |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 27 | /* Newer Cintiq and DTU have an offset between tablet and screen areas */ |
| 28 | #define WACOM_DTU_OFFSET 200 |
| 29 | #define WACOM_CINTIQ_OFFSET 400 |
| 30 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 31 | /* |
| 32 | * Scale factor relating reported contact size to logical contact area. |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 33 | * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo |
| 34 | */ |
| 35 | #define WACOM_CONTACT_AREA_SCALE 2607 |
| 36 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 37 | static bool touch_arbitration = 1; |
| 38 | module_param(touch_arbitration, bool, 0644); |
| 39 | MODULE_PARM_DESC(touch_arbitration, " on (Y) off (N)"); |
| 40 | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 41 | static void wacom_report_numbered_buttons(struct input_dev *input_dev, |
| 42 | int button_count, int mask); |
| 43 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 44 | static int wacom_numbered_button_to_key(int n); |
| 45 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 46 | /* |
| 47 | * Percent of battery capacity for Graphire. |
| 48 | * 8th value means AC online and show 100% capacity. |
| 49 | */ |
| 50 | static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; |
| 51 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 52 | /* |
| 53 | * Percent of battery capacity for Intuos4 WL, AC has a separate bit. |
| 54 | */ |
| 55 | static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 }; |
| 56 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 57 | static void __wacom_notify_battery(struct wacom_battery *battery, |
| 58 | int bat_capacity, bool bat_charging, |
| 59 | bool bat_connected, bool ps_connected) |
| 60 | { |
| 61 | bool changed = battery->battery_capacity != bat_capacity || |
| 62 | battery->bat_charging != bat_charging || |
| 63 | battery->bat_connected != bat_connected || |
| 64 | battery->ps_connected != ps_connected; |
| 65 | |
| 66 | if (changed) { |
| 67 | battery->battery_capacity = bat_capacity; |
| 68 | battery->bat_charging = bat_charging; |
| 69 | battery->bat_connected = bat_connected; |
| 70 | battery->ps_connected = ps_connected; |
| 71 | |
| 72 | if (battery->battery) |
| 73 | power_supply_changed(battery->battery); |
| 74 | } |
| 75 | } |
| 76 | |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 77 | static void wacom_notify_battery(struct wacom_wac *wacom_wac, |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 78 | int bat_capacity, bool bat_charging, bool bat_connected, |
| 79 | bool ps_connected) |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 80 | { |
| 81 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 82 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 83 | __wacom_notify_battery(&wacom->battery, bat_capacity, bat_charging, |
| 84 | bat_connected, ps_connected); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 85 | } |
| 86 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 87 | static int wacom_penpartner_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 88 | { |
| 89 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 90 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 91 | |
| 92 | switch (data[0]) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 93 | case 1: |
| 94 | if (data[5] & 0x80) { |
| 95 | wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
| 96 | wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 97 | input_report_key(input, wacom->tool[0], 1); |
| 98 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 99 | input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); |
| 100 | input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3])); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 101 | input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127); |
| 102 | input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); |
| 103 | input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 104 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 105 | input_report_key(input, wacom->tool[0], 0); |
| 106 | input_report_abs(input, ABS_MISC, 0); /* report tool id */ |
| 107 | input_report_abs(input, ABS_PRESSURE, -1); |
| 108 | input_report_key(input, BTN_TOUCH, 0); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 109 | } |
| 110 | break; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 111 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 112 | case 2: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 113 | input_report_key(input, BTN_TOOL_PEN, 1); |
| 114 | input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */ |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 115 | input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); |
| 116 | input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3])); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 117 | input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127); |
| 118 | input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); |
| 119 | input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 120 | break; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 121 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 122 | default: |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 123 | dev_dbg(input->dev.parent, |
| 124 | "%s: received unknown report #%d\n", __func__, data[0]); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 125 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 126 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 127 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 128 | return 1; |
| 129 | } |
| 130 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 131 | static int wacom_pl_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 132 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 133 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 134 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 135 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 136 | int prox, pressure; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 137 | |
Ping Cheng | cad7470 | 2009-12-15 00:35:25 -0800 | [diff] [blame] | 138 | if (data[0] != WACOM_REPORT_PENABLED) { |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 139 | dev_dbg(input->dev.parent, |
| 140 | "%s: received unknown report #%d\n", __func__, data[0]); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 141 | return 0; |
| 142 | } |
| 143 | |
| 144 | prox = data[1] & 0x40; |
| 145 | |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 146 | if (!wacom->id[0]) { |
| 147 | if ((data[0] & 0x10) || (data[4] & 0x20)) { |
| 148 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 149 | wacom->id[0] = ERASER_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 150 | } |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 151 | else { |
| 152 | wacom->tool[0] = BTN_TOOL_PEN; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 153 | wacom->id[0] = STYLUS_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 154 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Jason Gerecke | 025bcc1 | 2015-08-03 10:18:10 -0700 | [diff] [blame] | 157 | /* If the eraser is in prox, STYLUS2 is always set. If we |
| 158 | * mis-detected the type and notice that STYLUS2 isn't set |
| 159 | * then force the eraser out of prox and let the pen in. |
| 160 | */ |
| 161 | if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { |
| 162 | input_report_key(input, BTN_TOOL_RUBBER, 0); |
| 163 | input_report_abs(input, ABS_MISC, 0); |
| 164 | input_sync(input); |
| 165 | wacom->tool[0] = BTN_TOOL_PEN; |
| 166 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 167 | } |
| 168 | |
| 169 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
| 170 | if (features->pressure_max > 255) |
| 171 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
| 172 | pressure += (features->pressure_max + 1) / 2; |
| 173 | |
| 174 | input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
| 175 | input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
| 176 | input_report_abs(input, ABS_PRESSURE, pressure); |
| 177 | |
| 178 | input_report_key(input, BTN_TOUCH, data[4] & 0x08); |
| 179 | input_report_key(input, BTN_STYLUS, data[4] & 0x10); |
| 180 | /* Only allow the stylus2 button to be reported for the pen tool. */ |
| 181 | input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); |
| 182 | |
| 183 | if (!prox) |
| 184 | wacom->id[0] = 0; |
| 185 | input_report_key(input, wacom->tool[0], prox); |
| 186 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 187 | return 1; |
| 188 | } |
| 189 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 190 | static int wacom_ptu_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 191 | { |
| 192 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 193 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 194 | |
Ping Cheng | cad7470 | 2009-12-15 00:35:25 -0800 | [diff] [blame] | 195 | if (data[0] != WACOM_REPORT_PENABLED) { |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 196 | dev_dbg(input->dev.parent, |
| 197 | "%s: received unknown report #%d\n", __func__, data[0]); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 198 | return 0; |
| 199 | } |
| 200 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 201 | if (data[1] & 0x04) { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 202 | input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20); |
| 203 | input_report_key(input, BTN_TOUCH, data[1] & 0x08); |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 204 | wacom->id[0] = ERASER_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 205 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 206 | input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20); |
| 207 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 208 | wacom->id[0] = STYLUS_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 209 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 210 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 211 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 212 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
| 213 | input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6])); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 214 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 215 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 216 | return 1; |
| 217 | } |
| 218 | |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 219 | static int wacom_dtu_irq(struct wacom_wac *wacom) |
| 220 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 221 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 222 | struct input_dev *input = wacom->pen_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 223 | int prox = data[1] & 0x20; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 224 | |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 225 | dev_dbg(input->dev.parent, |
| 226 | "%s: received report #%d", __func__, data[0]); |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 227 | |
| 228 | if (prox) { |
| 229 | /* Going into proximity select tool */ |
| 230 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
| 231 | if (wacom->tool[0] == BTN_TOOL_PEN) |
| 232 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 233 | else |
| 234 | wacom->id[0] = ERASER_DEVICE_ID; |
| 235 | } |
| 236 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 237 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
| 238 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 239 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 240 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]); |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 241 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
| 242 | if (!prox) /* out-prox */ |
| 243 | wacom->id[0] = 0; |
| 244 | input_report_key(input, wacom->tool[0], prox); |
| 245 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
| 246 | return 1; |
| 247 | } |
| 248 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 249 | static int wacom_dtus_irq(struct wacom_wac *wacom) |
| 250 | { |
| 251 | char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 252 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 253 | unsigned short prox, pressure = 0; |
| 254 | |
| 255 | if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { |
| 256 | dev_dbg(input->dev.parent, |
| 257 | "%s: received unknown report #%d", __func__, data[0]); |
| 258 | return 0; |
| 259 | } else if (data[0] == WACOM_REPORT_DTUSPAD) { |
Benjamin Tissoires | 422b031 | 2014-07-24 12:50:39 -0700 | [diff] [blame] | 260 | input = wacom->pad_input; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 261 | input_report_key(input, BTN_0, (data[1] & 0x01)); |
| 262 | input_report_key(input, BTN_1, (data[1] & 0x02)); |
| 263 | input_report_key(input, BTN_2, (data[1] & 0x04)); |
| 264 | input_report_key(input, BTN_3, (data[1] & 0x08)); |
| 265 | input_report_abs(input, ABS_MISC, |
| 266 | data[1] & 0x0f ? PAD_DEVICE_ID : 0); |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 267 | return 1; |
| 268 | } else { |
| 269 | prox = data[1] & 0x80; |
| 270 | if (prox) { |
| 271 | switch ((data[1] >> 3) & 3) { |
| 272 | case 1: /* Rubber */ |
| 273 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 274 | wacom->id[0] = ERASER_DEVICE_ID; |
| 275 | break; |
| 276 | |
| 277 | case 2: /* Pen */ |
| 278 | wacom->tool[0] = BTN_TOOL_PEN; |
| 279 | wacom->id[0] = STYLUS_DEVICE_ID; |
| 280 | break; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | input_report_key(input, BTN_STYLUS, data[1] & 0x20); |
| 285 | input_report_key(input, BTN_STYLUS2, data[1] & 0x40); |
| 286 | input_report_abs(input, ABS_X, get_unaligned_be16(&data[3])); |
| 287 | input_report_abs(input, ABS_Y, get_unaligned_be16(&data[5])); |
| 288 | pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff); |
| 289 | input_report_abs(input, ABS_PRESSURE, pressure); |
| 290 | input_report_key(input, BTN_TOUCH, pressure > 10); |
| 291 | |
| 292 | if (!prox) /* out-prox */ |
| 293 | wacom->id[0] = 0; |
| 294 | input_report_key(input, wacom->tool[0], prox); |
| 295 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 296 | return 1; |
| 297 | } |
| 298 | } |
| 299 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 300 | static int wacom_graphire_irq(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 301 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 302 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 303 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 304 | struct input_dev *input = wacom->pen_input; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 305 | struct input_dev *pad_input = wacom->pad_input; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 306 | int battery_capacity, ps_connected; |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 307 | int prox; |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 308 | int rw = 0; |
| 309 | int retval = 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 310 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 311 | if (features->type == GRAPHIRE_BT) { |
| 312 | if (data[0] != WACOM_REPORT_PENABLED_BT) { |
| 313 | dev_dbg(input->dev.parent, |
| 314 | "%s: received unknown report #%d\n", __func__, |
| 315 | data[0]); |
| 316 | goto exit; |
| 317 | } |
| 318 | } else if (data[0] != WACOM_REPORT_PENABLED) { |
Dmitry Torokhov | eb71d1b | 2012-05-02 00:13:38 -0700 | [diff] [blame] | 319 | dev_dbg(input->dev.parent, |
| 320 | "%s: received unknown report #%d\n", __func__, data[0]); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 321 | goto exit; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 322 | } |
| 323 | |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 324 | prox = data[1] & 0x80; |
| 325 | if (prox || wacom->id[0]) { |
| 326 | if (prox) { |
| 327 | switch ((data[1] >> 5) & 3) { |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 328 | |
| 329 | case 0: /* Pen */ |
| 330 | wacom->tool[0] = BTN_TOOL_PEN; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 331 | wacom->id[0] = STYLUS_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 332 | break; |
| 333 | |
| 334 | case 1: /* Rubber */ |
| 335 | wacom->tool[0] = BTN_TOOL_RUBBER; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 336 | wacom->id[0] = ERASER_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 337 | break; |
| 338 | |
| 339 | case 2: /* Mouse with wheel */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 340 | input_report_key(input, BTN_MIDDLE, data[1] & 0x04); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 341 | /* fall through */ |
| 342 | |
| 343 | case 3: /* Mouse without wheel */ |
| 344 | wacom->tool[0] = BTN_TOOL_MOUSE; |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 345 | wacom->id[0] = CURSOR_DEVICE_ID; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 346 | break; |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 347 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 348 | } |
Dmitry Torokhov | 252f776 | 2010-03-19 22:33:38 -0700 | [diff] [blame] | 349 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 350 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 351 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 352 | if (features->type == GRAPHIRE_BT) |
| 353 | input_report_abs(input, ABS_PRESSURE, data[6] | |
| 354 | (((__u16) (data[1] & 0x08)) << 5)); |
| 355 | else |
| 356 | input_report_abs(input, ABS_PRESSURE, data[6] | |
| 357 | ((data[7] & 0x03) << 8)); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 358 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
| 359 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 360 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); |
Dmitry Torokhov | afb567e | 2010-04-13 23:08:58 -0700 | [diff] [blame] | 361 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 362 | input_report_key(input, BTN_LEFT, data[1] & 0x01); |
| 363 | input_report_key(input, BTN_RIGHT, data[1] & 0x02); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 364 | if (features->type == WACOM_G4 || |
| 365 | features->type == WACOM_MO) { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 366 | input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); |
Mike Auty | d9f66c1 | 2010-08-28 20:35:17 -0700 | [diff] [blame] | 367 | rw = (data[7] & 0x04) - (data[7] & 0x03); |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 368 | } else if (features->type == GRAPHIRE_BT) { |
| 369 | /* Compute distance between mouse and tablet */ |
| 370 | rw = 44 - (data[6] >> 2); |
| 371 | rw = clamp_val(rw, 0, 31); |
| 372 | input_report_abs(input, ABS_DISTANCE, rw); |
| 373 | if (((data[1] >> 5) & 3) == 2) { |
| 374 | /* Mouse with wheel */ |
| 375 | input_report_key(input, BTN_MIDDLE, |
| 376 | data[1] & 0x04); |
| 377 | rw = (data[6] & 0x01) ? -1 : |
| 378 | (data[6] & 0x02) ? 1 : 0; |
| 379 | } else { |
| 380 | rw = 0; |
| 381 | } |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 382 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 383 | input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); |
Mike Auty | d9f66c1 | 2010-08-28 20:35:17 -0700 | [diff] [blame] | 384 | rw = -(signed char)data[6]; |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 385 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 386 | input_report_rel(input, REL_WHEEL, rw); |
Dmitry Torokhov | afb567e | 2010-04-13 23:08:58 -0700 | [diff] [blame] | 387 | } |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 388 | |
| 389 | if (!prox) |
| 390 | wacom->id[0] = 0; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 391 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
| 392 | input_report_key(input, wacom->tool[0], prox); |
| 393 | input_sync(input); /* sync last event */ |
Ping Cheng | 80d4e8e | 2007-02-23 12:22:48 -0800 | [diff] [blame] | 394 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 395 | |
| 396 | /* send pad data */ |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 397 | switch (features->type) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 398 | case WACOM_G4: |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 399 | prox = data[7] & 0xf8; |
| 400 | if (prox || wacom->id[1]) { |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 401 | wacom->id[1] = PAD_DEVICE_ID; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 402 | input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); |
| 403 | input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 404 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 405 | input_report_rel(pad_input, REL_WHEEL, rw); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 406 | if (!prox) |
| 407 | wacom->id[1] = 0; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 408 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
Ping Cheng | ab687b1 | 2010-04-05 23:07:41 -0700 | [diff] [blame] | 409 | retval = 1; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 410 | } |
Ping Cheng | 7ecfbfd | 2007-06-14 23:32:48 -0400 | [diff] [blame] | 411 | break; |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 412 | |
| 413 | case WACOM_MO: |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 414 | prox = (data[7] & 0xf8) || data[8]; |
| 415 | if (prox || wacom->id[1]) { |
Ping Cheng | e34b9d2 | 2008-05-05 11:36:41 -0400 | [diff] [blame] | 416 | wacom->id[1] = PAD_DEVICE_ID; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 417 | input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); |
| 418 | input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); |
| 419 | input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); |
| 420 | input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); |
| 421 | input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 422 | if (!prox) |
| 423 | wacom->id[1] = 0; |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 424 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
Ping Cheng | 8446001 | 2011-07-06 18:05:43 -0700 | [diff] [blame] | 425 | retval = 1; |
Ping Cheng | 7ecfbfd | 2007-06-14 23:32:48 -0400 | [diff] [blame] | 426 | } |
| 427 | break; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 428 | case GRAPHIRE_BT: |
| 429 | prox = data[7] & 0x03; |
| 430 | if (prox || wacom->id[1]) { |
| 431 | wacom->id[1] = PAD_DEVICE_ID; |
| 432 | input_report_key(pad_input, BTN_0, (data[7] & 0x02)); |
| 433 | input_report_key(pad_input, BTN_1, (data[7] & 0x01)); |
| 434 | if (!prox) |
| 435 | wacom->id[1] = 0; |
| 436 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
| 437 | retval = 1; |
| 438 | } |
| 439 | break; |
| 440 | } |
| 441 | |
| 442 | /* Store current battery capacity and power supply state */ |
| 443 | if (features->type == GRAPHIRE_BT) { |
| 444 | rw = (data[7] >> 2 & 0x07); |
| 445 | battery_capacity = batcap_gr[rw]; |
| 446 | ps_connected = rw == 7; |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 447 | wacom_notify_battery(wacom, battery_capacity, ps_connected, |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 448 | 1, ps_connected); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 449 | } |
Ping Cheng | 3b57ca0 | 2010-03-04 21:50:59 -0800 | [diff] [blame] | 450 | exit: |
| 451 | return retval; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
Benjamin Tissoires | 5fcad16 | 2015-03-05 17:36:54 -0500 | [diff] [blame] | 454 | static void wacom_intuos_schedule_prox_event(struct wacom_wac *wacom_wac) |
| 455 | { |
| 456 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 0bbfe28 | 2016-01-06 13:25:53 -0800 | [diff] [blame] | 457 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 5fcad16 | 2015-03-05 17:36:54 -0500 | [diff] [blame] | 458 | struct hid_report *r; |
| 459 | struct hid_report_enum *re; |
| 460 | |
| 461 | re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); |
Jason Gerecke | 0bbfe28 | 2016-01-06 13:25:53 -0800 | [diff] [blame] | 462 | if (features->type == INTUOSHT2) |
| 463 | r = re->report_id_hash[WACOM_REPORT_INTUOSHT2_ID]; |
| 464 | else |
| 465 | r = re->report_id_hash[WACOM_REPORT_INTUOS_ID1]; |
Benjamin Tissoires | 5fcad16 | 2015-03-05 17:36:54 -0500 | [diff] [blame] | 466 | if (r) { |
| 467 | hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); |
| 468 | } |
| 469 | } |
| 470 | |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 471 | static int wacom_intuos_pad(struct wacom_wac *wacom) |
| 472 | { |
| 473 | struct wacom_features *features = &wacom->features; |
| 474 | unsigned char *data = wacom->data; |
| 475 | struct input_dev *input = wacom->pad_input; |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 476 | int i; |
| 477 | int buttons = 0, nbuttons = features->numbered_buttons; |
| 478 | int keys = 0, nkeys = 0; |
| 479 | int ring1 = 0, ring2 = 0; |
| 480 | int strip1 = 0, strip2 = 0; |
| 481 | bool prox = false; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 482 | |
| 483 | /* pad packets. Works as a second tool and is always in prox */ |
| 484 | if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD || |
| 485 | data[0] == WACOM_REPORT_CINTIQPAD)) |
| 486 | return 0; |
| 487 | |
| 488 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 489 | buttons = (data[3] << 1) | (data[2] & 0x01); |
| 490 | ring1 = data[1]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 491 | } else if (features->type == DTK) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 492 | buttons = data[6]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 493 | } else if (features->type == WACOM_13HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 494 | buttons = (data[4] << 1) | (data[3] & 0x01); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 495 | } else if (features->type == WACOM_24HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 496 | buttons = (data[8] << 8) | data[6]; |
| 497 | ring1 = data[1]; |
| 498 | ring2 = data[2]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 499 | |
| 500 | /* |
| 501 | * Three "buttons" are available on the 24HD which are |
| 502 | * physically implemented as a touchstrip. Each button |
| 503 | * is approximately 3 bits wide with a 2 bit spacing. |
| 504 | * The raw touchstrip bits are stored at: |
| 505 | * ((data[3] & 0x1f) << 8) | data[4]) |
| 506 | */ |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 507 | nkeys = 3; |
| 508 | keys = ((data[3] & 0x1C) ? 1<<2 : 0) | |
| 509 | ((data[4] & 0xE0) ? 1<<1 : 0) | |
| 510 | ((data[4] & 0x07) ? 1<<0 : 0); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 511 | } else if (features->type == WACOM_27QHD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 512 | nkeys = 3; |
| 513 | keys = data[2] & 0x07; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 514 | |
| 515 | input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); |
| 516 | input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); |
| 517 | input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 518 | } else if (features->type == CINTIQ_HYBRID) { |
| 519 | /* |
| 520 | * Do not send hardware buttons under Android. They |
| 521 | * are already sent to the system through GPIO (and |
| 522 | * have different meaning). |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 523 | * |
| 524 | * d-pad right -> data[4] & 0x10 |
| 525 | * d-pad up -> data[4] & 0x20 |
| 526 | * d-pad left -> data[4] & 0x40 |
| 527 | * d-pad down -> data[4] & 0x80 |
| 528 | * d-pad center -> data[3] & 0x01 |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 529 | */ |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 530 | buttons = (data[4] << 1) | (data[3] & 0x01); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 531 | } else if (features->type == CINTIQ_COMPANION_2) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 532 | /* d-pad right -> data[4] & 0x10 |
| 533 | * d-pad up -> data[4] & 0x20 |
| 534 | * d-pad left -> data[4] & 0x40 |
| 535 | * d-pad down -> data[4] & 0x80 |
| 536 | * d-pad center -> data[3] & 0x01 |
| 537 | */ |
Jason Gerecke | 0402b6b | 2015-12-16 13:37:36 -0800 | [diff] [blame] | 538 | buttons = ((data[2] >> 4) << 7) | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 539 | ((data[1] & 0x04) << 6) | |
| 540 | ((data[2] & 0x0F) << 2) | |
| 541 | (data[1] & 0x03); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 542 | } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 543 | /* |
| 544 | * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in |
| 545 | * addition to the mechanical switch. Switch data is |
| 546 | * stored in data[4], capacitive data in data[5]. |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 547 | * |
| 548 | * Touch ring mode switch (data[3]) has no capacitive sensor |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 549 | */ |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 550 | buttons = (data[4] << 1) | (data[3] & 0x01); |
| 551 | ring1 = data[2]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 552 | } else { |
| 553 | if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 554 | buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) | |
| 555 | (data[6] << 1) | (data[5] & 0x01); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 556 | |
| 557 | if (features->type == WACOM_22HD) { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 558 | nkeys = 3; |
| 559 | keys = data[9] & 0x07; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 560 | } |
| 561 | } else { |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 562 | buttons = ((data[6] & 0x10) << 10) | |
| 563 | ((data[5] & 0x10) << 9) | |
| 564 | ((data[6] & 0x0F) << 4) | |
| 565 | (data[5] & 0x0F); |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 566 | } |
Jason Gerecke | f73d08d | 2015-12-16 13:37:33 -0800 | [diff] [blame] | 567 | strip1 = ((data[1] & 0x1f) << 8) | data[2]; |
| 568 | strip2 = ((data[3] & 0x1f) << 8) | data[4]; |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 569 | } |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 570 | |
Dan Carpenter | 8f9cfdd | 2015-12-09 13:22:05 +0300 | [diff] [blame] | 571 | prox = (buttons & ~(~0 << nbuttons)) | (keys & ~(~0 << nkeys)) | |
| 572 | (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 573 | |
| 574 | wacom_report_numbered_buttons(input, nbuttons, buttons); |
| 575 | |
| 576 | for (i = 0; i < nkeys; i++) |
| 577 | input_report_key(input, KEY_PROG1 + i, keys & (1 << i)); |
| 578 | |
| 579 | input_report_abs(input, ABS_RX, strip1); |
Jason Gerecke | 03a0dc5 | 2015-12-16 13:37:34 -0800 | [diff] [blame] | 580 | input_report_abs(input, ABS_RY, strip2); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 581 | |
Jason Gerecke | aaae03e | 2015-12-16 13:37:35 -0800 | [diff] [blame] | 582 | input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0); |
| 583 | input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 584 | |
| 585 | input_report_key(input, wacom->tool[1], prox ? 1 : 0); |
| 586 | input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); |
| 587 | |
| 588 | input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); |
| 589 | |
Jason Gerecke | fb013a0 | 2015-11-30 17:13:46 -0800 | [diff] [blame] | 590 | return 1; |
| 591 | } |
| 592 | |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 593 | static int wacom_intuos_id_mangle(int tool_id) |
| 594 | { |
| 595 | return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); |
| 596 | } |
| 597 | |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 598 | static int wacom_intuos_get_tool_type(int tool_id) |
| 599 | { |
| 600 | int tool_type; |
| 601 | |
| 602 | switch (tool_id) { |
| 603 | case 0x812: /* Inking pen */ |
| 604 | case 0x801: /* Intuos3 Inking pen */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 605 | case 0x12802: /* Intuos4/5 Inking Pen */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 606 | case 0x012: |
| 607 | tool_type = BTN_TOOL_PENCIL; |
| 608 | break; |
| 609 | |
| 610 | case 0x822: /* Pen */ |
| 611 | case 0x842: |
| 612 | case 0x852: |
| 613 | case 0x823: /* Intuos3 Grip Pen */ |
| 614 | case 0x813: /* Intuos3 Classic Pen */ |
| 615 | case 0x885: /* Intuos3 Marker Pen */ |
| 616 | case 0x802: /* Intuos4/5 13HD/24HD General Pen */ |
| 617 | case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ |
| 618 | case 0x8e2: /* IntuosHT2 pen */ |
| 619 | case 0x022: |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 620 | case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ |
| 621 | case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ |
| 622 | case 0x16802: /* Cintiq 13HD Pro Pen */ |
| 623 | case 0x18802: /* DTH2242 Pen */ |
| 624 | case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 625 | tool_type = BTN_TOOL_PEN; |
| 626 | break; |
| 627 | |
| 628 | case 0x832: /* Stroke pen */ |
| 629 | case 0x032: |
| 630 | tool_type = BTN_TOOL_BRUSH; |
| 631 | break; |
| 632 | |
| 633 | case 0x007: /* Mouse 4D and 2D */ |
| 634 | case 0x09c: |
| 635 | case 0x094: |
| 636 | case 0x017: /* Intuos3 2D Mouse */ |
| 637 | case 0x806: /* Intuos4 Mouse */ |
| 638 | tool_type = BTN_TOOL_MOUSE; |
| 639 | break; |
| 640 | |
| 641 | case 0x096: /* Lens cursor */ |
| 642 | case 0x097: /* Intuos3 Lens cursor */ |
| 643 | case 0x006: /* Intuos4 Lens cursor */ |
| 644 | tool_type = BTN_TOOL_LENS; |
| 645 | break; |
| 646 | |
| 647 | case 0x82a: /* Eraser */ |
Jason Gerecke | 9ce9a12 | 2016-11-11 15:05:52 -0800 | [diff] [blame] | 648 | case 0x84a: |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 649 | case 0x85a: |
| 650 | case 0x91a: |
| 651 | case 0xd1a: |
| 652 | case 0x0fa: |
| 653 | case 0x82b: /* Intuos3 Grip Pen Eraser */ |
| 654 | case 0x81b: /* Intuos3 Classic Pen Eraser */ |
| 655 | case 0x91b: /* Intuos3 Airbrush Eraser */ |
| 656 | case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */ |
| 657 | case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */ |
| 658 | case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 659 | case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */ |
| 660 | case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ |
| 661 | case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */ |
| 662 | case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */ |
| 663 | case 0x1880a: /* DTH2242 Eraser */ |
| 664 | case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 665 | tool_type = BTN_TOOL_RUBBER; |
| 666 | break; |
| 667 | |
| 668 | case 0xd12: |
| 669 | case 0x912: |
| 670 | case 0x112: |
| 671 | case 0x913: /* Intuos3 Airbrush */ |
| 672 | case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 673 | case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 674 | tool_type = BTN_TOOL_AIRBRUSH; |
| 675 | break; |
| 676 | |
| 677 | default: /* Unknown tool */ |
| 678 | tool_type = BTN_TOOL_PEN; |
| 679 | break; |
| 680 | } |
| 681 | return tool_type; |
| 682 | } |
| 683 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 684 | static int wacom_intuos_inout(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 685 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 686 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 687 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 688 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 689 | int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 690 | |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 691 | if (!(((data[1] & 0xfc) == 0xc0) || /* in prox */ |
| 692 | ((data[1] & 0xfe) == 0x20) || /* in range */ |
| 693 | ((data[1] & 0xfe) == 0x80))) /* out prox */ |
| 694 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 695 | |
| 696 | /* Enter report */ |
| 697 | if ((data[1] & 0xfc) == 0xc0) { |
| 698 | /* serial number of the tool */ |
| 699 | wacom->serial[idx] = ((data[3] & 0x0f) << 28) + |
| 700 | (data[4] << 20) + (data[5] << 12) + |
| 701 | (data[6] << 4) + (data[7] >> 4); |
| 702 | |
Ping Cheng | 493630b | 2010-06-22 11:21:34 -0700 | [diff] [blame] | 703 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 704 | ((data[7] & 0x0f) << 16) | ((data[8] & 0xf0) << 8); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 705 | |
Benjamin Tissoires | 7e12978 | 2016-02-12 17:27:40 +0100 | [diff] [blame] | 706 | wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 707 | |
Ping Cheng | eff6ca9 | 2016-05-02 21:17:34 -0700 | [diff] [blame] | 708 | wacom->shared->stylus_in_proximity = true; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 709 | return 1; |
| 710 | } |
| 711 | |
Ping Cheng | c1b03f5 | 2016-01-08 17:16:06 -0800 | [diff] [blame] | 712 | /* in Range */ |
| 713 | if ((data[1] & 0xfe) == 0x20) { |
Ping Cheng | 526d6e7 | 2016-01-08 17:16:25 -0800 | [diff] [blame] | 714 | if (features->type != INTUOSHT2) |
| 715 | wacom->shared->stylus_in_proximity = true; |
Ping Cheng | 486b908 | 2015-02-20 14:25:58 -0800 | [diff] [blame] | 716 | |
Ping Cheng | c1b03f5 | 2016-01-08 17:16:06 -0800 | [diff] [blame] | 717 | /* in Range while exiting */ |
| 718 | if (wacom->reporting_data) { |
| 719 | input_report_key(input, BTN_TOUCH, 0); |
| 720 | input_report_abs(input, ABS_PRESSURE, 0); |
| 721 | input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); |
| 722 | return 2; |
| 723 | } |
| 724 | return 1; |
Jason Gerecke | 4eb1830 | 2013-09-20 09:48:46 -0700 | [diff] [blame] | 725 | } |
| 726 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 727 | /* Exit report */ |
| 728 | if ((data[1] & 0xfe) == 0x80) { |
Ping Cheng | f3586d2 | 2015-03-20 14:57:00 -0700 | [diff] [blame] | 729 | wacom->shared->stylus_in_proximity = false; |
Ping Cheng | b3bd7ef | 2015-01-09 11:05:13 -0800 | [diff] [blame] | 730 | wacom->reporting_data = false; |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 731 | |
Ping Cheng | 373a535 | 2015-01-09 11:04:50 -0800 | [diff] [blame] | 732 | /* don't report exit if we don't know the ID */ |
| 733 | if (!wacom->id[idx]) |
| 734 | return 1; |
| 735 | |
Ping Cheng | 6f660f1 | 2009-05-08 18:30:33 -0700 | [diff] [blame] | 736 | /* |
| 737 | * Reset all states otherwise we lose the initial states |
| 738 | * when in-prox next time |
| 739 | */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 740 | input_report_abs(input, ABS_X, 0); |
| 741 | input_report_abs(input, ABS_Y, 0); |
| 742 | input_report_abs(input, ABS_DISTANCE, 0); |
| 743 | input_report_abs(input, ABS_TILT_X, 0); |
| 744 | input_report_abs(input, ABS_TILT_Y, 0); |
Ping Cheng | 80d4e8e | 2007-02-23 12:22:48 -0800 | [diff] [blame] | 745 | if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 746 | input_report_key(input, BTN_LEFT, 0); |
| 747 | input_report_key(input, BTN_MIDDLE, 0); |
| 748 | input_report_key(input, BTN_RIGHT, 0); |
| 749 | input_report_key(input, BTN_SIDE, 0); |
| 750 | input_report_key(input, BTN_EXTRA, 0); |
| 751 | input_report_abs(input, ABS_THROTTLE, 0); |
| 752 | input_report_abs(input, ABS_RZ, 0); |
Ping Cheng | 7ecfbfd | 2007-06-14 23:32:48 -0400 | [diff] [blame] | 753 | } else { |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 754 | input_report_abs(input, ABS_PRESSURE, 0); |
| 755 | input_report_key(input, BTN_STYLUS, 0); |
| 756 | input_report_key(input, BTN_STYLUS2, 0); |
| 757 | input_report_key(input, BTN_TOUCH, 0); |
| 758 | input_report_abs(input, ABS_WHEEL, 0); |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 759 | if (features->type >= INTUOS3S) |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 760 | input_report_abs(input, ABS_Z, 0); |
Ping Cheng | 8d32e3a | 2006-09-26 13:34:47 -0700 | [diff] [blame] | 761 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 762 | input_report_key(input, wacom->tool[idx], 0); |
| 763 | input_report_abs(input, ABS_MISC, 0); /* reset tool id */ |
| 764 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
Ping Cheng | 6f660f1 | 2009-05-08 18:30:33 -0700 | [diff] [blame] | 765 | wacom->id[idx] = 0; |
Ping Cheng | 80d4e8e | 2007-02-23 12:22:48 -0800 | [diff] [blame] | 766 | return 2; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 767 | } |
Ping Cheng | 373a535 | 2015-01-09 11:04:50 -0800 | [diff] [blame] | 768 | |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 769 | return 0; |
| 770 | } |
| 771 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 772 | static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) |
| 773 | { |
| 774 | unsigned char *data = wacom_wac->data; |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 775 | struct input_dev *input; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 776 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Benjamin Tissoires | 83e6b40 | 2016-07-13 18:06:02 +0200 | [diff] [blame] | 777 | struct wacom_remote *remote = wacom->remote; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 778 | int bat_charging, bat_percent, touch_ring_mode; |
| 779 | __u32 serial; |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 780 | int i, index = -1; |
| 781 | unsigned long flags; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 782 | |
| 783 | if (data[0] != WACOM_REPORT_REMOTE) { |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 784 | hid_dbg(wacom->hdev, "%s: received unknown report #%d", |
| 785 | __func__, data[0]); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 786 | return 0; |
| 787 | } |
| 788 | |
| 789 | serial = data[3] + (data[4] << 8) + (data[5] << 16); |
| 790 | wacom_wac->id[0] = PAD_DEVICE_ID; |
| 791 | |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 792 | spin_lock_irqsave(&remote->remote_lock, flags); |
| 793 | |
| 794 | for (i = 0; i < WACOM_MAX_REMOTES; i++) { |
| 795 | if (remote->remotes[i].serial == serial) { |
| 796 | index = i; |
| 797 | break; |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | if (index < 0 || !remote->remotes[index].registered) |
| 802 | goto out; |
| 803 | |
| 804 | input = remote->remotes[index].input; |
| 805 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 806 | input_report_key(input, BTN_0, (data[9] & 0x01)); |
| 807 | input_report_key(input, BTN_1, (data[9] & 0x02)); |
| 808 | input_report_key(input, BTN_2, (data[9] & 0x04)); |
| 809 | input_report_key(input, BTN_3, (data[9] & 0x08)); |
| 810 | input_report_key(input, BTN_4, (data[9] & 0x10)); |
| 811 | input_report_key(input, BTN_5, (data[9] & 0x20)); |
| 812 | input_report_key(input, BTN_6, (data[9] & 0x40)); |
| 813 | input_report_key(input, BTN_7, (data[9] & 0x80)); |
| 814 | |
| 815 | input_report_key(input, BTN_8, (data[10] & 0x01)); |
| 816 | input_report_key(input, BTN_9, (data[10] & 0x02)); |
| 817 | input_report_key(input, BTN_A, (data[10] & 0x04)); |
| 818 | input_report_key(input, BTN_B, (data[10] & 0x08)); |
| 819 | input_report_key(input, BTN_C, (data[10] & 0x10)); |
| 820 | input_report_key(input, BTN_X, (data[10] & 0x20)); |
| 821 | input_report_key(input, BTN_Y, (data[10] & 0x40)); |
| 822 | input_report_key(input, BTN_Z, (data[10] & 0x80)); |
| 823 | |
| 824 | input_report_key(input, BTN_BASE, (data[11] & 0x01)); |
| 825 | input_report_key(input, BTN_BASE2, (data[11] & 0x02)); |
| 826 | |
| 827 | if (data[12] & 0x80) |
| 828 | input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f)); |
| 829 | else |
| 830 | input_report_abs(input, ABS_WHEEL, 0); |
| 831 | |
| 832 | bat_percent = data[7] & 0x7f; |
| 833 | bat_charging = !!(data[7] & 0x80); |
| 834 | |
| 835 | if (data[9] | data[10] | (data[11] & 0x03) | data[12]) |
| 836 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
| 837 | else |
| 838 | input_report_abs(input, ABS_MISC, 0); |
| 839 | |
| 840 | input_event(input, EV_MSC, MSC_SERIAL, serial); |
| 841 | |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 842 | input_sync(input); |
| 843 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 844 | /*Which mode select (LED light) is currently on?*/ |
| 845 | touch_ring_mode = (data[11] & 0xC0) >> 6; |
| 846 | |
| 847 | for (i = 0; i < WACOM_MAX_REMOTES; i++) { |
Benjamin Tissoires | e7749f6 | 2016-07-13 18:06:06 +0200 | [diff] [blame] | 848 | if (remote->remotes[i].serial == serial) |
Benjamin Tissoires | a50aac7 | 2016-07-13 18:06:00 +0200 | [diff] [blame] | 849 | wacom->led.groups[i].select = touch_ring_mode; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 850 | } |
| 851 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 852 | __wacom_notify_battery(&remote->remotes[index].battery, bat_percent, |
| 853 | bat_charging, 1, bat_charging); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 854 | |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 855 | out: |
| 856 | spin_unlock_irqrestore(&remote->remote_lock, flags); |
| 857 | return 0; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 858 | } |
| 859 | |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 860 | static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 861 | { |
| 862 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
| 863 | unsigned char *data = wacom_wac->data; |
Benjamin Tissoires | 83e6b40 | 2016-07-13 18:06:02 +0200 | [diff] [blame] | 864 | struct wacom_remote *remote = wacom->remote; |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 865 | struct wacom_remote_data remote_data; |
| 866 | unsigned long flags; |
| 867 | int i, ret; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 868 | |
| 869 | if (data[0] != WACOM_REPORT_DEVICE_LIST) |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 870 | return; |
| 871 | |
| 872 | memset(&remote_data, 0, sizeof(struct wacom_remote_data)); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 873 | |
| 874 | for (i = 0; i < WACOM_MAX_REMOTES; i++) { |
| 875 | int j = i * 6; |
| 876 | int serial = (data[j+6] << 16) + (data[j+5] << 8) + data[j+4]; |
| 877 | bool connected = data[j+2]; |
| 878 | |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 879 | remote_data.remote[i].serial = serial; |
| 880 | remote_data.remote[i].connected = connected; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 881 | } |
| 882 | |
Benjamin Tissoires | 83e6b40 | 2016-07-13 18:06:02 +0200 | [diff] [blame] | 883 | spin_lock_irqsave(&remote->remote_lock, flags); |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 884 | |
Benjamin Tissoires | 83e6b40 | 2016-07-13 18:06:02 +0200 | [diff] [blame] | 885 | ret = kfifo_in(&remote->remote_fifo, &remote_data, sizeof(remote_data)); |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 886 | if (ret != sizeof(remote_data)) { |
Benjamin Tissoires | 83e6b40 | 2016-07-13 18:06:02 +0200 | [diff] [blame] | 887 | spin_unlock_irqrestore(&remote->remote_lock, flags); |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 888 | hid_err(wacom->hdev, "Can't queue Remote status event.\n"); |
| 889 | return; |
| 890 | } |
| 891 | |
Benjamin Tissoires | 83e6b40 | 2016-07-13 18:06:02 +0200 | [diff] [blame] | 892 | spin_unlock_irqrestore(&remote->remote_lock, flags); |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 893 | |
| 894 | wacom_schedule_work(wacom_wac, WACOM_WORKER_REMOTE); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 895 | } |
| 896 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 897 | static inline bool report_touch_events(struct wacom_wac *wacom) |
| 898 | { |
| 899 | return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1); |
| 900 | } |
| 901 | |
| 902 | static inline bool delay_pen_events(struct wacom_wac *wacom) |
| 903 | { |
| 904 | return (wacom->shared->touch_down && touch_arbitration); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 905 | } |
| 906 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 907 | static int wacom_intuos_general(struct wacom_wac *wacom) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 908 | { |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 909 | struct wacom_features *features = &wacom->features; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 910 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 911 | struct input_dev *input = wacom->pen_input; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 912 | int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 913 | unsigned char type = (data[1] >> 1) & 0x0F; |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 914 | unsigned int x, y, distance, t; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 915 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 916 | if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_CINTIQ && |
| 917 | data[0] != WACOM_REPORT_INTUOS_PEN) |
| 918 | return 0; |
| 919 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 920 | if (delay_pen_events(wacom)) |
Ping Cheng | c1b03f5 | 2016-01-08 17:16:06 -0800 | [diff] [blame] | 921 | return 1; |
| 922 | |
Ping Cheng | 599b082 | 2016-01-08 17:14:54 -0800 | [diff] [blame] | 923 | /* don't report events if we don't know the tool ID */ |
| 924 | if (!wacom->id[idx]) { |
| 925 | /* but reschedule a read of the current tool */ |
| 926 | wacom_intuos_schedule_prox_event(wacom); |
| 927 | return 1; |
| 928 | } |
| 929 | |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 930 | /* |
| 931 | * don't report events for invalid data |
| 932 | */ |
| 933 | /* older I4 styli don't work with new Cintiqs */ |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 934 | if ((!((wacom->id[idx] >> 16) & 0x01) && |
Ping Cheng | 4750f5f | 2016-01-08 17:15:48 -0800 | [diff] [blame] | 935 | (features->type == WACOM_21UX2)) || |
| 936 | /* Only large Intuos support Lense Cursor */ |
| 937 | (wacom->tool[idx] == BTN_TOOL_LENS && |
| 938 | (features->type == INTUOS3 || |
| 939 | features->type == INTUOS3S || |
| 940 | features->type == INTUOS4 || |
| 941 | features->type == INTUOS4S || |
| 942 | features->type == INTUOS5 || |
| 943 | features->type == INTUOS5S || |
| 944 | features->type == INTUOSPM || |
| 945 | features->type == INTUOSPS)) || |
| 946 | /* Cintiq doesn't send data when RDY bit isn't set */ |
| 947 | (features->type == CINTIQ && !(data[1] & 0x40))) |
| 948 | return 1; |
| 949 | |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 950 | x = (be16_to_cpup((__be16 *)&data[2]) << 1) | ((data[9] >> 1) & 1); |
| 951 | y = (be16_to_cpup((__be16 *)&data[4]) << 1) | (data[9] & 1); |
| 952 | distance = data[9] >> 2; |
| 953 | if (features->type < INTUOS3S) { |
| 954 | x >>= 1; |
| 955 | y >>= 1; |
| 956 | distance >>= 1; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 957 | } |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 958 | input_report_abs(input, ABS_X, x); |
| 959 | input_report_abs(input, ABS_Y, y); |
| 960 | input_report_abs(input, ABS_DISTANCE, distance); |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 961 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 962 | switch (type) { |
| 963 | case 0x00: |
| 964 | case 0x01: |
| 965 | case 0x02: |
| 966 | case 0x03: |
| 967 | /* general pen packet */ |
Jason Gerecke | 5f33f43 | 2015-11-30 17:13:51 -0800 | [diff] [blame] | 968 | t = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | (data[1] & 1); |
| 969 | if (features->pressure_max < 2047) |
| 970 | t >>= 1; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 971 | input_report_abs(input, ABS_PRESSURE, t); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 972 | if (features->type != INTUOSHT2) { |
| 973 | input_report_abs(input, ABS_TILT_X, |
Jason Gerecke | ec5fc1c | 2014-11-18 16:50:08 -0800 | [diff] [blame] | 974 | (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 975 | input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); |
| 976 | } |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 977 | input_report_key(input, BTN_STYLUS, data[1] & 2); |
| 978 | input_report_key(input, BTN_STYLUS2, data[1] & 4); |
| 979 | input_report_key(input, BTN_TOUCH, t > 10); |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 980 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 981 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 982 | case 0x0a: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 983 | /* airbrush second packet */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 984 | input_report_abs(input, ABS_WHEEL, |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 985 | (data[6] << 2) | ((data[7] >> 6) & 3)); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 986 | input_report_abs(input, ABS_TILT_X, |
Jason Gerecke | ec5fc1c | 2014-11-18 16:50:08 -0800 | [diff] [blame] | 987 | (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); |
| 988 | input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 989 | break; |
| 990 | |
| 991 | case 0x05: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 992 | /* Rotation packet */ |
| 993 | if (features->type >= INTUOS3S) { |
| 994 | /* I3 marker pen rotation */ |
| 995 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
| 996 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
| 997 | ((t-1) / 2 + 450)) : (450 - t / 2) ; |
| 998 | input_report_abs(input, ABS_Z, t); |
| 999 | } else { |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1000 | /* 4D mouse 2nd packet */ |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1001 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
| 1002 | input_report_abs(input, ABS_RZ, (data[7] & 0x20) ? |
| 1003 | ((t - 1) / 2) : -t / 2); |
| 1004 | } |
| 1005 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1006 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1007 | case 0x04: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1008 | /* 4D mouse 1st packet */ |
| 1009 | input_report_key(input, BTN_LEFT, data[8] & 0x01); |
| 1010 | input_report_key(input, BTN_MIDDLE, data[8] & 0x02); |
| 1011 | input_report_key(input, BTN_RIGHT, data[8] & 0x04); |
| 1012 | |
| 1013 | input_report_key(input, BTN_SIDE, data[8] & 0x20); |
| 1014 | input_report_key(input, BTN_EXTRA, data[8] & 0x10); |
| 1015 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
| 1016 | input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); |
| 1017 | break; |
| 1018 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1019 | case 0x06: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1020 | /* I4 mouse */ |
| 1021 | input_report_key(input, BTN_LEFT, data[6] & 0x01); |
| 1022 | input_report_key(input, BTN_MIDDLE, data[6] & 0x02); |
| 1023 | input_report_key(input, BTN_RIGHT, data[6] & 0x04); |
| 1024 | input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) |
| 1025 | - ((data[7] & 0x40) >> 6)); |
| 1026 | input_report_key(input, BTN_SIDE, data[6] & 0x08); |
| 1027 | input_report_key(input, BTN_EXTRA, data[6] & 0x10); |
| 1028 | |
| 1029 | input_report_abs(input, ABS_TILT_X, |
| 1030 | (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); |
| 1031 | input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); |
| 1032 | break; |
| 1033 | |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1034 | case 0x08: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1035 | if (wacom->tool[idx] == BTN_TOOL_MOUSE) { |
| 1036 | /* 2D mouse packet */ |
| 1037 | input_report_key(input, BTN_LEFT, data[8] & 0x04); |
| 1038 | input_report_key(input, BTN_MIDDLE, data[8] & 0x08); |
| 1039 | input_report_key(input, BTN_RIGHT, data[8] & 0x10); |
| 1040 | input_report_rel(input, REL_WHEEL, (data[8] & 0x01) |
| 1041 | - ((data[8] & 0x02) >> 1)); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1042 | |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1043 | /* I3 2D mouse side buttons */ |
| 1044 | if (features->type >= INTUOS3S && features->type <= INTUOS3L) { |
| 1045 | input_report_key(input, BTN_SIDE, data[8] & 0x40); |
| 1046 | input_report_key(input, BTN_EXTRA, data[8] & 0x20); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1047 | } |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1048 | } |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1049 | else if (wacom->tool[idx] == BTN_TOOL_LENS) { |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1050 | /* Lens cursor packets */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 1051 | input_report_key(input, BTN_LEFT, data[8] & 0x01); |
| 1052 | input_report_key(input, BTN_MIDDLE, data[8] & 0x02); |
| 1053 | input_report_key(input, BTN_RIGHT, data[8] & 0x04); |
| 1054 | input_report_key(input, BTN_SIDE, data[8] & 0x10); |
| 1055 | input_report_key(input, BTN_EXTRA, data[8] & 0x08); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1056 | } |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1057 | break; |
| 1058 | |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1059 | case 0x07: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1060 | case 0x09: |
Jason Gerecke | 571f572 | 2015-11-30 17:13:50 -0800 | [diff] [blame] | 1061 | case 0x0b: |
Jason Gerecke | a8a09c8 | 2015-11-30 17:13:49 -0800 | [diff] [blame] | 1062 | case 0x0c: |
| 1063 | case 0x0d: |
| 1064 | case 0x0e: |
| 1065 | case 0x0f: |
| 1066 | /* unhandled */ |
| 1067 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1068 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1069 | |
Jason Gerecke | 82527da | 2016-10-19 18:03:47 -0700 | [diff] [blame] | 1070 | input_report_abs(input, ABS_MISC, |
| 1071 | wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */ |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 1072 | input_report_key(input, wacom->tool[idx], 1); |
| 1073 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
Ping Cheng | b3bd7ef | 2015-01-09 11:05:13 -0800 | [diff] [blame] | 1074 | wacom->reporting_data = true; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1075 | return 2; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1076 | } |
| 1077 | |
| 1078 | static int wacom_intuos_irq(struct wacom_wac *wacom) |
| 1079 | { |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1080 | unsigned char *data = wacom->data; |
| 1081 | struct input_dev *input = wacom->pen_input; |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1082 | int result; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1083 | |
| 1084 | if (data[0] != WACOM_REPORT_PENABLED && |
Jason Gerecke | 0610999 | 2015-11-30 17:13:52 -0800 | [diff] [blame] | 1085 | data[0] != WACOM_REPORT_INTUOS_ID1 && |
| 1086 | data[0] != WACOM_REPORT_INTUOS_ID2 && |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1087 | data[0] != WACOM_REPORT_INTUOSPAD && |
| 1088 | data[0] != WACOM_REPORT_INTUOS_PEN && |
| 1089 | data[0] != WACOM_REPORT_CINTIQ && |
| 1090 | data[0] != WACOM_REPORT_CINTIQPAD && |
| 1091 | data[0] != WACOM_REPORT_INTUOS5PAD) { |
| 1092 | dev_dbg(input->dev.parent, |
| 1093 | "%s: received unknown report #%d\n", __func__, data[0]); |
| 1094 | return 0; |
| 1095 | } |
| 1096 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1097 | /* process pad events */ |
| 1098 | result = wacom_intuos_pad(wacom); |
| 1099 | if (result) |
| 1100 | return result; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1101 | |
| 1102 | /* process in/out prox events */ |
| 1103 | result = wacom_intuos_inout(wacom); |
| 1104 | if (result) |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1105 | return result - 1; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1106 | |
| 1107 | /* process general packets */ |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1108 | result = wacom_intuos_general(wacom); |
| 1109 | if (result) |
| 1110 | return result - 1; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1111 | |
Jason Gerecke | 16e0a6a | 2015-11-30 17:13:48 -0800 | [diff] [blame] | 1112 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 1113 | } |
| 1114 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1115 | static int int_dist(int x1, int y1, int x2, int y2) |
| 1116 | { |
| 1117 | int x = x2 - x1; |
| 1118 | int y = y2 - y1; |
| 1119 | |
| 1120 | return int_sqrt(x*x + y*y); |
| 1121 | } |
| 1122 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1123 | static void wacom_intuos_bt_process_data(struct wacom_wac *wacom, |
| 1124 | unsigned char *data) |
| 1125 | { |
| 1126 | memcpy(wacom->data, data, 10); |
| 1127 | wacom_intuos_irq(wacom); |
| 1128 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1129 | input_sync(wacom->pen_input); |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1130 | if (wacom->pad_input) |
| 1131 | input_sync(wacom->pad_input); |
| 1132 | } |
| 1133 | |
| 1134 | static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len) |
| 1135 | { |
| 1136 | unsigned char data[WACOM_PKGLEN_MAX]; |
| 1137 | int i = 1; |
| 1138 | unsigned power_raw, battery_capacity, bat_charging, ps_connected; |
| 1139 | |
| 1140 | memcpy(data, wacom->data, len); |
| 1141 | |
| 1142 | switch (data[0]) { |
| 1143 | case 0x04: |
| 1144 | wacom_intuos_bt_process_data(wacom, data + i); |
| 1145 | i += 10; |
| 1146 | /* fall through */ |
| 1147 | case 0x03: |
| 1148 | wacom_intuos_bt_process_data(wacom, data + i); |
| 1149 | i += 10; |
| 1150 | wacom_intuos_bt_process_data(wacom, data + i); |
| 1151 | i += 10; |
| 1152 | power_raw = data[i]; |
| 1153 | bat_charging = (power_raw & 0x08) ? 1 : 0; |
| 1154 | ps_connected = (power_raw & 0x10) ? 1 : 0; |
| 1155 | battery_capacity = batcap_i4[power_raw & 0x07]; |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 1156 | wacom_notify_battery(wacom, battery_capacity, bat_charging, |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 1157 | battery_capacity || bat_charging, |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 1158 | ps_connected); |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1159 | break; |
| 1160 | default: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1161 | dev_dbg(wacom->pen_input->dev.parent, |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 1162 | "Unknown report: %d,%d size:%zu\n", |
| 1163 | data[0], data[1], len); |
| 1164 | return 0; |
| 1165 | } |
| 1166 | return 0; |
| 1167 | } |
| 1168 | |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1169 | static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) |
| 1170 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1171 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1172 | unsigned touch_max = wacom->features.touch_max; |
| 1173 | int count = 0; |
| 1174 | int i; |
| 1175 | |
Ping Cheng | 26ba61f | 2015-05-19 17:42:02 -0700 | [diff] [blame] | 1176 | if (!touch_max) |
| 1177 | return 0; |
| 1178 | |
Jason Gerecke | 71b5c47 | 2015-04-15 17:22:32 -0700 | [diff] [blame] | 1179 | if (touch_max == 1) |
| 1180 | return test_bit(BTN_TOUCH, input->key) && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1181 | report_touch_events(wacom); |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1182 | |
| 1183 | for (i = 0; i < input->mt->num_slots; i++) { |
| 1184 | struct input_mt_slot *ps = &input->mt->slots[i]; |
| 1185 | int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID); |
| 1186 | if (id >= 0) |
| 1187 | count++; |
| 1188 | } |
| 1189 | |
| 1190 | return count; |
| 1191 | } |
| 1192 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 1193 | static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom) |
| 1194 | { |
| 1195 | const int pen_frame_len = 14; |
| 1196 | const int pen_frames = 7; |
| 1197 | |
| 1198 | struct input_dev *pen_input = wacom->pen_input; |
| 1199 | unsigned char *data = wacom->data; |
| 1200 | int i; |
| 1201 | |
| 1202 | wacom->serial[0] = get_unaligned_le64(&data[99]); |
| 1203 | wacom->id[0] = get_unaligned_le16(&data[107]); |
| 1204 | if (wacom->serial[0] >> 52 == 1) { |
| 1205 | /* Add back in missing bits of ID for non-USI pens */ |
| 1206 | wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF; |
| 1207 | } |
| 1208 | wacom->tool[0] = wacom_intuos_get_tool_type(wacom_intuos_id_mangle(wacom->id[0])); |
| 1209 | |
| 1210 | for (i = 0; i < pen_frames; i++) { |
| 1211 | unsigned char *frame = &data[i*pen_frame_len + 1]; |
| 1212 | |
| 1213 | if (!(frame[0] & 0x80)) |
| 1214 | continue; |
| 1215 | |
| 1216 | input_report_abs(pen_input, ABS_X, get_unaligned_le16(&frame[1])); |
| 1217 | input_report_abs(pen_input, ABS_Y, get_unaligned_le16(&frame[3])); |
| 1218 | input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5])); |
| 1219 | input_report_abs(pen_input, ABS_TILT_X, frame[7]); |
| 1220 | input_report_abs(pen_input, ABS_TILT_Y, frame[8]); |
| 1221 | input_report_abs(pen_input, ABS_Z, get_unaligned_le16(&frame[9])); |
| 1222 | input_report_abs(pen_input, ABS_WHEEL, get_unaligned_le16(&frame[11])); |
| 1223 | input_report_abs(pen_input, ABS_DISTANCE, frame[13]); |
| 1224 | |
| 1225 | input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01); |
| 1226 | input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02); |
| 1227 | input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04); |
| 1228 | |
| 1229 | input_report_key(pen_input, wacom->tool[0], 1); |
| 1230 | input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]); |
| 1231 | input_report_abs(pen_input, ABS_MISC, |
| 1232 | wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */ |
| 1233 | |
| 1234 | wacom->shared->stylus_in_proximity = frame[0] & 0x40; |
| 1235 | |
| 1236 | input_sync(pen_input); |
| 1237 | } |
| 1238 | } |
| 1239 | |
| 1240 | static void wacom_intuos_pro2_bt_touch(struct wacom_wac *wacom) |
| 1241 | { |
| 1242 | const int finger_touch_len = 8; |
| 1243 | const int finger_frames = 4; |
| 1244 | const int finger_frame_len = 43; |
| 1245 | |
| 1246 | struct input_dev *touch_input = wacom->touch_input; |
| 1247 | unsigned char *data = wacom->data; |
| 1248 | int num_contacts_left = 5; |
| 1249 | int i, j; |
| 1250 | |
| 1251 | for (i = 0; i < finger_frames; i++) { |
| 1252 | unsigned char *frame = &data[i*finger_frame_len + 109]; |
| 1253 | int current_num_contacts = frame[0] & 0x7F; |
| 1254 | int contacts_to_send; |
| 1255 | |
| 1256 | if (!(frame[0] & 0x80)) |
| 1257 | continue; |
| 1258 | |
| 1259 | /* |
| 1260 | * First packet resets the counter since only the first |
| 1261 | * packet in series will have non-zero current_num_contacts. |
| 1262 | */ |
| 1263 | if (current_num_contacts) |
| 1264 | wacom->num_contacts_left = current_num_contacts; |
| 1265 | |
| 1266 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); |
| 1267 | |
| 1268 | for (j = 0; j < contacts_to_send; j++) { |
| 1269 | unsigned char *touch = &frame[j*finger_touch_len + 1]; |
| 1270 | int slot = input_mt_get_slot_by_key(touch_input, touch[0]); |
| 1271 | int x = get_unaligned_le16(&touch[2]); |
| 1272 | int y = get_unaligned_le16(&touch[4]); |
| 1273 | int w = touch[6] * input_abs_get_res(touch_input, ABS_MT_POSITION_X); |
| 1274 | int h = touch[7] * input_abs_get_res(touch_input, ABS_MT_POSITION_Y); |
| 1275 | |
| 1276 | if (slot < 0) |
| 1277 | continue; |
| 1278 | |
| 1279 | input_mt_slot(touch_input, slot); |
| 1280 | input_mt_report_slot_state(touch_input, MT_TOOL_FINGER, touch[1] & 0x01); |
| 1281 | input_report_abs(touch_input, ABS_MT_POSITION_X, x); |
| 1282 | input_report_abs(touch_input, ABS_MT_POSITION_Y, y); |
| 1283 | input_report_abs(touch_input, ABS_MT_TOUCH_MAJOR, max(w, h)); |
| 1284 | input_report_abs(touch_input, ABS_MT_TOUCH_MINOR, min(w, h)); |
| 1285 | input_report_abs(touch_input, ABS_MT_ORIENTATION, w > h); |
| 1286 | } |
| 1287 | |
| 1288 | input_mt_sync_frame(touch_input); |
| 1289 | |
| 1290 | wacom->num_contacts_left -= contacts_to_send; |
| 1291 | if (wacom->num_contacts_left <= 0) { |
| 1292 | wacom->num_contacts_left = 0; |
| 1293 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
| 1294 | } |
| 1295 | } |
| 1296 | |
| 1297 | input_report_switch(touch_input, SW_MUTE_DEVICE, !(data[281] >> 7)); |
| 1298 | input_sync(touch_input); |
| 1299 | } |
| 1300 | |
| 1301 | static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom) |
| 1302 | { |
| 1303 | struct input_dev *pad_input = wacom->pad_input; |
| 1304 | unsigned char *data = wacom->data; |
| 1305 | |
| 1306 | int buttons = (data[282] << 1) | ((data[281] >> 6) & 0x01); |
| 1307 | int ring = data[285]; |
| 1308 | int prox = buttons | (ring & 0x80); |
| 1309 | |
| 1310 | wacom_report_numbered_buttons(pad_input, 9, buttons); |
| 1311 | |
| 1312 | input_report_abs(pad_input, ABS_WHEEL, (ring & 0x80) ? (ring & 0x7f) : 0); |
| 1313 | |
| 1314 | input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0); |
| 1315 | input_report_abs(pad_input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); |
| 1316 | input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); |
| 1317 | |
| 1318 | input_sync(pad_input); |
| 1319 | } |
| 1320 | |
| 1321 | static void wacom_intuos_pro2_bt_battery(struct wacom_wac *wacom) |
| 1322 | { |
| 1323 | unsigned char *data = wacom->data; |
| 1324 | |
| 1325 | bool chg = data[284] & 0x80; |
| 1326 | int battery_status = data[284] & 0x7F; |
| 1327 | |
| 1328 | wacom_notify_battery(wacom, battery_status, chg, 1, chg); |
| 1329 | } |
| 1330 | |
| 1331 | static int wacom_intuos_pro2_bt_irq(struct wacom_wac *wacom, size_t len) |
| 1332 | { |
| 1333 | unsigned char *data = wacom->data; |
| 1334 | |
| 1335 | if (data[0] != 0x80) { |
| 1336 | dev_dbg(wacom->pen_input->dev.parent, |
| 1337 | "%s: received unknown report #%d\n", __func__, data[0]); |
| 1338 | return 0; |
| 1339 | } |
| 1340 | |
| 1341 | wacom_intuos_pro2_bt_pen(wacom); |
| 1342 | wacom_intuos_pro2_bt_touch(wacom); |
| 1343 | wacom_intuos_pro2_bt_pad(wacom); |
| 1344 | wacom_intuos_pro2_bt_battery(wacom); |
| 1345 | return 0; |
| 1346 | } |
| 1347 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1348 | static int wacom_24hdt_irq(struct wacom_wac *wacom) |
| 1349 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1350 | struct input_dev *input = wacom->touch_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1351 | unsigned char *data = wacom->data; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1352 | int i; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1353 | int current_num_contacts = data[61]; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1354 | int contacts_to_send = 0; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1355 | int num_contacts_left = 4; /* maximum contacts per packet */ |
| 1356 | int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; |
| 1357 | int y_offset = 2; |
| 1358 | |
| 1359 | if (wacom->features.type == WACOM_27QHDT) { |
| 1360 | current_num_contacts = data[63]; |
| 1361 | num_contacts_left = 10; |
| 1362 | byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; |
| 1363 | y_offset = 0; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1364 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1365 | |
| 1366 | /* |
| 1367 | * First packet resets the counter since only the first |
| 1368 | * packet in series will have non-zero current_num_contacts. |
| 1369 | */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1370 | if (current_num_contacts) |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1371 | wacom->num_contacts_left = current_num_contacts; |
| 1372 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1373 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1374 | |
| 1375 | for (i = 0; i < contacts_to_send; i++) { |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1376 | int offset = (byte_per_packet * i) + 1; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1377 | bool touch = (data[offset] & 0x1) && report_touch_events(wacom); |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 1378 | int slot = input_mt_get_slot_by_key(input, data[offset + 1]); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1379 | |
| 1380 | if (slot < 0) |
| 1381 | continue; |
| 1382 | input_mt_slot(input, slot); |
| 1383 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1384 | |
| 1385 | if (touch) { |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1386 | int t_x = get_unaligned_le16(&data[offset + 2]); |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1387 | int t_y = get_unaligned_le16(&data[offset + 4 + y_offset]); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1388 | |
| 1389 | input_report_abs(input, ABS_MT_POSITION_X, t_x); |
| 1390 | input_report_abs(input, ABS_MT_POSITION_Y, t_y); |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1391 | |
| 1392 | if (wacom->features.type != WACOM_27QHDT) { |
| 1393 | int c_x = get_unaligned_le16(&data[offset + 4]); |
| 1394 | int c_y = get_unaligned_le16(&data[offset + 8]); |
| 1395 | int w = get_unaligned_le16(&data[offset + 10]); |
| 1396 | int h = get_unaligned_le16(&data[offset + 12]); |
| 1397 | |
| 1398 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); |
| 1399 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, |
| 1400 | min(w, h) + int_dist(t_x, t_y, c_x, c_y)); |
| 1401 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); |
| 1402 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); |
| 1403 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1404 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1405 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1406 | input_mt_sync_frame(input); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1407 | |
| 1408 | wacom->num_contacts_left -= contacts_to_send; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1409 | if (wacom->num_contacts_left <= 0) { |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1410 | wacom->num_contacts_left = 0; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1411 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1412 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1413 | return 1; |
| 1414 | } |
| 1415 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1416 | static int wacom_mt_touch(struct wacom_wac *wacom) |
| 1417 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1418 | struct input_dev *input = wacom->touch_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1419 | unsigned char *data = wacom->data; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1420 | int i; |
| 1421 | int current_num_contacts = data[2]; |
| 1422 | int contacts_to_send = 0; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1423 | int x_offset = 0; |
| 1424 | |
| 1425 | /* MTTPC does not support Height and Width */ |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1426 | if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1427 | x_offset = -4; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1428 | |
| 1429 | /* |
| 1430 | * First packet resets the counter since only the first |
| 1431 | * packet in series will have non-zero current_num_contacts. |
| 1432 | */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1433 | if (current_num_contacts) |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1434 | wacom->num_contacts_left = current_num_contacts; |
| 1435 | |
| 1436 | /* There are at most 5 contacts per packet */ |
| 1437 | contacts_to_send = min(5, wacom->num_contacts_left); |
| 1438 | |
| 1439 | for (i = 0; i < contacts_to_send; i++) { |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1440 | int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1441 | bool touch = (data[offset] & 0x1) && report_touch_events(wacom); |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1442 | int id = get_unaligned_le16(&data[offset + 1]); |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 1443 | int slot = input_mt_get_slot_by_key(input, id); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1444 | |
| 1445 | if (slot < 0) |
| 1446 | continue; |
| 1447 | |
| 1448 | input_mt_slot(input, slot); |
| 1449 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1450 | if (touch) { |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1451 | int x = get_unaligned_le16(&data[offset + x_offset + 7]); |
| 1452 | int y = get_unaligned_le16(&data[offset + x_offset + 9]); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1453 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1454 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 1455 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1456 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1457 | input_mt_sync_frame(input); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1458 | |
| 1459 | wacom->num_contacts_left -= contacts_to_send; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1460 | if (wacom->num_contacts_left <= 0) { |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1461 | wacom->num_contacts_left = 0; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1462 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1463 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1464 | return 1; |
| 1465 | } |
| 1466 | |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1467 | static int wacom_tpc_mt_touch(struct wacom_wac *wacom) |
| 1468 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1469 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1470 | unsigned char *data = wacom->data; |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1471 | int i; |
| 1472 | |
| 1473 | for (i = 0; i < 2; i++) { |
| 1474 | int p = data[1] & (1 << i); |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1475 | bool touch = p && report_touch_events(wacom); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1476 | |
| 1477 | input_mt_slot(input, i); |
| 1478 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1479 | if (touch) { |
| 1480 | int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; |
| 1481 | int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; |
| 1482 | |
| 1483 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1484 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1485 | } |
| 1486 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1487 | input_mt_sync_frame(input); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1488 | |
| 1489 | /* keep touch state for pen event */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1490 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1491 | |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1492 | return 1; |
| 1493 | } |
| 1494 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1495 | 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] | 1496 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1497 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1498 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1499 | bool prox = report_touch_events(wacom); |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1500 | int x = 0, y = 0; |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1501 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1502 | if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) |
| 1503 | return 0; |
| 1504 | |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1505 | if (len == WACOM_PKGLEN_TPC1FG) { |
| 1506 | prox = prox && (data[0] & 0x01); |
| 1507 | x = get_unaligned_le16(&data[1]); |
| 1508 | y = get_unaligned_le16(&data[3]); |
| 1509 | } else if (len == WACOM_PKGLEN_TPC1FG_B) { |
| 1510 | prox = prox && (data[2] & 0x01); |
| 1511 | x = get_unaligned_le16(&data[3]); |
| 1512 | y = get_unaligned_le16(&data[5]); |
| 1513 | } else { |
| 1514 | prox = prox && (data[1] & 0x01); |
| 1515 | x = le16_to_cpup((__le16 *)&data[2]); |
| 1516 | y = le16_to_cpup((__le16 *)&data[4]); |
| 1517 | } |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1518 | |
| 1519 | if (prox) { |
| 1520 | input_report_abs(input, ABS_X, x); |
| 1521 | input_report_abs(input, ABS_Y, y); |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1522 | } |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1523 | input_report_key(input, BTN_TOUCH, prox); |
| 1524 | |
| 1525 | /* keep touch state for pen events */ |
| 1526 | wacom->shared->touch_down = prox; |
| 1527 | |
| 1528 | return 1; |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1529 | } |
| 1530 | |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1531 | static int wacom_tpc_pen(struct wacom_wac *wacom) |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1532 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1533 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1534 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1535 | bool prox = data[1] & 0x20; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1536 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1537 | if (!wacom->shared->stylus_in_proximity) /* first in prox */ |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1538 | /* Going into proximity select tool */ |
| 1539 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1540 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1541 | /* keep pen state for touch events */ |
| 1542 | wacom->shared->stylus_in_proximity = prox; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1543 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1544 | /* send pen events only when touch is up or forced out |
| 1545 | * or touch arbitration is off |
| 1546 | */ |
| 1547 | if (!delay_pen_events(wacom)) { |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1548 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 1549 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
| 1550 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 1551 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Jason Gerecke | 0b335ca | 2014-07-24 13:15:31 -0700 | [diff] [blame] | 1552 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1553 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
| 1554 | input_report_key(input, wacom->tool[0], prox); |
| 1555 | return 1; |
| 1556 | } |
| 1557 | |
| 1558 | return 0; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1559 | } |
| 1560 | |
| 1561 | static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) |
| 1562 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1563 | unsigned char *data = wacom->data; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1564 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1565 | if (wacom->pen_input) |
| 1566 | dev_dbg(wacom->pen_input->dev.parent, |
| 1567 | "%s: received report #%d\n", __func__, data[0]); |
| 1568 | else if (wacom->touch_input) |
| 1569 | dev_dbg(wacom->touch_input->dev.parent, |
| 1570 | "%s: received report #%d\n", __func__, data[0]); |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1571 | |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1572 | switch (len) { |
| 1573 | case WACOM_PKGLEN_TPC1FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1574 | return wacom_tpc_single_touch(wacom, len); |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1575 | |
| 1576 | case WACOM_PKGLEN_TPC2FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1577 | return wacom_tpc_mt_touch(wacom); |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1578 | |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1579 | case WACOM_PKGLEN_PENABLED: |
| 1580 | return wacom_tpc_pen(wacom); |
| 1581 | |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1582 | default: |
| 1583 | switch (data[0]) { |
| 1584 | case WACOM_REPORT_TPC1FG: |
| 1585 | case WACOM_REPORT_TPCHID: |
| 1586 | case WACOM_REPORT_TPCST: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 1587 | case WACOM_REPORT_TPC1FGE: |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1588 | return wacom_tpc_single_touch(wacom, len); |
| 1589 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1590 | case WACOM_REPORT_TPCMT: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1591 | case WACOM_REPORT_TPCMT2: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1592 | return wacom_mt_touch(wacom); |
| 1593 | |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1594 | case WACOM_REPORT_PENABLED: |
| 1595 | return wacom_tpc_pen(wacom); |
| 1596 | } |
| 1597 | } |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1598 | |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1599 | return 0; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1600 | } |
| 1601 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1602 | static int wacom_equivalent_usage(int usage) |
| 1603 | { |
| 1604 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) { |
| 1605 | int subpage = (usage & 0xFF00) << 8; |
| 1606 | int subusage = (usage & 0xFF); |
| 1607 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1608 | if (subpage == WACOM_HID_SP_PAD || |
| 1609 | subpage == WACOM_HID_SP_BUTTON || |
| 1610 | subpage == WACOM_HID_SP_DIGITIZER || |
Jason Gerecke | b5c921e | 2016-10-19 18:03:44 -0700 | [diff] [blame] | 1611 | subpage == WACOM_HID_SP_DIGITIZERINFO || |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1612 | usage == WACOM_HID_WD_SENSE || |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1613 | usage == WACOM_HID_WD_SERIALHI || |
| 1614 | usage == WACOM_HID_WD_TOOLTYPE || |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1615 | usage == WACOM_HID_WD_DISTANCE || |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1616 | usage == WACOM_HID_WD_TOUCHSTRIP || |
| 1617 | usage == WACOM_HID_WD_TOUCHSTRIP2 || |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1618 | usage == WACOM_HID_WD_TOUCHRING || |
| 1619 | usage == WACOM_HID_WD_TOUCHRINGSTATUS) { |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1620 | return usage; |
| 1621 | } |
| 1622 | |
| 1623 | if (subpage == HID_UP_UNDEFINED) |
| 1624 | subpage = HID_UP_DIGITIZER; |
| 1625 | |
| 1626 | return subpage | subusage; |
| 1627 | } |
| 1628 | |
| 1629 | return usage; |
| 1630 | } |
| 1631 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1632 | 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] | 1633 | struct hid_field *field, __u8 type, __u16 code, int fuzz) |
| 1634 | { |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1635 | struct wacom *wacom = input_get_drvdata(input); |
| 1636 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1637 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1638 | int fmin = field->logical_minimum; |
| 1639 | int fmax = field->logical_maximum; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1640 | unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1641 | int resolution_code = code; |
| 1642 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1643 | if (equivalent_usage == HID_DG_TWIST) { |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1644 | resolution_code = ABS_RZ; |
| 1645 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1646 | |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1647 | if (equivalent_usage == HID_GD_X) { |
| 1648 | fmin += features->offset_left; |
| 1649 | fmax -= features->offset_right; |
| 1650 | } |
| 1651 | if (equivalent_usage == HID_GD_Y) { |
| 1652 | fmin += features->offset_top; |
| 1653 | fmax -= features->offset_bottom; |
| 1654 | } |
| 1655 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1656 | usage->type = type; |
| 1657 | usage->code = code; |
| 1658 | |
| 1659 | set_bit(type, input->evbit); |
| 1660 | |
| 1661 | switch (type) { |
| 1662 | case EV_ABS: |
| 1663 | input_set_abs_params(input, code, fmin, fmax, fuzz, 0); |
| 1664 | input_abs_set_res(input, code, |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1665 | hidinput_calc_abs_res(field, resolution_code)); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1666 | break; |
| 1667 | case EV_KEY: |
| 1668 | input_set_capability(input, EV_KEY, code); |
| 1669 | break; |
| 1670 | case EV_MSC: |
| 1671 | input_set_capability(input, EV_MSC, code); |
| 1672 | break; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1673 | case EV_SW: |
| 1674 | input_set_capability(input, EV_SW, code); |
| 1675 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1676 | } |
| 1677 | } |
| 1678 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1679 | static void wacom_wac_pad_usage_mapping(struct hid_device *hdev, |
| 1680 | struct hid_field *field, struct hid_usage *usage) |
| 1681 | { |
| 1682 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1683 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1684 | struct wacom_features *features = &wacom_wac->features; |
| 1685 | struct input_dev *input = wacom_wac->pad_input; |
| 1686 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1687 | |
| 1688 | switch (equivalent_usage) { |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1689 | case WACOM_HID_WD_BATTERY_LEVEL: |
| 1690 | case WACOM_HID_WD_BATTERY_CHARGING: |
| 1691 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 1692 | break; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1693 | case WACOM_HID_WD_ACCELEROMETER_X: |
| 1694 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1695 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1696 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1697 | break; |
| 1698 | case WACOM_HID_WD_ACCELEROMETER_Y: |
| 1699 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1700 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1701 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1702 | break; |
| 1703 | case WACOM_HID_WD_ACCELEROMETER_Z: |
| 1704 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1705 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1706 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1707 | break; |
| 1708 | case WACOM_HID_WD_BUTTONHOME: |
| 1709 | case WACOM_HID_WD_BUTTONUP: |
| 1710 | case WACOM_HID_WD_BUTTONDOWN: |
| 1711 | case WACOM_HID_WD_BUTTONLEFT: |
| 1712 | case WACOM_HID_WD_BUTTONRIGHT: |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1713 | case WACOM_HID_WD_BUTTONCENTER: |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1714 | wacom_map_usage(input, usage, field, EV_KEY, |
| 1715 | wacom_numbered_button_to_key(features->numbered_buttons), |
| 1716 | 0); |
| 1717 | features->numbered_buttons++; |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1718 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1719 | break; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1720 | case WACOM_HID_WD_TOUCHONOFF: |
| 1721 | wacom_map_usage(input, usage, field, EV_SW, SW_MUTE_DEVICE, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1722 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1723 | break; |
| 1724 | case WACOM_HID_WD_TOUCHSTRIP: |
| 1725 | wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1726 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1727 | break; |
| 1728 | case WACOM_HID_WD_TOUCHSTRIP2: |
| 1729 | wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1730 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1731 | break; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1732 | case WACOM_HID_WD_TOUCHRING: |
| 1733 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1734 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1735 | break; |
| 1736 | } |
| 1737 | |
| 1738 | switch (equivalent_usage & 0xfffffff0) { |
| 1739 | case WACOM_HID_WD_EXPRESSKEY00: |
| 1740 | wacom_map_usage(input, usage, field, EV_KEY, |
| 1741 | wacom_numbered_button_to_key(features->numbered_buttons), |
| 1742 | 0); |
| 1743 | features->numbered_buttons++; |
Ping Cheng | f3f24e7 | 2016-12-08 22:05:44 -0800 | [diff] [blame] | 1744 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1745 | break; |
| 1746 | } |
| 1747 | } |
| 1748 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1749 | static void wacom_wac_pad_battery_event(struct hid_device *hdev, struct hid_field *field, |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1750 | struct hid_usage *usage, __s32 value) |
| 1751 | { |
| 1752 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1753 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1754 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1755 | |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1756 | switch (equivalent_usage) { |
| 1757 | case WACOM_HID_WD_BATTERY_LEVEL: |
| 1758 | wacom_wac->hid_data.battery_capacity = value; |
| 1759 | wacom_wac->hid_data.bat_connected = 1; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1760 | break; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1761 | |
| 1762 | case WACOM_HID_WD_BATTERY_CHARGING: |
| 1763 | wacom_wac->hid_data.bat_charging = value; |
| 1764 | wacom_wac->hid_data.ps_connected = value; |
| 1765 | wacom_wac->hid_data.bat_connected = 1; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1766 | break; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1767 | } |
| 1768 | } |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1769 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1770 | static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field, |
| 1771 | struct hid_usage *usage, __s32 value) |
| 1772 | { |
| 1773 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1774 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1775 | struct input_dev *input = wacom_wac->pad_input; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1776 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1777 | |
| 1778 | if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { |
| 1779 | wacom_wac->hid_data.inrange_state |= value; |
| 1780 | } |
| 1781 | |
| 1782 | switch (equivalent_usage) { |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1783 | case WACOM_HID_WD_TOUCHRINGSTATUS: |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1784 | break; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1785 | |
| 1786 | default: |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1787 | input_event(input, usage->type, usage->code, value); |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1788 | break; |
| 1789 | } |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1790 | } |
| 1791 | |
| 1792 | static void wacom_wac_pad_pre_report(struct hid_device *hdev, |
| 1793 | struct hid_report *report) |
| 1794 | { |
| 1795 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1796 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1797 | |
| 1798 | wacom_wac->hid_data.inrange_state = 0; |
| 1799 | } |
| 1800 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1801 | static void wacom_wac_pad_battery_report(struct hid_device *hdev, |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1802 | struct hid_report *report) |
| 1803 | { |
| 1804 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1805 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1806 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1807 | |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1808 | if (features->quirks & WACOM_QUIRK_BATTERY) { |
| 1809 | int capacity = wacom_wac->hid_data.battery_capacity; |
| 1810 | bool charging = wacom_wac->hid_data.bat_charging; |
| 1811 | bool connected = wacom_wac->hid_data.bat_connected; |
| 1812 | bool powered = wacom_wac->hid_data.ps_connected; |
| 1813 | |
| 1814 | wacom_notify_battery(wacom_wac, capacity, charging, |
| 1815 | connected, powered); |
| 1816 | } |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1817 | } |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1818 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1819 | static void wacom_wac_pad_report(struct hid_device *hdev, |
| 1820 | struct hid_report *report) |
| 1821 | { |
| 1822 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1823 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1824 | struct input_dev *input = wacom_wac->pad_input; |
| 1825 | bool active = wacom_wac->hid_data.inrange_state != 0; |
| 1826 | |
| 1827 | /* report prox for expresskey events */ |
| 1828 | if (wacom_equivalent_usage(report->field[0]->physical) == HID_DG_TABLETFUNCTIONKEY) { |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1829 | input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 1830 | input_sync(input); |
| 1831 | } |
Aaron Armstrong Skomra | 65ef4c1 | 2017-01-25 12:08:38 -0800 | [diff] [blame^] | 1832 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1833 | } |
| 1834 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1835 | static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, |
| 1836 | struct hid_field *field, struct hid_usage *usage) |
| 1837 | { |
| 1838 | struct wacom *wacom = hid_get_drvdata(hdev); |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1839 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1840 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1841 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1842 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1843 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1844 | switch (equivalent_usage) { |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1845 | case HID_GD_X: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1846 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1847 | break; |
| 1848 | case HID_GD_Y: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1849 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1850 | break; |
Jason Gerecke | b5c921e | 2016-10-19 18:03:44 -0700 | [diff] [blame] | 1851 | case WACOM_HID_WD_DISTANCE: |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1852 | case HID_GD_Z: |
| 1853 | wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); |
| 1854 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1855 | case HID_DG_TIPPRESSURE: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1856 | wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1857 | break; |
| 1858 | case HID_DG_INRANGE: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1859 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1860 | break; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1861 | case HID_DG_BATTERYSTRENGTH: |
| 1862 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 1863 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1864 | case HID_DG_INVERT: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1865 | wacom_map_usage(input, usage, field, EV_KEY, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1866 | BTN_TOOL_RUBBER, 0); |
| 1867 | break; |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1868 | case HID_DG_TILT_X: |
| 1869 | wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); |
| 1870 | break; |
| 1871 | case HID_DG_TILT_Y: |
| 1872 | wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); |
| 1873 | break; |
| 1874 | case HID_DG_TWIST: |
| 1875 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); |
| 1876 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1877 | case HID_DG_ERASER: |
| 1878 | case HID_DG_TIPSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1879 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1880 | break; |
| 1881 | case HID_DG_BARRELSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1882 | wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1883 | break; |
| 1884 | case HID_DG_BARRELSWITCH2: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1885 | wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1886 | break; |
| 1887 | case HID_DG_TOOLSERIALNUMBER: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1888 | wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1889 | break; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1890 | case WACOM_HID_WD_SENSE: |
| 1891 | features->quirks |= WACOM_QUIRK_SENSE; |
| 1892 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); |
| 1893 | break; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1894 | case WACOM_HID_WD_SERIALHI: |
| 1895 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); |
| 1896 | set_bit(EV_KEY, input->evbit); |
| 1897 | input_set_capability(input, EV_KEY, BTN_TOOL_PEN); |
| 1898 | input_set_capability(input, EV_KEY, BTN_TOOL_RUBBER); |
| 1899 | input_set_capability(input, EV_KEY, BTN_TOOL_BRUSH); |
| 1900 | input_set_capability(input, EV_KEY, BTN_TOOL_PENCIL); |
| 1901 | input_set_capability(input, EV_KEY, BTN_TOOL_AIRBRUSH); |
| 1902 | input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE); |
| 1903 | input_set_capability(input, EV_KEY, BTN_TOOL_LENS); |
| 1904 | break; |
Jason Gerecke | 929d6d5 | 2016-10-19 18:03:45 -0700 | [diff] [blame] | 1905 | case WACOM_HID_WD_FINGERWHEEL: |
| 1906 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
| 1907 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1908 | } |
| 1909 | } |
| 1910 | |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1911 | 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] | 1912 | struct hid_usage *usage, __s32 value) |
| 1913 | { |
| 1914 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1915 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1916 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1917 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1918 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1919 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1920 | switch (equivalent_usage) { |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1921 | case HID_GD_Z: |
| 1922 | /* |
| 1923 | * HID_GD_Z "should increase as the control's position is |
| 1924 | * moved from high to low", while ABS_DISTANCE instead |
| 1925 | * increases in value as the tool moves from low to high. |
| 1926 | */ |
| 1927 | value = field->logical_maximum - value; |
| 1928 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1929 | case HID_DG_INRANGE: |
| 1930 | wacom_wac->hid_data.inrange_state = value; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1931 | if (!(features->quirks & WACOM_QUIRK_SENSE)) |
| 1932 | wacom_wac->hid_data.sense_state = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1933 | return; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1934 | case HID_DG_BATTERYSTRENGTH: |
| 1935 | wacom_wac->hid_data.battery_capacity = value; |
| 1936 | wacom_wac->hid_data.bat_connected = 1; |
| 1937 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1938 | case HID_DG_INVERT: |
| 1939 | wacom_wac->hid_data.invert_state = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1940 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1941 | case HID_DG_ERASER: |
| 1942 | case HID_DG_TIPSWITCH: |
| 1943 | wacom_wac->hid_data.tipswitch |= value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1944 | return; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1945 | case HID_DG_TOOLSERIALNUMBER: |
Dan Carpenter | a35f09b | 2016-11-10 22:25:39 +0300 | [diff] [blame] | 1946 | wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1947 | wacom_wac->serial[0] |= value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1948 | return; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1949 | case WACOM_HID_WD_SENSE: |
| 1950 | wacom_wac->hid_data.sense_state = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1951 | return; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1952 | case WACOM_HID_WD_SERIALHI: |
| 1953 | wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); |
| 1954 | wacom_wac->serial[0] |= ((__u64)value) << 32; |
| 1955 | /* |
| 1956 | * Non-USI EMR devices may contain additional tool type |
| 1957 | * information here. See WACOM_HID_WD_TOOLTYPE case for |
| 1958 | * more details. |
| 1959 | */ |
| 1960 | if (value >> 20 == 1) { |
| 1961 | wacom_wac->id[0] |= value & 0xFFFFF; |
| 1962 | } |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1963 | return; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1964 | case WACOM_HID_WD_TOOLTYPE: |
| 1965 | /* |
| 1966 | * Some devices (MobileStudio Pro, and possibly later |
| 1967 | * devices as well) do not return the complete tool |
| 1968 | * type in their WACOM_HID_WD_TOOLTYPE usage. Use a |
| 1969 | * bitwise OR so the complete value can be built |
| 1970 | * up over time :( |
| 1971 | */ |
| 1972 | wacom_wac->id[0] |= value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1973 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1974 | case WACOM_HID_WD_OFFSETLEFT: |
| 1975 | if (features->offset_left && value != features->offset_left) |
| 1976 | hid_warn(hdev, "%s: overriding exising left offset " |
| 1977 | "%d -> %d\n", __func__, value, |
| 1978 | features->offset_left); |
| 1979 | features->offset_left = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1980 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1981 | case WACOM_HID_WD_OFFSETRIGHT: |
| 1982 | if (features->offset_right && value != features->offset_right) |
| 1983 | hid_warn(hdev, "%s: overriding exising right offset " |
| 1984 | "%d -> %d\n", __func__, value, |
| 1985 | features->offset_right); |
| 1986 | features->offset_right = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1987 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1988 | case WACOM_HID_WD_OFFSETTOP: |
| 1989 | if (features->offset_top && value != features->offset_top) |
| 1990 | hid_warn(hdev, "%s: overriding exising top offset " |
| 1991 | "%d -> %d\n", __func__, value, |
| 1992 | features->offset_top); |
| 1993 | features->offset_top = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 1994 | return; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1995 | case WACOM_HID_WD_OFFSETBOTTOM: |
| 1996 | if (features->offset_bottom && value != features->offset_bottom) |
| 1997 | hid_warn(hdev, "%s: overriding exising bottom offset " |
| 1998 | "%d -> %d\n", __func__, value, |
| 1999 | features->offset_bottom); |
| 2000 | features->offset_bottom = value; |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2001 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2002 | } |
| 2003 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2004 | /* send pen events only when touch is up or forced out |
| 2005 | * or touch arbitration is off |
| 2006 | */ |
| 2007 | if (!usage->type || delay_pen_events(wacom_wac)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2008 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2009 | |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2010 | /* send pen events only when the pen is in/entering/leaving proximity */ |
| 2011 | if (!wacom_wac->hid_data.inrange_state && !wacom_wac->tool[0]) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2012 | return; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2013 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2014 | input_event(input, usage->type, usage->code, value); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2015 | } |
| 2016 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2017 | static void wacom_wac_pen_pre_report(struct hid_device *hdev, |
| 2018 | struct hid_report *report) |
| 2019 | { |
| 2020 | return; |
| 2021 | } |
| 2022 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2023 | static void wacom_wac_pen_report(struct hid_device *hdev, |
| 2024 | struct hid_report *report) |
| 2025 | { |
| 2026 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2027 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2028 | struct input_dev *input = wacom_wac->pen_input; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2029 | bool prox = wacom_wac->hid_data.inrange_state; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2030 | bool range = wacom_wac->hid_data.sense_state; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2031 | |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2032 | if (!wacom_wac->tool[0] && prox) { /* first in prox */ |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2033 | /* Going into proximity select tool */ |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2034 | if (wacom_wac->hid_data.invert_state) |
| 2035 | wacom_wac->tool[0] = BTN_TOOL_RUBBER; |
| 2036 | else if (wacom_wac->id[0]) |
| 2037 | wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); |
| 2038 | else |
| 2039 | wacom_wac->tool[0] = BTN_TOOL_PEN; |
| 2040 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2041 | |
| 2042 | /* keep pen state for touch events */ |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2043 | wacom_wac->shared->stylus_in_proximity = range; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2044 | |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2045 | if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2046 | int id = wacom_wac->id[0]; |
| 2047 | |
| 2048 | /* |
| 2049 | * Non-USI EMR tools should have their IDs mangled to |
| 2050 | * match the legacy behavior of wacom_intuos_general |
| 2051 | */ |
| 2052 | if (wacom_wac->serial[0] >> 52 == 1) |
| 2053 | id = wacom_intuos_id_mangle(id); |
| 2054 | |
| 2055 | /* |
| 2056 | * To ensure compatibility with xf86-input-wacom, we should |
| 2057 | * report the BTN_TOOL_* event prior to the ABS_MISC or |
| 2058 | * MSC_SERIAL events. |
| 2059 | */ |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2060 | input_report_key(input, BTN_TOUCH, |
| 2061 | wacom_wac->hid_data.tipswitch); |
| 2062 | input_report_key(input, wacom_wac->tool[0], prox); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2063 | if (wacom_wac->serial[0]) { |
| 2064 | input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); |
| 2065 | input_report_abs(input, ABS_MISC, id); |
| 2066 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2067 | |
| 2068 | wacom_wac->hid_data.tipswitch = false; |
| 2069 | |
| 2070 | input_sync(input); |
| 2071 | } |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2072 | |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2073 | if (!prox) { |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 2074 | wacom_wac->tool[0] = 0; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 2075 | wacom_wac->id[0] = 0; |
| 2076 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2077 | } |
| 2078 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2079 | static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, |
| 2080 | struct hid_field *field, struct hid_usage *usage) |
| 2081 | { |
| 2082 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2083 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2084 | struct input_dev *input = wacom_wac->touch_input; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2085 | unsigned touch_max = wacom_wac->features.touch_max; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2086 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2087 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2088 | switch (equivalent_usage) { |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2089 | case HID_GD_X: |
| 2090 | if (touch_max == 1) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2091 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2092 | else |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2093 | wacom_map_usage(input, usage, field, EV_ABS, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2094 | ABS_MT_POSITION_X, 4); |
| 2095 | break; |
| 2096 | case HID_GD_Y: |
| 2097 | if (touch_max == 1) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2098 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2099 | else |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2100 | wacom_map_usage(input, usage, field, EV_ABS, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2101 | ABS_MT_POSITION_Y, 4); |
| 2102 | break; |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2103 | case HID_DG_WIDTH: |
| 2104 | case HID_DG_HEIGHT: |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2105 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); |
| 2106 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); |
| 2107 | input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); |
| 2108 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2109 | case HID_DG_TIPSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2110 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2111 | break; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2112 | case HID_DG_CONTACTCOUNT: |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2113 | wacom_wac->hid_data.cc_report = field->report->id; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2114 | wacom_wac->hid_data.cc_index = field->index; |
| 2115 | wacom_wac->hid_data.cc_value_index = usage->usage_index; |
| 2116 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2117 | } |
| 2118 | } |
| 2119 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2120 | static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, |
| 2121 | struct input_dev *input) |
| 2122 | { |
| 2123 | struct hid_data *hid_data = &wacom_wac->hid_data; |
| 2124 | bool mt = wacom_wac->features.touch_max > 1; |
| 2125 | bool prox = hid_data->tipswitch && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2126 | report_touch_events(wacom_wac); |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2127 | |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2128 | wacom_wac->hid_data.num_received++; |
| 2129 | if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) |
| 2130 | return; |
| 2131 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2132 | if (mt) { |
| 2133 | int slot; |
| 2134 | |
| 2135 | slot = input_mt_get_slot_by_key(input, hid_data->id); |
| 2136 | input_mt_slot(input, slot); |
| 2137 | input_mt_report_slot_state(input, MT_TOOL_FINGER, prox); |
| 2138 | } |
| 2139 | else { |
| 2140 | input_report_key(input, BTN_TOUCH, prox); |
| 2141 | } |
| 2142 | |
| 2143 | if (prox) { |
| 2144 | input_report_abs(input, mt ? ABS_MT_POSITION_X : ABS_X, |
| 2145 | hid_data->x); |
| 2146 | input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, |
| 2147 | hid_data->y); |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2148 | |
| 2149 | if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { |
| 2150 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); |
| 2151 | input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); |
| 2152 | if (hid_data->width != hid_data->height) |
| 2153 | input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); |
| 2154 | } |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2155 | } |
| 2156 | } |
| 2157 | |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2158 | static void wacom_wac_finger_event(struct hid_device *hdev, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2159 | struct hid_field *field, struct hid_usage *usage, __s32 value) |
| 2160 | { |
| 2161 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2162 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2163 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2164 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2165 | switch (equivalent_usage) { |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2166 | case HID_GD_X: |
| 2167 | wacom_wac->hid_data.x = value; |
| 2168 | break; |
| 2169 | case HID_GD_Y: |
| 2170 | wacom_wac->hid_data.y = value; |
| 2171 | break; |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 2172 | case HID_DG_WIDTH: |
| 2173 | wacom_wac->hid_data.width = value; |
| 2174 | break; |
| 2175 | case HID_DG_HEIGHT: |
| 2176 | wacom_wac->hid_data.height = value; |
| 2177 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2178 | case HID_DG_CONTACTID: |
| 2179 | wacom_wac->hid_data.id = value; |
| 2180 | break; |
| 2181 | case HID_DG_TIPSWITCH: |
| 2182 | wacom_wac->hid_data.tipswitch = value; |
| 2183 | break; |
| 2184 | } |
| 2185 | |
| 2186 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2187 | if (usage->usage_index + 1 == field->report_count) { |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2188 | if (equivalent_usage == wacom_wac->hid_data.last_slot_field) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2189 | wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2190 | } |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2191 | } |
| 2192 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2193 | static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
| 2194 | struct hid_report *report) |
| 2195 | { |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2196 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2197 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2198 | struct hid_data* hid_data = &wacom_wac->hid_data; |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2199 | int i; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2200 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2201 | for (i = 0; i < report->maxfield; i++) { |
| 2202 | struct hid_field *field = report->field[i]; |
| 2203 | int j; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2204 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2205 | for (j = 0; j < field->maxusage; j++) { |
| 2206 | struct hid_usage *usage = &field->usage[j]; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2207 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2208 | switch (usage->hid) { |
| 2209 | case HID_GD_X: |
| 2210 | case HID_GD_Y: |
| 2211 | case HID_DG_WIDTH: |
| 2212 | case HID_DG_HEIGHT: |
| 2213 | case HID_DG_CONTACTID: |
| 2214 | case HID_DG_INRANGE: |
| 2215 | case HID_DG_INVERT: |
| 2216 | case HID_DG_TIPSWITCH: |
| 2217 | hid_data->last_slot_field = usage->hid; |
| 2218 | break; |
| 2219 | case HID_DG_CONTACTCOUNT: |
| 2220 | hid_data->cc_report = report->id; |
| 2221 | hid_data->cc_index = i; |
| 2222 | hid_data->cc_value_index = j; |
| 2223 | break; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2224 | } |
| 2225 | } |
| 2226 | } |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2227 | |
Jason Gerecke | df70793 | 2015-10-07 16:54:22 -0700 | [diff] [blame] | 2228 | if (hid_data->cc_report != 0 && |
| 2229 | hid_data->cc_index >= 0) { |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2230 | struct hid_field *field = report->field[hid_data->cc_index]; |
| 2231 | int value = field->value[hid_data->cc_value_index]; |
| 2232 | if (value) |
| 2233 | hid_data->num_expected = value; |
| 2234 | } |
| 2235 | else { |
| 2236 | hid_data->num_expected = wacom_wac->features.touch_max; |
| 2237 | } |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2238 | } |
| 2239 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2240 | static void wacom_wac_finger_report(struct hid_device *hdev, |
| 2241 | struct hid_report *report) |
| 2242 | { |
| 2243 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2244 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2245 | struct input_dev *input = wacom_wac->touch_input; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2246 | unsigned touch_max = wacom_wac->features.touch_max; |
| 2247 | |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2248 | /* If more packets of data are expected, give us a chance to |
| 2249 | * process them rather than immediately syncing a partial |
| 2250 | * update. |
| 2251 | */ |
| 2252 | if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) |
| 2253 | return; |
| 2254 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2255 | if (touch_max > 1) |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2256 | input_mt_sync_frame(input); |
| 2257 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2258 | input_sync(input); |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2259 | wacom_wac->hid_data.num_received = 0; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2260 | |
| 2261 | /* keep touch state for pen event */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2262 | wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2263 | } |
| 2264 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2265 | void wacom_wac_usage_mapping(struct hid_device *hdev, |
| 2266 | struct hid_field *field, struct hid_usage *usage) |
| 2267 | { |
| 2268 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2269 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2270 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2271 | |
| 2272 | /* currently, only direct devices have proper hid report descriptors */ |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2273 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2274 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2275 | if (WACOM_PAD_FIELD(field)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2276 | wacom_wac_pad_usage_mapping(hdev, field, usage); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2277 | else if (WACOM_PEN_FIELD(field)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2278 | wacom_wac_pen_usage_mapping(hdev, field, usage); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2279 | else if (WACOM_FINGER_FIELD(field)) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2280 | wacom_wac_finger_usage_mapping(hdev, field, usage); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2281 | } |
| 2282 | |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2283 | void wacom_wac_event(struct hid_device *hdev, struct hid_field *field, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2284 | struct hid_usage *usage, __s32 value) |
| 2285 | { |
| 2286 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2287 | |
| 2288 | if (wacom->wacom_wac.features.type != HID_GENERIC) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2289 | return; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2290 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2291 | if (WACOM_PAD_FIELD(field)) { |
| 2292 | wacom_wac_pad_battery_event(hdev, field, usage, value); |
| 2293 | if (wacom->wacom_wac.pad_input) |
| 2294 | wacom_wac_pad_event(hdev, field, usage, value); |
| 2295 | } else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2296 | wacom_wac_pen_event(hdev, field, usage, value); |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2297 | else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) |
Ping Cheng | 354a329 | 2016-12-08 22:03:27 -0800 | [diff] [blame] | 2298 | wacom_wac_finger_event(hdev, field, usage, value); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2299 | } |
| 2300 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2301 | static void wacom_report_events(struct hid_device *hdev, struct hid_report *report) |
| 2302 | { |
| 2303 | int r; |
| 2304 | |
| 2305 | for (r = 0; r < report->maxfield; r++) { |
| 2306 | struct hid_field *field; |
| 2307 | unsigned count, n; |
| 2308 | |
| 2309 | field = report->field[r]; |
| 2310 | count = field->report_count; |
| 2311 | |
| 2312 | if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) |
| 2313 | continue; |
| 2314 | |
| 2315 | for (n = 0; n < count; n++) |
| 2316 | wacom_wac_event(hdev, field, &field->usage[n], field->value[n]); |
| 2317 | } |
| 2318 | } |
| 2319 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2320 | void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) |
| 2321 | { |
| 2322 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2323 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2324 | struct hid_field *field = report->field[0]; |
| 2325 | |
| 2326 | if (wacom_wac->features.type != HID_GENERIC) |
| 2327 | return; |
| 2328 | |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2329 | if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2330 | wacom_wac_pad_pre_report(hdev, report); |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2331 | else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2332 | wacom_wac_pen_pre_report(hdev, report); |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2333 | else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2334 | wacom_wac_finger_pre_report(hdev, report); |
| 2335 | |
| 2336 | wacom_report_events(hdev, report); |
| 2337 | |
Jason Gerecke | a9ce785 | 2017-01-17 15:38:58 -0800 | [diff] [blame] | 2338 | /* |
| 2339 | * Non-input reports may be sent prior to the device being |
| 2340 | * completely initialized. Since only their events need |
| 2341 | * to be processed, exit after 'wacom_report_events' has |
| 2342 | * been called to prevent potential crashes in the report- |
| 2343 | * processing functions. |
| 2344 | */ |
| 2345 | if (report->type != HID_INPUT_REPORT) |
| 2346 | return; |
| 2347 | |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2348 | if (WACOM_PAD_FIELD(field)) { |
| 2349 | wacom_wac_pad_battery_report(hdev, report); |
| 2350 | if (wacom->wacom_wac.pad_input) |
| 2351 | wacom_wac_pad_report(hdev, report); |
| 2352 | } else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) |
| 2353 | wacom_wac_pen_report(hdev, report); |
Ping Cheng | 6f46cf9 | 2016-12-08 22:04:52 -0800 | [diff] [blame] | 2354 | else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) |
Ping Cheng | c9cfb2a | 2016-12-08 22:06:15 -0800 | [diff] [blame] | 2355 | wacom_wac_finger_report(hdev, report); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2356 | } |
| 2357 | |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2358 | static int wacom_bpt_touch(struct wacom_wac *wacom) |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2359 | { |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2360 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2361 | struct input_dev *input = wacom->touch_input; |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2362 | struct input_dev *pad_input = wacom->pad_input; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2363 | unsigned char *data = wacom->data; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2364 | int i; |
| 2365 | |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2366 | if (data[0] != 0x02) |
| 2367 | return 0; |
| 2368 | |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2369 | for (i = 0; i < 2; i++) { |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2370 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2371 | bool touch = report_touch_events(wacom) |
| 2372 | && (data[offset + 3] & 0x80); |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2373 | |
| 2374 | input_mt_slot(input, i); |
| 2375 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
Henrik Rydberg | c5f4dec | 2010-12-15 13:50:34 +0100 | [diff] [blame] | 2376 | if (touch) { |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2377 | int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; |
| 2378 | int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2379 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { |
| 2380 | x <<= 5; |
| 2381 | y <<= 5; |
| 2382 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2383 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2384 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2385 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2386 | } |
| 2387 | |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 2388 | input_mt_sync_frame(input); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2389 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2390 | input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 2391 | input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); |
| 2392 | input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); |
| 2393 | input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2394 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2395 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2396 | return 1; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2397 | } |
| 2398 | |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2399 | 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] | 2400 | { |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2401 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2402 | struct input_dev *input = wacom->touch_input; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2403 | bool touch = data[1] & 0x80; |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 2404 | int slot = input_mt_get_slot_by_key(input, data[0]); |
| 2405 | |
| 2406 | if (slot < 0) |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2407 | return; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2408 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2409 | touch = touch && report_touch_events(wacom); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2410 | |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 2411 | input_mt_slot(input, slot); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2412 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 2413 | |
| 2414 | if (touch) { |
| 2415 | int x = (data[2] << 4) | (data[4] >> 4); |
| 2416 | int y = (data[3] << 4) | (data[4] & 0x0f); |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2417 | int width, height; |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 2418 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2419 | if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { |
Jason Gerecke | 0b279da | 2013-11-25 18:43:16 -0800 | [diff] [blame] | 2420 | width = data[5] * 100; |
| 2421 | height = data[6] * 100; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2422 | } else { |
| 2423 | /* |
| 2424 | * "a" is a scaled-down area which we assume is |
| 2425 | * roughly circular and which can be described as: |
| 2426 | * a=(pi*r^2)/C. |
| 2427 | */ |
| 2428 | int a = data[5]; |
Ping Cheng | d7da3a3 | 2014-06-13 13:37:33 -0700 | [diff] [blame] | 2429 | int x_res = input_abs_get_res(input, ABS_MT_POSITION_X); |
| 2430 | int y_res = input_abs_get_res(input, ABS_MT_POSITION_Y); |
| 2431 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2432 | height = width * y_res / x_res; |
| 2433 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2434 | |
| 2435 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2436 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 2437 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); |
| 2438 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2439 | } |
| 2440 | } |
| 2441 | |
| 2442 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) |
| 2443 | { |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2444 | struct input_dev *input = wacom->pad_input; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2445 | struct wacom_features *features = &wacom->features; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2446 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2447 | if (features->type == INTUOSHT || features->type == INTUOSHT2) { |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2448 | input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); |
| 2449 | input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); |
| 2450 | } else { |
| 2451 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); |
| 2452 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 2453 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2454 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2455 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); |
| 2456 | } |
| 2457 | |
| 2458 | static int wacom_bpt3_touch(struct wacom_wac *wacom) |
| 2459 | { |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2460 | unsigned char *data = wacom->data; |
Jason Gerecke | 19d57d3 | 2012-03-06 10:19:19 -0800 | [diff] [blame] | 2461 | int count = data[1] & 0x07; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2462 | int touch_changed = 0, i; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2463 | |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2464 | if (data[0] != 0x02) |
| 2465 | return 0; |
| 2466 | |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2467 | /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ |
| 2468 | for (i = 0; i < count; i++) { |
| 2469 | int offset = (8 * i) + 2; |
| 2470 | int msg_id = data[offset]; |
| 2471 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2472 | if (msg_id >= 2 && msg_id <= 17) { |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2473 | wacom_bpt3_touch_msg(wacom, data + offset); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2474 | touch_changed++; |
| 2475 | } else if (msg_id == 128) |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2476 | wacom_bpt3_button_msg(wacom, data + offset); |
| 2477 | |
| 2478 | } |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2479 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2480 | /* 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] | 2481 | if (wacom->touch_input && touch_changed) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2482 | input_mt_sync_frame(wacom->touch_input); |
| 2483 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
| 2484 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2485 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2486 | return 1; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2487 | } |
| 2488 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2489 | static int wacom_bpt_pen(struct wacom_wac *wacom) |
| 2490 | { |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2491 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2492 | struct input_dev *input = wacom->pen_input; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2493 | unsigned char *data = wacom->data; |
| 2494 | int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; |
| 2495 | |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2496 | if (data[0] != WACOM_REPORT_PENABLED) |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2497 | return 0; |
| 2498 | |
Chris Bagwell | c598141 | 2011-10-26 22:28:34 -0700 | [diff] [blame] | 2499 | prox = (data[1] & 0x20) == 0x20; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2500 | |
| 2501 | /* |
| 2502 | * All reports shared between PEN and RUBBER tool must be |
| 2503 | * forced to a known starting value (zero) when transitioning to |
| 2504 | * out-of-prox. |
| 2505 | * |
| 2506 | * If not reset then, to userspace, it will look like lost events |
| 2507 | * if new tool comes in-prox with same values as previous tool sent. |
| 2508 | * |
| 2509 | * Hardware does report zero in most out-of-prox cases but not all. |
| 2510 | */ |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2511 | if (!wacom->shared->stylus_in_proximity) { |
| 2512 | if (data[1] & 0x08) { |
| 2513 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 2514 | wacom->id[0] = ERASER_DEVICE_ID; |
| 2515 | } else { |
| 2516 | wacom->tool[0] = BTN_TOOL_PEN; |
| 2517 | wacom->id[0] = STYLUS_DEVICE_ID; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2518 | } |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2519 | } |
| 2520 | |
| 2521 | wacom->shared->stylus_in_proximity = prox; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2522 | if (delay_pen_events(wacom)) |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2523 | return 0; |
| 2524 | |
| 2525 | if (prox) { |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2526 | x = le16_to_cpup((__le16 *)&data[2]); |
| 2527 | y = le16_to_cpup((__le16 *)&data[4]); |
| 2528 | p = le16_to_cpup((__le16 *)&data[6]); |
Chris Bagwell | c18c2ce | 2011-10-10 08:52:13 -0700 | [diff] [blame] | 2529 | /* |
| 2530 | * Convert distance from out prox to distance from tablet. |
| 2531 | * distance will be greater than distance_max once |
| 2532 | * touching and applying pressure; do not report negative |
| 2533 | * distance. |
| 2534 | */ |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2535 | if (data[8] <= features->distance_max) |
| 2536 | d = features->distance_max - data[8]; |
Chris Bagwell | c18c2ce | 2011-10-10 08:52:13 -0700 | [diff] [blame] | 2537 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2538 | pen = data[1] & 0x01; |
| 2539 | btn1 = data[1] & 0x02; |
| 2540 | btn2 = data[1] & 0x04; |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2541 | } else { |
| 2542 | wacom->id[0] = 0; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2543 | } |
| 2544 | |
| 2545 | input_report_key(input, BTN_TOUCH, pen); |
| 2546 | input_report_key(input, BTN_STYLUS, btn1); |
| 2547 | input_report_key(input, BTN_STYLUS2, btn2); |
| 2548 | |
| 2549 | input_report_abs(input, ABS_X, x); |
| 2550 | input_report_abs(input, ABS_Y, y); |
| 2551 | input_report_abs(input, ABS_PRESSURE, p); |
| 2552 | input_report_abs(input, ABS_DISTANCE, d); |
| 2553 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2554 | input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */ |
| 2555 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ |
| 2556 | |
| 2557 | return 1; |
| 2558 | } |
| 2559 | |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2560 | static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) |
| 2561 | { |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2562 | struct wacom_features *features = &wacom->features; |
| 2563 | |
| 2564 | if ((features->type == INTUOSHT2) && |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2565 | (features->device_type & WACOM_DEVICETYPE_PEN)) |
| 2566 | return wacom_intuos_irq(wacom); |
| 2567 | else if (len == WACOM_PKGLEN_BBTOUCH) |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2568 | return wacom_bpt_touch(wacom); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2569 | else if (len == WACOM_PKGLEN_BBTOUCH3) |
| 2570 | return wacom_bpt3_touch(wacom); |
| 2571 | else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2572 | return wacom_bpt_pen(wacom); |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2573 | |
| 2574 | return 0; |
| 2575 | } |
| 2576 | |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2577 | static void wacom_bamboo_pad_pen_event(struct wacom_wac *wacom, |
| 2578 | unsigned char *data) |
| 2579 | { |
| 2580 | unsigned char prefix; |
| 2581 | |
| 2582 | /* |
| 2583 | * We need to reroute the event from the debug interface to the |
| 2584 | * pen interface. |
| 2585 | * We need to add the report ID to the actual pen report, so we |
| 2586 | * temporary overwrite the first byte to prevent having to kzalloc/kfree |
| 2587 | * and memcpy the report. |
| 2588 | */ |
| 2589 | prefix = data[0]; |
| 2590 | data[0] = WACOM_REPORT_BPAD_PEN; |
| 2591 | |
| 2592 | /* |
| 2593 | * actually reroute the event. |
| 2594 | * No need to check if wacom->shared->pen is valid, hid_input_report() |
| 2595 | * will check for us. |
| 2596 | */ |
| 2597 | hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, |
| 2598 | WACOM_PKGLEN_PENABLED, 1); |
| 2599 | |
| 2600 | data[0] = prefix; |
| 2601 | } |
| 2602 | |
| 2603 | static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom, |
| 2604 | unsigned char *data) |
| 2605 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2606 | struct input_dev *input = wacom->touch_input; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2607 | unsigned char *finger_data, prefix; |
| 2608 | unsigned id; |
| 2609 | int x, y; |
| 2610 | bool valid; |
| 2611 | |
| 2612 | prefix = data[0]; |
| 2613 | |
| 2614 | for (id = 0; id < wacom->features.touch_max; id++) { |
| 2615 | valid = !!(prefix & BIT(id)) && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2616 | report_touch_events(wacom); |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2617 | |
| 2618 | input_mt_slot(input, id); |
| 2619 | input_mt_report_slot_state(input, MT_TOOL_FINGER, valid); |
| 2620 | |
| 2621 | if (!valid) |
| 2622 | continue; |
| 2623 | |
| 2624 | finger_data = data + 1 + id * 3; |
| 2625 | x = finger_data[0] | ((finger_data[1] & 0x0f) << 8); |
| 2626 | y = (finger_data[2] << 4) | (finger_data[1] >> 4); |
| 2627 | |
| 2628 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2629 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 2630 | } |
| 2631 | |
| 2632 | input_mt_sync_frame(input); |
| 2633 | |
| 2634 | input_report_key(input, BTN_LEFT, prefix & 0x40); |
| 2635 | input_report_key(input, BTN_RIGHT, prefix & 0x80); |
| 2636 | |
| 2637 | /* keep touch state for pen event */ |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2638 | wacom->shared->touch_down = !!prefix && report_touch_events(wacom); |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2639 | |
| 2640 | return 1; |
| 2641 | } |
| 2642 | |
| 2643 | static int wacom_bamboo_pad_irq(struct wacom_wac *wacom, size_t len) |
| 2644 | { |
| 2645 | unsigned char *data = wacom->data; |
| 2646 | |
| 2647 | if (!((len == WACOM_PKGLEN_BPAD_TOUCH) || |
| 2648 | (len == WACOM_PKGLEN_BPAD_TOUCH_USB)) || |
| 2649 | (data[0] != WACOM_REPORT_BPAD_TOUCH)) |
| 2650 | return 0; |
| 2651 | |
| 2652 | if (data[1] & 0x01) |
| 2653 | wacom_bamboo_pad_pen_event(wacom, &data[1]); |
| 2654 | |
| 2655 | if (data[1] & 0x02) |
| 2656 | return wacom_bamboo_pad_touch_event(wacom, &data[9]); |
| 2657 | |
| 2658 | return 0; |
| 2659 | } |
| 2660 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2661 | static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) |
| 2662 | { |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2663 | unsigned char *data = wacom->data; |
| 2664 | int connected; |
| 2665 | |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2666 | if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL) |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2667 | return 0; |
| 2668 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2669 | connected = data[1] & 0x01; |
| 2670 | if (connected) { |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 2671 | int pid, battery, charging; |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2672 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2673 | if ((wacom->shared->type == INTUOSHT || |
| 2674 | wacom->shared->type == INTUOSHT2) && |
Ping Cheng | 44b9683 | 2014-11-06 17:30:51 -0800 | [diff] [blame] | 2675 | wacom->shared->touch_input && |
| 2676 | wacom->shared->touch_max) { |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2677 | input_report_switch(wacom->shared->touch_input, |
| 2678 | SW_MUTE_DEVICE, data[5] & 0x40); |
| 2679 | input_sync(wacom->shared->touch_input); |
| 2680 | } |
| 2681 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2682 | pid = get_unaligned_be16(&data[6]); |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 2683 | battery = (data[5] & 0x3f) * 100 / 31; |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 2684 | charging = !!(data[5] & 0x80); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2685 | if (wacom->pid != pid) { |
| 2686 | wacom->pid = pid; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2687 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2688 | } |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 2689 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 2690 | wacom_notify_battery(wacom, battery, charging, 1, 0); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 2691 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2692 | } else if (wacom->pid != 0) { |
| 2693 | /* disconnected while previously connected */ |
| 2694 | wacom->pid = 0; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2695 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 2696 | wacom_notify_battery(wacom, 0, 0, 0, 0); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2697 | } |
| 2698 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2699 | return 0; |
| 2700 | } |
| 2701 | |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2702 | static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len) |
| 2703 | { |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2704 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2705 | struct wacom_features *features = &wacom_wac->features; |
| 2706 | unsigned char *data = wacom_wac->data; |
| 2707 | |
| 2708 | if (data[0] != WACOM_REPORT_USB) |
| 2709 | return 0; |
| 2710 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2711 | if ((features->type == INTUOSHT || |
| 2712 | features->type == INTUOSHT2) && |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2713 | wacom_wac->shared->touch_input && |
| 2714 | features->touch_max) { |
| 2715 | input_report_switch(wacom_wac->shared->touch_input, |
| 2716 | SW_MUTE_DEVICE, data[8] & 0x40); |
| 2717 | input_sync(wacom_wac->shared->touch_input); |
| 2718 | } |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2719 | |
| 2720 | if (data[9] & 0x02) { /* wireless module is attached */ |
| 2721 | int battery = (data[8] & 0x3f) * 100 / 31; |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 2722 | bool charging = !!(data[8] & 0x80); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2723 | |
| 2724 | wacom_notify_battery(wacom_wac, battery, charging, |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 2725 | battery || charging, 1); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2726 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 2727 | if (!wacom->battery.battery && |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2728 | !(features->quirks & WACOM_QUIRK_BATTERY)) { |
| 2729 | features->quirks |= WACOM_QUIRK_BATTERY; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2730 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2731 | } |
| 2732 | } |
| 2733 | else if ((features->quirks & WACOM_QUIRK_BATTERY) && |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 2734 | wacom->battery.battery) { |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2735 | features->quirks &= ~WACOM_QUIRK_BATTERY; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2736 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 2737 | wacom_notify_battery(wacom_wac, 0, 0, 0, 0); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2738 | } |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2739 | return 0; |
| 2740 | } |
| 2741 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2742 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2743 | { |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2744 | bool sync; |
| 2745 | |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 2746 | switch (wacom_wac->features.type) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2747 | case PENPARTNER: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2748 | sync = wacom_penpartner_irq(wacom_wac); |
| 2749 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2750 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2751 | case PL: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2752 | sync = wacom_pl_irq(wacom_wac); |
| 2753 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2754 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2755 | case WACOM_G4: |
| 2756 | case GRAPHIRE: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 2757 | case GRAPHIRE_BT: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2758 | case WACOM_MO: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2759 | sync = wacom_graphire_irq(wacom_wac); |
| 2760 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2761 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2762 | case PTU: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2763 | sync = wacom_ptu_irq(wacom_wac); |
| 2764 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2765 | |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 2766 | case DTU: |
| 2767 | sync = wacom_dtu_irq(wacom_wac); |
| 2768 | break; |
| 2769 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 2770 | case DTUS: |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 2771 | case DTUSX: |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 2772 | sync = wacom_dtus_irq(wacom_wac); |
| 2773 | break; |
| 2774 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2775 | case INTUOS: |
| 2776 | case INTUOS3S: |
| 2777 | case INTUOS3: |
| 2778 | case INTUOS3L: |
| 2779 | case INTUOS4S: |
| 2780 | case INTUOS4: |
| 2781 | case INTUOS4L: |
| 2782 | case CINTIQ: |
| 2783 | case WACOM_BEE: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 2784 | case WACOM_13HD: |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 2785 | case WACOM_21UX2: |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 2786 | case WACOM_22HD: |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 2787 | case WACOM_24HD: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 2788 | case WACOM_27QHD: |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 2789 | case DTK: |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 2790 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 2791 | case CINTIQ_COMPANION_2: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2792 | sync = wacom_intuos_irq(wacom_wac); |
| 2793 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2794 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 2795 | case INTUOS4WL: |
| 2796 | sync = wacom_intuos_bt_irq(wacom_wac, len); |
| 2797 | break; |
| 2798 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 2799 | case WACOM_24HDT: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 2800 | case WACOM_27QHDT: |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 2801 | sync = wacom_24hdt_irq(wacom_wac); |
| 2802 | break; |
| 2803 | |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2804 | case INTUOS5S: |
| 2805 | case INTUOS5: |
| 2806 | case INTUOS5L: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2807 | case INTUOSPS: |
| 2808 | case INTUOSPM: |
| 2809 | case INTUOSPL: |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2810 | if (len == WACOM_PKGLEN_BBTOUCH3) |
| 2811 | sync = wacom_bpt3_touch(wacom_wac); |
Jason Gerecke | 2d13a43 | 2015-03-06 11:47:42 -0800 | [diff] [blame] | 2812 | else if (wacom_wac->data[0] == WACOM_REPORT_USB) |
| 2813 | sync = wacom_status_irq(wacom_wac, len); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2814 | else |
| 2815 | sync = wacom_intuos_irq(wacom_wac); |
| 2816 | break; |
| 2817 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 2818 | case INTUOSP2_BT: |
| 2819 | sync = wacom_intuos_pro2_bt_irq(wacom_wac, len); |
| 2820 | break; |
| 2821 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2822 | case TABLETPC: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 2823 | case TABLETPCE: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2824 | case TABLETPC2FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 2825 | case MTSCREEN: |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 2826 | case MTTPC: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 2827 | case MTTPC_B: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2828 | sync = wacom_tpc_irq(wacom_wac, len); |
| 2829 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2830 | |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2831 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2832 | case BAMBOO_PEN: |
| 2833 | case BAMBOO_TOUCH: |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2834 | case INTUOSHT: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2835 | case INTUOSHT2: |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2836 | if (wacom_wac->data[0] == WACOM_REPORT_USB) |
| 2837 | sync = wacom_status_irq(wacom_wac, len); |
| 2838 | else |
| 2839 | sync = wacom_bpt_irq(wacom_wac, len); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2840 | break; |
| 2841 | |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2842 | case BAMBOO_PAD: |
| 2843 | sync = wacom_bamboo_pad_irq(wacom_wac, len); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2844 | break; |
| 2845 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2846 | case WIRELESS: |
| 2847 | sync = wacom_wireless_irq(wacom_wac, len); |
| 2848 | break; |
| 2849 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2850 | case REMOTE: |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 2851 | sync = false; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2852 | if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 2853 | wacom_remote_status_irq(wacom_wac, len); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2854 | else |
| 2855 | sync = wacom_remote_irq(wacom_wac, len); |
| 2856 | break; |
| 2857 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2858 | default: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2859 | sync = false; |
| 2860 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2861 | } |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2862 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 2863 | if (sync) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2864 | if (wacom_wac->pen_input) |
| 2865 | input_sync(wacom_wac->pen_input); |
| 2866 | if (wacom_wac->touch_input) |
| 2867 | input_sync(wacom_wac->touch_input); |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 2868 | if (wacom_wac->pad_input) |
| 2869 | input_sync(wacom_wac->pad_input); |
| 2870 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2871 | } |
| 2872 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2873 | static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2874 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2875 | struct input_dev *input_dev = wacom_wac->pen_input; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2876 | |
| 2877 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2878 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2879 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2880 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 2881 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 2882 | |
| 2883 | input_set_abs_params(input_dev, ABS_DISTANCE, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2884 | 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2885 | } |
| 2886 | |
| 2887 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) |
| 2888 | { |
| 2889 | struct input_dev *input_dev = wacom_wac->pen_input; |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2890 | struct wacom_features *features = &wacom_wac->features; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2891 | |
| 2892 | wacom_setup_basic_pro_pen(wacom_wac); |
| 2893 | |
| 2894 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 2895 | __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); |
| 2896 | __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); |
| 2897 | __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); |
| 2898 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2899 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2900 | 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] | 2901 | input_abs_set_res(input_dev, ABS_TILT_X, 57); |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2902 | 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] | 2903 | input_abs_set_res(input_dev, ABS_TILT_Y, 57); |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 2904 | } |
| 2905 | |
| 2906 | static void wacom_setup_intuos(struct wacom_wac *wacom_wac) |
| 2907 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2908 | struct input_dev *input_dev = wacom_wac->pen_input; |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 2909 | |
| 2910 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 2911 | |
| 2912 | wacom_setup_cintiq(wacom_wac); |
| 2913 | |
| 2914 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 2915 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 2916 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 2917 | __set_bit(BTN_SIDE, input_dev->keybit); |
| 2918 | __set_bit(BTN_EXTRA, input_dev->keybit); |
| 2919 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 2920 | __set_bit(BTN_TOOL_LENS, input_dev->keybit); |
| 2921 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2922 | input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 2923 | input_abs_set_res(input_dev, ABS_RZ, 287); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2924 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); |
| 2925 | } |
| 2926 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2927 | void wacom_setup_device_quirks(struct wacom *wacom) |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2928 | { |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2929 | struct wacom_features *features = &wacom->wacom_wac.features; |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2930 | |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2931 | /* The pen and pad share the same interface on most devices */ |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2932 | if (features->numbered_buttons > 0) |
| 2933 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2934 | if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2935 | features->type == DTUS || |
| 2936 | (features->type >= INTUOS3S && features->type <= WACOM_MO)) { |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2937 | if (features->device_type & WACOM_DEVICETYPE_PEN) |
| 2938 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2939 | } |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2940 | |
| 2941 | /* touch device found but size is not defined. use default */ |
Jason Gerecke | aa86b18 | 2015-06-15 18:01:42 -0700 | [diff] [blame] | 2942 | if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2943 | features->x_max = 1023; |
| 2944 | features->y_max = 1023; |
| 2945 | } |
| 2946 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2947 | /* |
| 2948 | * Intuos5/Pro and Bamboo 3rd gen have no useful data about its |
| 2949 | * touch interface in its HID descriptor. If this is the touch |
| 2950 | * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the |
| 2951 | * tablet values. |
| 2952 | */ |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2953 | if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || |
| 2954 | (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2955 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2956 | if (features->touch_max) |
| 2957 | features->device_type |= WACOM_DEVICETYPE_TOUCH; |
Jiri Kosina | a3088ab | 2015-11-17 00:24:14 +0100 | [diff] [blame] | 2958 | if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2959 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2960 | |
| 2961 | features->x_max = 4096; |
| 2962 | features->y_max = 4096; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2963 | } |
Jason Gerecke | 9633920 | 2015-07-01 13:01:00 -0700 | [diff] [blame] | 2964 | else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
| 2965 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2966 | } |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2967 | } |
| 2968 | |
| 2969 | /* |
Benjamin Tissoires | 580549e | 2016-03-25 15:26:55 +0100 | [diff] [blame] | 2970 | * Hack for the Bamboo One: |
| 2971 | * the device presents a PAD/Touch interface as most Bamboos and even |
| 2972 | * sends ghosts PAD data on it. However, later, we must disable this |
| 2973 | * ghost interface, and we can not detect it unless we set it here |
| 2974 | * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH. |
| 2975 | */ |
| 2976 | if (features->type == BAMBOO_PEN && |
| 2977 | features->pktlen == WACOM_PKGLEN_BBTOUCH3) |
| 2978 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2979 | |
| 2980 | /* |
Jason Gerecke | 042628a | 2015-04-30 17:51:54 -0700 | [diff] [blame] | 2981 | * Raw Wacom-mode pen and touch events both come from interface |
| 2982 | * 0, whose HID descriptor has an application usage of 0xFF0D |
Jason Gerecke | 8de8228 | 2016-10-19 18:03:37 -0700 | [diff] [blame] | 2983 | * (i.e., WACOM_HID_WD_DIGITIZER). We route pen packets back |
Jason Gerecke | 042628a | 2015-04-30 17:51:54 -0700 | [diff] [blame] | 2984 | * out through the HID_GENERIC device created for interface 1, |
Benjamin Tissoires | 70caee0a | 2015-07-09 14:11:51 -0400 | [diff] [blame] | 2985 | * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH. |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2986 | */ |
| 2987 | if (features->type == BAMBOO_PAD) |
Benjamin Tissoires | 70caee0a | 2015-07-09 14:11:51 -0400 | [diff] [blame] | 2988 | features->device_type = WACOM_DEVICETYPE_TOUCH; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2989 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2990 | if (features->type == REMOTE) |
| 2991 | features->device_type = WACOM_DEVICETYPE_PAD; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2992 | |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 2993 | if (features->type == INTUOSP2_BT) { |
| 2994 | features->device_type |= WACOM_DEVICETYPE_PEN | |
| 2995 | WACOM_DEVICETYPE_PAD | |
| 2996 | WACOM_DEVICETYPE_TOUCH; |
| 2997 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 2998 | } |
| 2999 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3000 | switch (features->type) { |
| 3001 | case PL: |
| 3002 | case DTU: |
| 3003 | case DTUS: |
| 3004 | case DTUSX: |
| 3005 | case WACOM_21UX2: |
| 3006 | case WACOM_22HD: |
| 3007 | case DTK: |
| 3008 | case WACOM_24HD: |
| 3009 | case WACOM_27QHD: |
| 3010 | case CINTIQ_HYBRID: |
| 3011 | case CINTIQ_COMPANION_2: |
| 3012 | case CINTIQ: |
| 3013 | case WACOM_BEE: |
| 3014 | case WACOM_13HD: |
| 3015 | case WACOM_24HDT: |
| 3016 | case WACOM_27QHDT: |
| 3017 | case TABLETPC: |
| 3018 | case TABLETPCE: |
| 3019 | case TABLETPC2FG: |
| 3020 | case MTSCREEN: |
| 3021 | case MTTPC: |
| 3022 | case MTTPC_B: |
| 3023 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
| 3024 | break; |
| 3025 | } |
| 3026 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 3027 | if (wacom->hdev->bus == BUS_BLUETOOTH) |
| 3028 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 3029 | |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3030 | /* quirk for bamboo touch with 2 low res touches */ |
Jason Gerecke | be853fd | 2015-12-04 14:45:27 -0800 | [diff] [blame] | 3031 | if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3032 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 3033 | features->x_max <<= 5; |
| 3034 | features->y_max <<= 5; |
| 3035 | features->x_fuzz <<= 5; |
| 3036 | features->y_fuzz <<= 5; |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 3037 | features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3038 | } |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3039 | |
| 3040 | if (features->type == WIRELESS) { |
Jason Gerecke | ccad85c | 2015-08-03 10:17:04 -0700 | [diff] [blame] | 3041 | if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 3042 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 3043 | } |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3044 | } |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 3045 | |
| 3046 | if (features->type == REMOTE) |
| 3047 | features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 3048 | } |
| 3049 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3050 | int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3051 | struct wacom_wac *wacom_wac) |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3052 | { |
| 3053 | struct wacom_features *features = &wacom_wac->features; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3054 | |
| 3055 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3056 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3057 | if (!(features->device_type & WACOM_DEVICETYPE_PEN)) |
| 3058 | return -ENODEV; |
| 3059 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3060 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
| 3061 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 3062 | else |
| 3063 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 3064 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 3065 | if (features->type == HID_GENERIC) |
| 3066 | /* setup has already been done */ |
| 3067 | return 0; |
| 3068 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3069 | __set_bit(BTN_TOUCH, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3070 | __set_bit(ABS_MISC, input_dev->absbit); |
| 3071 | |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3072 | input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, |
| 3073 | features->x_max - features->offset_right, |
| 3074 | features->x_fuzz, 0); |
| 3075 | input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, |
| 3076 | features->y_max - features->offset_bottom, |
| 3077 | features->y_fuzz, 0); |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3078 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, |
| 3079 | features->pressure_max, features->pressure_fuzz, 0); |
| 3080 | |
| 3081 | /* penabled devices have fixed resolution for each model */ |
| 3082 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
| 3083 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
| 3084 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3085 | switch (features->type) { |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3086 | case GRAPHIRE_BT: |
| 3087 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 3088 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3089 | case WACOM_MO: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3090 | case WACOM_G4: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3091 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 3092 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3093 | features->distance_fuzz, 0); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3094 | /* fall through */ |
| 3095 | |
| 3096 | case GRAPHIRE: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3097 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 3098 | |
| 3099 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3100 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3101 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 3102 | |
| 3103 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 3104 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 3105 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 3106 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3107 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3108 | break; |
| 3109 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3110 | case WACOM_27QHD: |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 3111 | case WACOM_24HD: |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3112 | case DTK: |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 3113 | case WACOM_22HD: |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3114 | case WACOM_21UX2: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3115 | case WACOM_BEE: |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 3116 | case CINTIQ: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3117 | case WACOM_13HD: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3118 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3119 | case CINTIQ_COMPANION_2: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3120 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3121 | input_abs_set_res(input_dev, ABS_Z, 287); |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3122 | wacom_setup_cintiq(wacom_wac); |
| 3123 | break; |
| 3124 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3125 | case INTUOS3: |
| 3126 | case INTUOS3L: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3127 | case INTUOS3S: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 3128 | case INTUOS4: |
| 3129 | case INTUOS4WL: |
| 3130 | case INTUOS4L: |
| 3131 | case INTUOS4S: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3132 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 3133 | input_abs_set_res(input_dev, ABS_Z, 287); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3134 | /* fall through */ |
| 3135 | |
| 3136 | case INTUOS: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3137 | wacom_setup_intuos(wacom_wac); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3138 | break; |
| 3139 | |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3140 | case INTUOS5: |
| 3141 | case INTUOS5L: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3142 | case INTUOSPM: |
| 3143 | case INTUOSPL: |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3144 | case INTUOS5S: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3145 | case INTUOSPS: |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3146 | case INTUOSP2_BT: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3147 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 3148 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3149 | features->distance_fuzz, 0); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3150 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3151 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 3152 | input_abs_set_res(input_dev, ABS_Z, 287); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3153 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3154 | wacom_setup_intuos(wacom_wac); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 3155 | break; |
| 3156 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 3157 | case WACOM_24HDT: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3158 | case WACOM_27QHDT: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3159 | case MTSCREEN: |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3160 | case MTTPC: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3161 | case MTTPC_B: |
Ping Cheng | 6795a52 | 2012-06-28 16:49:00 -0700 | [diff] [blame] | 3162 | case TABLETPC2FG: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3163 | case TABLETPC: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3164 | case TABLETPCE: |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 3165 | __clear_bit(ABS_MISC, input_dev->absbit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3166 | /* fall through */ |
| 3167 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3168 | case DTUS: |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3169 | case DTUSX: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3170 | case PL: |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3171 | case DTU: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3172 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Jason Gerecke | 3512069 | 2011-09-08 09:38:14 -0700 | [diff] [blame] | 3173 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3174 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3175 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
Jason Gerecke | 3512069 | 2011-09-08 09:38:14 -0700 | [diff] [blame] | 3176 | break; |
| 3177 | |
| 3178 | case PTU: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3179 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 3180 | /* fall through */ |
| 3181 | |
| 3182 | case PENPARTNER: |
Jason Gerecke | 1fab84a | 2011-08-26 23:18:22 -0700 | [diff] [blame] | 3183 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3184 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
Jason Gerecke | 1fab84a | 2011-08-26 23:18:22 -0700 | [diff] [blame] | 3185 | __set_bit(BTN_STYLUS, input_dev->keybit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 3186 | break; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3187 | |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3188 | case INTUOSHT: |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3189 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3190 | case BAMBOO_PEN: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3191 | case INTUOSHT2: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3192 | if (features->type == INTUOSHT2) { |
| 3193 | wacom_setup_basic_pro_pen(wacom_wac); |
| 3194 | } else { |
| 3195 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 3196 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 3197 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 3198 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3199 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 3200 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3201 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3202 | features->distance_fuzz, 0); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3203 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3204 | break; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3205 | case BAMBOO_PAD: |
| 3206 | __clear_bit(ABS_MISC, input_dev->absbit); |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3207 | break; |
| 3208 | } |
| 3209 | return 0; |
| 3210 | } |
| 3211 | |
| 3212 | int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, |
| 3213 | struct wacom_wac *wacom_wac) |
| 3214 | { |
| 3215 | struct wacom_features *features = &wacom_wac->features; |
| 3216 | |
| 3217 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3218 | |
| 3219 | if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) |
| 3220 | return -ENODEV; |
| 3221 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3222 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
| 3223 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 3224 | else |
| 3225 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 3226 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3227 | if (features->type == HID_GENERIC) |
| 3228 | /* setup has already been done */ |
| 3229 | return 0; |
| 3230 | |
| 3231 | __set_bit(BTN_TOUCH, input_dev->keybit); |
| 3232 | |
| 3233 | if (features->touch_max == 1) { |
| 3234 | input_set_abs_params(input_dev, ABS_X, 0, |
| 3235 | features->x_max, features->x_fuzz, 0); |
| 3236 | input_set_abs_params(input_dev, ABS_Y, 0, |
| 3237 | features->y_max, features->y_fuzz, 0); |
| 3238 | input_abs_set_res(input_dev, ABS_X, |
| 3239 | features->x_resolution); |
| 3240 | input_abs_set_res(input_dev, ABS_Y, |
| 3241 | features->y_resolution); |
| 3242 | } |
| 3243 | else if (features->touch_max > 1) { |
| 3244 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, |
| 3245 | features->x_max, features->x_fuzz, 0); |
| 3246 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, |
| 3247 | features->y_max, features->y_fuzz, 0); |
| 3248 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, |
| 3249 | features->x_resolution); |
| 3250 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, |
| 3251 | features->y_resolution); |
| 3252 | } |
| 3253 | |
| 3254 | switch (features->type) { |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3255 | case INTUOSP2_BT: |
| 3256 | input_dev->evbit[0] |= BIT_MASK(EV_SW); |
| 3257 | __set_bit(SW_MUTE_DEVICE, input_dev->swbit); |
| 3258 | |
| 3259 | if (wacom_wac->shared->touch->product == 0x361) { |
| 3260 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| 3261 | 0, 12440, 4, 0); |
| 3262 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
| 3263 | 0, 8640, 4, 0); |
| 3264 | } |
| 3265 | else if (wacom_wac->shared->touch->product == 0x360) { |
| 3266 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| 3267 | 0, 8960, 4, 0); |
| 3268 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, |
| 3269 | 0, 5920, 4, 0); |
| 3270 | } |
| 3271 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, 40); |
| 3272 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, 40); |
| 3273 | |
| 3274 | /* fall through */ |
| 3275 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3276 | case INTUOS5: |
| 3277 | case INTUOS5L: |
| 3278 | case INTUOSPM: |
| 3279 | case INTUOSPL: |
| 3280 | case INTUOS5S: |
| 3281 | case INTUOSPS: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3282 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); |
| 3283 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); |
| 3284 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 3285 | break; |
| 3286 | |
| 3287 | case WACOM_24HDT: |
| 3288 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); |
| 3289 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); |
| 3290 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); |
| 3291 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); |
| 3292 | /* fall through */ |
| 3293 | |
| 3294 | case WACOM_27QHDT: |
| 3295 | case MTSCREEN: |
| 3296 | case MTTPC: |
| 3297 | case MTTPC_B: |
| 3298 | case TABLETPC2FG: |
| 3299 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); |
| 3300 | /*fall through */ |
| 3301 | |
| 3302 | case TABLETPC: |
| 3303 | case TABLETPCE: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3304 | break; |
| 3305 | |
| 3306 | case INTUOSHT: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3307 | case INTUOSHT2: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3308 | input_dev->evbit[0] |= BIT_MASK(EV_SW); |
| 3309 | __set_bit(SW_MUTE_DEVICE, input_dev->swbit); |
| 3310 | /* fall through */ |
| 3311 | |
| 3312 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3313 | case BAMBOO_TOUCH: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3314 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
| 3315 | input_set_abs_params(input_dev, |
| 3316 | ABS_MT_TOUCH_MAJOR, |
| 3317 | 0, features->x_max, 0, 0); |
| 3318 | input_set_abs_params(input_dev, |
| 3319 | ABS_MT_TOUCH_MINOR, |
| 3320 | 0, features->y_max, 0, 0); |
| 3321 | } |
| 3322 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 3323 | break; |
| 3324 | |
| 3325 | case BAMBOO_PAD: |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3326 | input_mt_init_slots(input_dev, features->touch_max, |
| 3327 | INPUT_MT_POINTER); |
| 3328 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3329 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3330 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3331 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3332 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3333 | } |
| 3334 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3335 | static int wacom_numbered_button_to_key(int n) |
| 3336 | { |
| 3337 | if (n < 10) |
| 3338 | return BTN_0 + n; |
| 3339 | else if (n < 16) |
| 3340 | return BTN_A + (n-10); |
| 3341 | else if (n < 18) |
| 3342 | return BTN_BASE + (n-16); |
| 3343 | else |
| 3344 | return 0; |
| 3345 | } |
| 3346 | |
Jiri Kosina | 5397df1 | 2015-08-28 20:46:42 +0200 | [diff] [blame] | 3347 | static void wacom_setup_numbered_buttons(struct input_dev *input_dev, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3348 | int button_count) |
| 3349 | { |
| 3350 | int i; |
| 3351 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3352 | for (i = 0; i < button_count; i++) { |
| 3353 | int key = wacom_numbered_button_to_key(i); |
| 3354 | |
| 3355 | if (key) |
| 3356 | __set_bit(key, input_dev->keybit); |
| 3357 | } |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3358 | } |
| 3359 | |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3360 | static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group) |
| 3361 | { |
| 3362 | struct wacom_led *led; |
| 3363 | int i; |
| 3364 | bool updated = false; |
| 3365 | |
| 3366 | /* |
| 3367 | * 24HD has LED group 1 to the left and LED group 0 to the right. |
| 3368 | * So group 0 matches the second half of the buttons and thus the mask |
| 3369 | * needs to be shifted. |
| 3370 | */ |
| 3371 | if (group == 0) |
| 3372 | mask >>= 8; |
| 3373 | |
| 3374 | for (i = 0; i < 3; i++) { |
| 3375 | led = wacom_led_find(wacom, group, i); |
| 3376 | if (!led) { |
| 3377 | hid_err(wacom->hdev, "can't find LED %d in group %d\n", |
| 3378 | i, group); |
| 3379 | continue; |
| 3380 | } |
| 3381 | if (!updated && mask & BIT(i)) { |
| 3382 | led->held = true; |
| 3383 | led_trigger_event(&led->trigger, LED_FULL); |
| 3384 | } else { |
| 3385 | led->held = false; |
| 3386 | } |
| 3387 | } |
| 3388 | } |
| 3389 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3390 | static bool wacom_is_led_toggled(struct wacom *wacom, int button_count, |
| 3391 | int mask, int group) |
| 3392 | { |
| 3393 | int button_per_group; |
| 3394 | |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3395 | /* |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3396 | * 21UX2 has LED group 1 to the left and LED group 0 |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3397 | * to the right. We need to reverse the group to match this |
| 3398 | * historical behavior. |
| 3399 | */ |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3400 | if (wacom->wacom_wac.features.type == WACOM_21UX2) |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3401 | group = 1 - group; |
| 3402 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3403 | button_per_group = button_count/wacom->led.count; |
| 3404 | |
| 3405 | return mask & (1 << (group * button_per_group)); |
| 3406 | } |
| 3407 | |
| 3408 | static void wacom_update_led(struct wacom *wacom, int button_count, int mask, |
| 3409 | int group) |
| 3410 | { |
| 3411 | struct wacom_led *led, *next_led; |
| 3412 | int cur; |
| 3413 | bool pressed; |
| 3414 | |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3415 | if (wacom->wacom_wac.features.type == WACOM_24HD) |
| 3416 | return wacom_24hd_update_leds(wacom, mask, group); |
| 3417 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3418 | pressed = wacom_is_led_toggled(wacom, button_count, mask, group); |
| 3419 | cur = wacom->led.groups[group].select; |
| 3420 | |
| 3421 | led = wacom_led_find(wacom, group, cur); |
| 3422 | if (!led) { |
| 3423 | hid_err(wacom->hdev, "can't find current LED %d in group %d\n", |
| 3424 | cur, group); |
| 3425 | return; |
| 3426 | } |
| 3427 | |
| 3428 | if (!pressed) { |
| 3429 | led->held = false; |
| 3430 | return; |
| 3431 | } |
| 3432 | |
| 3433 | if (led->held && pressed) |
| 3434 | return; |
| 3435 | |
| 3436 | next_led = wacom_led_next(wacom, led); |
| 3437 | if (!next_led) { |
| 3438 | hid_err(wacom->hdev, "can't find next LED in group %d\n", |
| 3439 | group); |
| 3440 | return; |
| 3441 | } |
| 3442 | if (next_led == led) |
| 3443 | return; |
| 3444 | |
| 3445 | next_led->held = true; |
| 3446 | led_trigger_event(&next_led->trigger, |
| 3447 | wacom_leds_brightness_get(next_led)); |
| 3448 | } |
| 3449 | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3450 | static void wacom_report_numbered_buttons(struct input_dev *input_dev, |
| 3451 | int button_count, int mask) |
| 3452 | { |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3453 | struct wacom *wacom = input_get_drvdata(input_dev); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3454 | int i; |
| 3455 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3456 | for (i = 0; i < wacom->led.count; i++) |
| 3457 | wacom_update_led(wacom, button_count, mask, i); |
| 3458 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3459 | for (i = 0; i < button_count; i++) { |
| 3460 | int key = wacom_numbered_button_to_key(i); |
| 3461 | |
| 3462 | if (key) |
| 3463 | input_report_key(input_dev, key, mask & (1 << i)); |
| 3464 | } |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3465 | } |
| 3466 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3467 | int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, |
| 3468 | struct wacom_wac *wacom_wac) |
| 3469 | { |
| 3470 | struct wacom_features *features = &wacom_wac->features; |
| 3471 | |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3472 | if (!(features->device_type & WACOM_DEVICETYPE_PAD)) |
| 3473 | return -ENODEV; |
| 3474 | |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 3475 | if (features->type == REMOTE && input_dev == wacom_wac->pad_input) |
| 3476 | return -ENODEV; |
| 3477 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3478 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3479 | |
| 3480 | /* kept for making legacy xf86-input-wacom working with the wheels */ |
| 3481 | __set_bit(ABS_MISC, input_dev->absbit); |
| 3482 | |
| 3483 | /* kept for making legacy xf86-input-wacom accepting the pad */ |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 3484 | if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || |
| 3485 | input_dev->absinfo[ABS_X].maximum))) |
| 3486 | input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); |
| 3487 | if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || |
| 3488 | input_dev->absinfo[ABS_Y].maximum))) |
| 3489 | input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3490 | |
Benjamin Tissoires | 12969e3 | 2014-09-11 13:14:04 -0400 | [diff] [blame] | 3491 | /* kept for making udev and libwacom accepting the pad */ |
| 3492 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3493 | |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3494 | wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); |
| 3495 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3496 | switch (features->type) { |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3497 | |
| 3498 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3499 | case CINTIQ_COMPANION_2: |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3500 | case DTK: |
| 3501 | case DTUS: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3502 | case GRAPHIRE_BT: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3503 | break; |
| 3504 | |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 3505 | case WACOM_MO: |
| 3506 | __set_bit(BTN_BACK, input_dev->keybit); |
| 3507 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3508 | __set_bit(BTN_FORWARD, input_dev->keybit); |
| 3509 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3510 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3511 | break; |
| 3512 | |
| 3513 | case WACOM_G4: |
| 3514 | __set_bit(BTN_BACK, input_dev->keybit); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 3515 | __set_bit(BTN_FORWARD, input_dev->keybit); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 3516 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 3517 | break; |
| 3518 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3519 | case WACOM_24HD: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3520 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 3521 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 3522 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 3523 | |
| 3524 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3525 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
| 3526 | break; |
| 3527 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3528 | case WACOM_27QHD: |
| 3529 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 3530 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 3531 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 3532 | input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); |
| 3533 | input_abs_set_res(input_dev, ABS_X, 1024); /* points/g */ |
| 3534 | input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); |
| 3535 | input_abs_set_res(input_dev, ABS_Y, 1024); |
| 3536 | input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); |
| 3537 | input_abs_set_res(input_dev, ABS_Z, 1024); |
| 3538 | __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); |
| 3539 | break; |
| 3540 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3541 | case WACOM_22HD: |
| 3542 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 3543 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 3544 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 3545 | /* fall through */ |
| 3546 | |
| 3547 | case WACOM_21UX2: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3548 | case WACOM_BEE: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3549 | case CINTIQ: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3550 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 3551 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
| 3552 | break; |
| 3553 | |
| 3554 | case WACOM_13HD: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3555 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3556 | break; |
| 3557 | |
| 3558 | case INTUOS3: |
| 3559 | case INTUOS3L: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3560 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
| 3561 | /* fall through */ |
| 3562 | |
| 3563 | case INTUOS3S: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3564 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 3565 | break; |
| 3566 | |
| 3567 | case INTUOS5: |
| 3568 | case INTUOS5L: |
| 3569 | case INTUOSPM: |
| 3570 | case INTUOSPL: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3571 | case INTUOS5S: |
| 3572 | case INTUOSPS: |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 3573 | case INTUOSP2_BT: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3574 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3575 | break; |
| 3576 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 3577 | case INTUOS4WL: |
| 3578 | /* |
| 3579 | * For Bluetooth devices, the udev rule does not work correctly |
| 3580 | * for pads unless we add a stylus capability, which forces |
| 3581 | * ID_INPUT_TABLET to be set. |
| 3582 | */ |
| 3583 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3584 | /* fall through */ |
| 3585 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3586 | case INTUOS4: |
| 3587 | case INTUOS4L: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3588 | case INTUOS4S: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3589 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3590 | break; |
| 3591 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 3592 | case INTUOSHT: |
| 3593 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3594 | case BAMBOO_TOUCH: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3595 | case INTUOSHT2: |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 3596 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 3597 | |
| 3598 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3599 | __set_bit(BTN_FORWARD, input_dev->keybit); |
| 3600 | __set_bit(BTN_BACK, input_dev->keybit); |
| 3601 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3602 | |
| 3603 | break; |
| 3604 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3605 | case REMOTE: |
| 3606 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
| 3607 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3608 | break; |
| 3609 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 3610 | case HID_GENERIC: |
| 3611 | break; |
| 3612 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3613 | default: |
| 3614 | /* no pad supported */ |
Ping Cheng | b3c8e93 | 2014-11-18 13:27:48 -0800 | [diff] [blame] | 3615 | return -ENODEV; |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3616 | } |
| 3617 | return 0; |
| 3618 | } |
| 3619 | |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3620 | static const struct wacom_features wacom_features_0x00 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3621 | { "Wacom Penpartner", 5040, 3780, 255, 0, |
| 3622 | PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3623 | static const struct wacom_features wacom_features_0x10 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3624 | { "Wacom Graphire", 10206, 7422, 511, 63, |
| 3625 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3626 | static const struct wacom_features wacom_features_0x81 = |
| 3627 | { "Wacom Graphire BT", 16704, 12064, 511, 32, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3628 | GRAPHIRE_BT, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES, 2 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3629 | static const struct wacom_features wacom_features_0x11 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3630 | { "Wacom Graphire2 4x5", 10206, 7422, 511, 63, |
| 3631 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3632 | static const struct wacom_features wacom_features_0x12 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3633 | { "Wacom Graphire2 5x7", 13918, 10206, 511, 63, |
| 3634 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3635 | static const struct wacom_features wacom_features_0x13 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3636 | { "Wacom Graphire3", 10208, 7424, 511, 63, |
| 3637 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3638 | static const struct wacom_features wacom_features_0x14 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3639 | { "Wacom Graphire3 6x8", 16704, 12064, 511, 63, |
| 3640 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3641 | static const struct wacom_features wacom_features_0x15 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3642 | { "Wacom Graphire4 4x5", 10208, 7424, 511, 63, |
| 3643 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3644 | static const struct wacom_features wacom_features_0x16 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3645 | { "Wacom Graphire4 6x8", 16704, 12064, 511, 63, |
| 3646 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3647 | static const struct wacom_features wacom_features_0x17 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3648 | { "Wacom BambooFun 4x5", 14760, 9225, 511, 63, |
| 3649 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3650 | static const struct wacom_features wacom_features_0x18 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3651 | { "Wacom BambooFun 6x8", 21648, 13530, 511, 63, |
| 3652 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3653 | static const struct wacom_features wacom_features_0x19 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3654 | { "Wacom Bamboo1 Medium", 16704, 12064, 511, 63, |
| 3655 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3656 | static const struct wacom_features wacom_features_0x60 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3657 | { "Wacom Volito", 5104, 3712, 511, 63, |
| 3658 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3659 | static const struct wacom_features wacom_features_0x61 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3660 | { "Wacom PenStation2", 3250, 2320, 255, 63, |
| 3661 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3662 | static const struct wacom_features wacom_features_0x62 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3663 | { "Wacom Volito2 4x5", 5104, 3712, 511, 63, |
| 3664 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3665 | static const struct wacom_features wacom_features_0x63 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3666 | { "Wacom Volito2 2x3", 3248, 2320, 511, 63, |
| 3667 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3668 | static const struct wacom_features wacom_features_0x64 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3669 | { "Wacom PenPartner2", 3250, 2320, 511, 63, |
| 3670 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3671 | static const struct wacom_features wacom_features_0x65 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3672 | { "Wacom Bamboo", 14760, 9225, 511, 63, |
| 3673 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3674 | static const struct wacom_features wacom_features_0x69 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3675 | { "Wacom Bamboo1", 5104, 3712, 511, 63, |
| 3676 | GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 3677 | static const struct wacom_features wacom_features_0x6A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3678 | { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63, |
| 3679 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 3680 | static const struct wacom_features wacom_features_0x6B = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3681 | { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63, |
| 3682 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3683 | static const struct wacom_features wacom_features_0x20 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3684 | { "Wacom Intuos 4x5", 12700, 10600, 1023, 31, |
| 3685 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3686 | static const struct wacom_features wacom_features_0x21 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3687 | { "Wacom Intuos 6x8", 20320, 16240, 1023, 31, |
| 3688 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3689 | static const struct wacom_features wacom_features_0x22 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3690 | { "Wacom Intuos 9x12", 30480, 24060, 1023, 31, |
| 3691 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3692 | static const struct wacom_features wacom_features_0x23 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3693 | { "Wacom Intuos 12x12", 30480, 31680, 1023, 31, |
| 3694 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3695 | static const struct wacom_features wacom_features_0x24 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3696 | { "Wacom Intuos 12x18", 45720, 31680, 1023, 31, |
| 3697 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3698 | static const struct wacom_features wacom_features_0x30 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3699 | { "Wacom PL400", 5408, 4056, 255, 0, |
| 3700 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3701 | static const struct wacom_features wacom_features_0x31 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3702 | { "Wacom PL500", 6144, 4608, 255, 0, |
| 3703 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3704 | static const struct wacom_features wacom_features_0x32 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3705 | { "Wacom PL600", 6126, 4604, 255, 0, |
| 3706 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3707 | static const struct wacom_features wacom_features_0x33 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3708 | { "Wacom PL600SX", 6260, 5016, 255, 0, |
| 3709 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3710 | static const struct wacom_features wacom_features_0x34 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3711 | { "Wacom PL550", 6144, 4608, 511, 0, |
| 3712 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3713 | static const struct wacom_features wacom_features_0x35 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3714 | { "Wacom PL800", 7220, 5780, 511, 0, |
| 3715 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3716 | static const struct wacom_features wacom_features_0x37 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3717 | { "Wacom PL700", 6758, 5406, 511, 0, |
| 3718 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3719 | static const struct wacom_features wacom_features_0x38 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3720 | { "Wacom PL510", 6282, 4762, 511, 0, |
| 3721 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3722 | static const struct wacom_features wacom_features_0x39 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3723 | { "Wacom DTU710", 34080, 27660, 511, 0, |
| 3724 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3725 | static const struct wacom_features wacom_features_0xC4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3726 | { "Wacom DTF521", 6282, 4762, 511, 0, |
| 3727 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3728 | static const struct wacom_features wacom_features_0xC0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3729 | { "Wacom DTF720", 6858, 5506, 511, 0, |
| 3730 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3731 | static const struct wacom_features wacom_features_0xC2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3732 | { "Wacom DTF720a", 6858, 5506, 511, 0, |
| 3733 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3734 | static const struct wacom_features wacom_features_0x03 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3735 | { "Wacom Cintiq Partner", 20480, 15360, 511, 0, |
| 3736 | PTU, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3737 | static const struct wacom_features wacom_features_0x41 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3738 | { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31, |
| 3739 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3740 | static const struct wacom_features wacom_features_0x42 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3741 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 3742 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3743 | static const struct wacom_features wacom_features_0x43 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3744 | { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31, |
| 3745 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3746 | static const struct wacom_features wacom_features_0x44 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3747 | { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31, |
| 3748 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3749 | static const struct wacom_features wacom_features_0x45 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3750 | { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31, |
| 3751 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3752 | static const struct wacom_features wacom_features_0xB0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3753 | { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3754 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3755 | static const struct wacom_features wacom_features_0xB1 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3756 | { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3757 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3758 | static const struct wacom_features wacom_features_0xB2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3759 | { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3760 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3761 | static const struct wacom_features wacom_features_0xB3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3762 | { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3763 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3764 | static const struct wacom_features wacom_features_0xB4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3765 | { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3766 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3767 | static const struct wacom_features wacom_features_0xB5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3768 | { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3769 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3770 | static const struct wacom_features wacom_features_0xB7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3771 | { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3772 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3773 | static const struct wacom_features wacom_features_0xB8 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3774 | { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3775 | INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3776 | static const struct wacom_features wacom_features_0xB9 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3777 | { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3778 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3779 | static const struct wacom_features wacom_features_0xBA = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3780 | { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3781 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3782 | static const struct wacom_features wacom_features_0xBB = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3783 | { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3784 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3785 | static const struct wacom_features wacom_features_0xBC = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3786 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3787 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 3788 | static const struct wacom_features wacom_features_0xBD = |
| 3789 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3790 | INTUOS4WL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3791 | static const struct wacom_features wacom_features_0x26 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3792 | { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3793 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3794 | static const struct wacom_features wacom_features_0x27 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3795 | { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3796 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3797 | static const struct wacom_features wacom_features_0x28 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3798 | { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3799 | INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3800 | static const struct wacom_features wacom_features_0x29 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3801 | { "Wacom Intuos5 S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3802 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3803 | static const struct wacom_features wacom_features_0x2A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3804 | { "Wacom Intuos5 M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3805 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3806 | static const struct wacom_features wacom_features_0x314 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3807 | { "Wacom Intuos Pro S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3808 | INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3809 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3810 | static const struct wacom_features wacom_features_0x315 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3811 | { "Wacom Intuos Pro M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3812 | INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3813 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3814 | static const struct wacom_features wacom_features_0x317 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3815 | { "Wacom Intuos Pro L", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3816 | INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3817 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 3818 | static const struct wacom_features wacom_features_0xF4 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3819 | { "Wacom Cintiq 24HD", 104480, 65600, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3820 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3821 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3822 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Jason Gerecke | 6f4d038 | 2012-08-21 22:11:59 -0700 | [diff] [blame] | 3823 | static const struct wacom_features wacom_features_0xF8 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3824 | { "Wacom Cintiq 24HD touch", 104480, 65600, 2047, 63, /* Pen */ |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3825 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3826 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3827 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 3bd1f7e | 2013-05-23 10:22:33 -0700 | [diff] [blame] | 3828 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 3829 | static const struct wacom_features wacom_features_0xF6 = |
| 3830 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3831 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, |
| 3832 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3833 | static const struct wacom_features wacom_features_0x32A = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3834 | { "Wacom Cintiq 27QHD", 120140, 67920, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3835 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3836 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | a7e6645 | 2015-02-04 16:01:54 -0800 | [diff] [blame] | 3837 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3838 | static const struct wacom_features wacom_features_0x32B = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3839 | { "Wacom Cintiq 27QHD touch", 120140, 67920, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3840 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3841 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3842 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3843 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C }; |
| 3844 | static const struct wacom_features wacom_features_0x32C = |
| 3845 | { "Wacom Cintiq 27QHD touch", .type = WACOM_27QHDT, |
| 3846 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3847 | static const struct wacom_features wacom_features_0x3F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3848 | { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3849 | CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3850 | static const struct wacom_features wacom_features_0xC5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3851 | { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3852 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3853 | static const struct wacom_features wacom_features_0xC6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3854 | { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3855 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3856 | static const struct wacom_features wacom_features_0x304 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3857 | { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3858 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3859 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3860 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 3861 | static const struct wacom_features wacom_features_0x333 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3862 | { "Wacom Cintiq 13HD touch", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3863 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 3864 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3865 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 3866 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 }; |
| 3867 | static const struct wacom_features wacom_features_0x335 = |
| 3868 | { "Wacom Cintiq 13HD touch", .type = WACOM_24HDT, /* Touch */ |
| 3869 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x333, .touch_max = 10, |
| 3870 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3871 | static const struct wacom_features wacom_features_0xC7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3872 | { "Wacom DTU1931", 37832, 30305, 511, 0, |
| 3873 | PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3874 | static const struct wacom_features wacom_features_0xCE = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3875 | { "Wacom DTU2231", 47864, 27011, 511, 0, |
| 3876 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3877 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBMOUSE }; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3878 | static const struct wacom_features wacom_features_0xF0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3879 | { "Wacom DTU1631", 34623, 19553, 511, 0, |
| 3880 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3881 | static const struct wacom_features wacom_features_0xFB = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3882 | { "Wacom DTU1031", 22096, 13960, 511, 0, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3883 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3884 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3885 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3886 | static const struct wacom_features wacom_features_0x32F = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3887 | { "Wacom DTU1031X", 22672, 12928, 511, 0, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3888 | DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3889 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3890 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Aaron Skomra | 007760c | 2015-04-16 15:01:14 -0700 | [diff] [blame] | 3891 | static const struct wacom_features wacom_features_0x336 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3892 | { "Wacom DTU1141", 23672, 13403, 1023, 0, |
Ping Cheng | ff38e82 | 2015-11-12 17:21:14 -0800 | [diff] [blame] | 3893 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3894 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | ff38e82 | 2015-11-12 17:21:14 -0800 | [diff] [blame] | 3895 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3896 | static const struct wacom_features wacom_features_0x57 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3897 | { "Wacom DTK2241", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3898 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3899 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3900 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3901 | static const struct wacom_features wacom_features_0x59 = /* Pen */ |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3902 | { "Wacom DTH2242", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3903 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3904 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3905 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3906 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; |
| 3907 | static const struct wacom_features wacom_features_0x5D = /* Touch */ |
| 3908 | { "Wacom DTH2242", .type = WACOM_24HDT, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3909 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10, |
| 3910 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3911 | static const struct wacom_features wacom_features_0xCC = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3912 | { "Wacom Cintiq 21UX2", 87200, 65600, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3913 | WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3914 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3915 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 3916 | static const struct wacom_features wacom_features_0xFA = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3917 | { "Wacom Cintiq 22HD", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3918 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3919 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3920 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3921 | static const struct wacom_features wacom_features_0x5B = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3922 | { "Wacom Cintiq 22HDT", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3923 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3924 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3925 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 3bd1f7e | 2013-05-23 10:22:33 -0700 | [diff] [blame] | 3926 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3927 | static const struct wacom_features wacom_features_0x5E = |
| 3928 | { "Wacom Cintiq 22HDT", .type = WACOM_24HDT, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3929 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10, |
| 3930 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3931 | static const struct wacom_features wacom_features_0x90 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3932 | { "Wacom ISDv4 90", 26202, 16325, 255, 0, |
| 3933 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3934 | static const struct wacom_features wacom_features_0x93 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3935 | { "Wacom ISDv4 93", 26202, 16325, 255, 0, |
| 3936 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 3937 | static const struct wacom_features wacom_features_0x97 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3938 | { "Wacom ISDv4 97", 26202, 16325, 511, 0, |
| 3939 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3940 | static const struct wacom_features wacom_features_0x9A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3941 | { "Wacom ISDv4 9A", 26202, 16325, 255, 0, |
| 3942 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3943 | static const struct wacom_features wacom_features_0x9F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3944 | { "Wacom ISDv4 9F", 26202, 16325, 255, 0, |
| 3945 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3946 | static const struct wacom_features wacom_features_0xE2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3947 | { "Wacom ISDv4 E2", 26202, 16325, 255, 0, |
| 3948 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3949 | static const struct wacom_features wacom_features_0xE3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3950 | { "Wacom ISDv4 E3", 26202, 16325, 255, 0, |
| 3951 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3952 | static const struct wacom_features wacom_features_0xE5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3953 | { "Wacom ISDv4 E5", 26202, 16325, 255, 0, |
| 3954 | MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Manoj Iyer | 26fcd2a | 2011-03-31 22:39:43 -0700 | [diff] [blame] | 3955 | static const struct wacom_features wacom_features_0xE6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3956 | { "Wacom ISDv4 E6", 27760, 15694, 255, 0, |
| 3957 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Chris Bagwell | 0d0e306 | 2011-12-11 23:50:59 -0800 | [diff] [blame] | 3958 | static const struct wacom_features wacom_features_0xEC = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3959 | { "Wacom ISDv4 EC", 25710, 14500, 255, 0, |
| 3960 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3961 | static const struct wacom_features wacom_features_0xED = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3962 | { "Wacom ISDv4 ED", 26202, 16325, 255, 0, |
| 3963 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3964 | static const struct wacom_features wacom_features_0xEF = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3965 | { "Wacom ISDv4 EF", 26202, 16325, 255, 0, |
| 3966 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3967 | static const struct wacom_features wacom_features_0x100 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3968 | { "Wacom ISDv4 100", 26202, 16325, 255, 0, |
| 3969 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3970 | static const struct wacom_features wacom_features_0x101 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3971 | { "Wacom ISDv4 101", 26202, 16325, 255, 0, |
| 3972 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Stephan Frank | 5869483 | 2013-03-07 14:08:50 -0800 | [diff] [blame] | 3973 | static const struct wacom_features wacom_features_0x10D = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3974 | { "Wacom ISDv4 10D", 26202, 16325, 255, 0, |
| 3975 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 2d3163f | 2013-10-22 15:35:30 -0700 | [diff] [blame] | 3976 | static const struct wacom_features wacom_features_0x10E = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3977 | { "Wacom ISDv4 10E", 27760, 15694, 255, 0, |
| 3978 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 9b4f60e | 2013-10-15 23:46:34 -0700 | [diff] [blame] | 3979 | static const struct wacom_features wacom_features_0x10F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3980 | { "Wacom ISDv4 10F", 27760, 15694, 255, 0, |
| 3981 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 61616ed | 2014-05-14 11:42:22 -0700 | [diff] [blame] | 3982 | static const struct wacom_features wacom_features_0x116 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3983 | { "Wacom ISDv4 116", 26202, 16325, 255, 0, |
| 3984 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | aeaf50d | 2014-07-28 10:53:16 -0700 | [diff] [blame] | 3985 | static const struct wacom_features wacom_features_0x12C = |
| 3986 | { "Wacom ISDv4 12C", 27848, 15752, 2047, 0, |
| 3987 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | edbe265 | 2012-11-21 13:12:50 -0800 | [diff] [blame] | 3988 | static const struct wacom_features wacom_features_0x4001 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3989 | { "Wacom ISDv4 4001", 26202, 16325, 255, 0, |
| 3990 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3991 | static const struct wacom_features wacom_features_0x4004 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3992 | { "Wacom ISDv4 4004", 11060, 6220, 255, 0, |
| 3993 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3994 | static const struct wacom_features wacom_features_0x5000 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3995 | { "Wacom ISDv4 5000", 27848, 15752, 1023, 0, |
| 3996 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3997 | static const struct wacom_features wacom_features_0x5002 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3998 | { "Wacom ISDv4 5002", 29576, 16724, 1023, 0, |
| 3999 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 4000 | static const struct wacom_features wacom_features_0x47 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4001 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 4002 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 4003 | static const struct wacom_features wacom_features_0x84 = |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4004 | { "Wacom Wireless Receiver", .type = WIRELESS, .touch_max = 16 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4005 | static const struct wacom_features wacom_features_0xD0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4006 | { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4007 | BAMBOO_TOUCH, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4008 | static const struct wacom_features wacom_features_0xD1 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4009 | { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31, |
| 4010 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4011 | static const struct wacom_features wacom_features_0xD2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4012 | { "Wacom Bamboo Craft", 14720, 9200, 1023, 31, |
| 4013 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4014 | static const struct wacom_features wacom_features_0xD3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4015 | { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31, |
| 4016 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Kevin Granade | 57a7872 | 2010-12-10 23:04:02 -0800 | [diff] [blame] | 4017 | static const struct wacom_features wacom_features_0xD4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4018 | { "Wacom Bamboo Pen", 14720, 9200, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4019 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Gerard Braad | 18adad1 | 2011-08-16 00:17:56 -0700 | [diff] [blame] | 4020 | static const struct wacom_features wacom_features_0xD5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4021 | { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4022 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4023 | static const struct wacom_features wacom_features_0xD6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4024 | { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31, |
| 4025 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4026 | static const struct wacom_features wacom_features_0xD7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4027 | { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31, |
| 4028 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4029 | static const struct wacom_features wacom_features_0xD8 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4030 | { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31, |
| 4031 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 4032 | static const struct wacom_features wacom_features_0xDA = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4033 | { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31, |
| 4034 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4035 | static const struct wacom_features wacom_features_0xDB = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4036 | { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31, |
| 4037 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4038 | static const struct wacom_features wacom_features_0xDD = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4039 | { "Wacom Bamboo Connect", 14720, 9200, 1023, 31, |
| 4040 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4041 | static const struct wacom_features wacom_features_0xDE = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4042 | { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31, |
| 4043 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4044 | static const struct wacom_features wacom_features_0xDF = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4045 | { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31, |
| 4046 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4047 | static const struct wacom_features wacom_features_0x300 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4048 | { "Wacom Bamboo One S", 14720, 9225, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4049 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4050 | static const struct wacom_features wacom_features_0x301 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4051 | { "Wacom Bamboo One M", 21648, 13530, 1023, 31, |
| 4052 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 4053 | static const struct wacom_features wacom_features_0x302 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4054 | { "Wacom Intuos PT S", 15200, 9500, 1023, 31, |
| 4055 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4056 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 4057 | static const struct wacom_features wacom_features_0x303 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4058 | { "Wacom Intuos PT M", 21600, 13500, 1023, 31, |
| 4059 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4060 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 4061 | static const struct wacom_features wacom_features_0x30E = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4062 | { "Wacom Intuos S", 15200, 9500, 1023, 31, |
| 4063 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4064 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 4065 | static const struct wacom_features wacom_features_0x6004 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 4066 | { "ISD-V4", 12800, 8000, 255, 0, |
| 4067 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4068 | static const struct wacom_features wacom_features_0x307 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4069 | { "Wacom ISDv5 307", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4070 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4071 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4072 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 4073 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4074 | static const struct wacom_features wacom_features_0x309 = |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 4075 | { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4076 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10, |
| 4077 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4078 | static const struct wacom_features wacom_features_0x30A = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4079 | { "Wacom ISDv5 30A", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 4080 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 4081 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4082 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4083 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C }; |
| 4084 | static const struct wacom_features wacom_features_0x30C = |
| 4085 | { "Wacom ISDv5 30C", .type = WACOM_24HDT, /* Touch */ |
| 4086 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10, |
| 4087 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 4088 | static const struct wacom_features wacom_features_0x318 = |
| 4089 | { "Wacom USB Bamboo PAD", 4095, 4095, /* Touch */ |
| 4090 | .type = BAMBOO_PAD, 35, 48, .touch_max = 4 }; |
| 4091 | static const struct wacom_features wacom_features_0x319 = |
| 4092 | { "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */ |
| 4093 | .type = BAMBOO_PAD, 35, 48, .touch_max = 4 }; |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4094 | static const struct wacom_features wacom_features_0x325 = |
| 4095 | { "Wacom ISDv5 325", 59552, 33848, 2047, 63, |
| 4096 | CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11, |
| 4097 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4098 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4099 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 }; |
| 4100 | static const struct wacom_features wacom_features_0x326 = /* Touch */ |
| 4101 | { "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM, |
| 4102 | .oPid = 0x325 }; |
Ping Cheng | fefb391 | 2014-11-11 12:52:08 -0800 | [diff] [blame] | 4103 | static const struct wacom_features wacom_features_0x323 = |
| 4104 | { "Wacom Intuos P M", 21600, 13500, 1023, 31, |
| 4105 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 4106 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4107 | static const struct wacom_features wacom_features_0x331 = |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 4108 | { "Wacom Express Key Remote", .type = REMOTE, |
| 4109 | .numbered_buttons = 18, .check_for_hid_type = true, |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4110 | .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 4111 | static const struct wacom_features wacom_features_0x33B = |
| 4112 | { "Wacom Intuos S 2", 15200, 9500, 2047, 63, |
| 4113 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 4114 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 4115 | static const struct wacom_features wacom_features_0x33C = |
| 4116 | { "Wacom Intuos PT S 2", 15200, 9500, 2047, 63, |
| 4117 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 4118 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 4119 | static const struct wacom_features wacom_features_0x33D = |
| 4120 | { "Wacom Intuos P M 2", 21600, 13500, 2047, 63, |
| 4121 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 4122 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 4123 | static const struct wacom_features wacom_features_0x33E = |
| 4124 | { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63, |
| 4125 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 4126 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4127 | static const struct wacom_features wacom_features_0x343 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4128 | { "Wacom DTK1651", 34816, 19759, 1023, 0, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4129 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 4130 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4131 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 4132 | static const struct wacom_features wacom_features_0x360 = |
| 4133 | { "Wacom Intuos Pro M", 44800, 29600, 8191, 63, |
| 4134 | INTUOSP2_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 9, .touch_max = 10 }; |
| 4135 | static const struct wacom_features wacom_features_0x361 = |
| 4136 | { "Wacom Intuos Pro L", 62200, 43200, 8191, 63, |
| 4137 | INTUOSP2_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 9, .touch_max = 10 }; |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4138 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 4139 | static const struct wacom_features wacom_features_HID_ANY_ID = |
Jason Gerecke | 41372d5 | 2016-08-08 12:06:30 -0700 | [diff] [blame] | 4140 | { "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] | 4141 | |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4142 | #define USB_DEVICE_WACOM(prod) \ |
| 4143 | HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 4144 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4145 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4146 | #define BT_DEVICE_WACOM(prod) \ |
| 4147 | HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 4148 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Aristeu Rozanski | 1483f55 | 2011-06-22 01:17:17 -0700 | [diff] [blame] | 4149 | |
Mika Westerberg | eef23a8 | 2015-02-23 15:52:43 +0200 | [diff] [blame] | 4150 | #define I2C_DEVICE_WACOM(prod) \ |
| 4151 | HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 4152 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
| 4153 | |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 4154 | #define USB_DEVICE_LENOVO(prod) \ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4155 | HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ |
| 4156 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 4157 | |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4158 | const struct hid_device_id wacom_ids[] = { |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4159 | { USB_DEVICE_WACOM(0x00) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4160 | { USB_DEVICE_WACOM(0x03) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4161 | { USB_DEVICE_WACOM(0x10) }, |
| 4162 | { USB_DEVICE_WACOM(0x11) }, |
| 4163 | { USB_DEVICE_WACOM(0x12) }, |
| 4164 | { USB_DEVICE_WACOM(0x13) }, |
| 4165 | { USB_DEVICE_WACOM(0x14) }, |
| 4166 | { USB_DEVICE_WACOM(0x15) }, |
| 4167 | { USB_DEVICE_WACOM(0x16) }, |
| 4168 | { USB_DEVICE_WACOM(0x17) }, |
| 4169 | { USB_DEVICE_WACOM(0x18) }, |
| 4170 | { USB_DEVICE_WACOM(0x19) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4171 | { USB_DEVICE_WACOM(0x20) }, |
| 4172 | { USB_DEVICE_WACOM(0x21) }, |
| 4173 | { USB_DEVICE_WACOM(0x22) }, |
| 4174 | { USB_DEVICE_WACOM(0x23) }, |
| 4175 | { USB_DEVICE_WACOM(0x24) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4176 | { USB_DEVICE_WACOM(0x26) }, |
| 4177 | { USB_DEVICE_WACOM(0x27) }, |
| 4178 | { USB_DEVICE_WACOM(0x28) }, |
| 4179 | { USB_DEVICE_WACOM(0x29) }, |
| 4180 | { USB_DEVICE_WACOM(0x2A) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4181 | { USB_DEVICE_WACOM(0x30) }, |
| 4182 | { USB_DEVICE_WACOM(0x31) }, |
| 4183 | { USB_DEVICE_WACOM(0x32) }, |
| 4184 | { USB_DEVICE_WACOM(0x33) }, |
| 4185 | { USB_DEVICE_WACOM(0x34) }, |
| 4186 | { USB_DEVICE_WACOM(0x35) }, |
| 4187 | { USB_DEVICE_WACOM(0x37) }, |
| 4188 | { USB_DEVICE_WACOM(0x38) }, |
| 4189 | { USB_DEVICE_WACOM(0x39) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4190 | { USB_DEVICE_WACOM(0x3F) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4191 | { USB_DEVICE_WACOM(0x41) }, |
| 4192 | { USB_DEVICE_WACOM(0x42) }, |
| 4193 | { USB_DEVICE_WACOM(0x43) }, |
| 4194 | { USB_DEVICE_WACOM(0x44) }, |
| 4195 | { USB_DEVICE_WACOM(0x45) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4196 | { USB_DEVICE_WACOM(0x47) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4197 | { USB_DEVICE_WACOM(0x57) }, |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 4198 | { USB_DEVICE_WACOM(0x59) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4199 | { USB_DEVICE_WACOM(0x5B) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4200 | { USB_DEVICE_WACOM(0x5D) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4201 | { USB_DEVICE_WACOM(0x5E) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4202 | { USB_DEVICE_WACOM(0x60) }, |
| 4203 | { USB_DEVICE_WACOM(0x61) }, |
| 4204 | { USB_DEVICE_WACOM(0x62) }, |
| 4205 | { USB_DEVICE_WACOM(0x63) }, |
| 4206 | { USB_DEVICE_WACOM(0x64) }, |
| 4207 | { USB_DEVICE_WACOM(0x65) }, |
| 4208 | { USB_DEVICE_WACOM(0x69) }, |
| 4209 | { USB_DEVICE_WACOM(0x6A) }, |
| 4210 | { USB_DEVICE_WACOM(0x6B) }, |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 4211 | { BT_DEVICE_WACOM(0x81) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4212 | { USB_DEVICE_WACOM(0x84) }, |
| 4213 | { USB_DEVICE_WACOM(0x90) }, |
| 4214 | { USB_DEVICE_WACOM(0x93) }, |
| 4215 | { USB_DEVICE_WACOM(0x97) }, |
| 4216 | { USB_DEVICE_WACOM(0x9A) }, |
| 4217 | { USB_DEVICE_WACOM(0x9F) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4218 | { USB_DEVICE_WACOM(0xB0) }, |
| 4219 | { USB_DEVICE_WACOM(0xB1) }, |
| 4220 | { USB_DEVICE_WACOM(0xB2) }, |
| 4221 | { USB_DEVICE_WACOM(0xB3) }, |
| 4222 | { USB_DEVICE_WACOM(0xB4) }, |
| 4223 | { USB_DEVICE_WACOM(0xB5) }, |
| 4224 | { USB_DEVICE_WACOM(0xB7) }, |
| 4225 | { USB_DEVICE_WACOM(0xB8) }, |
| 4226 | { USB_DEVICE_WACOM(0xB9) }, |
| 4227 | { USB_DEVICE_WACOM(0xBA) }, |
| 4228 | { USB_DEVICE_WACOM(0xBB) }, |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 4229 | { USB_DEVICE_WACOM(0xBC) }, |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 4230 | { BT_DEVICE_WACOM(0xBD) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4231 | { USB_DEVICE_WACOM(0xC0) }, |
| 4232 | { USB_DEVICE_WACOM(0xC2) }, |
| 4233 | { USB_DEVICE_WACOM(0xC4) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4234 | { USB_DEVICE_WACOM(0xC5) }, |
| 4235 | { USB_DEVICE_WACOM(0xC6) }, |
| 4236 | { USB_DEVICE_WACOM(0xC7) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4237 | { USB_DEVICE_WACOM(0xCC) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4238 | { USB_DEVICE_WACOM(0xCE) }, |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 4239 | { USB_DEVICE_WACOM(0xD0) }, |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 4240 | { USB_DEVICE_WACOM(0xD1) }, |
| 4241 | { USB_DEVICE_WACOM(0xD2) }, |
| 4242 | { USB_DEVICE_WACOM(0xD3) }, |
Kevin Granade | 57a7872 | 2010-12-10 23:04:02 -0800 | [diff] [blame] | 4243 | { USB_DEVICE_WACOM(0xD4) }, |
Gerard Braad | 18adad1 | 2011-08-16 00:17:56 -0700 | [diff] [blame] | 4244 | { USB_DEVICE_WACOM(0xD5) }, |
Ping Cheng | d38acb4 | 2011-01-24 09:32:50 -0800 | [diff] [blame] | 4245 | { USB_DEVICE_WACOM(0xD6) }, |
| 4246 | { USB_DEVICE_WACOM(0xD7) }, |
David Foley | a318e6b | 2010-11-30 23:45:46 -0800 | [diff] [blame] | 4247 | { USB_DEVICE_WACOM(0xD8) }, |
| 4248 | { USB_DEVICE_WACOM(0xDA) }, |
David Foley | 47d0923 | 2010-12-07 21:05:59 -0800 | [diff] [blame] | 4249 | { USB_DEVICE_WACOM(0xDB) }, |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4250 | { USB_DEVICE_WACOM(0xDD) }, |
| 4251 | { USB_DEVICE_WACOM(0xDE) }, |
| 4252 | { USB_DEVICE_WACOM(0xDF) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4253 | { USB_DEVICE_WACOM(0xE2) }, |
| 4254 | { USB_DEVICE_WACOM(0xE3) }, |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 4255 | { USB_DEVICE_WACOM(0xE5) }, |
Manoj Iyer | 26fcd2a | 2011-03-31 22:39:43 -0700 | [diff] [blame] | 4256 | { USB_DEVICE_WACOM(0xE6) }, |
Chris Bagwell | 0d0e306 | 2011-12-11 23:50:59 -0800 | [diff] [blame] | 4257 | { USB_DEVICE_WACOM(0xEC) }, |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 4258 | { USB_DEVICE_WACOM(0xED) }, |
| 4259 | { USB_DEVICE_WACOM(0xEF) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4260 | { USB_DEVICE_WACOM(0xF0) }, |
| 4261 | { USB_DEVICE_WACOM(0xF4) }, |
| 4262 | { USB_DEVICE_WACOM(0xF6) }, |
| 4263 | { USB_DEVICE_WACOM(0xF8) }, |
| 4264 | { USB_DEVICE_WACOM(0xFA) }, |
| 4265 | { USB_DEVICE_WACOM(0xFB) }, |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 4266 | { USB_DEVICE_WACOM(0x100) }, |
| 4267 | { USB_DEVICE_WACOM(0x101) }, |
Stephan Frank | 5869483 | 2013-03-07 14:08:50 -0800 | [diff] [blame] | 4268 | { USB_DEVICE_WACOM(0x10D) }, |
Jason Gerecke | 2d3163f | 2013-10-22 15:35:30 -0700 | [diff] [blame] | 4269 | { USB_DEVICE_WACOM(0x10E) }, |
Jason Gerecke | 9b4f60e | 2013-10-15 23:46:34 -0700 | [diff] [blame] | 4270 | { USB_DEVICE_WACOM(0x10F) }, |
Jason Gerecke | 61616ed | 2014-05-14 11:42:22 -0700 | [diff] [blame] | 4271 | { USB_DEVICE_WACOM(0x116) }, |
Jason Gerecke | aeaf50d | 2014-07-28 10:53:16 -0700 | [diff] [blame] | 4272 | { USB_DEVICE_WACOM(0x12C) }, |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4273 | { USB_DEVICE_WACOM(0x300) }, |
| 4274 | { USB_DEVICE_WACOM(0x301) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4275 | { USB_DEVICE_WACOM(0x302) }, |
| 4276 | { USB_DEVICE_WACOM(0x303) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4277 | { USB_DEVICE_WACOM(0x304) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4278 | { USB_DEVICE_WACOM(0x307) }, |
| 4279 | { USB_DEVICE_WACOM(0x309) }, |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4280 | { USB_DEVICE_WACOM(0x30A) }, |
| 4281 | { USB_DEVICE_WACOM(0x30C) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4282 | { USB_DEVICE_WACOM(0x30E) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4283 | { USB_DEVICE_WACOM(0x314) }, |
| 4284 | { USB_DEVICE_WACOM(0x315) }, |
| 4285 | { USB_DEVICE_WACOM(0x317) }, |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 4286 | { USB_DEVICE_WACOM(0x318) }, |
| 4287 | { USB_DEVICE_WACOM(0x319) }, |
Ping Cheng | fefb391 | 2014-11-11 12:52:08 -0800 | [diff] [blame] | 4288 | { USB_DEVICE_WACOM(0x323) }, |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4289 | { USB_DEVICE_WACOM(0x325) }, |
| 4290 | { USB_DEVICE_WACOM(0x326) }, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4291 | { USB_DEVICE_WACOM(0x32A) }, |
| 4292 | { USB_DEVICE_WACOM(0x32B) }, |
| 4293 | { USB_DEVICE_WACOM(0x32C) }, |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 4294 | { USB_DEVICE_WACOM(0x32F) }, |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4295 | { USB_DEVICE_WACOM(0x331) }, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 4296 | { USB_DEVICE_WACOM(0x333) }, |
| 4297 | { USB_DEVICE_WACOM(0x335) }, |
Aaron Skomra | 007760c | 2015-04-16 15:01:14 -0700 | [diff] [blame] | 4298 | { USB_DEVICE_WACOM(0x336) }, |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 4299 | { USB_DEVICE_WACOM(0x33B) }, |
| 4300 | { USB_DEVICE_WACOM(0x33C) }, |
| 4301 | { USB_DEVICE_WACOM(0x33D) }, |
| 4302 | { USB_DEVICE_WACOM(0x33E) }, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4303 | { USB_DEVICE_WACOM(0x343) }, |
Jason Gerecke | 4922cd2 | 2017-01-25 12:08:37 -0800 | [diff] [blame] | 4304 | { BT_DEVICE_WACOM(0x360) }, |
| 4305 | { BT_DEVICE_WACOM(0x361) }, |
Ping Cheng | edbe265 | 2012-11-21 13:12:50 -0800 | [diff] [blame] | 4306 | { USB_DEVICE_WACOM(0x4001) }, |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 4307 | { USB_DEVICE_WACOM(0x4004) }, |
| 4308 | { USB_DEVICE_WACOM(0x5000) }, |
| 4309 | { USB_DEVICE_WACOM(0x5002) }, |
Benjamin Tissoires | 00d6f227 | 2014-12-01 11:52:39 -0500 | [diff] [blame] | 4310 | { USB_DEVICE_LENOVO(0x6004) }, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 4311 | |
| 4312 | { USB_DEVICE_WACOM(HID_ANY_ID) }, |
Mika Westerberg | eef23a8 | 2015-02-23 15:52:43 +0200 | [diff] [blame] | 4313 | { I2C_DEVICE_WACOM(HID_ANY_ID) }, |
Jason Gerecke | b9e0625 | 2017-01-25 12:08:35 -0800 | [diff] [blame] | 4314 | { BT_DEVICE_WACOM(HID_ANY_ID) }, |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 4315 | { } |
| 4316 | }; |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4317 | MODULE_DEVICE_TABLE(hid, wacom_ids); |