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