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 | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1193 | static int wacom_24hdt_irq(struct wacom_wac *wacom) |
| 1194 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1195 | struct input_dev *input = wacom->touch_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1196 | unsigned char *data = wacom->data; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1197 | int i; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1198 | int current_num_contacts = data[61]; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1199 | int contacts_to_send = 0; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1200 | int num_contacts_left = 4; /* maximum contacts per packet */ |
| 1201 | int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; |
| 1202 | int y_offset = 2; |
| 1203 | |
| 1204 | if (wacom->features.type == WACOM_27QHDT) { |
| 1205 | current_num_contacts = data[63]; |
| 1206 | num_contacts_left = 10; |
| 1207 | byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; |
| 1208 | y_offset = 0; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1209 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1210 | |
| 1211 | /* |
| 1212 | * First packet resets the counter since only the first |
| 1213 | * packet in series will have non-zero current_num_contacts. |
| 1214 | */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1215 | if (current_num_contacts) |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1216 | wacom->num_contacts_left = current_num_contacts; |
| 1217 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1218 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1219 | |
| 1220 | for (i = 0; i < contacts_to_send; i++) { |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1221 | int offset = (byte_per_packet * i) + 1; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1222 | bool touch = (data[offset] & 0x1) && report_touch_events(wacom); |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 1223 | int slot = input_mt_get_slot_by_key(input, data[offset + 1]); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1224 | |
| 1225 | if (slot < 0) |
| 1226 | continue; |
| 1227 | input_mt_slot(input, slot); |
| 1228 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1229 | |
| 1230 | if (touch) { |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1231 | int t_x = get_unaligned_le16(&data[offset + 2]); |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1232 | int t_y = get_unaligned_le16(&data[offset + 4 + y_offset]); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1233 | |
| 1234 | input_report_abs(input, ABS_MT_POSITION_X, t_x); |
| 1235 | input_report_abs(input, ABS_MT_POSITION_Y, t_y); |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 1236 | |
| 1237 | if (wacom->features.type != WACOM_27QHDT) { |
| 1238 | int c_x = get_unaligned_le16(&data[offset + 4]); |
| 1239 | int c_y = get_unaligned_le16(&data[offset + 8]); |
| 1240 | int w = get_unaligned_le16(&data[offset + 10]); |
| 1241 | int h = get_unaligned_le16(&data[offset + 12]); |
| 1242 | |
| 1243 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); |
| 1244 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, |
| 1245 | min(w, h) + int_dist(t_x, t_y, c_x, c_y)); |
| 1246 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); |
| 1247 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); |
| 1248 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1249 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1250 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1251 | input_mt_sync_frame(input); |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1252 | |
| 1253 | wacom->num_contacts_left -= contacts_to_send; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1254 | if (wacom->num_contacts_left <= 0) { |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1255 | wacom->num_contacts_left = 0; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1256 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1257 | } |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 1258 | return 1; |
| 1259 | } |
| 1260 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1261 | static int wacom_mt_touch(struct wacom_wac *wacom) |
| 1262 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1263 | struct input_dev *input = wacom->touch_input; |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1264 | unsigned char *data = wacom->data; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1265 | int i; |
| 1266 | int current_num_contacts = data[2]; |
| 1267 | int contacts_to_send = 0; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1268 | int x_offset = 0; |
| 1269 | |
| 1270 | /* MTTPC does not support Height and Width */ |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1271 | if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1272 | x_offset = -4; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1273 | |
| 1274 | /* |
| 1275 | * First packet resets the counter since only the first |
| 1276 | * packet in series will have non-zero current_num_contacts. |
| 1277 | */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1278 | if (current_num_contacts) |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1279 | wacom->num_contacts_left = current_num_contacts; |
| 1280 | |
| 1281 | /* There are at most 5 contacts per packet */ |
| 1282 | contacts_to_send = min(5, wacom->num_contacts_left); |
| 1283 | |
| 1284 | for (i = 0; i < contacts_to_send; i++) { |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 1285 | int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1286 | bool touch = (data[offset] & 0x1) && report_touch_events(wacom); |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1287 | int id = get_unaligned_le16(&data[offset + 1]); |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 1288 | int slot = input_mt_get_slot_by_key(input, id); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1289 | |
| 1290 | if (slot < 0) |
| 1291 | continue; |
| 1292 | |
| 1293 | input_mt_slot(input, slot); |
| 1294 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1295 | if (touch) { |
Jason Gerecke | edc8e20a | 2014-05-14 16:53:30 -0700 | [diff] [blame] | 1296 | int x = get_unaligned_le16(&data[offset + x_offset + 7]); |
| 1297 | int y = get_unaligned_le16(&data[offset + x_offset + 9]); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1298 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1299 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 1300 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1301 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1302 | input_mt_sync_frame(input); |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1303 | |
| 1304 | wacom->num_contacts_left -= contacts_to_send; |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1305 | if (wacom->num_contacts_left <= 0) { |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1306 | wacom->num_contacts_left = 0; |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1307 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1308 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1309 | return 1; |
| 1310 | } |
| 1311 | |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1312 | static int wacom_tpc_mt_touch(struct wacom_wac *wacom) |
| 1313 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1314 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1315 | unsigned char *data = wacom->data; |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1316 | int i; |
| 1317 | |
| 1318 | for (i = 0; i < 2; i++) { |
| 1319 | int p = data[1] & (1 << i); |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1320 | bool touch = p && report_touch_events(wacom); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1321 | |
| 1322 | input_mt_slot(input, i); |
| 1323 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 1324 | if (touch) { |
| 1325 | int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; |
| 1326 | int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; |
| 1327 | |
| 1328 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1329 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1330 | } |
| 1331 | } |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 1332 | input_mt_sync_frame(input); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1333 | |
| 1334 | /* keep touch state for pen event */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 1335 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1336 | |
Ping Cheng | 84eb5aa | 2011-03-12 20:35:18 -0800 | [diff] [blame] | 1337 | return 1; |
| 1338 | } |
| 1339 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1340 | 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] | 1341 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1342 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1343 | struct input_dev *input = wacom->touch_input; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1344 | bool prox = report_touch_events(wacom); |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1345 | int x = 0, y = 0; |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1346 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1347 | if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) |
| 1348 | return 0; |
| 1349 | |
Ping Cheng | e0d41fd | 2015-02-20 14:27:30 -0800 | [diff] [blame] | 1350 | if (len == WACOM_PKGLEN_TPC1FG) { |
| 1351 | prox = prox && (data[0] & 0x01); |
| 1352 | x = get_unaligned_le16(&data[1]); |
| 1353 | y = get_unaligned_le16(&data[3]); |
| 1354 | } else if (len == WACOM_PKGLEN_TPC1FG_B) { |
| 1355 | prox = prox && (data[2] & 0x01); |
| 1356 | x = get_unaligned_le16(&data[3]); |
| 1357 | y = get_unaligned_le16(&data[5]); |
| 1358 | } else { |
| 1359 | prox = prox && (data[1] & 0x01); |
| 1360 | x = le16_to_cpup((__le16 *)&data[2]); |
| 1361 | y = le16_to_cpup((__le16 *)&data[4]); |
| 1362 | } |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1363 | |
| 1364 | if (prox) { |
| 1365 | input_report_abs(input, ABS_X, x); |
| 1366 | input_report_abs(input, ABS_Y, y); |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1367 | } |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1368 | input_report_key(input, BTN_TOUCH, prox); |
| 1369 | |
| 1370 | /* keep touch state for pen events */ |
| 1371 | wacom->shared->touch_down = prox; |
| 1372 | |
| 1373 | return 1; |
Ping Cheng | ec67bbe | 2009-12-15 00:35:24 -0800 | [diff] [blame] | 1374 | } |
| 1375 | |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1376 | static int wacom_tpc_pen(struct wacom_wac *wacom) |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1377 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1378 | unsigned char *data = wacom->data; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1379 | struct input_dev *input = wacom->pen_input; |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1380 | bool prox = data[1] & 0x20; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1381 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1382 | if (!wacom->shared->stylus_in_proximity) /* first in prox */ |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1383 | /* Going into proximity select tool */ |
| 1384 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1385 | |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1386 | /* keep pen state for touch events */ |
| 1387 | wacom->shared->stylus_in_proximity = prox; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1388 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1389 | /* send pen events only when touch is up or forced out |
| 1390 | * or touch arbitration is off |
| 1391 | */ |
| 1392 | if (!delay_pen_events(wacom)) { |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1393 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 1394 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
| 1395 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 1396 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
Jason Gerecke | 0b335ca | 2014-07-24 13:15:31 -0700 | [diff] [blame] | 1397 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 1398 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
| 1399 | input_report_key(input, wacom->tool[0], prox); |
| 1400 | return 1; |
| 1401 | } |
| 1402 | |
| 1403 | return 0; |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1404 | } |
| 1405 | |
| 1406 | static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) |
| 1407 | { |
Jason Gerecke | 74b6341 | 2014-04-19 13:50:22 -0700 | [diff] [blame] | 1408 | unsigned char *data = wacom->data; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1409 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1410 | if (wacom->pen_input) |
| 1411 | dev_dbg(wacom->pen_input->dev.parent, |
| 1412 | "%s: received report #%d\n", __func__, data[0]); |
| 1413 | else if (wacom->touch_input) |
| 1414 | dev_dbg(wacom->touch_input->dev.parent, |
| 1415 | "%s: received report #%d\n", __func__, data[0]); |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1416 | |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1417 | switch (len) { |
| 1418 | case WACOM_PKGLEN_TPC1FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1419 | return wacom_tpc_single_touch(wacom, len); |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1420 | |
| 1421 | case WACOM_PKGLEN_TPC2FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1422 | return wacom_tpc_mt_touch(wacom); |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1423 | |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1424 | case WACOM_PKGLEN_PENABLED: |
| 1425 | return wacom_tpc_pen(wacom); |
| 1426 | |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1427 | default: |
| 1428 | switch (data[0]) { |
| 1429 | case WACOM_REPORT_TPC1FG: |
| 1430 | case WACOM_REPORT_TPCHID: |
| 1431 | case WACOM_REPORT_TPCST: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 1432 | case WACOM_REPORT_TPC1FGE: |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1433 | return wacom_tpc_single_touch(wacom, len); |
| 1434 | |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1435 | case WACOM_REPORT_TPCMT: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 1436 | case WACOM_REPORT_TPCMT2: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 1437 | return wacom_mt_touch(wacom); |
| 1438 | |
Ping Cheng | 31175a8 | 2012-01-31 00:07:33 -0800 | [diff] [blame] | 1439 | case WACOM_REPORT_PENABLED: |
| 1440 | return wacom_tpc_pen(wacom); |
| 1441 | } |
| 1442 | } |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1443 | |
Ping Cheng | 8aa9a9a | 2011-03-12 20:34:11 -0800 | [diff] [blame] | 1444 | return 0; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 1445 | } |
| 1446 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1447 | static int wacom_equivalent_usage(int usage) |
| 1448 | { |
| 1449 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) { |
| 1450 | int subpage = (usage & 0xFF00) << 8; |
| 1451 | int subusage = (usage & 0xFF); |
| 1452 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1453 | if (subpage == WACOM_HID_SP_PAD || |
| 1454 | subpage == WACOM_HID_SP_BUTTON || |
| 1455 | subpage == WACOM_HID_SP_DIGITIZER || |
Jason Gerecke | b5c921e | 2016-10-19 18:03:44 -0700 | [diff] [blame] | 1456 | subpage == WACOM_HID_SP_DIGITIZERINFO || |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1457 | usage == WACOM_HID_WD_SENSE || |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1458 | usage == WACOM_HID_WD_SERIALHI || |
| 1459 | usage == WACOM_HID_WD_TOOLTYPE || |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1460 | usage == WACOM_HID_WD_DISTANCE || |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1461 | usage == WACOM_HID_WD_TOUCHSTRIP || |
| 1462 | usage == WACOM_HID_WD_TOUCHSTRIP2 || |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1463 | usage == WACOM_HID_WD_TOUCHRING || |
| 1464 | usage == WACOM_HID_WD_TOUCHRINGSTATUS) { |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1465 | return usage; |
| 1466 | } |
| 1467 | |
| 1468 | if (subpage == HID_UP_UNDEFINED) |
| 1469 | subpage = HID_UP_DIGITIZER; |
| 1470 | |
| 1471 | return subpage | subusage; |
| 1472 | } |
| 1473 | |
| 1474 | return usage; |
| 1475 | } |
| 1476 | |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1477 | 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] | 1478 | struct hid_field *field, __u8 type, __u16 code, int fuzz) |
| 1479 | { |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1480 | struct wacom *wacom = input_get_drvdata(input); |
| 1481 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1482 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1483 | int fmin = field->logical_minimum; |
| 1484 | int fmax = field->logical_maximum; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1485 | unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1486 | int resolution_code = code; |
| 1487 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1488 | if (equivalent_usage == HID_DG_TWIST) { |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1489 | resolution_code = ABS_RZ; |
| 1490 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1491 | |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1492 | if (equivalent_usage == HID_GD_X) { |
| 1493 | fmin += features->offset_left; |
| 1494 | fmax -= features->offset_right; |
| 1495 | } |
| 1496 | if (equivalent_usage == HID_GD_Y) { |
| 1497 | fmin += features->offset_top; |
| 1498 | fmax -= features->offset_bottom; |
| 1499 | } |
| 1500 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1501 | usage->type = type; |
| 1502 | usage->code = code; |
| 1503 | |
| 1504 | set_bit(type, input->evbit); |
| 1505 | |
| 1506 | switch (type) { |
| 1507 | case EV_ABS: |
| 1508 | input_set_abs_params(input, code, fmin, fmax, fuzz, 0); |
| 1509 | input_abs_set_res(input, code, |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1510 | hidinput_calc_abs_res(field, resolution_code)); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1511 | break; |
| 1512 | case EV_KEY: |
| 1513 | input_set_capability(input, EV_KEY, code); |
| 1514 | break; |
| 1515 | case EV_MSC: |
| 1516 | input_set_capability(input, EV_MSC, code); |
| 1517 | break; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1518 | case EV_SW: |
| 1519 | input_set_capability(input, EV_SW, code); |
| 1520 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1521 | } |
| 1522 | } |
| 1523 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1524 | static void wacom_wac_pad_usage_mapping(struct hid_device *hdev, |
| 1525 | struct hid_field *field, struct hid_usage *usage) |
| 1526 | { |
| 1527 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1528 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1529 | struct wacom_features *features = &wacom_wac->features; |
| 1530 | struct input_dev *input = wacom_wac->pad_input; |
| 1531 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1532 | |
| 1533 | switch (equivalent_usage) { |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1534 | case WACOM_HID_WD_BATTERY_LEVEL: |
| 1535 | case WACOM_HID_WD_BATTERY_CHARGING: |
| 1536 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 1537 | break; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1538 | case WACOM_HID_WD_ACCELEROMETER_X: |
| 1539 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1540 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0); |
| 1541 | break; |
| 1542 | case WACOM_HID_WD_ACCELEROMETER_Y: |
| 1543 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1544 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0); |
| 1545 | break; |
| 1546 | case WACOM_HID_WD_ACCELEROMETER_Z: |
| 1547 | __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); |
| 1548 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); |
| 1549 | break; |
| 1550 | case WACOM_HID_WD_BUTTONHOME: |
| 1551 | case WACOM_HID_WD_BUTTONUP: |
| 1552 | case WACOM_HID_WD_BUTTONDOWN: |
| 1553 | case WACOM_HID_WD_BUTTONLEFT: |
| 1554 | case WACOM_HID_WD_BUTTONRIGHT: |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1555 | case WACOM_HID_WD_BUTTONCENTER: |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1556 | wacom_map_usage(input, usage, field, EV_KEY, |
| 1557 | wacom_numbered_button_to_key(features->numbered_buttons), |
| 1558 | 0); |
| 1559 | features->numbered_buttons++; |
| 1560 | break; |
Jason Gerecke | bf78adc | 2016-10-19 18:03:53 -0700 | [diff] [blame] | 1561 | case WACOM_HID_WD_TOUCHONOFF: |
| 1562 | wacom_map_usage(input, usage, field, EV_SW, SW_MUTE_DEVICE, 0); |
| 1563 | break; |
| 1564 | case WACOM_HID_WD_TOUCHSTRIP: |
| 1565 | wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); |
| 1566 | break; |
| 1567 | case WACOM_HID_WD_TOUCHSTRIP2: |
| 1568 | wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0); |
| 1569 | break; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1570 | case WACOM_HID_WD_TOUCHRING: |
| 1571 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
| 1572 | break; |
| 1573 | } |
| 1574 | |
| 1575 | switch (equivalent_usage & 0xfffffff0) { |
| 1576 | case WACOM_HID_WD_EXPRESSKEY00: |
| 1577 | wacom_map_usage(input, usage, field, EV_KEY, |
| 1578 | wacom_numbered_button_to_key(features->numbered_buttons), |
| 1579 | 0); |
| 1580 | features->numbered_buttons++; |
| 1581 | break; |
| 1582 | } |
| 1583 | } |
| 1584 | |
| 1585 | static int wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field, |
| 1586 | struct hid_usage *usage, __s32 value) |
| 1587 | { |
| 1588 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1589 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1590 | struct input_dev *input = wacom_wac->pad_input; |
| 1591 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
| 1592 | |
| 1593 | if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { |
| 1594 | wacom_wac->hid_data.inrange_state |= value; |
| 1595 | } |
| 1596 | |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1597 | switch (equivalent_usage) { |
| 1598 | case WACOM_HID_WD_BATTERY_LEVEL: |
| 1599 | wacom_wac->hid_data.battery_capacity = value; |
| 1600 | wacom_wac->hid_data.bat_connected = 1; |
| 1601 | return 0; |
| 1602 | |
| 1603 | case WACOM_HID_WD_BATTERY_CHARGING: |
| 1604 | wacom_wac->hid_data.bat_charging = value; |
| 1605 | wacom_wac->hid_data.ps_connected = value; |
| 1606 | wacom_wac->hid_data.bat_connected = 1; |
| 1607 | return 0; |
| 1608 | |
| 1609 | case WACOM_HID_WD_TOUCHRINGSTATUS: |
| 1610 | return 0; |
| 1611 | |
| 1612 | default: |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1613 | input_event(input, usage->type, usage->code, value); |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1614 | break; |
| 1615 | } |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1616 | |
| 1617 | return 0; |
| 1618 | } |
| 1619 | |
| 1620 | static void wacom_wac_pad_pre_report(struct hid_device *hdev, |
| 1621 | struct hid_report *report) |
| 1622 | { |
| 1623 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1624 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1625 | |
| 1626 | wacom_wac->hid_data.inrange_state = 0; |
| 1627 | } |
| 1628 | |
| 1629 | static void wacom_wac_pad_report(struct hid_device *hdev, |
| 1630 | struct hid_report *report) |
| 1631 | { |
| 1632 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1633 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1634 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1635 | struct input_dev *input = wacom_wac->pad_input; |
| 1636 | bool active = wacom_wac->hid_data.inrange_state != 0; |
| 1637 | |
| 1638 | /* |
| 1639 | * don't report prox for events like accelerometer |
| 1640 | * or battery status |
| 1641 | */ |
| 1642 | if (wacom_equivalent_usage(report->field[0]->physical) == HID_DG_TABLETFUNCTIONKEY) |
| 1643 | input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); |
| 1644 | |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1645 | if (features->quirks & WACOM_QUIRK_BATTERY) { |
| 1646 | int capacity = wacom_wac->hid_data.battery_capacity; |
| 1647 | bool charging = wacom_wac->hid_data.bat_charging; |
| 1648 | bool connected = wacom_wac->hid_data.bat_connected; |
| 1649 | bool powered = wacom_wac->hid_data.ps_connected; |
| 1650 | |
| 1651 | wacom_notify_battery(wacom_wac, capacity, charging, |
| 1652 | connected, powered); |
| 1653 | } |
| 1654 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 1655 | input_sync(input); |
| 1656 | } |
| 1657 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1658 | static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, |
| 1659 | struct hid_field *field, struct hid_usage *usage) |
| 1660 | { |
| 1661 | struct wacom *wacom = hid_get_drvdata(hdev); |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1662 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1663 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1664 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1665 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1666 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1667 | switch (equivalent_usage) { |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1668 | case HID_GD_X: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1669 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1670 | break; |
| 1671 | case HID_GD_Y: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1672 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1673 | break; |
Jason Gerecke | b5c921e | 2016-10-19 18:03:44 -0700 | [diff] [blame] | 1674 | case WACOM_HID_WD_DISTANCE: |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1675 | case HID_GD_Z: |
| 1676 | wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); |
| 1677 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1678 | case HID_DG_TIPPRESSURE: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1679 | wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1680 | break; |
| 1681 | case HID_DG_INRANGE: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1682 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1683 | break; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1684 | case HID_DG_BATTERYSTRENGTH: |
| 1685 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 1686 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1687 | case HID_DG_INVERT: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1688 | wacom_map_usage(input, usage, field, EV_KEY, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1689 | BTN_TOOL_RUBBER, 0); |
| 1690 | break; |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1691 | case HID_DG_TILT_X: |
| 1692 | wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); |
| 1693 | break; |
| 1694 | case HID_DG_TILT_Y: |
| 1695 | wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); |
| 1696 | break; |
| 1697 | case HID_DG_TWIST: |
| 1698 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); |
| 1699 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1700 | case HID_DG_ERASER: |
| 1701 | case HID_DG_TIPSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1702 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1703 | break; |
| 1704 | case HID_DG_BARRELSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1705 | wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1706 | break; |
| 1707 | case HID_DG_BARRELSWITCH2: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1708 | wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1709 | break; |
| 1710 | case HID_DG_TOOLSERIALNUMBER: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1711 | wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1712 | break; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1713 | case WACOM_HID_WD_SENSE: |
| 1714 | features->quirks |= WACOM_QUIRK_SENSE; |
| 1715 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); |
| 1716 | break; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1717 | case WACOM_HID_WD_SERIALHI: |
| 1718 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); |
| 1719 | set_bit(EV_KEY, input->evbit); |
| 1720 | input_set_capability(input, EV_KEY, BTN_TOOL_PEN); |
| 1721 | input_set_capability(input, EV_KEY, BTN_TOOL_RUBBER); |
| 1722 | input_set_capability(input, EV_KEY, BTN_TOOL_BRUSH); |
| 1723 | input_set_capability(input, EV_KEY, BTN_TOOL_PENCIL); |
| 1724 | input_set_capability(input, EV_KEY, BTN_TOOL_AIRBRUSH); |
| 1725 | input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE); |
| 1726 | input_set_capability(input, EV_KEY, BTN_TOOL_LENS); |
| 1727 | break; |
Jason Gerecke | 929d6d5 | 2016-10-19 18:03:45 -0700 | [diff] [blame] | 1728 | case WACOM_HID_WD_FINGERWHEEL: |
| 1729 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
| 1730 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field, |
| 1735 | struct hid_usage *usage, __s32 value) |
| 1736 | { |
| 1737 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1738 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1739 | struct wacom_features *features = &wacom_wac->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1740 | struct input_dev *input = wacom_wac->pen_input; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1741 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1742 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1743 | switch (equivalent_usage) { |
Jason Gerecke | 50066a0 | 2016-10-19 18:03:42 -0700 | [diff] [blame] | 1744 | case HID_GD_Z: |
| 1745 | /* |
| 1746 | * HID_GD_Z "should increase as the control's position is |
| 1747 | * moved from high to low", while ABS_DISTANCE instead |
| 1748 | * increases in value as the tool moves from low to high. |
| 1749 | */ |
| 1750 | value = field->logical_maximum - value; |
| 1751 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1752 | case HID_DG_INRANGE: |
| 1753 | wacom_wac->hid_data.inrange_state = value; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1754 | if (!(features->quirks & WACOM_QUIRK_SENSE)) |
| 1755 | wacom_wac->hid_data.sense_state = value; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1756 | return 0; |
Jason Gerecke | 93aab7f | 2016-10-19 18:03:52 -0700 | [diff] [blame] | 1757 | case HID_DG_BATTERYSTRENGTH: |
| 1758 | wacom_wac->hid_data.battery_capacity = value; |
| 1759 | wacom_wac->hid_data.bat_connected = 1; |
| 1760 | break; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1761 | case HID_DG_INVERT: |
| 1762 | wacom_wac->hid_data.invert_state = value; |
| 1763 | return 0; |
| 1764 | case HID_DG_ERASER: |
| 1765 | case HID_DG_TIPSWITCH: |
| 1766 | wacom_wac->hid_data.tipswitch |= value; |
| 1767 | return 0; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1768 | case HID_DG_TOOLSERIALNUMBER: |
Dan Carpenter | a35f09b | 2016-11-10 22:25:39 +0300 | [diff] [blame] | 1769 | wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1770 | wacom_wac->serial[0] |= value; |
| 1771 | return 0; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1772 | case WACOM_HID_WD_SENSE: |
| 1773 | wacom_wac->hid_data.sense_state = value; |
| 1774 | return 0; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1775 | case WACOM_HID_WD_SERIALHI: |
| 1776 | wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); |
| 1777 | wacom_wac->serial[0] |= ((__u64)value) << 32; |
| 1778 | /* |
| 1779 | * Non-USI EMR devices may contain additional tool type |
| 1780 | * information here. See WACOM_HID_WD_TOOLTYPE case for |
| 1781 | * more details. |
| 1782 | */ |
| 1783 | if (value >> 20 == 1) { |
| 1784 | wacom_wac->id[0] |= value & 0xFFFFF; |
| 1785 | } |
| 1786 | return 0; |
| 1787 | case WACOM_HID_WD_TOOLTYPE: |
| 1788 | /* |
| 1789 | * Some devices (MobileStudio Pro, and possibly later |
| 1790 | * devices as well) do not return the complete tool |
| 1791 | * type in their WACOM_HID_WD_TOOLTYPE usage. Use a |
| 1792 | * bitwise OR so the complete value can be built |
| 1793 | * up over time :( |
| 1794 | */ |
| 1795 | wacom_wac->id[0] |= value; |
| 1796 | return 0; |
Jason Gerecke | 345857b | 2016-10-19 18:03:50 -0700 | [diff] [blame] | 1797 | case WACOM_HID_WD_OFFSETLEFT: |
| 1798 | if (features->offset_left && value != features->offset_left) |
| 1799 | hid_warn(hdev, "%s: overriding exising left offset " |
| 1800 | "%d -> %d\n", __func__, value, |
| 1801 | features->offset_left); |
| 1802 | features->offset_left = value; |
| 1803 | return 0; |
| 1804 | case WACOM_HID_WD_OFFSETRIGHT: |
| 1805 | if (features->offset_right && value != features->offset_right) |
| 1806 | hid_warn(hdev, "%s: overriding exising right offset " |
| 1807 | "%d -> %d\n", __func__, value, |
| 1808 | features->offset_right); |
| 1809 | features->offset_right = value; |
| 1810 | return 0; |
| 1811 | case WACOM_HID_WD_OFFSETTOP: |
| 1812 | if (features->offset_top && value != features->offset_top) |
| 1813 | hid_warn(hdev, "%s: overriding exising top offset " |
| 1814 | "%d -> %d\n", __func__, value, |
| 1815 | features->offset_top); |
| 1816 | features->offset_top = value; |
| 1817 | return 0; |
| 1818 | case WACOM_HID_WD_OFFSETBOTTOM: |
| 1819 | if (features->offset_bottom && value != features->offset_bottom) |
| 1820 | hid_warn(hdev, "%s: overriding exising bottom offset " |
| 1821 | "%d -> %d\n", __func__, value, |
| 1822 | features->offset_bottom); |
| 1823 | features->offset_bottom = value; |
| 1824 | return 0; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1825 | } |
| 1826 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1827 | /* send pen events only when touch is up or forced out |
| 1828 | * or touch arbitration is off |
| 1829 | */ |
| 1830 | if (!usage->type || delay_pen_events(wacom_wac)) |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1831 | return 0; |
| 1832 | |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1833 | /* send pen events only when the pen is in/entering/leaving proximity */ |
| 1834 | if (!wacom_wac->hid_data.inrange_state && !wacom_wac->tool[0]) |
| 1835 | return 0; |
| 1836 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1837 | input_event(input, usage->type, usage->code, value); |
| 1838 | |
| 1839 | return 0; |
| 1840 | } |
| 1841 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 1842 | static void wacom_wac_pen_pre_report(struct hid_device *hdev, |
| 1843 | struct hid_report *report) |
| 1844 | { |
| 1845 | return; |
| 1846 | } |
| 1847 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1848 | static void wacom_wac_pen_report(struct hid_device *hdev, |
| 1849 | struct hid_report *report) |
| 1850 | { |
| 1851 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1852 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1853 | struct input_dev *input = wacom_wac->pen_input; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1854 | bool prox = wacom_wac->hid_data.inrange_state; |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1855 | bool range = wacom_wac->hid_data.sense_state; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1856 | |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1857 | if (!wacom_wac->tool[0] && prox) { /* first in prox */ |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1858 | /* Going into proximity select tool */ |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1859 | if (wacom_wac->hid_data.invert_state) |
| 1860 | wacom_wac->tool[0] = BTN_TOOL_RUBBER; |
| 1861 | else if (wacom_wac->id[0]) |
| 1862 | wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); |
| 1863 | else |
| 1864 | wacom_wac->tool[0] = BTN_TOOL_PEN; |
| 1865 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1866 | |
| 1867 | /* keep pen state for touch events */ |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1868 | wacom_wac->shared->stylus_in_proximity = range; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1869 | |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1870 | if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1871 | int id = wacom_wac->id[0]; |
| 1872 | |
| 1873 | /* |
| 1874 | * Non-USI EMR tools should have their IDs mangled to |
| 1875 | * match the legacy behavior of wacom_intuos_general |
| 1876 | */ |
| 1877 | if (wacom_wac->serial[0] >> 52 == 1) |
| 1878 | id = wacom_intuos_id_mangle(id); |
| 1879 | |
| 1880 | /* |
| 1881 | * To ensure compatibility with xf86-input-wacom, we should |
| 1882 | * report the BTN_TOOL_* event prior to the ABS_MISC or |
| 1883 | * MSC_SERIAL events. |
| 1884 | */ |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1885 | input_report_key(input, BTN_TOUCH, |
| 1886 | wacom_wac->hid_data.tipswitch); |
| 1887 | input_report_key(input, wacom_wac->tool[0], prox); |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1888 | if (wacom_wac->serial[0]) { |
| 1889 | input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); |
| 1890 | input_report_abs(input, ABS_MISC, id); |
| 1891 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1892 | |
| 1893 | wacom_wac->hid_data.tipswitch = false; |
| 1894 | |
| 1895 | input_sync(input); |
| 1896 | } |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1897 | |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1898 | if (!prox) { |
Jason Gerecke | 61ce346 | 2016-10-19 18:03:46 -0700 | [diff] [blame] | 1899 | wacom_wac->tool[0] = 0; |
Jason Gerecke | f85c9dc | 2016-10-19 18:03:48 -0700 | [diff] [blame] | 1900 | wacom_wac->id[0] = 0; |
| 1901 | } |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 1902 | } |
| 1903 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1904 | static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, |
| 1905 | struct hid_field *field, struct hid_usage *usage) |
| 1906 | { |
| 1907 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1908 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1909 | struct input_dev *input = wacom_wac->touch_input; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1910 | unsigned touch_max = wacom_wac->features.touch_max; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1911 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1912 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1913 | switch (equivalent_usage) { |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1914 | case HID_GD_X: |
| 1915 | if (touch_max == 1) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1916 | wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1917 | else |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1918 | wacom_map_usage(input, usage, field, EV_ABS, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1919 | ABS_MT_POSITION_X, 4); |
| 1920 | break; |
| 1921 | case HID_GD_Y: |
| 1922 | if (touch_max == 1) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1923 | wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1924 | else |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1925 | wacom_map_usage(input, usage, field, EV_ABS, |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1926 | ABS_MT_POSITION_Y, 4); |
| 1927 | break; |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 1928 | case HID_DG_WIDTH: |
| 1929 | case HID_DG_HEIGHT: |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 1930 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); |
| 1931 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); |
| 1932 | input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); |
| 1933 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1934 | case HID_DG_TIPSWITCH: |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 1935 | wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1936 | break; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 1937 | case HID_DG_CONTACTCOUNT: |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 1938 | wacom_wac->hid_data.cc_report = field->report->id; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 1939 | wacom_wac->hid_data.cc_index = field->index; |
| 1940 | wacom_wac->hid_data.cc_value_index = usage->usage_index; |
| 1941 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1942 | } |
| 1943 | } |
| 1944 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 1945 | static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, |
| 1946 | struct input_dev *input) |
| 1947 | { |
| 1948 | struct hid_data *hid_data = &wacom_wac->hid_data; |
| 1949 | bool mt = wacom_wac->features.touch_max > 1; |
| 1950 | bool prox = hid_data->tipswitch && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 1951 | report_touch_events(wacom_wac); |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 1952 | |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 1953 | wacom_wac->hid_data.num_received++; |
| 1954 | if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) |
| 1955 | return; |
| 1956 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 1957 | if (mt) { |
| 1958 | int slot; |
| 1959 | |
| 1960 | slot = input_mt_get_slot_by_key(input, hid_data->id); |
| 1961 | input_mt_slot(input, slot); |
| 1962 | input_mt_report_slot_state(input, MT_TOOL_FINGER, prox); |
| 1963 | } |
| 1964 | else { |
| 1965 | input_report_key(input, BTN_TOUCH, prox); |
| 1966 | } |
| 1967 | |
| 1968 | if (prox) { |
| 1969 | input_report_abs(input, mt ? ABS_MT_POSITION_X : ABS_X, |
| 1970 | hid_data->x); |
| 1971 | input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, |
| 1972 | hid_data->y); |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 1973 | |
| 1974 | if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { |
| 1975 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); |
| 1976 | input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); |
| 1977 | if (hid_data->width != hid_data->height) |
| 1978 | input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); |
| 1979 | } |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 1980 | } |
| 1981 | } |
| 1982 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1983 | static int wacom_wac_finger_event(struct hid_device *hdev, |
| 1984 | struct hid_field *field, struct hid_usage *usage, __s32 value) |
| 1985 | { |
| 1986 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1987 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1988 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1989 | |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 1990 | switch (equivalent_usage) { |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 1991 | case HID_GD_X: |
| 1992 | wacom_wac->hid_data.x = value; |
| 1993 | break; |
| 1994 | case HID_GD_Y: |
| 1995 | wacom_wac->hid_data.y = value; |
| 1996 | break; |
Jason Gerecke | 488abb5 | 2015-07-21 11:07:25 -0700 | [diff] [blame] | 1997 | case HID_DG_WIDTH: |
| 1998 | wacom_wac->hid_data.width = value; |
| 1999 | break; |
| 2000 | case HID_DG_HEIGHT: |
| 2001 | wacom_wac->hid_data.height = value; |
| 2002 | break; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2003 | case HID_DG_CONTACTID: |
| 2004 | wacom_wac->hid_data.id = value; |
| 2005 | break; |
| 2006 | case HID_DG_TIPSWITCH: |
| 2007 | wacom_wac->hid_data.tipswitch = value; |
| 2008 | break; |
| 2009 | } |
| 2010 | |
| 2011 | |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2012 | if (usage->usage_index + 1 == field->report_count) { |
Jason Gerecke | c9c0958 | 2016-10-19 18:03:43 -0700 | [diff] [blame] | 2013 | if (equivalent_usage == wacom_wac->hid_data.last_slot_field) |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2014 | wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2015 | } |
| 2016 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2017 | return 0; |
| 2018 | } |
| 2019 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2020 | static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
| 2021 | struct hid_report *report) |
| 2022 | { |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2023 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2024 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2025 | struct hid_data* hid_data = &wacom_wac->hid_data; |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2026 | int i; |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2027 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2028 | for (i = 0; i < report->maxfield; i++) { |
| 2029 | struct hid_field *field = report->field[i]; |
| 2030 | int j; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2031 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2032 | for (j = 0; j < field->maxusage; j++) { |
| 2033 | struct hid_usage *usage = &field->usage[j]; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2034 | |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2035 | switch (usage->hid) { |
| 2036 | case HID_GD_X: |
| 2037 | case HID_GD_Y: |
| 2038 | case HID_DG_WIDTH: |
| 2039 | case HID_DG_HEIGHT: |
| 2040 | case HID_DG_CONTACTID: |
| 2041 | case HID_DG_INRANGE: |
| 2042 | case HID_DG_INVERT: |
| 2043 | case HID_DG_TIPSWITCH: |
| 2044 | hid_data->last_slot_field = usage->hid; |
| 2045 | break; |
| 2046 | case HID_DG_CONTACTCOUNT: |
| 2047 | hid_data->cc_report = report->id; |
| 2048 | hid_data->cc_index = i; |
| 2049 | hid_data->cc_value_index = j; |
| 2050 | break; |
Jason Gerecke | 499522c | 2015-10-07 16:54:21 -0700 | [diff] [blame] | 2051 | } |
| 2052 | } |
| 2053 | } |
Jason Gerecke | 003f50a | 2016-07-21 09:10:46 -0700 | [diff] [blame] | 2054 | |
Jason Gerecke | df70793 | 2015-10-07 16:54:22 -0700 | [diff] [blame] | 2055 | if (hid_data->cc_report != 0 && |
| 2056 | hid_data->cc_index >= 0) { |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2057 | struct hid_field *field = report->field[hid_data->cc_index]; |
| 2058 | int value = field->value[hid_data->cc_value_index]; |
| 2059 | if (value) |
| 2060 | hid_data->num_expected = value; |
| 2061 | } |
| 2062 | else { |
| 2063 | hid_data->num_expected = wacom_wac->features.touch_max; |
| 2064 | } |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2065 | } |
| 2066 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2067 | static void wacom_wac_finger_report(struct hid_device *hdev, |
| 2068 | struct hid_report *report) |
| 2069 | { |
| 2070 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2071 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2072 | struct input_dev *input = wacom_wac->touch_input; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2073 | unsigned touch_max = wacom_wac->features.touch_max; |
| 2074 | |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2075 | /* If more packets of data are expected, give us a chance to |
| 2076 | * process them rather than immediately syncing a partial |
| 2077 | * update. |
| 2078 | */ |
| 2079 | if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) |
| 2080 | return; |
| 2081 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2082 | if (touch_max > 1) |
Jason Gerecke | 601a22f | 2014-12-10 16:26:04 -0800 | [diff] [blame] | 2083 | input_mt_sync_frame(input); |
| 2084 | |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2085 | input_sync(input); |
Jason Gerecke | 1b5d514a | 2015-07-21 11:07:24 -0700 | [diff] [blame] | 2086 | wacom_wac->hid_data.num_received = 0; |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2087 | |
| 2088 | /* keep touch state for pen event */ |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2089 | wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2090 | } |
| 2091 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2092 | void wacom_wac_usage_mapping(struct hid_device *hdev, |
| 2093 | struct hid_field *field, struct hid_usage *usage) |
| 2094 | { |
| 2095 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2096 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2097 | struct wacom_features *features = &wacom_wac->features; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2098 | |
| 2099 | /* currently, only direct devices have proper hid report descriptors */ |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2100 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2101 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2102 | if (WACOM_PAD_FIELD(field)) |
| 2103 | return wacom_wac_pad_usage_mapping(hdev, field, usage); |
| 2104 | else if (WACOM_PEN_FIELD(field)) |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2105 | return wacom_wac_pen_usage_mapping(hdev, field, usage); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2106 | else if (WACOM_FINGER_FIELD(field)) |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2107 | return wacom_wac_finger_usage_mapping(hdev, field, usage); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2108 | } |
| 2109 | |
| 2110 | int wacom_wac_event(struct hid_device *hdev, struct hid_field *field, |
| 2111 | struct hid_usage *usage, __s32 value) |
| 2112 | { |
| 2113 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2114 | |
| 2115 | if (wacom->wacom_wac.features.type != HID_GENERIC) |
| 2116 | return 0; |
| 2117 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2118 | if (WACOM_PAD_FIELD(field)) |
| 2119 | return wacom_wac_pad_event(hdev, field, usage, value); |
| 2120 | else if (WACOM_PEN_FIELD(field)) |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2121 | return wacom_wac_pen_event(hdev, field, usage, value); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2122 | else if (WACOM_FINGER_FIELD(field)) |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2123 | return wacom_wac_finger_event(hdev, field, usage, value); |
| 2124 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2125 | return 0; |
| 2126 | } |
| 2127 | |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2128 | static void wacom_report_events(struct hid_device *hdev, struct hid_report *report) |
| 2129 | { |
| 2130 | int r; |
| 2131 | |
| 2132 | for (r = 0; r < report->maxfield; r++) { |
| 2133 | struct hid_field *field; |
| 2134 | unsigned count, n; |
| 2135 | |
| 2136 | field = report->field[r]; |
| 2137 | count = field->report_count; |
| 2138 | |
| 2139 | if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) |
| 2140 | continue; |
| 2141 | |
| 2142 | for (n = 0; n < count; n++) |
| 2143 | wacom_wac_event(hdev, field, &field->usage[n], field->value[n]); |
| 2144 | } |
| 2145 | } |
| 2146 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2147 | void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) |
| 2148 | { |
| 2149 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 2150 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 2151 | struct hid_field *field = report->field[0]; |
| 2152 | |
| 2153 | if (wacom_wac->features.type != HID_GENERIC) |
| 2154 | return; |
| 2155 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2156 | if (WACOM_PAD_FIELD(field)) |
| 2157 | wacom_wac_pad_pre_report(hdev, report); |
| 2158 | else if (WACOM_PEN_FIELD(field)) |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2159 | wacom_wac_pen_pre_report(hdev, report); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2160 | else if (WACOM_FINGER_FIELD(field)) |
Jason Gerecke | 06324e0 | 2015-07-21 11:07:23 -0700 | [diff] [blame] | 2161 | wacom_wac_finger_pre_report(hdev, report); |
| 2162 | |
| 2163 | wacom_report_events(hdev, report); |
| 2164 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2165 | if (WACOM_PAD_FIELD(field)) |
| 2166 | return wacom_wac_pad_report(hdev, report); |
| 2167 | else if (WACOM_PEN_FIELD(field)) |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2168 | return wacom_wac_pen_report(hdev, report); |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2169 | else if (WACOM_FINGER_FIELD(field)) |
Benjamin Tissoires | 5ae6e89 | 2014-09-23 12:08:09 -0400 | [diff] [blame] | 2170 | return wacom_wac_finger_report(hdev, report); |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2171 | } |
| 2172 | |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2173 | static int wacom_bpt_touch(struct wacom_wac *wacom) |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2174 | { |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2175 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2176 | struct input_dev *input = wacom->touch_input; |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2177 | struct input_dev *pad_input = wacom->pad_input; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2178 | unsigned char *data = wacom->data; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2179 | int i; |
| 2180 | |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2181 | if (data[0] != 0x02) |
| 2182 | return 0; |
| 2183 | |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2184 | for (i = 0; i < 2; i++) { |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2185 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2186 | bool touch = report_touch_events(wacom) |
| 2187 | && (data[offset + 3] & 0x80); |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2188 | |
| 2189 | input_mt_slot(input, i); |
| 2190 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
Henrik Rydberg | c5f4dec | 2010-12-15 13:50:34 +0100 | [diff] [blame] | 2191 | if (touch) { |
Chris Bagwell | 8f90686 | 2011-09-09 13:38:10 -0700 | [diff] [blame] | 2192 | int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; |
| 2193 | int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2194 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { |
| 2195 | x <<= 5; |
| 2196 | y <<= 5; |
| 2197 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2198 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2199 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2200 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2201 | } |
| 2202 | |
Benjamin Tissoires | 9a1c001 | 2015-02-17 14:19:46 -0500 | [diff] [blame] | 2203 | input_mt_sync_frame(input); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2204 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2205 | input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 2206 | input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); |
| 2207 | input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); |
| 2208 | input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2209 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2210 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2211 | return 1; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2212 | } |
| 2213 | |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2214 | 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] | 2215 | { |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2216 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2217 | struct input_dev *input = wacom->touch_input; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2218 | bool touch = data[1] & 0x80; |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 2219 | int slot = input_mt_get_slot_by_key(input, data[0]); |
| 2220 | |
| 2221 | if (slot < 0) |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2222 | return; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2223 | |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2224 | touch = touch && report_touch_events(wacom); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2225 | |
Ping Cheng | 02295e6 | 2013-01-04 23:56:00 -0800 | [diff] [blame] | 2226 | input_mt_slot(input, slot); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2227 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
| 2228 | |
| 2229 | if (touch) { |
| 2230 | int x = (data[2] << 4) | (data[4] >> 4); |
| 2231 | int y = (data[3] << 4) | (data[4] & 0x0f); |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2232 | int width, height; |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 2233 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2234 | if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { |
Jason Gerecke | 0b279da | 2013-11-25 18:43:16 -0800 | [diff] [blame] | 2235 | width = data[5] * 100; |
| 2236 | height = data[6] * 100; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2237 | } else { |
| 2238 | /* |
| 2239 | * "a" is a scaled-down area which we assume is |
| 2240 | * roughly circular and which can be described as: |
| 2241 | * a=(pi*r^2)/C. |
| 2242 | */ |
| 2243 | int a = data[5]; |
Ping Cheng | d7da3a3 | 2014-06-13 13:37:33 -0700 | [diff] [blame] | 2244 | int x_res = input_abs_get_res(input, ABS_MT_POSITION_X); |
| 2245 | int y_res = input_abs_get_res(input, ABS_MT_POSITION_Y); |
| 2246 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2247 | height = width * y_res / x_res; |
| 2248 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2249 | |
| 2250 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2251 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
Jason Gerecke | 4e90495 | 2012-10-03 17:19:11 -0700 | [diff] [blame] | 2252 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); |
| 2253 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2254 | } |
| 2255 | } |
| 2256 | |
| 2257 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) |
| 2258 | { |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2259 | struct input_dev *input = wacom->pad_input; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2260 | struct wacom_features *features = &wacom->features; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2261 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2262 | if (features->type == INTUOSHT || features->type == INTUOSHT2) { |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2263 | input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); |
| 2264 | input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); |
| 2265 | } else { |
| 2266 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); |
| 2267 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 2268 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2269 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2270 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); |
| 2271 | } |
| 2272 | |
| 2273 | static int wacom_bpt3_touch(struct wacom_wac *wacom) |
| 2274 | { |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2275 | unsigned char *data = wacom->data; |
Jason Gerecke | 19d57d3 | 2012-03-06 10:19:19 -0800 | [diff] [blame] | 2276 | int count = data[1] & 0x07; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2277 | int touch_changed = 0, i; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2278 | |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2279 | if (data[0] != 0x02) |
| 2280 | return 0; |
| 2281 | |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2282 | /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ |
| 2283 | for (i = 0; i < count; i++) { |
| 2284 | int offset = (8 * i) + 2; |
| 2285 | int msg_id = data[offset]; |
| 2286 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2287 | if (msg_id >= 2 && msg_id <= 17) { |
Ping Cheng | 7d059ed | 2015-03-20 14:57:21 -0700 | [diff] [blame] | 2288 | wacom_bpt3_touch_msg(wacom, data + offset); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2289 | touch_changed++; |
| 2290 | } else if (msg_id == 128) |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2291 | wacom_bpt3_button_msg(wacom, data + offset); |
| 2292 | |
| 2293 | } |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2294 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2295 | /* 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] | 2296 | if (wacom->touch_input && touch_changed) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2297 | input_mt_sync_frame(wacom->touch_input); |
| 2298 | wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); |
| 2299 | } |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2300 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 2301 | return 1; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2302 | } |
| 2303 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2304 | static int wacom_bpt_pen(struct wacom_wac *wacom) |
| 2305 | { |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2306 | struct wacom_features *features = &wacom->features; |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2307 | struct input_dev *input = wacom->pen_input; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2308 | unsigned char *data = wacom->data; |
| 2309 | int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; |
| 2310 | |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2311 | if (data[0] != WACOM_REPORT_PENABLED) |
Chris Bagwell | 5a6c865 | 2011-11-07 19:52:42 -0800 | [diff] [blame] | 2312 | return 0; |
| 2313 | |
Chris Bagwell | c598141 | 2011-10-26 22:28:34 -0700 | [diff] [blame] | 2314 | prox = (data[1] & 0x20) == 0x20; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2315 | |
| 2316 | /* |
| 2317 | * All reports shared between PEN and RUBBER tool must be |
| 2318 | * forced to a known starting value (zero) when transitioning to |
| 2319 | * out-of-prox. |
| 2320 | * |
| 2321 | * If not reset then, to userspace, it will look like lost events |
| 2322 | * if new tool comes in-prox with same values as previous tool sent. |
| 2323 | * |
| 2324 | * Hardware does report zero in most out-of-prox cases but not all. |
| 2325 | */ |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2326 | if (!wacom->shared->stylus_in_proximity) { |
| 2327 | if (data[1] & 0x08) { |
| 2328 | wacom->tool[0] = BTN_TOOL_RUBBER; |
| 2329 | wacom->id[0] = ERASER_DEVICE_ID; |
| 2330 | } else { |
| 2331 | wacom->tool[0] = BTN_TOOL_PEN; |
| 2332 | wacom->id[0] = STYLUS_DEVICE_ID; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2333 | } |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2334 | } |
| 2335 | |
| 2336 | wacom->shared->stylus_in_proximity = prox; |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2337 | if (delay_pen_events(wacom)) |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2338 | return 0; |
| 2339 | |
| 2340 | if (prox) { |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2341 | x = le16_to_cpup((__le16 *)&data[2]); |
| 2342 | y = le16_to_cpup((__le16 *)&data[4]); |
| 2343 | p = le16_to_cpup((__le16 *)&data[6]); |
Chris Bagwell | c18c2ce | 2011-10-10 08:52:13 -0700 | [diff] [blame] | 2344 | /* |
| 2345 | * Convert distance from out prox to distance from tablet. |
| 2346 | * distance will be greater than distance_max once |
| 2347 | * touching and applying pressure; do not report negative |
| 2348 | * distance. |
| 2349 | */ |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2350 | if (data[8] <= features->distance_max) |
| 2351 | d = features->distance_max - data[8]; |
Chris Bagwell | c18c2ce | 2011-10-10 08:52:13 -0700 | [diff] [blame] | 2352 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2353 | pen = data[1] & 0x01; |
| 2354 | btn1 = data[1] & 0x02; |
| 2355 | btn2 = data[1] & 0x04; |
Ping Cheng | 0149931 | 2015-03-20 14:58:01 -0700 | [diff] [blame] | 2356 | } else { |
| 2357 | wacom->id[0] = 0; |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2358 | } |
| 2359 | |
| 2360 | input_report_key(input, BTN_TOUCH, pen); |
| 2361 | input_report_key(input, BTN_STYLUS, btn1); |
| 2362 | input_report_key(input, BTN_STYLUS2, btn2); |
| 2363 | |
| 2364 | input_report_abs(input, ABS_X, x); |
| 2365 | input_report_abs(input, ABS_Y, y); |
| 2366 | input_report_abs(input, ABS_PRESSURE, p); |
| 2367 | input_report_abs(input, ABS_DISTANCE, d); |
| 2368 | |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2369 | input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */ |
| 2370 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ |
| 2371 | |
| 2372 | return 1; |
| 2373 | } |
| 2374 | |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2375 | static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) |
| 2376 | { |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2377 | struct wacom_features *features = &wacom->features; |
| 2378 | |
| 2379 | if ((features->type == INTUOSHT2) && |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2380 | (features->device_type & WACOM_DEVICETYPE_PEN)) |
| 2381 | return wacom_intuos_irq(wacom); |
| 2382 | else if (len == WACOM_PKGLEN_BBTOUCH) |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2383 | return wacom_bpt_touch(wacom); |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2384 | else if (len == WACOM_PKGLEN_BBTOUCH3) |
| 2385 | return wacom_bpt3_touch(wacom); |
| 2386 | else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 2387 | return wacom_bpt_pen(wacom); |
Chris Bagwell | e1d38e4 | 2010-09-12 00:09:27 -0700 | [diff] [blame] | 2388 | |
| 2389 | return 0; |
| 2390 | } |
| 2391 | |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2392 | static void wacom_bamboo_pad_pen_event(struct wacom_wac *wacom, |
| 2393 | unsigned char *data) |
| 2394 | { |
| 2395 | unsigned char prefix; |
| 2396 | |
| 2397 | /* |
| 2398 | * We need to reroute the event from the debug interface to the |
| 2399 | * pen interface. |
| 2400 | * We need to add the report ID to the actual pen report, so we |
| 2401 | * temporary overwrite the first byte to prevent having to kzalloc/kfree |
| 2402 | * and memcpy the report. |
| 2403 | */ |
| 2404 | prefix = data[0]; |
| 2405 | data[0] = WACOM_REPORT_BPAD_PEN; |
| 2406 | |
| 2407 | /* |
| 2408 | * actually reroute the event. |
| 2409 | * No need to check if wacom->shared->pen is valid, hid_input_report() |
| 2410 | * will check for us. |
| 2411 | */ |
| 2412 | hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, |
| 2413 | WACOM_PKGLEN_PENABLED, 1); |
| 2414 | |
| 2415 | data[0] = prefix; |
| 2416 | } |
| 2417 | |
| 2418 | static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom, |
| 2419 | unsigned char *data) |
| 2420 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2421 | struct input_dev *input = wacom->touch_input; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2422 | unsigned char *finger_data, prefix; |
| 2423 | unsigned id; |
| 2424 | int x, y; |
| 2425 | bool valid; |
| 2426 | |
| 2427 | prefix = data[0]; |
| 2428 | |
| 2429 | for (id = 0; id < wacom->features.touch_max; id++) { |
| 2430 | valid = !!(prefix & BIT(id)) && |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2431 | report_touch_events(wacom); |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2432 | |
| 2433 | input_mt_slot(input, id); |
| 2434 | input_mt_report_slot_state(input, MT_TOOL_FINGER, valid); |
| 2435 | |
| 2436 | if (!valid) |
| 2437 | continue; |
| 2438 | |
| 2439 | finger_data = data + 1 + id * 3; |
| 2440 | x = finger_data[0] | ((finger_data[1] & 0x0f) << 8); |
| 2441 | y = (finger_data[2] << 4) | (finger_data[1] >> 4); |
| 2442 | |
| 2443 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 2444 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 2445 | } |
| 2446 | |
| 2447 | input_mt_sync_frame(input); |
| 2448 | |
| 2449 | input_report_key(input, BTN_LEFT, prefix & 0x40); |
| 2450 | input_report_key(input, BTN_RIGHT, prefix & 0x80); |
| 2451 | |
| 2452 | /* keep touch state for pen event */ |
Ping Cheng | 1924e05 | 2016-08-09 14:38:56 -0700 | [diff] [blame] | 2453 | wacom->shared->touch_down = !!prefix && report_touch_events(wacom); |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2454 | |
| 2455 | return 1; |
| 2456 | } |
| 2457 | |
| 2458 | static int wacom_bamboo_pad_irq(struct wacom_wac *wacom, size_t len) |
| 2459 | { |
| 2460 | unsigned char *data = wacom->data; |
| 2461 | |
| 2462 | if (!((len == WACOM_PKGLEN_BPAD_TOUCH) || |
| 2463 | (len == WACOM_PKGLEN_BPAD_TOUCH_USB)) || |
| 2464 | (data[0] != WACOM_REPORT_BPAD_TOUCH)) |
| 2465 | return 0; |
| 2466 | |
| 2467 | if (data[1] & 0x01) |
| 2468 | wacom_bamboo_pad_pen_event(wacom, &data[1]); |
| 2469 | |
| 2470 | if (data[1] & 0x02) |
| 2471 | return wacom_bamboo_pad_touch_event(wacom, &data[9]); |
| 2472 | |
| 2473 | return 0; |
| 2474 | } |
| 2475 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2476 | static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) |
| 2477 | { |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2478 | unsigned char *data = wacom->data; |
| 2479 | int connected; |
| 2480 | |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2481 | if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL) |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2482 | return 0; |
| 2483 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2484 | connected = data[1] & 0x01; |
| 2485 | if (connected) { |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 2486 | int pid, battery, charging; |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2487 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2488 | if ((wacom->shared->type == INTUOSHT || |
| 2489 | wacom->shared->type == INTUOSHT2) && |
Ping Cheng | 44b9683 | 2014-11-06 17:30:51 -0800 | [diff] [blame] | 2490 | wacom->shared->touch_input && |
| 2491 | wacom->shared->touch_max) { |
Ping Cheng | 961794a | 2013-12-05 12:54:53 -0800 | [diff] [blame] | 2492 | input_report_switch(wacom->shared->touch_input, |
| 2493 | SW_MUTE_DEVICE, data[5] & 0x40); |
| 2494 | input_sync(wacom->shared->touch_input); |
| 2495 | } |
| 2496 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2497 | pid = get_unaligned_be16(&data[6]); |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 2498 | battery = (data[5] & 0x3f) * 100 / 31; |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 2499 | charging = !!(data[5] & 0x80); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2500 | if (wacom->pid != pid) { |
| 2501 | wacom->pid = pid; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2502 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2503 | } |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 2504 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 2505 | wacom_notify_battery(wacom, battery, charging, 1, 0); |
Jason Gerecke | 953f2c5 | 2015-03-06 11:47:39 -0800 | [diff] [blame] | 2506 | |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2507 | } else if (wacom->pid != 0) { |
| 2508 | /* disconnected while previously connected */ |
| 2509 | wacom->pid = 0; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2510 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 2511 | wacom_notify_battery(wacom, 0, 0, 0, 0); |
Chris Bagwell | 16bf288 | 2012-03-25 23:26:20 -0700 | [diff] [blame] | 2512 | } |
| 2513 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2514 | return 0; |
| 2515 | } |
| 2516 | |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2517 | static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len) |
| 2518 | { |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2519 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2520 | struct wacom_features *features = &wacom_wac->features; |
| 2521 | unsigned char *data = wacom_wac->data; |
| 2522 | |
| 2523 | if (data[0] != WACOM_REPORT_USB) |
| 2524 | return 0; |
| 2525 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2526 | if ((features->type == INTUOSHT || |
| 2527 | features->type == INTUOSHT2) && |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2528 | wacom_wac->shared->touch_input && |
| 2529 | features->touch_max) { |
| 2530 | input_report_switch(wacom_wac->shared->touch_input, |
| 2531 | SW_MUTE_DEVICE, data[8] & 0x40); |
| 2532 | input_sync(wacom_wac->shared->touch_input); |
| 2533 | } |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2534 | |
| 2535 | if (data[9] & 0x02) { /* wireless module is attached */ |
| 2536 | int battery = (data[8] & 0x3f) * 100 / 31; |
Jason Gerecke | b0882cb | 2015-03-06 11:47:43 -0800 | [diff] [blame] | 2537 | bool charging = !!(data[8] & 0x80); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2538 | |
| 2539 | wacom_notify_battery(wacom_wac, battery, charging, |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 2540 | battery || charging, 1); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2541 | |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 2542 | if (!wacom->battery.battery && |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2543 | !(features->quirks & WACOM_QUIRK_BATTERY)) { |
| 2544 | features->quirks |= WACOM_QUIRK_BATTERY; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2545 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2546 | } |
| 2547 | } |
| 2548 | else if ((features->quirks & WACOM_QUIRK_BATTERY) && |
Benjamin Tissoires | 59d69bc | 2016-07-13 18:06:08 +0200 | [diff] [blame] | 2549 | wacom->battery.battery) { |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2550 | features->quirks &= ~WACOM_QUIRK_BATTERY; |
Benjamin Tissoires | d17d1f1 | 2016-07-13 18:05:52 +0200 | [diff] [blame] | 2551 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
Jason Gerecke | 71fa641 | 2015-03-11 10:25:41 -0700 | [diff] [blame] | 2552 | wacom_notify_battery(wacom_wac, 0, 0, 0, 0); |
Jason Gerecke | 8f93b0b | 2015-03-06 11:47:41 -0800 | [diff] [blame] | 2553 | } |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2554 | return 0; |
| 2555 | } |
| 2556 | |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2557 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2558 | { |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2559 | bool sync; |
| 2560 | |
Jason Childs | e33da8a | 2010-02-17 22:38:31 -0800 | [diff] [blame] | 2561 | switch (wacom_wac->features.type) { |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2562 | case PENPARTNER: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2563 | sync = wacom_penpartner_irq(wacom_wac); |
| 2564 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2565 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2566 | case PL: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2567 | sync = wacom_pl_irq(wacom_wac); |
| 2568 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2569 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2570 | case WACOM_G4: |
| 2571 | case GRAPHIRE: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 2572 | case GRAPHIRE_BT: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2573 | case WACOM_MO: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2574 | sync = wacom_graphire_irq(wacom_wac); |
| 2575 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2576 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2577 | case PTU: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2578 | sync = wacom_ptu_irq(wacom_wac); |
| 2579 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2580 | |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 2581 | case DTU: |
| 2582 | sync = wacom_dtu_irq(wacom_wac); |
| 2583 | break; |
| 2584 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 2585 | case DTUS: |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 2586 | case DTUSX: |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 2587 | sync = wacom_dtus_irq(wacom_wac); |
| 2588 | break; |
| 2589 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2590 | case INTUOS: |
| 2591 | case INTUOS3S: |
| 2592 | case INTUOS3: |
| 2593 | case INTUOS3L: |
| 2594 | case INTUOS4S: |
| 2595 | case INTUOS4: |
| 2596 | case INTUOS4L: |
| 2597 | case CINTIQ: |
| 2598 | case WACOM_BEE: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 2599 | case WACOM_13HD: |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 2600 | case WACOM_21UX2: |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 2601 | case WACOM_22HD: |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 2602 | case WACOM_24HD: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 2603 | case WACOM_27QHD: |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 2604 | case DTK: |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 2605 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 2606 | case CINTIQ_COMPANION_2: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2607 | sync = wacom_intuos_irq(wacom_wac); |
| 2608 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2609 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 2610 | case INTUOS4WL: |
| 2611 | sync = wacom_intuos_bt_irq(wacom_wac, len); |
| 2612 | break; |
| 2613 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 2614 | case WACOM_24HDT: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 2615 | case WACOM_27QHDT: |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 2616 | sync = wacom_24hdt_irq(wacom_wac); |
| 2617 | break; |
| 2618 | |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2619 | case INTUOS5S: |
| 2620 | case INTUOS5: |
| 2621 | case INTUOS5L: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2622 | case INTUOSPS: |
| 2623 | case INTUOSPM: |
| 2624 | case INTUOSPL: |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2625 | if (len == WACOM_PKGLEN_BBTOUCH3) |
| 2626 | sync = wacom_bpt3_touch(wacom_wac); |
Jason Gerecke | 2d13a43 | 2015-03-06 11:47:42 -0800 | [diff] [blame] | 2627 | else if (wacom_wac->data[0] == WACOM_REPORT_USB) |
| 2628 | sync = wacom_status_irq(wacom_wac, len); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2629 | else |
| 2630 | sync = wacom_intuos_irq(wacom_wac); |
| 2631 | break; |
| 2632 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2633 | case TABLETPC: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 2634 | case TABLETPCE: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2635 | case TABLETPC2FG: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 2636 | case MTSCREEN: |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 2637 | case MTTPC: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 2638 | case MTTPC_B: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2639 | sync = wacom_tpc_irq(wacom_wac, len); |
| 2640 | break; |
Ping Cheng | 545f4e9 | 2008-11-24 11:44:27 -0500 | [diff] [blame] | 2641 | |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2642 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2643 | case BAMBOO_PEN: |
| 2644 | case BAMBOO_TOUCH: |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2645 | case INTUOSHT: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2646 | case INTUOSHT2: |
Jason Gerecke | 4ca4ec7 | 2015-03-06 11:47:38 -0800 | [diff] [blame] | 2647 | if (wacom_wac->data[0] == WACOM_REPORT_USB) |
| 2648 | sync = wacom_status_irq(wacom_wac, len); |
| 2649 | else |
| 2650 | sync = wacom_bpt_irq(wacom_wac, len); |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2651 | break; |
| 2652 | |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 2653 | case BAMBOO_PAD: |
| 2654 | sync = wacom_bamboo_pad_irq(wacom_wac, len); |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2655 | break; |
| 2656 | |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2657 | case WIRELESS: |
| 2658 | sync = wacom_wireless_irq(wacom_wac, len); |
| 2659 | break; |
| 2660 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2661 | case REMOTE: |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 2662 | sync = false; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2663 | if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) |
Benjamin Tissoires | e6f2813 | 2016-07-13 18:06:01 +0200 | [diff] [blame] | 2664 | wacom_remote_status_irq(wacom_wac, len); |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2665 | else |
| 2666 | sync = wacom_remote_irq(wacom_wac, len); |
| 2667 | break; |
| 2668 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2669 | default: |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2670 | sync = false; |
| 2671 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2672 | } |
Dmitry Torokhov | 95dd3b3 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2673 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 2674 | if (sync) { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2675 | if (wacom_wac->pen_input) |
| 2676 | input_sync(wacom_wac->pen_input); |
| 2677 | if (wacom_wac->touch_input) |
| 2678 | input_sync(wacom_wac->touch_input); |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 2679 | if (wacom_wac->pad_input) |
| 2680 | input_sync(wacom_wac->pad_input); |
| 2681 | } |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2682 | } |
| 2683 | |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2684 | static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac) |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 2685 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2686 | struct input_dev *input_dev = wacom_wac->pen_input; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2687 | |
| 2688 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2689 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2690 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2691 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 2692 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 2693 | |
| 2694 | input_set_abs_params(input_dev, ABS_DISTANCE, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2695 | 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2696 | } |
| 2697 | |
| 2698 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) |
| 2699 | { |
| 2700 | struct input_dev *input_dev = wacom_wac->pen_input; |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2701 | struct wacom_features *features = &wacom_wac->features; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2702 | |
| 2703 | wacom_setup_basic_pro_pen(wacom_wac); |
| 2704 | |
| 2705 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 2706 | __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); |
| 2707 | __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); |
| 2708 | __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); |
| 2709 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2710 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2711 | 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] | 2712 | input_abs_set_res(input_dev, ABS_TILT_X, 57); |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2713 | 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] | 2714 | input_abs_set_res(input_dev, ABS_TILT_Y, 57); |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 2715 | } |
| 2716 | |
| 2717 | static void wacom_setup_intuos(struct wacom_wac *wacom_wac) |
| 2718 | { |
Jason Gerecke | 2a6cdbd | 2015-06-15 18:01:45 -0700 | [diff] [blame] | 2719 | struct input_dev *input_dev = wacom_wac->pen_input; |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 2720 | |
| 2721 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 2722 | |
| 2723 | wacom_setup_cintiq(wacom_wac); |
| 2724 | |
| 2725 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 2726 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 2727 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 2728 | __set_bit(BTN_SIDE, input_dev->keybit); |
| 2729 | __set_bit(BTN_EXTRA, input_dev->keybit); |
| 2730 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 2731 | __set_bit(BTN_TOOL_LENS, input_dev->keybit); |
| 2732 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2733 | input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 2734 | input_abs_set_res(input_dev, ABS_RZ, 287); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2735 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); |
| 2736 | } |
| 2737 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2738 | void wacom_setup_device_quirks(struct wacom *wacom) |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2739 | { |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2740 | struct wacom_features *features = &wacom->wacom_wac.features; |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2741 | |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2742 | /* The pen and pad share the same interface on most devices */ |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 2743 | if (features->numbered_buttons > 0) |
| 2744 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2745 | if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2746 | features->type == DTUS || |
| 2747 | (features->type >= INTUOS3S && features->type <= WACOM_MO)) { |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2748 | if (features->device_type & WACOM_DEVICETYPE_PEN) |
| 2749 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2750 | } |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2751 | |
| 2752 | /* touch device found but size is not defined. use default */ |
Jason Gerecke | aa86b18 | 2015-06-15 18:01:42 -0700 | [diff] [blame] | 2753 | if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2754 | features->x_max = 1023; |
| 2755 | features->y_max = 1023; |
| 2756 | } |
| 2757 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2758 | /* |
| 2759 | * Intuos5/Pro and Bamboo 3rd gen have no useful data about its |
| 2760 | * touch interface in its HID descriptor. If this is the touch |
| 2761 | * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the |
| 2762 | * tablet values. |
| 2763 | */ |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2764 | if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || |
| 2765 | (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2766 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2767 | if (features->touch_max) |
| 2768 | features->device_type |= WACOM_DEVICETYPE_TOUCH; |
Jiri Kosina | a3088ab | 2015-11-17 00:24:14 +0100 | [diff] [blame] | 2769 | if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 2770 | features->device_type |= WACOM_DEVICETYPE_PAD; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2771 | |
| 2772 | features->x_max = 4096; |
| 2773 | features->y_max = 4096; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2774 | } |
Jason Gerecke | 9633920 | 2015-07-01 13:01:00 -0700 | [diff] [blame] | 2775 | else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
| 2776 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2777 | } |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2778 | } |
| 2779 | |
| 2780 | /* |
Benjamin Tissoires | 580549e | 2016-03-25 15:26:55 +0100 | [diff] [blame] | 2781 | * Hack for the Bamboo One: |
| 2782 | * the device presents a PAD/Touch interface as most Bamboos and even |
| 2783 | * sends ghosts PAD data on it. However, later, we must disable this |
| 2784 | * ghost interface, and we can not detect it unless we set it here |
| 2785 | * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH. |
| 2786 | */ |
| 2787 | if (features->type == BAMBOO_PEN && |
| 2788 | features->pktlen == WACOM_PKGLEN_BBTOUCH3) |
| 2789 | features->device_type |= WACOM_DEVICETYPE_PAD; |
| 2790 | |
| 2791 | /* |
Jason Gerecke | 042628a | 2015-04-30 17:51:54 -0700 | [diff] [blame] | 2792 | * Raw Wacom-mode pen and touch events both come from interface |
| 2793 | * 0, whose HID descriptor has an application usage of 0xFF0D |
Jason Gerecke | 8de8228 | 2016-10-19 18:03:37 -0700 | [diff] [blame] | 2794 | * (i.e., WACOM_HID_WD_DIGITIZER). We route pen packets back |
Jason Gerecke | 042628a | 2015-04-30 17:51:54 -0700 | [diff] [blame] | 2795 | * out through the HID_GENERIC device created for interface 1, |
Benjamin Tissoires | 70caee0 | 2015-07-09 14:11:51 -0400 | [diff] [blame] | 2796 | * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH. |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2797 | */ |
| 2798 | if (features->type == BAMBOO_PAD) |
Benjamin Tissoires | 70caee0 | 2015-07-09 14:11:51 -0400 | [diff] [blame] | 2799 | features->device_type = WACOM_DEVICETYPE_TOUCH; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2800 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 2801 | if (features->type == REMOTE) |
| 2802 | features->device_type = WACOM_DEVICETYPE_PAD; |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2803 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2804 | switch (features->type) { |
| 2805 | case PL: |
| 2806 | case DTU: |
| 2807 | case DTUS: |
| 2808 | case DTUSX: |
| 2809 | case WACOM_21UX2: |
| 2810 | case WACOM_22HD: |
| 2811 | case DTK: |
| 2812 | case WACOM_24HD: |
| 2813 | case WACOM_27QHD: |
| 2814 | case CINTIQ_HYBRID: |
| 2815 | case CINTIQ_COMPANION_2: |
| 2816 | case CINTIQ: |
| 2817 | case WACOM_BEE: |
| 2818 | case WACOM_13HD: |
| 2819 | case WACOM_24HDT: |
| 2820 | case WACOM_27QHDT: |
| 2821 | case TABLETPC: |
| 2822 | case TABLETPCE: |
| 2823 | case TABLETPC2FG: |
| 2824 | case MTSCREEN: |
| 2825 | case MTTPC: |
| 2826 | case MTTPC_B: |
| 2827 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
| 2828 | break; |
| 2829 | } |
| 2830 | |
Ping Cheng | 42f4f27 | 2015-04-15 16:53:54 -0700 | [diff] [blame] | 2831 | if (wacom->hdev->bus == BUS_BLUETOOTH) |
| 2832 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 2833 | |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2834 | /* quirk for bamboo touch with 2 low res touches */ |
Jason Gerecke | be853fd | 2015-12-04 14:45:27 -0800 | [diff] [blame] | 2835 | if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 2836 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2837 | features->x_max <<= 5; |
| 2838 | features->y_max <<= 5; |
| 2839 | features->x_fuzz <<= 5; |
| 2840 | features->y_fuzz <<= 5; |
Henrik Rydberg | f4ccbef | 2010-09-05 12:57:13 -0700 | [diff] [blame] | 2841 | features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2842 | } |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2843 | |
| 2844 | if (features->type == WIRELESS) { |
Jason Gerecke | ccad85c | 2015-08-03 10:17:04 -0700 | [diff] [blame] | 2845 | if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { |
Benjamin Tissoires | ac8d101 | 2014-07-25 17:29:48 -0700 | [diff] [blame] | 2846 | features->quirks |= WACOM_QUIRK_BATTERY; |
| 2847 | } |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 2848 | } |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 2849 | |
| 2850 | if (features->type == REMOTE) |
| 2851 | features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; |
Henrik Rydberg | bc73dd3 | 2010-09-05 12:26:16 -0700 | [diff] [blame] | 2852 | } |
| 2853 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 2854 | int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 2855 | struct wacom_wac *wacom_wac) |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2856 | { |
| 2857 | struct wacom_features *features = &wacom_wac->features; |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2858 | |
| 2859 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 2860 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 2861 | if (!(features->device_type & WACOM_DEVICETYPE_PEN)) |
| 2862 | return -ENODEV; |
| 2863 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 2864 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
| 2865 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 2866 | else |
| 2867 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 2868 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 2869 | if (features->type == HID_GENERIC) |
| 2870 | /* setup has already been done */ |
| 2871 | return 0; |
| 2872 | |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2873 | __set_bit(BTN_TOUCH, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2874 | __set_bit(ABS_MISC, input_dev->absbit); |
| 2875 | |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 2876 | input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, |
| 2877 | features->x_max - features->offset_right, |
| 2878 | features->x_fuzz, 0); |
| 2879 | input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, |
| 2880 | features->y_max - features->offset_bottom, |
| 2881 | features->y_fuzz, 0); |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 2882 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, |
| 2883 | features->pressure_max, features->pressure_fuzz, 0); |
| 2884 | |
| 2885 | /* penabled devices have fixed resolution for each model */ |
| 2886 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
| 2887 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
| 2888 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 2889 | switch (features->type) { |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 2890 | case GRAPHIRE_BT: |
| 2891 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 2892 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2893 | case WACOM_MO: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2894 | case WACOM_G4: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 2895 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 2896 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2897 | features->distance_fuzz, 0); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2898 | /* fall through */ |
| 2899 | |
| 2900 | case GRAPHIRE: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2901 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 2902 | |
| 2903 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 2904 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 2905 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 2906 | |
| 2907 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 2908 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 2909 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); |
| 2910 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 2911 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2912 | break; |
| 2913 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 2914 | case WACOM_27QHD: |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 2915 | case WACOM_24HD: |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 2916 | case DTK: |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 2917 | case WACOM_22HD: |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 2918 | case WACOM_21UX2: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2919 | case WACOM_BEE: |
Ping Cheng | 6521d0b | 2010-10-24 21:53:40 -0700 | [diff] [blame] | 2920 | case CINTIQ: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 2921 | case WACOM_13HD: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 2922 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 2923 | case CINTIQ_COMPANION_2: |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 2924 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 2925 | input_abs_set_res(input_dev, ABS_Z, 287); |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 2926 | wacom_setup_cintiq(wacom_wac); |
| 2927 | break; |
| 2928 | |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2929 | case INTUOS3: |
| 2930 | case INTUOS3L: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2931 | case INTUOS3S: |
Ping Cheng | a2f71c6 | 2015-01-27 13:29:36 -0800 | [diff] [blame] | 2932 | case INTUOS4: |
| 2933 | case INTUOS4WL: |
| 2934 | case INTUOS4L: |
| 2935 | case INTUOS4S: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2936 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
Jason Gerecke | 26fe412 | 2014-11-18 16:50:09 -0800 | [diff] [blame] | 2937 | input_abs_set_res(input_dev, ABS_Z, 287); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2938 | /* fall through */ |
| 2939 | |
| 2940 | case INTUOS: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2941 | wacom_setup_intuos(wacom_wac); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2942 | break; |
| 2943 | |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 2944 | case INTUOS5: |
| 2945 | case INTUOS5L: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2946 | case INTUOSPM: |
| 2947 | case INTUOSPL: |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2948 | case INTUOS5S: |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 2949 | case INTUOSPS: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 2950 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 2951 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 2952 | features->distance_fuzz, 0); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2953 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 2954 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 2955 | input_abs_set_res(input_dev, ABS_Z, 287); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2956 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 2957 | wacom_setup_intuos(wacom_wac); |
Jason Gerecke | ae584ca | 2012-04-03 15:50:40 -0700 | [diff] [blame] | 2958 | break; |
| 2959 | |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 2960 | case WACOM_24HDT: |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 2961 | case WACOM_27QHDT: |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 2962 | case MTSCREEN: |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 2963 | case MTTPC: |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 2964 | case MTTPC_B: |
Ping Cheng | 6795a52 | 2012-06-28 16:49:00 -0700 | [diff] [blame] | 2965 | case TABLETPC2FG: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2966 | case TABLETPC: |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 2967 | case TABLETPCE: |
Ping Cheng | a43c7c5 | 2011-03-12 20:34:42 -0800 | [diff] [blame] | 2968 | __clear_bit(ABS_MISC, input_dev->absbit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2969 | /* fall through */ |
| 2970 | |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 2971 | case DTUS: |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 2972 | case DTUSX: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2973 | case PL: |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 2974 | case DTU: |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2975 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Jason Gerecke | 3512069 | 2011-09-08 09:38:14 -0700 | [diff] [blame] | 2976 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2977 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 2978 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
Jason Gerecke | 3512069 | 2011-09-08 09:38:14 -0700 | [diff] [blame] | 2979 | break; |
| 2980 | |
| 2981 | case PTU: |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2982 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 2983 | /* fall through */ |
| 2984 | |
| 2985 | case PENPARTNER: |
Jason Gerecke | 1fab84a | 2011-08-26 23:18:22 -0700 | [diff] [blame] | 2986 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
Dmitry Torokhov | 8da23fc | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2987 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
Jason Gerecke | 1fab84a | 2011-08-26 23:18:22 -0700 | [diff] [blame] | 2988 | __set_bit(BTN_STYLUS, input_dev->keybit); |
Dmitry Torokhov | 73a97f4 | 2010-03-19 22:18:15 -0700 | [diff] [blame] | 2989 | break; |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2990 | |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 2991 | case INTUOSHT: |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 2992 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 2993 | case BAMBOO_PEN: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2994 | case INTUOSHT2: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 2995 | if (features->type == INTUOSHT2) { |
| 2996 | wacom_setup_basic_pro_pen(wacom_wac); |
| 2997 | } else { |
| 2998 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 2999 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 3000 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 3001 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3002 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
| 3003 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3004 | features->distance_max, |
Jason Gerecke | bef7e20 | 2016-04-22 14:30:53 -0700 | [diff] [blame] | 3005 | features->distance_fuzz, 0); |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3006 | } |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 3007 | break; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3008 | case BAMBOO_PAD: |
| 3009 | __clear_bit(ABS_MISC, input_dev->absbit); |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3010 | break; |
| 3011 | } |
| 3012 | return 0; |
| 3013 | } |
| 3014 | |
| 3015 | int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, |
| 3016 | struct wacom_wac *wacom_wac) |
| 3017 | { |
| 3018 | struct wacom_features *features = &wacom_wac->features; |
| 3019 | |
| 3020 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3021 | |
| 3022 | if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) |
| 3023 | return -ENODEV; |
| 3024 | |
Jason Gerecke | e5bc8eb | 2016-08-08 12:06:29 -0700 | [diff] [blame] | 3025 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
| 3026 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 3027 | else |
| 3028 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 3029 | |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3030 | if (features->type == HID_GENERIC) |
| 3031 | /* setup has already been done */ |
| 3032 | return 0; |
| 3033 | |
| 3034 | __set_bit(BTN_TOUCH, input_dev->keybit); |
| 3035 | |
| 3036 | if (features->touch_max == 1) { |
| 3037 | input_set_abs_params(input_dev, ABS_X, 0, |
| 3038 | features->x_max, features->x_fuzz, 0); |
| 3039 | input_set_abs_params(input_dev, ABS_Y, 0, |
| 3040 | features->y_max, features->y_fuzz, 0); |
| 3041 | input_abs_set_res(input_dev, ABS_X, |
| 3042 | features->x_resolution); |
| 3043 | input_abs_set_res(input_dev, ABS_Y, |
| 3044 | features->y_resolution); |
| 3045 | } |
| 3046 | else if (features->touch_max > 1) { |
| 3047 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, |
| 3048 | features->x_max, features->x_fuzz, 0); |
| 3049 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, |
| 3050 | features->y_max, features->y_fuzz, 0); |
| 3051 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, |
| 3052 | features->x_resolution); |
| 3053 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, |
| 3054 | features->y_resolution); |
| 3055 | } |
| 3056 | |
| 3057 | switch (features->type) { |
| 3058 | case INTUOS5: |
| 3059 | case INTUOS5L: |
| 3060 | case INTUOSPM: |
| 3061 | case INTUOSPL: |
| 3062 | case INTUOS5S: |
| 3063 | case INTUOSPS: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3064 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); |
| 3065 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); |
| 3066 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 3067 | break; |
| 3068 | |
| 3069 | case WACOM_24HDT: |
| 3070 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); |
| 3071 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); |
| 3072 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); |
| 3073 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); |
| 3074 | /* fall through */ |
| 3075 | |
| 3076 | case WACOM_27QHDT: |
| 3077 | case MTSCREEN: |
| 3078 | case MTTPC: |
| 3079 | case MTTPC_B: |
| 3080 | case TABLETPC2FG: |
| 3081 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); |
| 3082 | /*fall through */ |
| 3083 | |
| 3084 | case TABLETPC: |
| 3085 | case TABLETPCE: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3086 | break; |
| 3087 | |
| 3088 | case INTUOSHT: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3089 | case INTUOSHT2: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3090 | input_dev->evbit[0] |= BIT_MASK(EV_SW); |
| 3091 | __set_bit(SW_MUTE_DEVICE, input_dev->swbit); |
| 3092 | /* fall through */ |
| 3093 | |
| 3094 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3095 | case BAMBOO_TOUCH: |
Jason Gerecke | 2636a3f | 2015-06-15 18:01:44 -0700 | [diff] [blame] | 3096 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
| 3097 | input_set_abs_params(input_dev, |
| 3098 | ABS_MT_TOUCH_MAJOR, |
| 3099 | 0, features->x_max, 0, 0); |
| 3100 | input_set_abs_params(input_dev, |
| 3101 | ABS_MT_TOUCH_MINOR, |
| 3102 | 0, features->y_max, 0, 0); |
| 3103 | } |
| 3104 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 3105 | break; |
| 3106 | |
| 3107 | case BAMBOO_PAD: |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3108 | input_mt_init_slots(input_dev, features->touch_max, |
| 3109 | INPUT_MT_POINTER); |
| 3110 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3111 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3112 | break; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3113 | } |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3114 | return 0; |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 3115 | } |
| 3116 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3117 | static int wacom_numbered_button_to_key(int n) |
| 3118 | { |
| 3119 | if (n < 10) |
| 3120 | return BTN_0 + n; |
| 3121 | else if (n < 16) |
| 3122 | return BTN_A + (n-10); |
| 3123 | else if (n < 18) |
| 3124 | return BTN_BASE + (n-16); |
| 3125 | else |
| 3126 | return 0; |
| 3127 | } |
| 3128 | |
Jiri Kosina | 5397df1 | 2015-08-28 20:46:42 +0200 | [diff] [blame] | 3129 | static void wacom_setup_numbered_buttons(struct input_dev *input_dev, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3130 | int button_count) |
| 3131 | { |
| 3132 | int i; |
| 3133 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3134 | for (i = 0; i < button_count; i++) { |
| 3135 | int key = wacom_numbered_button_to_key(i); |
| 3136 | |
| 3137 | if (key) |
| 3138 | __set_bit(key, input_dev->keybit); |
| 3139 | } |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3140 | } |
| 3141 | |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3142 | static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group) |
| 3143 | { |
| 3144 | struct wacom_led *led; |
| 3145 | int i; |
| 3146 | bool updated = false; |
| 3147 | |
| 3148 | /* |
| 3149 | * 24HD has LED group 1 to the left and LED group 0 to the right. |
| 3150 | * So group 0 matches the second half of the buttons and thus the mask |
| 3151 | * needs to be shifted. |
| 3152 | */ |
| 3153 | if (group == 0) |
| 3154 | mask >>= 8; |
| 3155 | |
| 3156 | for (i = 0; i < 3; i++) { |
| 3157 | led = wacom_led_find(wacom, group, i); |
| 3158 | if (!led) { |
| 3159 | hid_err(wacom->hdev, "can't find LED %d in group %d\n", |
| 3160 | i, group); |
| 3161 | continue; |
| 3162 | } |
| 3163 | if (!updated && mask & BIT(i)) { |
| 3164 | led->held = true; |
| 3165 | led_trigger_event(&led->trigger, LED_FULL); |
| 3166 | } else { |
| 3167 | led->held = false; |
| 3168 | } |
| 3169 | } |
| 3170 | } |
| 3171 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3172 | static bool wacom_is_led_toggled(struct wacom *wacom, int button_count, |
| 3173 | int mask, int group) |
| 3174 | { |
| 3175 | int button_per_group; |
| 3176 | |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3177 | /* |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3178 | * 21UX2 has LED group 1 to the left and LED group 0 |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3179 | * to the right. We need to reverse the group to match this |
| 3180 | * historical behavior. |
| 3181 | */ |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3182 | if (wacom->wacom_wac.features.type == WACOM_21UX2) |
Benjamin Tissoires | 5a0fe8ab | 2016-07-13 18:06:13 +0200 | [diff] [blame] | 3183 | group = 1 - group; |
| 3184 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3185 | button_per_group = button_count/wacom->led.count; |
| 3186 | |
| 3187 | return mask & (1 << (group * button_per_group)); |
| 3188 | } |
| 3189 | |
| 3190 | static void wacom_update_led(struct wacom *wacom, int button_count, int mask, |
| 3191 | int group) |
| 3192 | { |
| 3193 | struct wacom_led *led, *next_led; |
| 3194 | int cur; |
| 3195 | bool pressed; |
| 3196 | |
Benjamin Tissoires | 6a06281 | 2016-07-13 18:06:14 +0200 | [diff] [blame] | 3197 | if (wacom->wacom_wac.features.type == WACOM_24HD) |
| 3198 | return wacom_24hd_update_leds(wacom, mask, group); |
| 3199 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3200 | pressed = wacom_is_led_toggled(wacom, button_count, mask, group); |
| 3201 | cur = wacom->led.groups[group].select; |
| 3202 | |
| 3203 | led = wacom_led_find(wacom, group, cur); |
| 3204 | if (!led) { |
| 3205 | hid_err(wacom->hdev, "can't find current LED %d in group %d\n", |
| 3206 | cur, group); |
| 3207 | return; |
| 3208 | } |
| 3209 | |
| 3210 | if (!pressed) { |
| 3211 | led->held = false; |
| 3212 | return; |
| 3213 | } |
| 3214 | |
| 3215 | if (led->held && pressed) |
| 3216 | return; |
| 3217 | |
| 3218 | next_led = wacom_led_next(wacom, led); |
| 3219 | if (!next_led) { |
| 3220 | hid_err(wacom->hdev, "can't find next LED in group %d\n", |
| 3221 | group); |
| 3222 | return; |
| 3223 | } |
| 3224 | if (next_led == led) |
| 3225 | return; |
| 3226 | |
| 3227 | next_led->held = true; |
| 3228 | led_trigger_event(&next_led->trigger, |
| 3229 | wacom_leds_brightness_get(next_led)); |
| 3230 | } |
| 3231 | |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3232 | static void wacom_report_numbered_buttons(struct input_dev *input_dev, |
| 3233 | int button_count, int mask) |
| 3234 | { |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3235 | struct wacom *wacom = input_get_drvdata(input_dev); |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3236 | int i; |
| 3237 | |
Benjamin Tissoires | 34736aa | 2016-07-13 18:06:12 +0200 | [diff] [blame] | 3238 | for (i = 0; i < wacom->led.count; i++) |
| 3239 | wacom_update_led(wacom, button_count, mask, i); |
| 3240 | |
Jason Gerecke | 49005b9 | 2016-10-19 18:03:39 -0700 | [diff] [blame] | 3241 | for (i = 0; i < button_count; i++) { |
| 3242 | int key = wacom_numbered_button_to_key(i); |
| 3243 | |
| 3244 | if (key) |
| 3245 | input_report_key(input_dev, key, mask & (1 << i)); |
| 3246 | } |
Jason Gerecke | c7f0522 | 2015-11-30 17:13:47 -0800 | [diff] [blame] | 3247 | } |
| 3248 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3249 | int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, |
| 3250 | struct wacom_wac *wacom_wac) |
| 3251 | { |
| 3252 | struct wacom_features *features = &wacom_wac->features; |
| 3253 | |
Jason Gerecke | 862cf55 | 2015-06-15 18:01:43 -0700 | [diff] [blame] | 3254 | if (!(features->device_type & WACOM_DEVICETYPE_PAD)) |
| 3255 | return -ENODEV; |
| 3256 | |
Benjamin Tissoires | 7c35dc3 | 2016-07-13 18:06:07 +0200 | [diff] [blame] | 3257 | if (features->type == REMOTE && input_dev == wacom_wac->pad_input) |
| 3258 | return -ENODEV; |
| 3259 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3260 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 3261 | |
| 3262 | /* kept for making legacy xf86-input-wacom working with the wheels */ |
| 3263 | __set_bit(ABS_MISC, input_dev->absbit); |
| 3264 | |
| 3265 | /* kept for making legacy xf86-input-wacom accepting the pad */ |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 3266 | if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || |
| 3267 | input_dev->absinfo[ABS_X].maximum))) |
| 3268 | input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); |
| 3269 | if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || |
| 3270 | input_dev->absinfo[ABS_Y].maximum))) |
| 3271 | input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3272 | |
Benjamin Tissoires | 12969e3 | 2014-09-11 13:14:04 -0400 | [diff] [blame] | 3273 | /* kept for making udev and libwacom accepting the pad */ |
| 3274 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3275 | |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3276 | wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); |
| 3277 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3278 | switch (features->type) { |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3279 | |
| 3280 | case CINTIQ_HYBRID: |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3281 | case CINTIQ_COMPANION_2: |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3282 | case DTK: |
| 3283 | case DTUS: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3284 | case GRAPHIRE_BT: |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3285 | break; |
| 3286 | |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 3287 | case WACOM_MO: |
| 3288 | __set_bit(BTN_BACK, input_dev->keybit); |
| 3289 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3290 | __set_bit(BTN_FORWARD, input_dev->keybit); |
| 3291 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3292 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3293 | break; |
| 3294 | |
| 3295 | case WACOM_G4: |
| 3296 | __set_bit(BTN_BACK, input_dev->keybit); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 3297 | __set_bit(BTN_FORWARD, input_dev->keybit); |
Benjamin Tissoires | 3813810 | 2014-07-24 12:51:03 -0700 | [diff] [blame] | 3298 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 3299 | break; |
| 3300 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3301 | case WACOM_24HD: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3302 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 3303 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 3304 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 3305 | |
| 3306 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3307 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
| 3308 | break; |
| 3309 | |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3310 | case WACOM_27QHD: |
| 3311 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 3312 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 3313 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 3314 | input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); |
| 3315 | input_abs_set_res(input_dev, ABS_X, 1024); /* points/g */ |
| 3316 | input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); |
| 3317 | input_abs_set_res(input_dev, ABS_Y, 1024); |
| 3318 | input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); |
| 3319 | input_abs_set_res(input_dev, ABS_Z, 1024); |
| 3320 | __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); |
| 3321 | break; |
| 3322 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3323 | case WACOM_22HD: |
| 3324 | __set_bit(KEY_PROG1, input_dev->keybit); |
| 3325 | __set_bit(KEY_PROG2, input_dev->keybit); |
| 3326 | __set_bit(KEY_PROG3, input_dev->keybit); |
| 3327 | /* fall through */ |
| 3328 | |
| 3329 | case WACOM_21UX2: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3330 | case WACOM_BEE: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3331 | case CINTIQ: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3332 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 3333 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
| 3334 | break; |
| 3335 | |
| 3336 | case WACOM_13HD: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3337 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3338 | break; |
| 3339 | |
| 3340 | case INTUOS3: |
| 3341 | case INTUOS3L: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3342 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
| 3343 | /* fall through */ |
| 3344 | |
| 3345 | case INTUOS3S: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3346 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 3347 | break; |
| 3348 | |
| 3349 | case INTUOS5: |
| 3350 | case INTUOS5L: |
| 3351 | case INTUOSPM: |
| 3352 | case INTUOSPL: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3353 | case INTUOS5S: |
| 3354 | case INTUOSPS: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3355 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3356 | break; |
| 3357 | |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 3358 | case INTUOS4WL: |
| 3359 | /* |
| 3360 | * For Bluetooth devices, the udev rule does not work correctly |
| 3361 | * for pads unless we add a stylus capability, which forces |
| 3362 | * ID_INPUT_TABLET to be set. |
| 3363 | */ |
| 3364 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| 3365 | /* fall through */ |
| 3366 | |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3367 | case INTUOS4: |
| 3368 | case INTUOS4L: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3369 | case INTUOS4S: |
Benjamin Tissoires | 10059cdc | 2014-07-24 12:49:08 -0700 | [diff] [blame] | 3370 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3371 | break; |
| 3372 | |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 3373 | case INTUOSHT: |
| 3374 | case BAMBOO_PT: |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3375 | case BAMBOO_TOUCH: |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3376 | case INTUOSHT2: |
Benjamin Tissoires | 3116871 | 2014-07-24 12:50:10 -0700 | [diff] [blame] | 3377 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 3378 | |
| 3379 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 3380 | __set_bit(BTN_FORWARD, input_dev->keybit); |
| 3381 | __set_bit(BTN_BACK, input_dev->keybit); |
| 3382 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 3383 | |
| 3384 | break; |
| 3385 | |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3386 | case REMOTE: |
| 3387 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
| 3388 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 3389 | break; |
| 3390 | |
Jason Gerecke | 5922e61 | 2016-10-19 18:03:51 -0700 | [diff] [blame] | 3391 | case HID_GENERIC: |
| 3392 | break; |
| 3393 | |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3394 | default: |
| 3395 | /* no pad supported */ |
Ping Cheng | b3c8e93 | 2014-11-18 13:27:48 -0800 | [diff] [blame] | 3396 | return -ENODEV; |
Benjamin Tissoires | d2d13f1 | 2014-07-24 12:48:28 -0700 | [diff] [blame] | 3397 | } |
| 3398 | return 0; |
| 3399 | } |
| 3400 | |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3401 | static const struct wacom_features wacom_features_0x00 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3402 | { "Wacom Penpartner", 5040, 3780, 255, 0, |
| 3403 | PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3404 | static const struct wacom_features wacom_features_0x10 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3405 | { "Wacom Graphire", 10206, 7422, 511, 63, |
| 3406 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3407 | static const struct wacom_features wacom_features_0x81 = |
| 3408 | { "Wacom Graphire BT", 16704, 12064, 511, 32, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3409 | GRAPHIRE_BT, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES, 2 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3410 | static const struct wacom_features wacom_features_0x11 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3411 | { "Wacom Graphire2 4x5", 10206, 7422, 511, 63, |
| 3412 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3413 | static const struct wacom_features wacom_features_0x12 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3414 | { "Wacom Graphire2 5x7", 13918, 10206, 511, 63, |
| 3415 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3416 | static const struct wacom_features wacom_features_0x13 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3417 | { "Wacom Graphire3", 10208, 7424, 511, 63, |
| 3418 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3419 | static const struct wacom_features wacom_features_0x14 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3420 | { "Wacom Graphire3 6x8", 16704, 12064, 511, 63, |
| 3421 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3422 | static const struct wacom_features wacom_features_0x15 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3423 | { "Wacom Graphire4 4x5", 10208, 7424, 511, 63, |
| 3424 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3425 | static const struct wacom_features wacom_features_0x16 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3426 | { "Wacom Graphire4 6x8", 16704, 12064, 511, 63, |
| 3427 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3428 | static const struct wacom_features wacom_features_0x17 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3429 | { "Wacom BambooFun 4x5", 14760, 9225, 511, 63, |
| 3430 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3431 | static const struct wacom_features wacom_features_0x18 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3432 | { "Wacom BambooFun 6x8", 21648, 13530, 511, 63, |
| 3433 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3434 | static const struct wacom_features wacom_features_0x19 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3435 | { "Wacom Bamboo1 Medium", 16704, 12064, 511, 63, |
| 3436 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3437 | static const struct wacom_features wacom_features_0x60 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3438 | { "Wacom Volito", 5104, 3712, 511, 63, |
| 3439 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3440 | static const struct wacom_features wacom_features_0x61 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3441 | { "Wacom PenStation2", 3250, 2320, 255, 63, |
| 3442 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3443 | static const struct wacom_features wacom_features_0x62 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3444 | { "Wacom Volito2 4x5", 5104, 3712, 511, 63, |
| 3445 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3446 | static const struct wacom_features wacom_features_0x63 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3447 | { "Wacom Volito2 2x3", 3248, 2320, 511, 63, |
| 3448 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3449 | static const struct wacom_features wacom_features_0x64 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3450 | { "Wacom PenPartner2", 3250, 2320, 511, 63, |
| 3451 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3452 | static const struct wacom_features wacom_features_0x65 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3453 | { "Wacom Bamboo", 14760, 9225, 511, 63, |
| 3454 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3455 | static const struct wacom_features wacom_features_0x69 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3456 | { "Wacom Bamboo1", 5104, 3712, 511, 63, |
| 3457 | GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 3458 | static const struct wacom_features wacom_features_0x6A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3459 | { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63, |
| 3460 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 3461 | static const struct wacom_features wacom_features_0x6B = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3462 | { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63, |
| 3463 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3464 | static const struct wacom_features wacom_features_0x20 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3465 | { "Wacom Intuos 4x5", 12700, 10600, 1023, 31, |
| 3466 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3467 | static const struct wacom_features wacom_features_0x21 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3468 | { "Wacom Intuos 6x8", 20320, 16240, 1023, 31, |
| 3469 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3470 | static const struct wacom_features wacom_features_0x22 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3471 | { "Wacom Intuos 9x12", 30480, 24060, 1023, 31, |
| 3472 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3473 | static const struct wacom_features wacom_features_0x23 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3474 | { "Wacom Intuos 12x12", 30480, 31680, 1023, 31, |
| 3475 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3476 | static const struct wacom_features wacom_features_0x24 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3477 | { "Wacom Intuos 12x18", 45720, 31680, 1023, 31, |
| 3478 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3479 | static const struct wacom_features wacom_features_0x30 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3480 | { "Wacom PL400", 5408, 4056, 255, 0, |
| 3481 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3482 | static const struct wacom_features wacom_features_0x31 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3483 | { "Wacom PL500", 6144, 4608, 255, 0, |
| 3484 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3485 | static const struct wacom_features wacom_features_0x32 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3486 | { "Wacom PL600", 6126, 4604, 255, 0, |
| 3487 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3488 | static const struct wacom_features wacom_features_0x33 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3489 | { "Wacom PL600SX", 6260, 5016, 255, 0, |
| 3490 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3491 | static const struct wacom_features wacom_features_0x34 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3492 | { "Wacom PL550", 6144, 4608, 511, 0, |
| 3493 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3494 | static const struct wacom_features wacom_features_0x35 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3495 | { "Wacom PL800", 7220, 5780, 511, 0, |
| 3496 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3497 | static const struct wacom_features wacom_features_0x37 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3498 | { "Wacom PL700", 6758, 5406, 511, 0, |
| 3499 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3500 | static const struct wacom_features wacom_features_0x38 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3501 | { "Wacom PL510", 6282, 4762, 511, 0, |
| 3502 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3503 | static const struct wacom_features wacom_features_0x39 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3504 | { "Wacom DTU710", 34080, 27660, 511, 0, |
| 3505 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3506 | static const struct wacom_features wacom_features_0xC4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3507 | { "Wacom DTF521", 6282, 4762, 511, 0, |
| 3508 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3509 | static const struct wacom_features wacom_features_0xC0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3510 | { "Wacom DTF720", 6858, 5506, 511, 0, |
| 3511 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3512 | static const struct wacom_features wacom_features_0xC2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3513 | { "Wacom DTF720a", 6858, 5506, 511, 0, |
| 3514 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3515 | static const struct wacom_features wacom_features_0x03 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3516 | { "Wacom Cintiq Partner", 20480, 15360, 511, 0, |
| 3517 | PTU, WACOM_PL_RES, WACOM_PL_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3518 | static const struct wacom_features wacom_features_0x41 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3519 | { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31, |
| 3520 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3521 | static const struct wacom_features wacom_features_0x42 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3522 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 3523 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3524 | static const struct wacom_features wacom_features_0x43 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3525 | { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31, |
| 3526 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3527 | static const struct wacom_features wacom_features_0x44 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3528 | { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31, |
| 3529 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3530 | static const struct wacom_features wacom_features_0x45 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3531 | { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31, |
| 3532 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3533 | static const struct wacom_features wacom_features_0xB0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3534 | { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3535 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3536 | static const struct wacom_features wacom_features_0xB1 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3537 | { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3538 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3539 | static const struct wacom_features wacom_features_0xB2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3540 | { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3541 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3542 | static const struct wacom_features wacom_features_0xB3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3543 | { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3544 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3545 | static const struct wacom_features wacom_features_0xB4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3546 | { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3547 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3548 | static const struct wacom_features wacom_features_0xB5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3549 | { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3550 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3551 | static const struct wacom_features wacom_features_0xB7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3552 | { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3553 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3554 | static const struct wacom_features wacom_features_0xB8 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3555 | { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3556 | INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3557 | static const struct wacom_features wacom_features_0xB9 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3558 | { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3559 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3560 | static const struct wacom_features wacom_features_0xBA = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3561 | { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3562 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3563 | static const struct wacom_features wacom_features_0xBB = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3564 | { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3565 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3566 | static const struct wacom_features wacom_features_0xBC = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3567 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3568 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 3569 | static const struct wacom_features wacom_features_0xBD = |
| 3570 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3571 | INTUOS4WL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3572 | static const struct wacom_features wacom_features_0x26 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3573 | { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3574 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3575 | static const struct wacom_features wacom_features_0x27 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3576 | { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3577 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3578 | static const struct wacom_features wacom_features_0x28 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3579 | { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3580 | INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3581 | static const struct wacom_features wacom_features_0x29 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3582 | { "Wacom Intuos5 S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3583 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; |
Jason Gerecke | 9fee619 | 2012-04-03 15:47:22 -0700 | [diff] [blame] | 3584 | static const struct wacom_features wacom_features_0x2A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3585 | { "Wacom Intuos5 M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3586 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3587 | static const struct wacom_features wacom_features_0x314 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3588 | { "Wacom Intuos Pro S", 31496, 19685, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3589 | INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3590 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3591 | static const struct wacom_features wacom_features_0x315 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3592 | { "Wacom Intuos Pro M", 44704, 27940, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3593 | INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3594 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 9a35c41 | 2013-09-20 09:51:56 -0700 | [diff] [blame] | 3595 | static const struct wacom_features wacom_features_0x317 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3596 | { "Wacom Intuos Pro L", 65024, 40640, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3597 | INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3598 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Jason Gerecke | 803296b | 2011-12-12 00:11:45 -0800 | [diff] [blame] | 3599 | static const struct wacom_features wacom_features_0xF4 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3600 | { "Wacom Cintiq 24HD", 104480, 65600, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3601 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3602 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3603 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Jason Gerecke | 6f4d038 | 2012-08-21 22:11:59 -0700 | [diff] [blame] | 3604 | static const struct wacom_features wacom_features_0xF8 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3605 | { "Wacom Cintiq 24HD touch", 104480, 65600, 2047, 63, /* Pen */ |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3606 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3607 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3608 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 3bd1f7e | 2013-05-23 10:22:33 -0700 | [diff] [blame] | 3609 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; |
Jason Gerecke | b1e4279 | 2012-10-21 00:38:04 -0700 | [diff] [blame] | 3610 | static const struct wacom_features wacom_features_0xF6 = |
| 3611 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3612 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, |
| 3613 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3614 | static const struct wacom_features wacom_features_0x32A = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3615 | { "Wacom Cintiq 27QHD", 120140, 67920, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3616 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3617 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | a7e6645 | 2015-02-04 16:01:54 -0800 | [diff] [blame] | 3618 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3619 | static const struct wacom_features wacom_features_0x32B = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3620 | { "Wacom Cintiq 27QHD touch", 120140, 67920, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3621 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3622 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3623 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 3624 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C }; |
| 3625 | static const struct wacom_features wacom_features_0x32C = |
| 3626 | { "Wacom Cintiq 27QHD touch", .type = WACOM_27QHDT, |
| 3627 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3628 | static const struct wacom_features wacom_features_0x3F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3629 | { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3630 | CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3631 | static const struct wacom_features wacom_features_0xC5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3632 | { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3633 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3634 | static const struct wacom_features wacom_features_0xC6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3635 | { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3636 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3637 | static const struct wacom_features wacom_features_0x304 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3638 | { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3639 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3640 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3641 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 3642 | static const struct wacom_features wacom_features_0x333 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3643 | { "Wacom Cintiq 13HD touch", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3644 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 3645 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3646 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 3647 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 }; |
| 3648 | static const struct wacom_features wacom_features_0x335 = |
| 3649 | { "Wacom Cintiq 13HD touch", .type = WACOM_24HDT, /* Touch */ |
| 3650 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x333, .touch_max = 10, |
| 3651 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3652 | static const struct wacom_features wacom_features_0xC7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3653 | { "Wacom DTU1931", 37832, 30305, 511, 0, |
| 3654 | PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3655 | static const struct wacom_features wacom_features_0xCE = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3656 | { "Wacom DTU2231", 47864, 27011, 511, 0, |
| 3657 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3658 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBMOUSE }; |
Ping Cheng | c8f2edc | 2010-06-28 01:10:51 -0700 | [diff] [blame] | 3659 | static const struct wacom_features wacom_features_0xF0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3660 | { "Wacom DTU1631", 34623, 19553, 511, 0, |
| 3661 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 497ab1f | 2014-01-20 20:18:04 -0800 | [diff] [blame] | 3662 | static const struct wacom_features wacom_features_0xFB = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3663 | { "Wacom DTU1031", 22096, 13960, 511, 0, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3664 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3665 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3666 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3667 | static const struct wacom_features wacom_features_0x32F = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3668 | { "Wacom DTU1031X", 22672, 12928, 511, 0, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3669 | DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3670 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 3671 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Aaron Skomra | 007760c | 2015-04-16 15:01:14 -0700 | [diff] [blame] | 3672 | static const struct wacom_features wacom_features_0x336 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3673 | { "Wacom DTU1141", 23672, 13403, 1023, 0, |
Ping Cheng | ff38e82 | 2015-11-12 17:21:14 -0800 | [diff] [blame] | 3674 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3675 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | ff38e82 | 2015-11-12 17:21:14 -0800 | [diff] [blame] | 3676 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3677 | static const struct wacom_features wacom_features_0x57 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3678 | { "Wacom DTK2241", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3679 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3680 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3681 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3682 | static const struct wacom_features wacom_features_0x59 = /* Pen */ |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3683 | { "Wacom DTH2242", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3684 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3685 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3686 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3687 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; |
| 3688 | static const struct wacom_features wacom_features_0x5D = /* Touch */ |
| 3689 | { "Wacom DTH2242", .type = WACOM_24HDT, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3690 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10, |
| 3691 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 3692 | static const struct wacom_features wacom_features_0xCC = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3693 | { "Wacom Cintiq 21UX2", 87200, 65600, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3694 | WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3695 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3696 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | d838c64 | 2012-07-24 23:54:11 -0700 | [diff] [blame] | 3697 | static const struct wacom_features wacom_features_0xFA = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3698 | { "Wacom Cintiq 22HD", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3699 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3700 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3701 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3702 | static const struct wacom_features wacom_features_0x5B = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3703 | { "Wacom Cintiq 22HDT", 95840, 54260, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3704 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3705 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3706 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Ping Cheng | 3bd1f7e | 2013-05-23 10:22:33 -0700 | [diff] [blame] | 3707 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3708 | static const struct wacom_features wacom_features_0x5E = |
| 3709 | { "Wacom Cintiq 22HDT", .type = WACOM_24HDT, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3710 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10, |
| 3711 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3712 | static const struct wacom_features wacom_features_0x90 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3713 | { "Wacom ISDv4 90", 26202, 16325, 255, 0, |
| 3714 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3715 | static const struct wacom_features wacom_features_0x93 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3716 | { "Wacom ISDv4 93", 26202, 16325, 255, 0, |
| 3717 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 11d0cf8 | 2011-06-27 12:57:58 -0700 | [diff] [blame] | 3718 | static const struct wacom_features wacom_features_0x97 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3719 | { "Wacom ISDv4 97", 26202, 16325, 511, 0, |
| 3720 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3721 | static const struct wacom_features wacom_features_0x9A = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3722 | { "Wacom ISDv4 9A", 26202, 16325, 255, 0, |
| 3723 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3724 | static const struct wacom_features wacom_features_0x9F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3725 | { "Wacom ISDv4 9F", 26202, 16325, 255, 0, |
| 3726 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3727 | static const struct wacom_features wacom_features_0xE2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3728 | { "Wacom ISDv4 E2", 26202, 16325, 255, 0, |
| 3729 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3730 | static const struct wacom_features wacom_features_0xE3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3731 | { "Wacom ISDv4 E3", 26202, 16325, 255, 0, |
| 3732 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 3733 | static const struct wacom_features wacom_features_0xE5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3734 | { "Wacom ISDv4 E5", 26202, 16325, 255, 0, |
| 3735 | MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Manoj Iyer | 26fcd2a | 2011-03-31 22:39:43 -0700 | [diff] [blame] | 3736 | static const struct wacom_features wacom_features_0xE6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3737 | { "Wacom ISDv4 E6", 27760, 15694, 255, 0, |
| 3738 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Chris Bagwell | 0d0e306 | 2011-12-11 23:50:59 -0800 | [diff] [blame] | 3739 | static const struct wacom_features wacom_features_0xEC = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3740 | { "Wacom ISDv4 EC", 25710, 14500, 255, 0, |
| 3741 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3742 | static const struct wacom_features wacom_features_0xED = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3743 | { "Wacom ISDv4 ED", 26202, 16325, 255, 0, |
| 3744 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 3745 | static const struct wacom_features wacom_features_0xEF = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3746 | { "Wacom ISDv4 EF", 26202, 16325, 255, 0, |
| 3747 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3748 | static const struct wacom_features wacom_features_0x100 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3749 | { "Wacom ISDv4 100", 26202, 16325, 255, 0, |
| 3750 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 3751 | static const struct wacom_features wacom_features_0x101 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3752 | { "Wacom ISDv4 101", 26202, 16325, 255, 0, |
| 3753 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Stephan Frank | 5869483 | 2013-03-07 14:08:50 -0800 | [diff] [blame] | 3754 | static const struct wacom_features wacom_features_0x10D = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3755 | { "Wacom ISDv4 10D", 26202, 16325, 255, 0, |
| 3756 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 2d3163f | 2013-10-22 15:35:30 -0700 | [diff] [blame] | 3757 | static const struct wacom_features wacom_features_0x10E = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3758 | { "Wacom ISDv4 10E", 27760, 15694, 255, 0, |
| 3759 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 9b4f60e | 2013-10-15 23:46:34 -0700 | [diff] [blame] | 3760 | static const struct wacom_features wacom_features_0x10F = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3761 | { "Wacom ISDv4 10F", 27760, 15694, 255, 0, |
| 3762 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | 61616ed | 2014-05-14 11:42:22 -0700 | [diff] [blame] | 3763 | static const struct wacom_features wacom_features_0x116 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3764 | { "Wacom ISDv4 116", 26202, 16325, 255, 0, |
| 3765 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | aeaf50d | 2014-07-28 10:53:16 -0700 | [diff] [blame] | 3766 | static const struct wacom_features wacom_features_0x12C = |
| 3767 | { "Wacom ISDv4 12C", 27848, 15752, 2047, 0, |
| 3768 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | edbe265 | 2012-11-21 13:12:50 -0800 | [diff] [blame] | 3769 | static const struct wacom_features wacom_features_0x4001 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3770 | { "Wacom ISDv4 4001", 26202, 16325, 255, 0, |
| 3771 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3772 | static const struct wacom_features wacom_features_0x4004 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3773 | { "Wacom ISDv4 4004", 11060, 6220, 255, 0, |
| 3774 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3775 | static const struct wacom_features wacom_features_0x5000 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3776 | { "Wacom ISDv4 5000", 27848, 15752, 1023, 0, |
| 3777 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 3778 | static const struct wacom_features wacom_features_0x5002 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3779 | { "Wacom ISDv4 5002", 29576, 16724, 1023, 0, |
| 3780 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Dmitry Torokhov | e87a344 | 2010-02-18 01:51:47 -0800 | [diff] [blame] | 3781 | static const struct wacom_features wacom_features_0x47 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3782 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 3783 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Chris Bagwell | d3825d5 | 2012-03-25 23:26:11 -0700 | [diff] [blame] | 3784 | static const struct wacom_features wacom_features_0x84 = |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3785 | { "Wacom Wireless Receiver", .type = WIRELESS, .touch_max = 16 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3786 | static const struct wacom_features wacom_features_0xD0 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3787 | { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3788 | BAMBOO_TOUCH, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3789 | static const struct wacom_features wacom_features_0xD1 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3790 | { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31, |
| 3791 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3792 | static const struct wacom_features wacom_features_0xD2 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3793 | { "Wacom Bamboo Craft", 14720, 9200, 1023, 31, |
| 3794 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3795 | static const struct wacom_features wacom_features_0xD3 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3796 | { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31, |
| 3797 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Kevin Granade | 57a7872 | 2010-12-10 23:04:02 -0800 | [diff] [blame] | 3798 | static const struct wacom_features wacom_features_0xD4 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3799 | { "Wacom Bamboo Pen", 14720, 9200, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3800 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Gerard Braad | 18adad1 | 2011-08-16 00:17:56 -0700 | [diff] [blame] | 3801 | static const struct wacom_features wacom_features_0xD5 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3802 | { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3803 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3804 | static const struct wacom_features wacom_features_0xD6 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3805 | { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31, |
| 3806 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3807 | static const struct wacom_features wacom_features_0xD7 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3808 | { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31, |
| 3809 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3810 | static const struct wacom_features wacom_features_0xD8 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3811 | { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31, |
| 3812 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | 7b824bb | 2011-03-26 21:16:04 -0700 | [diff] [blame] | 3813 | static const struct wacom_features wacom_features_0xDA = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3814 | { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31, |
| 3815 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 3816 | static const struct wacom_features wacom_features_0xDB = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3817 | { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31, |
| 3818 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3819 | static const struct wacom_features wacom_features_0xDD = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3820 | { "Wacom Bamboo Connect", 14720, 9200, 1023, 31, |
| 3821 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3822 | static const struct wacom_features wacom_features_0xDE = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3823 | { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31, |
| 3824 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 3825 | static const struct wacom_features wacom_features_0xDF = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3826 | { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31, |
| 3827 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 3828 | static const struct wacom_features wacom_features_0x300 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3829 | { "Wacom Bamboo One S", 14720, 9225, 1023, 31, |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3830 | BAMBOO_PEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 3831 | static const struct wacom_features wacom_features_0x301 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3832 | { "Wacom Bamboo One M", 21648, 13530, 1023, 31, |
| 3833 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3834 | static const struct wacom_features wacom_features_0x302 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3835 | { "Wacom Intuos PT S", 15200, 9500, 1023, 31, |
| 3836 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3837 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3838 | static const struct wacom_features wacom_features_0x303 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3839 | { "Wacom Intuos PT M", 21600, 13500, 1023, 31, |
| 3840 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3841 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | b5fd2a3 | 2013-11-25 18:44:55 -0800 | [diff] [blame] | 3842 | static const struct wacom_features wacom_features_0x30E = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3843 | { "Wacom Intuos S", 15200, 9500, 1023, 31, |
| 3844 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3845 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 3846 | static const struct wacom_features wacom_features_0x6004 = |
Benjamin Tissoires | 80befa9 | 2014-07-24 13:05:19 -0700 | [diff] [blame] | 3847 | { "ISD-V4", 12800, 8000, 255, 0, |
| 3848 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3849 | static const struct wacom_features wacom_features_0x307 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3850 | { "Wacom ISDv5 307", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3851 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3852 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3853 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 3854 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3855 | static const struct wacom_features wacom_features_0x309 = |
Jason Gerecke | 36d3c51 | 2013-09-20 09:47:35 -0700 | [diff] [blame] | 3856 | { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3857 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10, |
| 3858 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 3859 | static const struct wacom_features wacom_features_0x30A = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3860 | { "Wacom ISDv5 30A", 59552, 33848, 2047, 63, |
Aaron Skomra | 70ee06c | 2015-08-20 16:05:16 -0700 | [diff] [blame] | 3861 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, |
Ping Cheng | fa77034 | 2014-12-01 13:44:28 -0800 | [diff] [blame] | 3862 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3863 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 3864 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C }; |
| 3865 | static const struct wacom_features wacom_features_0x30C = |
| 3866 | { "Wacom ISDv5 30C", .type = WACOM_24HDT, /* Touch */ |
| 3867 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10, |
| 3868 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 3869 | static const struct wacom_features wacom_features_0x318 = |
| 3870 | { "Wacom USB Bamboo PAD", 4095, 4095, /* Touch */ |
| 3871 | .type = BAMBOO_PAD, 35, 48, .touch_max = 4 }; |
| 3872 | static const struct wacom_features wacom_features_0x319 = |
| 3873 | { "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */ |
| 3874 | .type = BAMBOO_PAD, 35, 48, .touch_max = 4 }; |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3875 | static const struct wacom_features wacom_features_0x325 = |
| 3876 | { "Wacom ISDv5 325", 59552, 33848, 2047, 63, |
| 3877 | CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11, |
| 3878 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3879 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 3880 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 }; |
| 3881 | static const struct wacom_features wacom_features_0x326 = /* Touch */ |
| 3882 | { "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM, |
| 3883 | .oPid = 0x325 }; |
Ping Cheng | fefb391 | 2014-11-11 12:52:08 -0800 | [diff] [blame] | 3884 | static const struct wacom_features wacom_features_0x323 = |
| 3885 | { "Wacom Intuos P M", 21600, 13500, 1023, 31, |
| 3886 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 3887 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3888 | static const struct wacom_features wacom_features_0x331 = |
Ping Cheng | 3b164a0 | 2015-09-23 09:59:10 -0700 | [diff] [blame] | 3889 | { "Wacom Express Key Remote", .type = REMOTE, |
| 3890 | .numbered_buttons = 18, .check_for_hid_type = true, |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 3891 | .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 3892 | static const struct wacom_features wacom_features_0x33B = |
| 3893 | { "Wacom Intuos S 2", 15200, 9500, 2047, 63, |
| 3894 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 3895 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 3896 | static const struct wacom_features wacom_features_0x33C = |
| 3897 | { "Wacom Intuos PT S 2", 15200, 9500, 2047, 63, |
| 3898 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 3899 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 3900 | static const struct wacom_features wacom_features_0x33D = |
| 3901 | { "Wacom Intuos P M 2", 21600, 13500, 2047, 63, |
| 3902 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 3903 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 3904 | static const struct wacom_features wacom_features_0x33E = |
| 3905 | { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63, |
| 3906 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 3907 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 3908 | static const struct wacom_features wacom_features_0x343 = |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3909 | { "Wacom DTK1651", 34816, 19759, 1023, 0, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 3910 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
Jason Gerecke | e779ef2 | 2016-10-19 18:03:49 -0700 | [diff] [blame] | 3911 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 3912 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3913 | |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 3914 | static const struct wacom_features wacom_features_HID_ANY_ID = |
Jason Gerecke | 41372d5 | 2016-08-08 12:06:30 -0700 | [diff] [blame] | 3915 | { "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] | 3916 | |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3917 | #define USB_DEVICE_WACOM(prod) \ |
| 3918 | HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 3919 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3920 | |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3921 | #define BT_DEVICE_WACOM(prod) \ |
| 3922 | HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 3923 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Aristeu Rozanski | 1483f55 | 2011-06-22 01:17:17 -0700 | [diff] [blame] | 3924 | |
Mika Westerberg | eef23a8 | 2015-02-23 15:52:43 +0200 | [diff] [blame] | 3925 | #define I2C_DEVICE_WACOM(prod) \ |
| 3926 | HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 3927 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
| 3928 | |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 3929 | #define USB_DEVICE_LENOVO(prod) \ |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3930 | HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ |
| 3931 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
Ajay Ramaswamy | 7b4b306 | 2010-12-23 01:19:39 -0800 | [diff] [blame] | 3932 | |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3933 | const struct hid_device_id wacom_ids[] = { |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3934 | { USB_DEVICE_WACOM(0x00) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3935 | { USB_DEVICE_WACOM(0x03) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3936 | { USB_DEVICE_WACOM(0x10) }, |
| 3937 | { USB_DEVICE_WACOM(0x11) }, |
| 3938 | { USB_DEVICE_WACOM(0x12) }, |
| 3939 | { USB_DEVICE_WACOM(0x13) }, |
| 3940 | { USB_DEVICE_WACOM(0x14) }, |
| 3941 | { USB_DEVICE_WACOM(0x15) }, |
| 3942 | { USB_DEVICE_WACOM(0x16) }, |
| 3943 | { USB_DEVICE_WACOM(0x17) }, |
| 3944 | { USB_DEVICE_WACOM(0x18) }, |
| 3945 | { USB_DEVICE_WACOM(0x19) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3946 | { USB_DEVICE_WACOM(0x20) }, |
| 3947 | { USB_DEVICE_WACOM(0x21) }, |
| 3948 | { USB_DEVICE_WACOM(0x22) }, |
| 3949 | { USB_DEVICE_WACOM(0x23) }, |
| 3950 | { USB_DEVICE_WACOM(0x24) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3951 | { USB_DEVICE_WACOM(0x26) }, |
| 3952 | { USB_DEVICE_WACOM(0x27) }, |
| 3953 | { USB_DEVICE_WACOM(0x28) }, |
| 3954 | { USB_DEVICE_WACOM(0x29) }, |
| 3955 | { USB_DEVICE_WACOM(0x2A) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3956 | { USB_DEVICE_WACOM(0x30) }, |
| 3957 | { USB_DEVICE_WACOM(0x31) }, |
| 3958 | { USB_DEVICE_WACOM(0x32) }, |
| 3959 | { USB_DEVICE_WACOM(0x33) }, |
| 3960 | { USB_DEVICE_WACOM(0x34) }, |
| 3961 | { USB_DEVICE_WACOM(0x35) }, |
| 3962 | { USB_DEVICE_WACOM(0x37) }, |
| 3963 | { USB_DEVICE_WACOM(0x38) }, |
| 3964 | { USB_DEVICE_WACOM(0x39) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3965 | { USB_DEVICE_WACOM(0x3F) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3966 | { USB_DEVICE_WACOM(0x41) }, |
| 3967 | { USB_DEVICE_WACOM(0x42) }, |
| 3968 | { USB_DEVICE_WACOM(0x43) }, |
| 3969 | { USB_DEVICE_WACOM(0x44) }, |
| 3970 | { USB_DEVICE_WACOM(0x45) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3971 | { USB_DEVICE_WACOM(0x47) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3972 | { USB_DEVICE_WACOM(0x57) }, |
Ping Cheng | a112e9f | 2013-02-13 20:20:01 -0800 | [diff] [blame] | 3973 | { USB_DEVICE_WACOM(0x59) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 3974 | { USB_DEVICE_WACOM(0x5B) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3975 | { USB_DEVICE_WACOM(0x5D) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 3976 | { USB_DEVICE_WACOM(0x5E) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3977 | { USB_DEVICE_WACOM(0x60) }, |
| 3978 | { USB_DEVICE_WACOM(0x61) }, |
| 3979 | { USB_DEVICE_WACOM(0x62) }, |
| 3980 | { USB_DEVICE_WACOM(0x63) }, |
| 3981 | { USB_DEVICE_WACOM(0x64) }, |
| 3982 | { USB_DEVICE_WACOM(0x65) }, |
| 3983 | { USB_DEVICE_WACOM(0x69) }, |
| 3984 | { USB_DEVICE_WACOM(0x6A) }, |
| 3985 | { USB_DEVICE_WACOM(0x6B) }, |
Benjamin Tissoires | 387142b | 2014-08-06 13:52:56 -0700 | [diff] [blame] | 3986 | { BT_DEVICE_WACOM(0x81) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 3987 | { USB_DEVICE_WACOM(0x84) }, |
| 3988 | { USB_DEVICE_WACOM(0x90) }, |
| 3989 | { USB_DEVICE_WACOM(0x93) }, |
| 3990 | { USB_DEVICE_WACOM(0x97) }, |
| 3991 | { USB_DEVICE_WACOM(0x9A) }, |
| 3992 | { USB_DEVICE_WACOM(0x9F) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 3993 | { USB_DEVICE_WACOM(0xB0) }, |
| 3994 | { USB_DEVICE_WACOM(0xB1) }, |
| 3995 | { USB_DEVICE_WACOM(0xB2) }, |
| 3996 | { USB_DEVICE_WACOM(0xB3) }, |
| 3997 | { USB_DEVICE_WACOM(0xB4) }, |
| 3998 | { USB_DEVICE_WACOM(0xB5) }, |
| 3999 | { USB_DEVICE_WACOM(0xB7) }, |
| 4000 | { USB_DEVICE_WACOM(0xB8) }, |
| 4001 | { USB_DEVICE_WACOM(0xB9) }, |
| 4002 | { USB_DEVICE_WACOM(0xBA) }, |
| 4003 | { USB_DEVICE_WACOM(0xBB) }, |
Ping Cheng | 3a4b4aa | 2010-06-03 22:10:21 -0700 | [diff] [blame] | 4004 | { USB_DEVICE_WACOM(0xBC) }, |
Benjamin Tissoires | 81af7e6 | 2014-08-06 13:55:56 -0700 | [diff] [blame] | 4005 | { BT_DEVICE_WACOM(0xBD) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4006 | { USB_DEVICE_WACOM(0xC0) }, |
| 4007 | { USB_DEVICE_WACOM(0xC2) }, |
| 4008 | { USB_DEVICE_WACOM(0xC4) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4009 | { USB_DEVICE_WACOM(0xC5) }, |
| 4010 | { USB_DEVICE_WACOM(0xC6) }, |
| 4011 | { USB_DEVICE_WACOM(0xC7) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4012 | { USB_DEVICE_WACOM(0xCC) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4013 | { USB_DEVICE_WACOM(0xCE) }, |
Henrik Rydberg | cb734c0 | 2010-09-05 12:53:16 -0700 | [diff] [blame] | 4014 | { USB_DEVICE_WACOM(0xD0) }, |
Chris Bagwell | 2aaacb1 | 2010-09-12 00:11:35 -0700 | [diff] [blame] | 4015 | { USB_DEVICE_WACOM(0xD1) }, |
| 4016 | { USB_DEVICE_WACOM(0xD2) }, |
| 4017 | { USB_DEVICE_WACOM(0xD3) }, |
Kevin Granade | 57a7872 | 2010-12-10 23:04:02 -0800 | [diff] [blame] | 4018 | { USB_DEVICE_WACOM(0xD4) }, |
Gerard Braad | 18adad1 | 2011-08-16 00:17:56 -0700 | [diff] [blame] | 4019 | { USB_DEVICE_WACOM(0xD5) }, |
Ping Cheng | d38acb4 | 2011-01-24 09:32:50 -0800 | [diff] [blame] | 4020 | { USB_DEVICE_WACOM(0xD6) }, |
| 4021 | { USB_DEVICE_WACOM(0xD7) }, |
David Foley | a318e6b | 2010-11-30 23:45:46 -0800 | [diff] [blame] | 4022 | { USB_DEVICE_WACOM(0xD8) }, |
| 4023 | { USB_DEVICE_WACOM(0xDA) }, |
David Foley | 47d0923 | 2010-12-07 21:05:59 -0800 | [diff] [blame] | 4024 | { USB_DEVICE_WACOM(0xDB) }, |
Chris Bagwell | 73149ab | 2011-10-26 22:34:21 -0700 | [diff] [blame] | 4025 | { USB_DEVICE_WACOM(0xDD) }, |
| 4026 | { USB_DEVICE_WACOM(0xDE) }, |
| 4027 | { USB_DEVICE_WACOM(0xDF) }, |
Bastian Blank | b036f6f | 2010-02-10 23:06:23 -0800 | [diff] [blame] | 4028 | { USB_DEVICE_WACOM(0xE2) }, |
| 4029 | { USB_DEVICE_WACOM(0xE3) }, |
Ping Cheng | 1963518 | 2012-04-29 21:09:18 -0700 | [diff] [blame] | 4030 | { USB_DEVICE_WACOM(0xE5) }, |
Manoj Iyer | 26fcd2a | 2011-03-31 22:39:43 -0700 | [diff] [blame] | 4031 | { USB_DEVICE_WACOM(0xE6) }, |
Chris Bagwell | 0d0e306 | 2011-12-11 23:50:59 -0800 | [diff] [blame] | 4032 | { USB_DEVICE_WACOM(0xEC) }, |
Ping Cheng | ac17383 | 2012-06-12 00:15:06 -0700 | [diff] [blame] | 4033 | { USB_DEVICE_WACOM(0xED) }, |
| 4034 | { USB_DEVICE_WACOM(0xEF) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4035 | { USB_DEVICE_WACOM(0xF0) }, |
| 4036 | { USB_DEVICE_WACOM(0xF4) }, |
| 4037 | { USB_DEVICE_WACOM(0xF6) }, |
| 4038 | { USB_DEVICE_WACOM(0xF8) }, |
| 4039 | { USB_DEVICE_WACOM(0xFA) }, |
| 4040 | { USB_DEVICE_WACOM(0xFB) }, |
Ping Cheng | 6afdc28 | 2012-11-03 12:16:15 -0700 | [diff] [blame] | 4041 | { USB_DEVICE_WACOM(0x100) }, |
| 4042 | { USB_DEVICE_WACOM(0x101) }, |
Stephan Frank | 5869483 | 2013-03-07 14:08:50 -0800 | [diff] [blame] | 4043 | { USB_DEVICE_WACOM(0x10D) }, |
Jason Gerecke | 2d3163f | 2013-10-22 15:35:30 -0700 | [diff] [blame] | 4044 | { USB_DEVICE_WACOM(0x10E) }, |
Jason Gerecke | 9b4f60e | 2013-10-15 23:46:34 -0700 | [diff] [blame] | 4045 | { USB_DEVICE_WACOM(0x10F) }, |
Jason Gerecke | 61616ed | 2014-05-14 11:42:22 -0700 | [diff] [blame] | 4046 | { USB_DEVICE_WACOM(0x116) }, |
Jason Gerecke | aeaf50d | 2014-07-28 10:53:16 -0700 | [diff] [blame] | 4047 | { USB_DEVICE_WACOM(0x12C) }, |
Ping Cheng | f41a64e | 2013-08-21 09:14:49 -0700 | [diff] [blame] | 4048 | { USB_DEVICE_WACOM(0x300) }, |
| 4049 | { USB_DEVICE_WACOM(0x301) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4050 | { USB_DEVICE_WACOM(0x302) }, |
| 4051 | { USB_DEVICE_WACOM(0x303) }, |
Ping Cheng | 5621856 | 2013-05-05 19:56:18 -0700 | [diff] [blame] | 4052 | { USB_DEVICE_WACOM(0x304) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4053 | { USB_DEVICE_WACOM(0x307) }, |
| 4054 | { USB_DEVICE_WACOM(0x309) }, |
Benjamin Tissoires | 89f2ab5 | 2014-09-03 15:43:25 -0400 | [diff] [blame] | 4055 | { USB_DEVICE_WACOM(0x30A) }, |
| 4056 | { USB_DEVICE_WACOM(0x30C) }, |
Benjamin Tissoires | a3e6f65 | 2014-07-24 13:05:49 -0700 | [diff] [blame] | 4057 | { USB_DEVICE_WACOM(0x30E) }, |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4058 | { USB_DEVICE_WACOM(0x314) }, |
| 4059 | { USB_DEVICE_WACOM(0x315) }, |
| 4060 | { USB_DEVICE_WACOM(0x317) }, |
Benjamin Tissoires | 8c97a76 | 2015-02-26 11:28:50 -0500 | [diff] [blame] | 4061 | { USB_DEVICE_WACOM(0x318) }, |
| 4062 | { USB_DEVICE_WACOM(0x319) }, |
Ping Cheng | fefb391 | 2014-11-11 12:52:08 -0800 | [diff] [blame] | 4063 | { USB_DEVICE_WACOM(0x323) }, |
Jason Gerecke | f7acb55 | 2015-10-13 10:03:49 -0700 | [diff] [blame] | 4064 | { USB_DEVICE_WACOM(0x325) }, |
| 4065 | { USB_DEVICE_WACOM(0x326) }, |
Ping Cheng | 500d416 | 2015-01-27 13:30:03 -0800 | [diff] [blame] | 4066 | { USB_DEVICE_WACOM(0x32A) }, |
| 4067 | { USB_DEVICE_WACOM(0x32B) }, |
| 4068 | { USB_DEVICE_WACOM(0x32C) }, |
Ping Cheng | fff00bf | 2014-12-04 18:23:04 -0800 | [diff] [blame] | 4069 | { USB_DEVICE_WACOM(0x32F) }, |
Aaron Skomra | 72b236d | 2015-08-20 16:05:17 -0700 | [diff] [blame] | 4070 | { USB_DEVICE_WACOM(0x331) }, |
Ping Cheng | b4bf212 | 2015-03-25 17:08:13 -0700 | [diff] [blame] | 4071 | { USB_DEVICE_WACOM(0x333) }, |
| 4072 | { USB_DEVICE_WACOM(0x335) }, |
Aaron Skomra | 007760c | 2015-04-16 15:01:14 -0700 | [diff] [blame] | 4073 | { USB_DEVICE_WACOM(0x336) }, |
Ping Cheng | eda01da | 2015-09-23 13:51:15 -0700 | [diff] [blame] | 4074 | { USB_DEVICE_WACOM(0x33B) }, |
| 4075 | { USB_DEVICE_WACOM(0x33C) }, |
| 4076 | { USB_DEVICE_WACOM(0x33D) }, |
| 4077 | { USB_DEVICE_WACOM(0x33E) }, |
Ping Cheng | e1123fe | 2016-04-12 13:37:45 -0700 | [diff] [blame] | 4078 | { USB_DEVICE_WACOM(0x343) }, |
Ping Cheng | edbe265 | 2012-11-21 13:12:50 -0800 | [diff] [blame] | 4079 | { USB_DEVICE_WACOM(0x4001) }, |
Jason Gerecke | d51ddb2 | 2014-05-14 17:14:29 -0700 | [diff] [blame] | 4080 | { USB_DEVICE_WACOM(0x4004) }, |
| 4081 | { USB_DEVICE_WACOM(0x5000) }, |
| 4082 | { USB_DEVICE_WACOM(0x5002) }, |
Benjamin Tissoires | 00d6f22 | 2014-12-01 11:52:39 -0500 | [diff] [blame] | 4083 | { USB_DEVICE_LENOVO(0x6004) }, |
Benjamin Tissoires | 7704ac9 | 2014-09-23 12:08:08 -0400 | [diff] [blame] | 4084 | |
| 4085 | { USB_DEVICE_WACOM(HID_ANY_ID) }, |
Mika Westerberg | eef23a8 | 2015-02-23 15:52:43 +0200 | [diff] [blame] | 4086 | { I2C_DEVICE_WACOM(HID_ANY_ID) }, |
Ping Cheng | 3bea733 | 2006-07-13 18:01:36 -0700 | [diff] [blame] | 4087 | { } |
| 4088 | }; |
Benjamin Tissoires | 29b4739 | 2014-07-24 12:52:23 -0700 | [diff] [blame] | 4089 | MODULE_DEVICE_TABLE(hid, wacom_ids); |