Commit | Line | Data |
---|---|---|
3bea733a | 1 | /* |
4104d13f | 2 | * drivers/input/tablet/wacom_wac.c |
3bea733a | 3 | * |
ee54500d | 4 | * USB Wacom tablet support - Wacom specific code |
3bea733a PC |
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 | */ | |
51269fe8 | 14 | |
3bea733a | 15 | #include "wacom_wac.h" |
51269fe8 | 16 | #include "wacom.h" |
47c78e89 | 17 | #include <linux/input/mt.h> |
1483f551 | 18 | #include <linux/hid.h> |
3bea733a | 19 | |
e35fb8c1 PC |
20 | /* resolution for penabled devices */ |
21 | #define WACOM_PL_RES 20 | |
22 | #define WACOM_PENPRTN_RES 40 | |
23 | #define WACOM_VOLITO_RES 50 | |
24 | #define WACOM_GRAPHIRE_RES 80 | |
25 | #define WACOM_INTUOS_RES 100 | |
26 | #define WACOM_INTUOS3_RES 200 | |
27 | ||
4e904954 JG |
28 | /* Scale factor relating reported contact size to logical contact area. |
29 | * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo | |
30 | */ | |
31 | #define WACOM_CONTACT_AREA_SCALE 2607 | |
32 | ||
95dd3b30 | 33 | static int wacom_penpartner_irq(struct wacom_wac *wacom) |
3bea733a PC |
34 | { |
35 | unsigned char *data = wacom->data; | |
8da23fc1 | 36 | struct input_dev *input = wacom->input; |
3bea733a PC |
37 | |
38 | switch (data[0]) { | |
73a97f4f DT |
39 | case 1: |
40 | if (data[5] & 0x80) { | |
41 | wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | |
42 | wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; | |
8da23fc1 DT |
43 | input_report_key(input, wacom->tool[0], 1); |
44 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ | |
252f7769 DT |
45 | input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); |
46 | input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3])); | |
8da23fc1 DT |
47 | input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127); |
48 | input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); | |
49 | input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); | |
73a97f4f | 50 | } else { |
8da23fc1 DT |
51 | input_report_key(input, wacom->tool[0], 0); |
52 | input_report_abs(input, ABS_MISC, 0); /* report tool id */ | |
53 | input_report_abs(input, ABS_PRESSURE, -1); | |
54 | input_report_key(input, BTN_TOUCH, 0); | |
73a97f4f DT |
55 | } |
56 | break; | |
8da23fc1 | 57 | |
73a97f4f | 58 | case 2: |
8da23fc1 DT |
59 | input_report_key(input, BTN_TOOL_PEN, 1); |
60 | input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */ | |
252f7769 DT |
61 | input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); |
62 | input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3])); | |
8da23fc1 DT |
63 | input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127); |
64 | input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); | |
65 | input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); | |
73a97f4f | 66 | break; |
8da23fc1 | 67 | |
73a97f4f | 68 | default: |
eb71d1bb DT |
69 | dev_dbg(input->dev.parent, |
70 | "%s: received unknown report #%d\n", __func__, data[0]); | |
73a97f4f | 71 | return 0; |
3bea733a | 72 | } |
8da23fc1 | 73 | |
3bea733a PC |
74 | return 1; |
75 | } | |
76 | ||
95dd3b30 | 77 | static int wacom_pl_irq(struct wacom_wac *wacom) |
3bea733a | 78 | { |
e33da8a5 | 79 | struct wacom_features *features = &wacom->features; |
3bea733a | 80 | unsigned char *data = wacom->data; |
8da23fc1 | 81 | struct input_dev *input = wacom->input; |
e34b9d2f | 82 | int prox, pressure; |
3bea733a | 83 | |
cad74700 | 84 | if (data[0] != WACOM_REPORT_PENABLED) { |
eb71d1bb DT |
85 | dev_dbg(input->dev.parent, |
86 | "%s: received unknown report #%d\n", __func__, data[0]); | |
3bea733a PC |
87 | return 0; |
88 | } | |
89 | ||
90 | prox = data[1] & 0x40; | |
91 | ||
3bea733a | 92 | if (prox) { |
ec67bbed | 93 | wacom->id[0] = ERASER_DEVICE_ID; |
3bea733a | 94 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
e33da8a5 | 95 | if (features->pressure_max > 255) |
3bea733a | 96 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
e33da8a5 | 97 | pressure += (features->pressure_max + 1) / 2; |
3bea733a PC |
98 | |
99 | /* | |
100 | * if going from out of proximity into proximity select between the eraser | |
101 | * and the pen based on the state of the stylus2 button, choose eraser if | |
102 | * pressed else choose pen. if not a proximity change from out to in, send | |
103 | * an out of proximity for previous tool then a in for new tool. | |
104 | */ | |
105 | if (!wacom->tool[0]) { | |
106 | /* Eraser bit set for DTF */ | |
107 | if (data[1] & 0x10) | |
108 | wacom->tool[1] = BTN_TOOL_RUBBER; | |
109 | else | |
110 | /* Going into proximity select tool */ | |
111 | wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | |
112 | } else { | |
113 | /* was entered with stylus2 pressed */ | |
114 | if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { | |
115 | /* report out proximity for previous tool */ | |
8da23fc1 DT |
116 | input_report_key(input, wacom->tool[1], 0); |
117 | input_sync(input); | |
3bea733a PC |
118 | wacom->tool[1] = BTN_TOOL_PEN; |
119 | return 0; | |
120 | } | |
121 | } | |
122 | if (wacom->tool[1] != BTN_TOOL_RUBBER) { | |
123 | /* Unknown tool selected default to pen tool */ | |
124 | wacom->tool[1] = BTN_TOOL_PEN; | |
e34b9d2f | 125 | wacom->id[0] = STYLUS_DEVICE_ID; |
3bea733a | 126 | } |
8da23fc1 DT |
127 | input_report_key(input, wacom->tool[1], prox); /* report in proximity for tool */ |
128 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ | |
129 | input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); | |
130 | input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); | |
131 | input_report_abs(input, ABS_PRESSURE, pressure); | |
132 | ||
133 | input_report_key(input, BTN_TOUCH, data[4] & 0x08); | |
134 | input_report_key(input, BTN_STYLUS, data[4] & 0x10); | |
3bea733a | 135 | /* Only allow the stylus2 button to be reported for the pen tool. */ |
8da23fc1 | 136 | input_report_key(input, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20)); |
3bea733a PC |
137 | } else { |
138 | /* report proximity-out of a (valid) tool */ | |
139 | if (wacom->tool[1] != BTN_TOOL_RUBBER) { | |
140 | /* Unknown tool selected default to pen tool */ | |
141 | wacom->tool[1] = BTN_TOOL_PEN; | |
142 | } | |
8da23fc1 | 143 | input_report_key(input, wacom->tool[1], prox); |
3bea733a PC |
144 | } |
145 | ||
146 | wacom->tool[0] = prox; /* Save proximity state */ | |
147 | return 1; | |
148 | } | |
149 | ||
95dd3b30 | 150 | static int wacom_ptu_irq(struct wacom_wac *wacom) |
3bea733a PC |
151 | { |
152 | unsigned char *data = wacom->data; | |
8da23fc1 | 153 | struct input_dev *input = wacom->input; |
3bea733a | 154 | |
cad74700 | 155 | if (data[0] != WACOM_REPORT_PENABLED) { |
eb71d1bb DT |
156 | dev_dbg(input->dev.parent, |
157 | "%s: received unknown report #%d\n", __func__, data[0]); | |
3bea733a PC |
158 | return 0; |
159 | } | |
160 | ||
3bea733a | 161 | if (data[1] & 0x04) { |
8da23fc1 DT |
162 | input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20); |
163 | input_report_key(input, BTN_TOUCH, data[1] & 0x08); | |
e34b9d2f | 164 | wacom->id[0] = ERASER_DEVICE_ID; |
3bea733a | 165 | } else { |
8da23fc1 DT |
166 | input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20); |
167 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); | |
e34b9d2f | 168 | wacom->id[0] = STYLUS_DEVICE_ID; |
3bea733a | 169 | } |
8da23fc1 | 170 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
252f7769 DT |
171 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
172 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | |
173 | input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6])); | |
8da23fc1 DT |
174 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
175 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | |
3bea733a PC |
176 | return 1; |
177 | } | |
178 | ||
c8f2edc5 PC |
179 | static int wacom_dtu_irq(struct wacom_wac *wacom) |
180 | { | |
181 | struct wacom_features *features = &wacom->features; | |
182 | char *data = wacom->data; | |
183 | struct input_dev *input = wacom->input; | |
184 | int prox = data[1] & 0x20, pressure; | |
185 | ||
eb71d1bb DT |
186 | dev_dbg(input->dev.parent, |
187 | "%s: received report #%d", __func__, data[0]); | |
c8f2edc5 PC |
188 | |
189 | if (prox) { | |
190 | /* Going into proximity select tool */ | |
191 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | |
192 | if (wacom->tool[0] == BTN_TOOL_PEN) | |
193 | wacom->id[0] = STYLUS_DEVICE_ID; | |
194 | else | |
195 | wacom->id[0] = ERASER_DEVICE_ID; | |
196 | } | |
197 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | |
198 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | |
199 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | |
200 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | |
201 | pressure = ((data[7] & 0x01) << 8) | data[6]; | |
202 | if (pressure < 0) | |
203 | pressure = features->pressure_max + pressure + 1; | |
204 | input_report_abs(input, ABS_PRESSURE, pressure); | |
205 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); | |
206 | if (!prox) /* out-prox */ | |
207 | wacom->id[0] = 0; | |
208 | input_report_key(input, wacom->tool[0], prox); | |
209 | input_report_abs(input, ABS_MISC, wacom->id[0]); | |
210 | return 1; | |
211 | } | |
212 | ||
95dd3b30 | 213 | static int wacom_graphire_irq(struct wacom_wac *wacom) |
3bea733a | 214 | { |
e33da8a5 | 215 | struct wacom_features *features = &wacom->features; |
3bea733a | 216 | unsigned char *data = wacom->data; |
8da23fc1 | 217 | struct input_dev *input = wacom->input; |
252f7769 | 218 | int prox; |
3b57ca0f PC |
219 | int rw = 0; |
220 | int retval = 0; | |
3bea733a | 221 | |
cad74700 | 222 | if (data[0] != WACOM_REPORT_PENABLED) { |
eb71d1bb DT |
223 | dev_dbg(input->dev.parent, |
224 | "%s: received unknown report #%d\n", __func__, data[0]); | |
3b57ca0f | 225 | goto exit; |
3bea733a PC |
226 | } |
227 | ||
3b57ca0f PC |
228 | prox = data[1] & 0x80; |
229 | if (prox || wacom->id[0]) { | |
230 | if (prox) { | |
231 | switch ((data[1] >> 5) & 3) { | |
3bea733a PC |
232 | |
233 | case 0: /* Pen */ | |
234 | wacom->tool[0] = BTN_TOOL_PEN; | |
e34b9d2f | 235 | wacom->id[0] = STYLUS_DEVICE_ID; |
3bea733a PC |
236 | break; |
237 | ||
238 | case 1: /* Rubber */ | |
239 | wacom->tool[0] = BTN_TOOL_RUBBER; | |
e34b9d2f | 240 | wacom->id[0] = ERASER_DEVICE_ID; |
3bea733a PC |
241 | break; |
242 | ||
243 | case 2: /* Mouse with wheel */ | |
8da23fc1 | 244 | input_report_key(input, BTN_MIDDLE, data[1] & 0x04); |
3bea733a PC |
245 | /* fall through */ |
246 | ||
247 | case 3: /* Mouse without wheel */ | |
248 | wacom->tool[0] = BTN_TOOL_MOUSE; | |
e34b9d2f | 249 | wacom->id[0] = CURSOR_DEVICE_ID; |
3bea733a | 250 | break; |
3b57ca0f | 251 | } |
3bea733a | 252 | } |
252f7769 DT |
253 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
254 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | |
3bea733a | 255 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
6dc46351 | 256 | input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8)); |
8da23fc1 DT |
257 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
258 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | |
259 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); | |
afb567e3 | 260 | } else { |
8da23fc1 DT |
261 | input_report_key(input, BTN_LEFT, data[1] & 0x01); |
262 | input_report_key(input, BTN_RIGHT, data[1] & 0x02); | |
3b57ca0f PC |
263 | if (features->type == WACOM_G4 || |
264 | features->type == WACOM_MO) { | |
8da23fc1 | 265 | input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); |
d9f66c1a | 266 | rw = (data[7] & 0x04) - (data[7] & 0x03); |
3b57ca0f | 267 | } else { |
8da23fc1 | 268 | input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); |
d9f66c1a | 269 | rw = -(signed char)data[6]; |
3b57ca0f | 270 | } |
8da23fc1 | 271 | input_report_rel(input, REL_WHEEL, rw); |
afb567e3 | 272 | } |
3b57ca0f PC |
273 | |
274 | if (!prox) | |
275 | wacom->id[0] = 0; | |
8da23fc1 DT |
276 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
277 | input_report_key(input, wacom->tool[0], prox); | |
998c454e | 278 | input_event(input, EV_MSC, MSC_SERIAL, 1); |
8da23fc1 | 279 | input_sync(input); /* sync last event */ |
80d4e8e9 | 280 | } |
3bea733a PC |
281 | |
282 | /* send pad data */ | |
e33da8a5 | 283 | switch (features->type) { |
73a97f4f | 284 | case WACOM_G4: |
3b57ca0f PC |
285 | prox = data[7] & 0xf8; |
286 | if (prox || wacom->id[1]) { | |
e34b9d2f | 287 | wacom->id[1] = PAD_DEVICE_ID; |
0bd10ef8 PC |
288 | input_report_key(input, BTN_BACK, (data[7] & 0x40)); |
289 | input_report_key(input, BTN_FORWARD, (data[7] & 0x80)); | |
3bea733a | 290 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
8da23fc1 | 291 | input_report_rel(input, REL_WHEEL, rw); |
3b57ca0f PC |
292 | if (!prox) |
293 | wacom->id[1] = 0; | |
8da23fc1 DT |
294 | input_report_abs(input, ABS_MISC, wacom->id[1]); |
295 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | |
ab687b18 | 296 | retval = 1; |
3bea733a | 297 | } |
7ecfbfd3 | 298 | break; |
73a97f4f DT |
299 | |
300 | case WACOM_MO: | |
3b57ca0f PC |
301 | prox = (data[7] & 0xf8) || data[8]; |
302 | if (prox || wacom->id[1]) { | |
e34b9d2f | 303 | wacom->id[1] = PAD_DEVICE_ID; |
0bd10ef8 PC |
304 | input_report_key(input, BTN_BACK, (data[7] & 0x08)); |
305 | input_report_key(input, BTN_LEFT, (data[7] & 0x20)); | |
306 | input_report_key(input, BTN_FORWARD, (data[7] & 0x10)); | |
307 | input_report_key(input, BTN_RIGHT, (data[7] & 0x40)); | |
8da23fc1 | 308 | input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f)); |
3b57ca0f PC |
309 | if (!prox) |
310 | wacom->id[1] = 0; | |
8da23fc1 DT |
311 | input_report_abs(input, ABS_MISC, wacom->id[1]); |
312 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | |
84460014 | 313 | retval = 1; |
7ecfbfd3 PC |
314 | } |
315 | break; | |
3bea733a | 316 | } |
3b57ca0f PC |
317 | exit: |
318 | return retval; | |
3bea733a PC |
319 | } |
320 | ||
95dd3b30 | 321 | static int wacom_intuos_inout(struct wacom_wac *wacom) |
3bea733a | 322 | { |
e33da8a5 | 323 | struct wacom_features *features = &wacom->features; |
3bea733a | 324 | unsigned char *data = wacom->data; |
8da23fc1 | 325 | struct input_dev *input = wacom->input; |
6f660f12 | 326 | int idx = 0; |
3bea733a PC |
327 | |
328 | /* tool number */ | |
e33da8a5 | 329 | if (features->type == INTUOS) |
6f660f12 | 330 | idx = data[1] & 0x01; |
3bea733a PC |
331 | |
332 | /* Enter report */ | |
333 | if ((data[1] & 0xfc) == 0xc0) { | |
9d336daf | 334 | if (features->quirks == WACOM_QUIRK_MULTI_INPUT) |
ae584ca4 JG |
335 | wacom->shared->stylus_in_proximity = true; |
336 | ||
3bea733a PC |
337 | /* serial number of the tool */ |
338 | wacom->serial[idx] = ((data[3] & 0x0f) << 28) + | |
339 | (data[4] << 20) + (data[5] << 12) + | |
340 | (data[6] << 4) + (data[7] >> 4); | |
341 | ||
493630b2 PC |
342 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | |
343 | ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12); | |
73a97f4f | 344 | |
493630b2 | 345 | switch (wacom->id[idx] & 0xfffff) { |
73a97f4f DT |
346 | case 0x812: /* Inking pen */ |
347 | case 0x801: /* Intuos3 Inking pen */ | |
493630b2 | 348 | case 0x20802: /* Intuos4 Inking Pen */ |
73a97f4f DT |
349 | case 0x012: |
350 | wacom->tool[idx] = BTN_TOOL_PENCIL; | |
351 | break; | |
352 | ||
353 | case 0x822: /* Pen */ | |
354 | case 0x842: | |
355 | case 0x852: | |
356 | case 0x823: /* Intuos3 Grip Pen */ | |
357 | case 0x813: /* Intuos3 Classic Pen */ | |
358 | case 0x885: /* Intuos3 Marker Pen */ | |
3a4b4aaa | 359 | case 0x802: /* Intuos4 General Pen */ |
73a97f4f DT |
360 | case 0x804: /* Intuos4 Marker Pen */ |
361 | case 0x40802: /* Intuos4 Classic Pen */ | |
362 | case 0x022: | |
363 | wacom->tool[idx] = BTN_TOOL_PEN; | |
364 | break; | |
365 | ||
366 | case 0x832: /* Stroke pen */ | |
367 | case 0x032: | |
368 | wacom->tool[idx] = BTN_TOOL_BRUSH; | |
369 | break; | |
370 | ||
371 | case 0x007: /* Mouse 4D and 2D */ | |
372 | case 0x09c: | |
373 | case 0x094: | |
374 | case 0x017: /* Intuos3 2D Mouse */ | |
375 | case 0x806: /* Intuos4 Mouse */ | |
376 | wacom->tool[idx] = BTN_TOOL_MOUSE; | |
377 | break; | |
378 | ||
379 | case 0x096: /* Lens cursor */ | |
380 | case 0x097: /* Intuos3 Lens cursor */ | |
381 | case 0x006: /* Intuos4 Lens cursor */ | |
382 | wacom->tool[idx] = BTN_TOOL_LENS; | |
383 | break; | |
384 | ||
385 | case 0x82a: /* Eraser */ | |
386 | case 0x85a: | |
387 | case 0x91a: | |
388 | case 0xd1a: | |
389 | case 0x0fa: | |
390 | case 0x82b: /* Intuos3 Grip Pen Eraser */ | |
391 | case 0x81b: /* Intuos3 Classic Pen Eraser */ | |
392 | case 0x91b: /* Intuos3 Airbrush Eraser */ | |
393 | case 0x80c: /* Intuos4 Marker Pen Eraser */ | |
3a4b4aaa | 394 | case 0x80a: /* Intuos4 General Pen Eraser */ |
73a97f4f DT |
395 | case 0x4080a: /* Intuos4 Classic Pen Eraser */ |
396 | case 0x90a: /* Intuos4 Airbrush Eraser */ | |
397 | wacom->tool[idx] = BTN_TOOL_RUBBER; | |
398 | break; | |
399 | ||
400 | case 0xd12: | |
401 | case 0x912: | |
402 | case 0x112: | |
403 | case 0x913: /* Intuos3 Airbrush */ | |
404 | case 0x902: /* Intuos4 Airbrush */ | |
405 | wacom->tool[idx] = BTN_TOOL_AIRBRUSH; | |
406 | break; | |
407 | ||
408 | default: /* Unknown tool */ | |
409 | wacom->tool[idx] = BTN_TOOL_PEN; | |
410 | break; | |
3bea733a | 411 | } |
3bea733a PC |
412 | return 1; |
413 | } | |
414 | ||
3a4b4aaa PC |
415 | /* older I4 styli don't work with new Cintiqs */ |
416 | if (!((wacom->id[idx] >> 20) & 0x01) && | |
417 | (features->type == WACOM_21UX2)) | |
418 | return 1; | |
419 | ||
3bea733a PC |
420 | /* Exit report */ |
421 | if ((data[1] & 0xfe) == 0x80) { | |
9d336daf | 422 | if (features->quirks == WACOM_QUIRK_MULTI_INPUT) |
ae584ca4 JG |
423 | wacom->shared->stylus_in_proximity = false; |
424 | ||
6f660f12 PC |
425 | /* |
426 | * Reset all states otherwise we lose the initial states | |
427 | * when in-prox next time | |
428 | */ | |
8da23fc1 DT |
429 | input_report_abs(input, ABS_X, 0); |
430 | input_report_abs(input, ABS_Y, 0); | |
431 | input_report_abs(input, ABS_DISTANCE, 0); | |
432 | input_report_abs(input, ABS_TILT_X, 0); | |
433 | input_report_abs(input, ABS_TILT_Y, 0); | |
80d4e8e9 | 434 | if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { |
8da23fc1 DT |
435 | input_report_key(input, BTN_LEFT, 0); |
436 | input_report_key(input, BTN_MIDDLE, 0); | |
437 | input_report_key(input, BTN_RIGHT, 0); | |
438 | input_report_key(input, BTN_SIDE, 0); | |
439 | input_report_key(input, BTN_EXTRA, 0); | |
440 | input_report_abs(input, ABS_THROTTLE, 0); | |
441 | input_report_abs(input, ABS_RZ, 0); | |
7ecfbfd3 | 442 | } else { |
8da23fc1 DT |
443 | input_report_abs(input, ABS_PRESSURE, 0); |
444 | input_report_key(input, BTN_STYLUS, 0); | |
445 | input_report_key(input, BTN_STYLUS2, 0); | |
446 | input_report_key(input, BTN_TOUCH, 0); | |
447 | input_report_abs(input, ABS_WHEEL, 0); | |
e33da8a5 | 448 | if (features->type >= INTUOS3S) |
8da23fc1 | 449 | input_report_abs(input, ABS_Z, 0); |
8d32e3ae | 450 | } |
8da23fc1 DT |
451 | input_report_key(input, wacom->tool[idx], 0); |
452 | input_report_abs(input, ABS_MISC, 0); /* reset tool id */ | |
453 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | |
6f660f12 | 454 | wacom->id[idx] = 0; |
80d4e8e9 | 455 | return 2; |
3bea733a PC |
456 | } |
457 | return 0; | |
458 | } | |
459 | ||
95dd3b30 | 460 | static void wacom_intuos_general(struct wacom_wac *wacom) |
3bea733a | 461 | { |
e33da8a5 | 462 | struct wacom_features *features = &wacom->features; |
3bea733a | 463 | unsigned char *data = wacom->data; |
8da23fc1 | 464 | struct input_dev *input = wacom->input; |
3bea733a PC |
465 | unsigned int t; |
466 | ||
467 | /* general pen packet */ | |
468 | if ((data[1] & 0xb8) == 0xa0) { | |
469 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | |
ca047fed | 470 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || |
9fee6195 | 471 | (features->type >= INTUOS5S && features->type <= INTUOS5L) || |
d838c644 | 472 | (features->type >= WACOM_21UX2 && features->type <= WACOM_24HD)) { |
6f660f12 | 473 | t = (t << 1) | (data[1] & 1); |
ca047fed | 474 | } |
8da23fc1 DT |
475 | input_report_abs(input, ABS_PRESSURE, t); |
476 | input_report_abs(input, ABS_TILT_X, | |
3bea733a | 477 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
8da23fc1 DT |
478 | input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); |
479 | input_report_key(input, BTN_STYLUS, data[1] & 2); | |
480 | input_report_key(input, BTN_STYLUS2, data[1] & 4); | |
481 | input_report_key(input, BTN_TOUCH, t > 10); | |
3bea733a PC |
482 | } |
483 | ||
484 | /* airbrush second packet */ | |
485 | if ((data[1] & 0xbc) == 0xb4) { | |
8da23fc1 | 486 | input_report_abs(input, ABS_WHEEL, |
3bea733a | 487 | (data[6] << 2) | ((data[7] >> 6) & 3)); |
8da23fc1 | 488 | input_report_abs(input, ABS_TILT_X, |
3bea733a | 489 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
8da23fc1 | 490 | input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); |
3bea733a | 491 | } |
3bea733a PC |
492 | } |
493 | ||
95dd3b30 | 494 | static int wacom_intuos_irq(struct wacom_wac *wacom) |
3bea733a | 495 | { |
e33da8a5 | 496 | struct wacom_features *features = &wacom->features; |
3bea733a | 497 | unsigned char *data = wacom->data; |
8da23fc1 | 498 | struct input_dev *input = wacom->input; |
3bea733a | 499 | unsigned int t; |
6f660f12 | 500 | int idx = 0, result; |
3bea733a | 501 | |
eb71d1bb DT |
502 | if (data[0] != WACOM_REPORT_PENABLED && |
503 | data[0] != WACOM_REPORT_INTUOSREAD && | |
504 | data[0] != WACOM_REPORT_INTUOSWRITE && | |
505 | data[0] != WACOM_REPORT_INTUOSPAD && | |
506 | data[0] != WACOM_REPORT_INTUOS5PAD) { | |
507 | dev_dbg(input->dev.parent, | |
508 | "%s: received unknown report #%d\n", __func__, data[0]); | |
3bea733a PC |
509 | return 0; |
510 | } | |
511 | ||
3bea733a | 512 | /* tool number */ |
e33da8a5 | 513 | if (features->type == INTUOS) |
6f660f12 | 514 | idx = data[1] & 0x01; |
3bea733a PC |
515 | |
516 | /* pad packets. Works as a second tool and is always in prox */ | |
f860e581 | 517 | if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) { |
e33da8a5 | 518 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
8da23fc1 DT |
519 | input_report_key(input, BTN_0, (data[2] & 0x01)); |
520 | input_report_key(input, BTN_1, (data[3] & 0x01)); | |
521 | input_report_key(input, BTN_2, (data[3] & 0x02)); | |
522 | input_report_key(input, BTN_3, (data[3] & 0x04)); | |
523 | input_report_key(input, BTN_4, (data[3] & 0x08)); | |
524 | input_report_key(input, BTN_5, (data[3] & 0x10)); | |
525 | input_report_key(input, BTN_6, (data[3] & 0x20)); | |
6f660f12 | 526 | if (data[1] & 0x80) { |
8da23fc1 | 527 | input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f)); |
a8629528 PC |
528 | } else { |
529 | /* Out of proximity, clear wheel value. */ | |
8da23fc1 | 530 | input_report_abs(input, ABS_WHEEL, 0); |
6f660f12 | 531 | } |
e33da8a5 | 532 | if (features->type != INTUOS4S) { |
8da23fc1 DT |
533 | input_report_key(input, BTN_7, (data[3] & 0x40)); |
534 | input_report_key(input, BTN_8, (data[3] & 0x80)); | |
6f660f12 PC |
535 | } |
536 | if (data[1] | (data[2] & 0x01) | data[3]) { | |
8da23fc1 DT |
537 | input_report_key(input, wacom->tool[1], 1); |
538 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | |
6f660f12 | 539 | } else { |
8da23fc1 DT |
540 | input_report_key(input, wacom->tool[1], 0); |
541 | input_report_abs(input, ABS_MISC, 0); | |
6f660f12 | 542 | } |
803296b6 JG |
543 | } else if (features->type == WACOM_24HD) { |
544 | input_report_key(input, BTN_0, (data[6] & 0x01)); | |
545 | input_report_key(input, BTN_1, (data[6] & 0x02)); | |
546 | input_report_key(input, BTN_2, (data[6] & 0x04)); | |
547 | input_report_key(input, BTN_3, (data[6] & 0x08)); | |
548 | input_report_key(input, BTN_4, (data[6] & 0x10)); | |
549 | input_report_key(input, BTN_5, (data[6] & 0x20)); | |
550 | input_report_key(input, BTN_6, (data[6] & 0x40)); | |
551 | input_report_key(input, BTN_7, (data[6] & 0x80)); | |
552 | input_report_key(input, BTN_8, (data[8] & 0x01)); | |
553 | input_report_key(input, BTN_9, (data[8] & 0x02)); | |
554 | input_report_key(input, BTN_A, (data[8] & 0x04)); | |
555 | input_report_key(input, BTN_B, (data[8] & 0x08)); | |
556 | input_report_key(input, BTN_C, (data[8] & 0x10)); | |
557 | input_report_key(input, BTN_X, (data[8] & 0x20)); | |
558 | input_report_key(input, BTN_Y, (data[8] & 0x40)); | |
559 | input_report_key(input, BTN_Z, (data[8] & 0x80)); | |
560 | ||
561 | /* | |
562 | * Three "buttons" are available on the 24HD which are | |
563 | * physically implemented as a touchstrip. Each button | |
564 | * is approximately 3 bits wide with a 2 bit spacing. | |
565 | * The raw touchstrip bits are stored at: | |
566 | * ((data[3] & 0x1f) << 8) | data[4]) | |
567 | */ | |
568 | input_report_key(input, KEY_PROG1, data[4] & 0x07); | |
569 | input_report_key(input, KEY_PROG2, data[4] & 0xE0); | |
570 | input_report_key(input, KEY_PROG3, data[3] & 0x1C); | |
571 | ||
572 | if (data[1] & 0x80) { | |
573 | input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f)); | |
574 | } else { | |
575 | /* Out of proximity, clear wheel value. */ | |
576 | input_report_abs(input, ABS_WHEEL, 0); | |
577 | } | |
578 | ||
579 | if (data[2] & 0x80) { | |
580 | input_report_abs(input, ABS_THROTTLE, (data[2] & 0x7f)); | |
581 | } else { | |
582 | /* Out of proximity, clear second wheel value. */ | |
583 | input_report_abs(input, ABS_THROTTLE, 0); | |
584 | } | |
585 | ||
586 | if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) { | |
587 | input_report_key(input, wacom->tool[1], 1); | |
f860e581 JG |
588 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
589 | } else { | |
590 | input_report_key(input, wacom->tool[1], 0); | |
591 | input_report_abs(input, ABS_MISC, 0); | |
592 | } | |
593 | } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { | |
594 | int i; | |
595 | ||
596 | /* Touch ring mode switch has no capacitive sensor */ | |
597 | input_report_key(input, BTN_0, (data[3] & 0x01)); | |
598 | ||
599 | /* | |
600 | * ExpressKeys on Intuos5 have a capacitive sensor in | |
601 | * addition to the mechanical switch. Switch data is | |
602 | * stored in data[4], capacitive data in data[5]. | |
603 | */ | |
604 | for (i = 0; i < 8; i++) | |
605 | input_report_key(input, BTN_1 + i, data[4] & (1 << i)); | |
606 | ||
607 | if (data[2] & 0x80) { | |
608 | input_report_abs(input, ABS_WHEEL, (data[2] & 0x7f)); | |
609 | } else { | |
610 | /* Out of proximity, clear wheel value. */ | |
611 | input_report_abs(input, ABS_WHEEL, 0); | |
612 | } | |
613 | ||
5e056ef4 | 614 | if (data[2] | (data[3] & 0x01) | data[4] | data[5]) { |
f860e581 | 615 | input_report_key(input, wacom->tool[1], 1); |
803296b6 JG |
616 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
617 | } else { | |
618 | input_report_key(input, wacom->tool[1], 0); | |
619 | input_report_abs(input, ABS_MISC, 0); | |
620 | } | |
6f660f12 | 621 | } else { |
d838c644 | 622 | if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { |
3a4b4aaa PC |
623 | input_report_key(input, BTN_0, (data[5] & 0x01)); |
624 | input_report_key(input, BTN_1, (data[6] & 0x01)); | |
625 | input_report_key(input, BTN_2, (data[6] & 0x02)); | |
626 | input_report_key(input, BTN_3, (data[6] & 0x04)); | |
627 | input_report_key(input, BTN_4, (data[6] & 0x08)); | |
628 | input_report_key(input, BTN_5, (data[6] & 0x10)); | |
629 | input_report_key(input, BTN_6, (data[6] & 0x20)); | |
630 | input_report_key(input, BTN_7, (data[6] & 0x40)); | |
631 | input_report_key(input, BTN_8, (data[6] & 0x80)); | |
632 | input_report_key(input, BTN_9, (data[7] & 0x01)); | |
633 | input_report_key(input, BTN_A, (data[8] & 0x01)); | |
634 | input_report_key(input, BTN_B, (data[8] & 0x02)); | |
635 | input_report_key(input, BTN_C, (data[8] & 0x04)); | |
636 | input_report_key(input, BTN_X, (data[8] & 0x08)); | |
637 | input_report_key(input, BTN_Y, (data[8] & 0x10)); | |
638 | input_report_key(input, BTN_Z, (data[8] & 0x20)); | |
639 | input_report_key(input, BTN_BASE, (data[8] & 0x40)); | |
640 | input_report_key(input, BTN_BASE2, (data[8] & 0x80)); | |
d838c644 PC |
641 | |
642 | if (features->type == WACOM_22HD) { | |
643 | input_report_key(input, KEY_PROG1, data[9] & 0x01); | |
644 | input_report_key(input, KEY_PROG2, data[9] & 0x02); | |
645 | input_report_key(input, KEY_PROG3, data[9] & 0x04); | |
646 | } | |
3a4b4aaa PC |
647 | } else { |
648 | input_report_key(input, BTN_0, (data[5] & 0x01)); | |
649 | input_report_key(input, BTN_1, (data[5] & 0x02)); | |
650 | input_report_key(input, BTN_2, (data[5] & 0x04)); | |
651 | input_report_key(input, BTN_3, (data[5] & 0x08)); | |
652 | input_report_key(input, BTN_4, (data[6] & 0x01)); | |
653 | input_report_key(input, BTN_5, (data[6] & 0x02)); | |
654 | input_report_key(input, BTN_6, (data[6] & 0x04)); | |
655 | input_report_key(input, BTN_7, (data[6] & 0x08)); | |
656 | input_report_key(input, BTN_8, (data[5] & 0x10)); | |
657 | input_report_key(input, BTN_9, (data[6] & 0x10)); | |
658 | } | |
8da23fc1 DT |
659 | input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
660 | input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); | |
6f660f12 | 661 | |
493630b2 | 662 | if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) | |
3a4b4aaa PC |
663 | data[2] | (data[3] & 0x1f) | data[4] | data[8] | |
664 | (data[7] & 0x01)) { | |
8da23fc1 DT |
665 | input_report_key(input, wacom->tool[1], 1); |
666 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | |
6f660f12 | 667 | } else { |
8da23fc1 DT |
668 | input_report_key(input, wacom->tool[1], 0); |
669 | input_report_abs(input, ABS_MISC, 0); | |
6f660f12 PC |
670 | } |
671 | } | |
8da23fc1 | 672 | input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); |
3bea733a PC |
673 | return 1; |
674 | } | |
675 | ||
676 | /* process in/out prox events */ | |
95dd3b30 | 677 | result = wacom_intuos_inout(wacom); |
3bea733a | 678 | if (result) |
73a97f4f | 679 | return result - 1; |
3bea733a | 680 | |
6f660f12 PC |
681 | /* don't proceed if we don't know the ID */ |
682 | if (!wacom->id[idx]) | |
683 | return 0; | |
684 | ||
685 | /* Only large Intuos support Lense Cursor */ | |
e33da8a5 JC |
686 | if (wacom->tool[idx] == BTN_TOOL_LENS && |
687 | (features->type == INTUOS3 || | |
688 | features->type == INTUOS3S || | |
689 | features->type == INTUOS4 || | |
9fee6195 JG |
690 | features->type == INTUOS4S || |
691 | features->type == INTUOS5 || | |
692 | features->type == INTUOS5S)) { | |
e33da8a5 | 693 | |
80d4e8e9 | 694 | return 0; |
e33da8a5 | 695 | } |
80d4e8e9 | 696 | |
3bea733a | 697 | /* Cintiq doesn't send data when RDY bit isn't set */ |
e33da8a5 | 698 | if (features->type == CINTIQ && !(data[1] & 0x40)) |
3bea733a PC |
699 | return 0; |
700 | ||
e33da8a5 | 701 | if (features->type >= INTUOS3S) { |
8da23fc1 DT |
702 | input_report_abs(input, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); |
703 | input_report_abs(input, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); | |
704 | input_report_abs(input, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); | |
3bea733a | 705 | } else { |
252f7769 DT |
706 | input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[2])); |
707 | input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[4])); | |
8da23fc1 | 708 | input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x1f)); |
3bea733a PC |
709 | } |
710 | ||
711 | /* process general packets */ | |
95dd3b30 | 712 | wacom_intuos_general(wacom); |
3bea733a | 713 | |
6f660f12 PC |
714 | /* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */ |
715 | if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) { | |
3bea733a PC |
716 | |
717 | if (data[1] & 0x02) { | |
718 | /* Rotation packet */ | |
e33da8a5 | 719 | if (features->type >= INTUOS3S) { |
0e1763f5 | 720 | /* I3 marker pen rotation */ |
3bea733a PC |
721 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
722 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | |
723 | ((t-1) / 2 + 450)) : (450 - t / 2) ; | |
8da23fc1 | 724 | input_report_abs(input, ABS_Z, t); |
3bea733a PC |
725 | } else { |
726 | /* 4D mouse rotation packet */ | |
727 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | |
8da23fc1 | 728 | input_report_abs(input, ABS_RZ, (data[7] & 0x20) ? |
3bea733a PC |
729 | ((t - 1) / 2) : -t / 2); |
730 | } | |
731 | ||
e33da8a5 | 732 | } else if (!(data[1] & 0x10) && features->type < INTUOS3S) { |
3bea733a | 733 | /* 4D mouse packet */ |
8da23fc1 DT |
734 | input_report_key(input, BTN_LEFT, data[8] & 0x01); |
735 | input_report_key(input, BTN_MIDDLE, data[8] & 0x02); | |
736 | input_report_key(input, BTN_RIGHT, data[8] & 0x04); | |
3bea733a | 737 | |
8da23fc1 DT |
738 | input_report_key(input, BTN_SIDE, data[8] & 0x20); |
739 | input_report_key(input, BTN_EXTRA, data[8] & 0x10); | |
3bea733a | 740 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
8da23fc1 | 741 | input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); |
3bea733a PC |
742 | |
743 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { | |
6f660f12 | 744 | /* I4 mouse */ |
9fee6195 JG |
745 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || |
746 | (features->type >= INTUOS5S && features->type <= INTUOS5L)) { | |
8da23fc1 DT |
747 | input_report_key(input, BTN_LEFT, data[6] & 0x01); |
748 | input_report_key(input, BTN_MIDDLE, data[6] & 0x02); | |
749 | input_report_key(input, BTN_RIGHT, data[6] & 0x04); | |
750 | input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) | |
6f660f12 | 751 | - ((data[7] & 0x40) >> 6)); |
8da23fc1 DT |
752 | input_report_key(input, BTN_SIDE, data[6] & 0x08); |
753 | input_report_key(input, BTN_EXTRA, data[6] & 0x10); | |
6f660f12 | 754 | |
8da23fc1 | 755 | input_report_abs(input, ABS_TILT_X, |
6f660f12 | 756 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
8da23fc1 | 757 | input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); |
6f660f12 PC |
758 | } else { |
759 | /* 2D mouse packet */ | |
8da23fc1 DT |
760 | input_report_key(input, BTN_LEFT, data[8] & 0x04); |
761 | input_report_key(input, BTN_MIDDLE, data[8] & 0x08); | |
762 | input_report_key(input, BTN_RIGHT, data[8] & 0x10); | |
763 | input_report_rel(input, REL_WHEEL, (data[8] & 0x01) | |
3bea733a PC |
764 | - ((data[8] & 0x02) >> 1)); |
765 | ||
6f660f12 | 766 | /* I3 2D mouse side buttons */ |
e33da8a5 | 767 | if (features->type >= INTUOS3S && features->type <= INTUOS3L) { |
8da23fc1 DT |
768 | input_report_key(input, BTN_SIDE, data[8] & 0x40); |
769 | input_report_key(input, BTN_EXTRA, data[8] & 0x20); | |
6f660f12 | 770 | } |
3bea733a | 771 | } |
e33da8a5 | 772 | } else if ((features->type < INTUOS3S || features->type == INTUOS3L || |
9fee6195 | 773 | features->type == INTUOS4L || features->type == INTUOS5L) && |
6f660f12 | 774 | wacom->tool[idx] == BTN_TOOL_LENS) { |
3bea733a | 775 | /* Lens cursor packets */ |
8da23fc1 DT |
776 | input_report_key(input, BTN_LEFT, data[8] & 0x01); |
777 | input_report_key(input, BTN_MIDDLE, data[8] & 0x02); | |
778 | input_report_key(input, BTN_RIGHT, data[8] & 0x04); | |
779 | input_report_key(input, BTN_SIDE, data[8] & 0x10); | |
780 | input_report_key(input, BTN_EXTRA, data[8] & 0x08); | |
3bea733a PC |
781 | } |
782 | } | |
783 | ||
8da23fc1 DT |
784 | input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */ |
785 | input_report_key(input, wacom->tool[idx], 1); | |
786 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | |
3bea733a PC |
787 | return 1; |
788 | } | |
789 | ||
1963518b PC |
790 | static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid) |
791 | { | |
792 | int touch_max = wacom->features.touch_max; | |
793 | int i; | |
794 | ||
795 | if (!wacom->slots) | |
796 | return -1; | |
797 | ||
798 | for (i = 0; i < touch_max; ++i) { | |
799 | if (wacom->slots[i] == contactid) | |
800 | return i; | |
801 | } | |
802 | for (i = 0; i < touch_max; ++i) { | |
803 | if (wacom->slots[i] == -1) | |
804 | return i; | |
805 | } | |
806 | return -1; | |
807 | } | |
808 | ||
809 | static int wacom_mt_touch(struct wacom_wac *wacom) | |
810 | { | |
811 | struct input_dev *input = wacom->input; | |
812 | char *data = wacom->data; | |
813 | int i; | |
814 | int current_num_contacts = data[2]; | |
815 | int contacts_to_send = 0; | |
816 | ||
817 | /* | |
818 | * First packet resets the counter since only the first | |
819 | * packet in series will have non-zero current_num_contacts. | |
820 | */ | |
821 | if (current_num_contacts) | |
822 | wacom->num_contacts_left = current_num_contacts; | |
823 | ||
824 | /* There are at most 5 contacts per packet */ | |
825 | contacts_to_send = min(5, wacom->num_contacts_left); | |
826 | ||
827 | for (i = 0; i < contacts_to_send; i++) { | |
828 | int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3; | |
829 | bool touch = data[offset] & 0x1; | |
830 | int id = le16_to_cpup((__le16 *)&data[offset + 1]); | |
831 | int slot = find_slot_from_contactid(wacom, id); | |
832 | ||
833 | if (slot < 0) | |
834 | continue; | |
835 | ||
836 | input_mt_slot(input, slot); | |
837 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | |
838 | if (touch) { | |
839 | int x = le16_to_cpup((__le16 *)&data[offset + 7]); | |
840 | int y = le16_to_cpup((__le16 *)&data[offset + 9]); | |
841 | input_report_abs(input, ABS_MT_POSITION_X, x); | |
842 | input_report_abs(input, ABS_MT_POSITION_Y, y); | |
843 | } | |
844 | wacom->slots[slot] = touch ? id : -1; | |
845 | } | |
846 | ||
847 | input_mt_report_pointer_emulation(input, true); | |
848 | ||
849 | wacom->num_contacts_left -= contacts_to_send; | |
850 | if (wacom->num_contacts_left < 0) | |
851 | wacom->num_contacts_left = 0; | |
852 | ||
853 | return 1; | |
854 | } | |
855 | ||
84eb5aa6 PC |
856 | static int wacom_tpc_mt_touch(struct wacom_wac *wacom) |
857 | { | |
858 | struct input_dev *input = wacom->input; | |
859 | unsigned char *data = wacom->data; | |
860 | int contact_with_no_pen_down_count = 0; | |
861 | int i; | |
862 | ||
863 | for (i = 0; i < 2; i++) { | |
864 | int p = data[1] & (1 << i); | |
865 | bool touch = p && !wacom->shared->stylus_in_proximity; | |
866 | ||
867 | input_mt_slot(input, i); | |
868 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | |
869 | if (touch) { | |
870 | int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; | |
871 | int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; | |
872 | ||
873 | input_report_abs(input, ABS_MT_POSITION_X, x); | |
874 | input_report_abs(input, ABS_MT_POSITION_Y, y); | |
875 | contact_with_no_pen_down_count++; | |
876 | } | |
877 | } | |
878 | ||
879 | /* keep touch state for pen event */ | |
880 | wacom->shared->touch_down = (contact_with_no_pen_down_count > 0); | |
881 | ||
882 | input_mt_report_pointer_emulation(input, true); | |
883 | ||
884 | return 1; | |
885 | } | |
886 | ||
a43c7c53 | 887 | static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) |
ec67bbed PC |
888 | { |
889 | char *data = wacom->data; | |
8da23fc1 | 890 | struct input_dev *input = wacom->input; |
a43c7c53 PC |
891 | bool prox; |
892 | int x = 0, y = 0; | |
ec67bbed | 893 | |
1963518b PC |
894 | if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) |
895 | return 0; | |
896 | ||
a43c7c53 PC |
897 | if (!wacom->shared->stylus_in_proximity) { |
898 | if (len == WACOM_PKGLEN_TPC1FG) { | |
899 | prox = data[0] & 0x01; | |
900 | x = get_unaligned_le16(&data[1]); | |
901 | y = get_unaligned_le16(&data[3]); | |
ac173837 | 902 | } else { |
a43c7c53 PC |
903 | prox = data[1] & 0x01; |
904 | x = le16_to_cpup((__le16 *)&data[2]); | |
905 | y = le16_to_cpup((__le16 *)&data[4]); | |
906 | } | |
907 | } else | |
908 | /* force touch out when pen is in prox */ | |
909 | prox = 0; | |
ec67bbed | 910 | |
a43c7c53 PC |
911 | if (prox) { |
912 | input_report_abs(input, ABS_X, x); | |
913 | input_report_abs(input, ABS_Y, y); | |
914 | } | |
915 | input_report_key(input, BTN_TOUCH, prox); | |
73a97f4f | 916 | |
a43c7c53 PC |
917 | /* keep touch state for pen events */ |
918 | wacom->shared->touch_down = prox; | |
ec67bbed | 919 | |
a43c7c53 | 920 | return 1; |
ec67bbed PC |
921 | } |
922 | ||
8aa9a9ac | 923 | static int wacom_tpc_pen(struct wacom_wac *wacom) |
545f4e99 | 924 | { |
e33da8a5 | 925 | struct wacom_features *features = &wacom->features; |
545f4e99 | 926 | char *data = wacom->data; |
8da23fc1 | 927 | struct input_dev *input = wacom->input; |
a43c7c53 PC |
928 | int pressure; |
929 | bool prox = data[1] & 0x20; | |
8aa9a9ac | 930 | |
a43c7c53 | 931 | if (!wacom->shared->stylus_in_proximity) /* first in prox */ |
8aa9a9ac PC |
932 | /* Going into proximity select tool */ |
933 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | |
8aa9a9ac | 934 | |
a43c7c53 PC |
935 | /* keep pen state for touch events */ |
936 | wacom->shared->stylus_in_proximity = prox; | |
937 | ||
938 | /* send pen events only when touch is up or forced out */ | |
939 | if (!wacom->shared->touch_down) { | |
940 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | |
941 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | |
942 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | |
943 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | |
944 | pressure = ((data[7] & 0x01) << 8) | data[6]; | |
945 | if (pressure < 0) | |
946 | pressure = features->pressure_max + pressure + 1; | |
947 | input_report_abs(input, ABS_PRESSURE, pressure); | |
948 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); | |
949 | input_report_key(input, wacom->tool[0], prox); | |
950 | return 1; | |
8aa9a9ac | 951 | } |
8aa9a9ac | 952 | |
a43c7c53 | 953 | return 0; |
8aa9a9ac PC |
954 | } |
955 | ||
956 | static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) | |
957 | { | |
958 | char *data = wacom->data; | |
545f4e99 | 959 | |
eb71d1bb DT |
960 | dev_dbg(wacom->input->dev.parent, |
961 | "%s: received report #%d\n", __func__, data[0]); | |
545f4e99 | 962 | |
31175a83 PC |
963 | switch (len) { |
964 | case WACOM_PKGLEN_TPC1FG: | |
1963518b | 965 | return wacom_tpc_single_touch(wacom, len); |
31175a83 PC |
966 | |
967 | case WACOM_PKGLEN_TPC2FG: | |
1963518b | 968 | return wacom_tpc_mt_touch(wacom); |
31175a83 PC |
969 | |
970 | default: | |
971 | switch (data[0]) { | |
972 | case WACOM_REPORT_TPC1FG: | |
973 | case WACOM_REPORT_TPCHID: | |
974 | case WACOM_REPORT_TPCST: | |
ac173837 | 975 | case WACOM_REPORT_TPC1FGE: |
31175a83 PC |
976 | return wacom_tpc_single_touch(wacom, len); |
977 | ||
1963518b PC |
978 | case WACOM_REPORT_TPCMT: |
979 | return wacom_mt_touch(wacom); | |
980 | ||
31175a83 PC |
981 | case WACOM_REPORT_PENABLED: |
982 | return wacom_tpc_pen(wacom); | |
983 | } | |
984 | } | |
4492efff | 985 | |
8aa9a9ac | 986 | return 0; |
545f4e99 PC |
987 | } |
988 | ||
e1d38e49 | 989 | static int wacom_bpt_touch(struct wacom_wac *wacom) |
cb734c03 | 990 | { |
f4ccbef2 | 991 | struct wacom_features *features = &wacom->features; |
cb734c03 HR |
992 | struct input_dev *input = wacom->input; |
993 | unsigned char *data = wacom->data; | |
cb734c03 HR |
994 | int i; |
995 | ||
5a6c865d CB |
996 | if (data[0] != 0x02) |
997 | return 0; | |
998 | ||
cb734c03 | 999 | for (i = 0; i < 2; i++) { |
8f906860 CB |
1000 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); |
1001 | bool touch = data[offset + 3] & 0x80; | |
c5f4dec1 | 1002 | |
33d5f713 CB |
1003 | /* |
1004 | * Touch events need to be disabled while stylus is | |
1005 | * in proximity because user's hand is resting on touchpad | |
1006 | * and sending unwanted events. User expects tablet buttons | |
1007 | * to continue working though. | |
1008 | */ | |
8f906860 CB |
1009 | touch = touch && !wacom->shared->stylus_in_proximity; |
1010 | ||
1011 | input_mt_slot(input, i); | |
1012 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | |
c5f4dec1 | 1013 | if (touch) { |
8f906860 CB |
1014 | int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; |
1015 | int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; | |
f4ccbef2 HR |
1016 | if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { |
1017 | x <<= 5; | |
1018 | y <<= 5; | |
1019 | } | |
cb734c03 HR |
1020 | input_report_abs(input, ABS_MT_POSITION_X, x); |
1021 | input_report_abs(input, ABS_MT_POSITION_Y, y); | |
cb734c03 | 1022 | } |
cb734c03 HR |
1023 | } |
1024 | ||
c5f4dec1 | 1025 | input_mt_report_pointer_emulation(input, true); |
cb734c03 HR |
1026 | |
1027 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); | |
1028 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); | |
1029 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); | |
1030 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); | |
1031 | ||
1032 | input_sync(input); | |
1033 | ||
1034 | return 0; | |
1035 | } | |
1036 | ||
73149ab8 CB |
1037 | static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) |
1038 | { | |
1039 | struct input_dev *input = wacom->input; | |
1040 | int slot_id = data[0] - 2; /* data[0] is between 2 and 17 */ | |
1041 | bool touch = data[1] & 0x80; | |
1042 | ||
1043 | touch = touch && !wacom->shared->stylus_in_proximity; | |
1044 | ||
1045 | input_mt_slot(input, slot_id); | |
1046 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | |
1047 | ||
1048 | if (touch) { | |
1049 | int x = (data[2] << 4) | (data[4] >> 4); | |
1050 | int y = (data[3] << 4) | (data[4] & 0x0f); | |
4e904954 JG |
1051 | int a = data[5]; |
1052 | ||
1053 | // "a" is a scaled-down area which we assume is roughly | |
1054 | // circular and which can be described as: a=(pi*r^2)/C. | |
1055 | int x_res = input_abs_get_res(input, ABS_X); | |
1056 | int y_res = input_abs_get_res(input, ABS_Y); | |
1057 | int width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); | |
1058 | int height = width * y_res / x_res; | |
73149ab8 CB |
1059 | |
1060 | input_report_abs(input, ABS_MT_POSITION_X, x); | |
1061 | input_report_abs(input, ABS_MT_POSITION_Y, y); | |
4e904954 JG |
1062 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); |
1063 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); | |
73149ab8 CB |
1064 | } |
1065 | } | |
1066 | ||
1067 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) | |
1068 | { | |
1069 | struct input_dev *input = wacom->input; | |
1070 | ||
1071 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); | |
1072 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); | |
1073 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); | |
1074 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); | |
1075 | } | |
1076 | ||
1077 | static int wacom_bpt3_touch(struct wacom_wac *wacom) | |
1078 | { | |
1079 | struct input_dev *input = wacom->input; | |
1080 | unsigned char *data = wacom->data; | |
19d57d3a | 1081 | int count = data[1] & 0x07; |
73149ab8 CB |
1082 | int i; |
1083 | ||
5a6c865d CB |
1084 | if (data[0] != 0x02) |
1085 | return 0; | |
1086 | ||
73149ab8 CB |
1087 | /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ |
1088 | for (i = 0; i < count; i++) { | |
1089 | int offset = (8 * i) + 2; | |
1090 | int msg_id = data[offset]; | |
1091 | ||
1092 | if (msg_id >= 2 && msg_id <= 17) | |
1093 | wacom_bpt3_touch_msg(wacom, data + offset); | |
1094 | else if (msg_id == 128) | |
1095 | wacom_bpt3_button_msg(wacom, data + offset); | |
1096 | ||
1097 | } | |
1098 | ||
1099 | input_mt_report_pointer_emulation(input, true); | |
1100 | ||
1101 | input_sync(input); | |
1102 | ||
1103 | return 0; | |
1104 | } | |
1105 | ||
2aaacb15 CB |
1106 | static int wacom_bpt_pen(struct wacom_wac *wacom) |
1107 | { | |
1108 | struct input_dev *input = wacom->input; | |
1109 | unsigned char *data = wacom->data; | |
1110 | int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; | |
1111 | ||
5a6c865d CB |
1112 | if (data[0] != 0x02) |
1113 | return 0; | |
1114 | ||
c5981411 | 1115 | prox = (data[1] & 0x20) == 0x20; |
2aaacb15 CB |
1116 | |
1117 | /* | |
1118 | * All reports shared between PEN and RUBBER tool must be | |
1119 | * forced to a known starting value (zero) when transitioning to | |
1120 | * out-of-prox. | |
1121 | * | |
1122 | * If not reset then, to userspace, it will look like lost events | |
1123 | * if new tool comes in-prox with same values as previous tool sent. | |
1124 | * | |
1125 | * Hardware does report zero in most out-of-prox cases but not all. | |
1126 | */ | |
1127 | if (prox) { | |
1128 | if (!wacom->shared->stylus_in_proximity) { | |
1129 | if (data[1] & 0x08) { | |
1130 | wacom->tool[0] = BTN_TOOL_RUBBER; | |
1131 | wacom->id[0] = ERASER_DEVICE_ID; | |
1132 | } else { | |
1133 | wacom->tool[0] = BTN_TOOL_PEN; | |
1134 | wacom->id[0] = STYLUS_DEVICE_ID; | |
1135 | } | |
1136 | wacom->shared->stylus_in_proximity = true; | |
1137 | } | |
1138 | x = le16_to_cpup((__le16 *)&data[2]); | |
1139 | y = le16_to_cpup((__le16 *)&data[4]); | |
1140 | p = le16_to_cpup((__le16 *)&data[6]); | |
c18c2cec CB |
1141 | /* |
1142 | * Convert distance from out prox to distance from tablet. | |
1143 | * distance will be greater than distance_max once | |
1144 | * touching and applying pressure; do not report negative | |
1145 | * distance. | |
1146 | */ | |
1147 | if (data[8] <= wacom->features.distance_max) | |
1148 | d = wacom->features.distance_max - data[8]; | |
1149 | ||
2aaacb15 CB |
1150 | pen = data[1] & 0x01; |
1151 | btn1 = data[1] & 0x02; | |
1152 | btn2 = data[1] & 0x04; | |
1153 | } | |
1154 | ||
1155 | input_report_key(input, BTN_TOUCH, pen); | |
1156 | input_report_key(input, BTN_STYLUS, btn1); | |
1157 | input_report_key(input, BTN_STYLUS2, btn2); | |
1158 | ||
1159 | input_report_abs(input, ABS_X, x); | |
1160 | input_report_abs(input, ABS_Y, y); | |
1161 | input_report_abs(input, ABS_PRESSURE, p); | |
1162 | input_report_abs(input, ABS_DISTANCE, d); | |
1163 | ||
1164 | if (!prox) { | |
1165 | wacom->id[0] = 0; | |
1166 | wacom->shared->stylus_in_proximity = false; | |
1167 | } | |
1168 | ||
1169 | input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */ | |
1170 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ | |
1171 | ||
1172 | return 1; | |
1173 | } | |
1174 | ||
e1d38e49 CB |
1175 | static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) |
1176 | { | |
1177 | if (len == WACOM_PKGLEN_BBTOUCH) | |
1178 | return wacom_bpt_touch(wacom); | |
73149ab8 CB |
1179 | else if (len == WACOM_PKGLEN_BBTOUCH3) |
1180 | return wacom_bpt3_touch(wacom); | |
1181 | else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) | |
2aaacb15 | 1182 | return wacom_bpt_pen(wacom); |
e1d38e49 CB |
1183 | |
1184 | return 0; | |
1185 | } | |
1186 | ||
d3825d51 CB |
1187 | static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) |
1188 | { | |
16bf288c CB |
1189 | unsigned char *data = wacom->data; |
1190 | int connected; | |
1191 | ||
1192 | if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80) | |
d3825d51 CB |
1193 | return 0; |
1194 | ||
16bf288c CB |
1195 | connected = data[1] & 0x01; |
1196 | if (connected) { | |
a1d552cc | 1197 | int pid, battery; |
16bf288c CB |
1198 | |
1199 | pid = get_unaligned_be16(&data[6]); | |
a1d552cc | 1200 | battery = data[5] & 0x3f; |
16bf288c CB |
1201 | if (wacom->pid != pid) { |
1202 | wacom->pid = pid; | |
1203 | wacom_schedule_work(wacom); | |
1204 | } | |
a1d552cc | 1205 | wacom->battery_capacity = battery; |
16bf288c CB |
1206 | } else if (wacom->pid != 0) { |
1207 | /* disconnected while previously connected */ | |
1208 | wacom->pid = 0; | |
1209 | wacom_schedule_work(wacom); | |
a1d552cc | 1210 | wacom->battery_capacity = 0; |
16bf288c CB |
1211 | } |
1212 | ||
d3825d51 CB |
1213 | return 0; |
1214 | } | |
1215 | ||
95dd3b30 | 1216 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) |
3bea733a | 1217 | { |
95dd3b30 DT |
1218 | bool sync; |
1219 | ||
e33da8a5 | 1220 | switch (wacom_wac->features.type) { |
73a97f4f | 1221 | case PENPARTNER: |
95dd3b30 DT |
1222 | sync = wacom_penpartner_irq(wacom_wac); |
1223 | break; | |
73a97f4f DT |
1224 | |
1225 | case PL: | |
95dd3b30 DT |
1226 | sync = wacom_pl_irq(wacom_wac); |
1227 | break; | |
73a97f4f DT |
1228 | |
1229 | case WACOM_G4: | |
1230 | case GRAPHIRE: | |
1231 | case WACOM_MO: | |
95dd3b30 DT |
1232 | sync = wacom_graphire_irq(wacom_wac); |
1233 | break; | |
73a97f4f DT |
1234 | |
1235 | case PTU: | |
95dd3b30 DT |
1236 | sync = wacom_ptu_irq(wacom_wac); |
1237 | break; | |
73a97f4f | 1238 | |
c8f2edc5 PC |
1239 | case DTU: |
1240 | sync = wacom_dtu_irq(wacom_wac); | |
1241 | break; | |
1242 | ||
73a97f4f DT |
1243 | case INTUOS: |
1244 | case INTUOS3S: | |
1245 | case INTUOS3: | |
1246 | case INTUOS3L: | |
1247 | case INTUOS4S: | |
1248 | case INTUOS4: | |
1249 | case INTUOS4L: | |
1250 | case CINTIQ: | |
1251 | case WACOM_BEE: | |
3a4b4aaa | 1252 | case WACOM_21UX2: |
d838c644 | 1253 | case WACOM_22HD: |
803296b6 | 1254 | case WACOM_24HD: |
95dd3b30 DT |
1255 | sync = wacom_intuos_irq(wacom_wac); |
1256 | break; | |
73a97f4f | 1257 | |
ae584ca4 JG |
1258 | case INTUOS5S: |
1259 | case INTUOS5: | |
1260 | case INTUOS5L: | |
1261 | if (len == WACOM_PKGLEN_BBTOUCH3) | |
1262 | sync = wacom_bpt3_touch(wacom_wac); | |
1263 | else | |
1264 | sync = wacom_intuos_irq(wacom_wac); | |
1265 | break; | |
1266 | ||
73a97f4f | 1267 | case TABLETPC: |
ac173837 | 1268 | case TABLETPCE: |
73a97f4f | 1269 | case TABLETPC2FG: |
1963518b | 1270 | case MTSCREEN: |
95dd3b30 DT |
1271 | sync = wacom_tpc_irq(wacom_wac, len); |
1272 | break; | |
73a97f4f | 1273 | |
cb734c03 HR |
1274 | case BAMBOO_PT: |
1275 | sync = wacom_bpt_irq(wacom_wac, len); | |
1276 | break; | |
1277 | ||
d3825d51 CB |
1278 | case WIRELESS: |
1279 | sync = wacom_wireless_irq(wacom_wac, len); | |
1280 | break; | |
1281 | ||
73a97f4f | 1282 | default: |
95dd3b30 DT |
1283 | sync = false; |
1284 | break; | |
3bea733a | 1285 | } |
95dd3b30 DT |
1286 | |
1287 | if (sync) | |
1288 | input_sync(wacom_wac->input); | |
3bea733a PC |
1289 | } |
1290 | ||
6521d0bf | 1291 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) |
8da23fc1 DT |
1292 | { |
1293 | struct input_dev *input_dev = wacom_wac->input; | |
1294 | ||
1295 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); | |
8da23fc1 DT |
1296 | |
1297 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | |
1298 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | |
8da23fc1 DT |
1299 | __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); |
1300 | __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); | |
1301 | __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); | |
8da23fc1 DT |
1302 | __set_bit(BTN_STYLUS, input_dev->keybit); |
1303 | __set_bit(BTN_STYLUS2, input_dev->keybit); | |
1304 | ||
1305 | input_set_abs_params(input_dev, ABS_DISTANCE, | |
1306 | 0, wacom_wac->features.distance_max, 0, 0); | |
1307 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); | |
1308 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); | |
1309 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); | |
6521d0bf PC |
1310 | } |
1311 | ||
1312 | static void wacom_setup_intuos(struct wacom_wac *wacom_wac) | |
1313 | { | |
1314 | struct input_dev *input_dev = wacom_wac->input; | |
1315 | ||
1316 | input_set_capability(input_dev, EV_REL, REL_WHEEL); | |
1317 | ||
1318 | wacom_setup_cintiq(wacom_wac); | |
1319 | ||
1320 | __set_bit(BTN_LEFT, input_dev->keybit); | |
1321 | __set_bit(BTN_RIGHT, input_dev->keybit); | |
1322 | __set_bit(BTN_MIDDLE, input_dev->keybit); | |
1323 | __set_bit(BTN_SIDE, input_dev->keybit); | |
1324 | __set_bit(BTN_EXTRA, input_dev->keybit); | |
1325 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); | |
1326 | __set_bit(BTN_TOOL_LENS, input_dev->keybit); | |
1327 | ||
8da23fc1 DT |
1328 | input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); |
1329 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); | |
1330 | } | |
1331 | ||
bc73dd39 HR |
1332 | void wacom_setup_device_quirks(struct wacom_features *features) |
1333 | { | |
1334 | ||
1335 | /* touch device found but size is not defined. use default */ | |
84eb5aa6 | 1336 | if (features->device_type == BTN_TOOL_FINGER && !features->x_max) { |
bc73dd39 HR |
1337 | features->x_max = 1023; |
1338 | features->y_max = 1023; | |
1339 | } | |
1340 | ||
1341 | /* these device have multiple inputs */ | |
ea2e6024 PC |
1342 | if (features->type >= WIRELESS || |
1343 | (features->type >= INTUOS5S && features->type <= INTUOS5L)) | |
bc73dd39 | 1344 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
cb734c03 | 1345 | |
73149ab8 | 1346 | /* quirk for bamboo touch with 2 low res touches */ |
cb734c03 | 1347 | if (features->type == BAMBOO_PT && |
73149ab8 | 1348 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
f4ccbef2 HR |
1349 | features->x_max <<= 5; |
1350 | features->y_max <<= 5; | |
1351 | features->x_fuzz <<= 5; | |
1352 | features->y_fuzz <<= 5; | |
f4ccbef2 | 1353 | features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; |
cb734c03 | 1354 | } |
d3825d51 CB |
1355 | |
1356 | if (features->type == WIRELESS) { | |
1357 | ||
1358 | /* monitor never has input and pen/touch have delayed create */ | |
1359 | features->quirks |= WACOM_QUIRK_NO_INPUT; | |
1360 | ||
1361 | /* must be monitor interface if no device_type set */ | |
1362 | if (!features->device_type) | |
1363 | features->quirks |= WACOM_QUIRK_MONITOR; | |
1364 | } | |
bc73dd39 HR |
1365 | } |
1366 | ||
409550f2 PC |
1367 | static unsigned int wacom_calculate_touch_res(unsigned int logical_max, |
1368 | unsigned int physical_max) | |
1369 | { | |
1370 | /* Touch physical dimensions are in 100th of mm */ | |
1371 | return (logical_max * 100) / physical_max; | |
1372 | } | |
1373 | ||
1963518b PC |
1374 | int wacom_setup_input_capabilities(struct input_dev *input_dev, |
1375 | struct wacom_wac *wacom_wac) | |
3bea733a | 1376 | { |
8da23fc1 DT |
1377 | struct wacom_features *features = &wacom_wac->features; |
1378 | int i; | |
1379 | ||
1380 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | |
1381 | ||
1382 | __set_bit(BTN_TOUCH, input_dev->keybit); | |
1383 | ||
fed87e65 HR |
1384 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, |
1385 | features->x_fuzz, 0); | |
1386 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, | |
1387 | features->y_fuzz, 0); | |
8da23fc1 | 1388 | |
e35fb8c1 | 1389 | if (features->device_type == BTN_TOOL_PEN) { |
cfb7d557 PC |
1390 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, |
1391 | features->pressure_fuzz, 0); | |
1392 | ||
e35fb8c1 PC |
1393 | /* penabled devices have fixed resolution for each model */ |
1394 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); | |
1395 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); | |
1396 | } else { | |
1397 | input_abs_set_res(input_dev, ABS_X, | |
1398 | wacom_calculate_touch_res(features->x_max, | |
1399 | features->x_phy)); | |
1400 | input_abs_set_res(input_dev, ABS_Y, | |
1401 | wacom_calculate_touch_res(features->y_max, | |
1402 | features->y_phy)); | |
1403 | } | |
1404 | ||
8da23fc1 DT |
1405 | __set_bit(ABS_MISC, input_dev->absbit); |
1406 | ||
e33da8a5 | 1407 | switch (wacom_wac->features.type) { |
73a97f4f | 1408 | case WACOM_MO: |
8da23fc1 DT |
1409 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
1410 | /* fall through */ | |
73a97f4f DT |
1411 | |
1412 | case WACOM_G4: | |
8da23fc1 DT |
1413 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
1414 | ||
0bd10ef8 PC |
1415 | __set_bit(BTN_BACK, input_dev->keybit); |
1416 | __set_bit(BTN_FORWARD, input_dev->keybit); | |
73a97f4f DT |
1417 | /* fall through */ |
1418 | ||
1419 | case GRAPHIRE: | |
8da23fc1 DT |
1420 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
1421 | ||
1422 | __set_bit(BTN_LEFT, input_dev->keybit); | |
1423 | __set_bit(BTN_RIGHT, input_dev->keybit); | |
1424 | __set_bit(BTN_MIDDLE, input_dev->keybit); | |
1425 | ||
1426 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | |
1427 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | |
1428 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); | |
1429 | __set_bit(BTN_STYLUS, input_dev->keybit); | |
1430 | __set_bit(BTN_STYLUS2, input_dev->keybit); | |
3512069e JG |
1431 | |
1432 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | |
73a97f4f DT |
1433 | break; |
1434 | ||
803296b6 JG |
1435 | case WACOM_24HD: |
1436 | __set_bit(BTN_A, input_dev->keybit); | |
1437 | __set_bit(BTN_B, input_dev->keybit); | |
1438 | __set_bit(BTN_C, input_dev->keybit); | |
1439 | __set_bit(BTN_X, input_dev->keybit); | |
1440 | __set_bit(BTN_Y, input_dev->keybit); | |
1441 | __set_bit(BTN_Z, input_dev->keybit); | |
1442 | ||
1443 | for (i = 0; i < 10; i++) | |
1444 | __set_bit(BTN_0 + i, input_dev->keybit); | |
1445 | ||
1446 | __set_bit(KEY_PROG1, input_dev->keybit); | |
1447 | __set_bit(KEY_PROG2, input_dev->keybit); | |
1448 | __set_bit(KEY_PROG3, input_dev->keybit); | |
1449 | ||
1450 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | |
1451 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | |
1452 | wacom_setup_cintiq(wacom_wac); | |
1453 | break; | |
1454 | ||
d838c644 PC |
1455 | case WACOM_22HD: |
1456 | __set_bit(KEY_PROG1, input_dev->keybit); | |
1457 | __set_bit(KEY_PROG2, input_dev->keybit); | |
1458 | __set_bit(KEY_PROG3, input_dev->keybit); | |
1459 | /* fall through */ | |
1460 | ||
3a4b4aaa PC |
1461 | case WACOM_21UX2: |
1462 | __set_bit(BTN_A, input_dev->keybit); | |
1463 | __set_bit(BTN_B, input_dev->keybit); | |
1464 | __set_bit(BTN_C, input_dev->keybit); | |
1465 | __set_bit(BTN_X, input_dev->keybit); | |
1466 | __set_bit(BTN_Y, input_dev->keybit); | |
1467 | __set_bit(BTN_Z, input_dev->keybit); | |
1468 | __set_bit(BTN_BASE, input_dev->keybit); | |
1469 | __set_bit(BTN_BASE2, input_dev->keybit); | |
1470 | /* fall through */ | |
1471 | ||
73a97f4f | 1472 | case WACOM_BEE: |
8da23fc1 DT |
1473 | __set_bit(BTN_8, input_dev->keybit); |
1474 | __set_bit(BTN_9, input_dev->keybit); | |
1475 | /* fall through */ | |
73a97f4f | 1476 | |
6521d0bf PC |
1477 | case CINTIQ: |
1478 | for (i = 0; i < 8; i++) | |
1479 | __set_bit(BTN_0 + i, input_dev->keybit); | |
6521d0bf | 1480 | |
d6069dae JG |
1481 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
1482 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | |
6521d0bf | 1483 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
3512069e JG |
1484 | |
1485 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | |
1486 | ||
6521d0bf PC |
1487 | wacom_setup_cintiq(wacom_wac); |
1488 | break; | |
1489 | ||
73a97f4f DT |
1490 | case INTUOS3: |
1491 | case INTUOS3L: | |
8da23fc1 DT |
1492 | __set_bit(BTN_4, input_dev->keybit); |
1493 | __set_bit(BTN_5, input_dev->keybit); | |
1494 | __set_bit(BTN_6, input_dev->keybit); | |
1495 | __set_bit(BTN_7, input_dev->keybit); | |
1496 | ||
1497 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | |
73a97f4f DT |
1498 | /* fall through */ |
1499 | ||
1500 | case INTUOS3S: | |
8da23fc1 DT |
1501 | __set_bit(BTN_0, input_dev->keybit); |
1502 | __set_bit(BTN_1, input_dev->keybit); | |
1503 | __set_bit(BTN_2, input_dev->keybit); | |
1504 | __set_bit(BTN_3, input_dev->keybit); | |
1505 | ||
8da23fc1 DT |
1506 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
1507 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | |
73a97f4f DT |
1508 | /* fall through */ |
1509 | ||
1510 | case INTUOS: | |
3512069e JG |
1511 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
1512 | ||
8da23fc1 | 1513 | wacom_setup_intuos(wacom_wac); |
73a97f4f DT |
1514 | break; |
1515 | ||
9fee6195 JG |
1516 | case INTUOS5: |
1517 | case INTUOS5L: | |
ae584ca4 JG |
1518 | if (features->device_type == BTN_TOOL_PEN) { |
1519 | __set_bit(BTN_7, input_dev->keybit); | |
1520 | __set_bit(BTN_8, input_dev->keybit); | |
1521 | } | |
1522 | /* fall through */ | |
1523 | ||
1524 | case INTUOS5S: | |
1525 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | |
1526 | ||
1527 | if (features->device_type == BTN_TOOL_PEN) { | |
1528 | for (i = 0; i < 7; i++) | |
1529 | __set_bit(BTN_0 + i, input_dev->keybit); | |
1530 | ||
1531 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, | |
1532 | features->distance_max, | |
1533 | 0, 0); | |
1534 | ||
1535 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | |
1536 | ||
1537 | wacom_setup_intuos(wacom_wac); | |
1538 | } else if (features->device_type == BTN_TOOL_FINGER) { | |
1539 | __clear_bit(ABS_MISC, input_dev->absbit); | |
1540 | ||
1541 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | |
1542 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | |
1543 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | |
1544 | __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); | |
1545 | ||
b4adbbef | 1546 | input_mt_init_slots(input_dev, features->touch_max, 0); |
ae584ca4 JG |
1547 | |
1548 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | |
4e904954 JG |
1549 | 0, features->x_max, 0, 0); |
1550 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, | |
1551 | 0, features->y_max, 0, 0); | |
ae584ca4 JG |
1552 | |
1553 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | |
1554 | 0, features->x_max, | |
1555 | features->x_fuzz, 0); | |
1556 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | |
1557 | 0, features->y_max, | |
1558 | features->y_fuzz, 0); | |
1559 | } | |
1560 | break; | |
1561 | ||
73a97f4f DT |
1562 | case INTUOS4: |
1563 | case INTUOS4L: | |
8da23fc1 DT |
1564 | __set_bit(BTN_7, input_dev->keybit); |
1565 | __set_bit(BTN_8, input_dev->keybit); | |
73a97f4f DT |
1566 | /* fall through */ |
1567 | ||
1568 | case INTUOS4S: | |
8da23fc1 DT |
1569 | for (i = 0; i < 7; i++) |
1570 | __set_bit(BTN_0 + i, input_dev->keybit); | |
8da23fc1 DT |
1571 | |
1572 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | |
1573 | wacom_setup_intuos(wacom_wac); | |
3512069e JG |
1574 | |
1575 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | |
73a97f4f DT |
1576 | break; |
1577 | ||
1963518b | 1578 | case MTSCREEN: |
8b4a0c1f | 1579 | if (features->device_type == BTN_TOOL_FINGER) { |
1963518b PC |
1580 | wacom_wac->slots = kmalloc(features->touch_max * |
1581 | sizeof(int), | |
1582 | GFP_KERNEL); | |
1583 | if (!wacom_wac->slots) | |
1584 | return -ENOMEM; | |
1585 | ||
1586 | for (i = 0; i < features->touch_max; i++) | |
1587 | wacom_wac->slots[i] = -1; | |
6795a524 PC |
1588 | } |
1589 | /* fall through */ | |
1963518b | 1590 | |
6795a524 PC |
1591 | case TABLETPC2FG: |
1592 | if (features->device_type == BTN_TOOL_FINGER) { | |
b4adbbef | 1593 | input_mt_init_slots(input_dev, features->touch_max, 0); |
84eb5aa6 PC |
1594 | input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, |
1595 | 0, MT_TOOL_MAX, 0, 0); | |
1596 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | |
1597 | 0, features->x_max, 0, 0); | |
1598 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | |
1599 | 0, features->y_max, 0, 0); | |
8da23fc1 | 1600 | } |
73a97f4f DT |
1601 | /* fall through */ |
1602 | ||
1603 | case TABLETPC: | |
ac173837 | 1604 | case TABLETPCE: |
a43c7c53 PC |
1605 | __clear_bit(ABS_MISC, input_dev->absbit); |
1606 | ||
3512069e JG |
1607 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
1608 | ||
e35fb8c1 | 1609 | if (features->device_type != BTN_TOOL_PEN) |
73a97f4f | 1610 | break; /* no need to process stylus stuff */ |
e35fb8c1 | 1611 | |
73a97f4f DT |
1612 | /* fall through */ |
1613 | ||
1614 | case PL: | |
c8f2edc5 | 1615 | case DTU: |
8da23fc1 | 1616 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
3512069e | 1617 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
8da23fc1 DT |
1618 | __set_bit(BTN_STYLUS, input_dev->keybit); |
1619 | __set_bit(BTN_STYLUS2, input_dev->keybit); | |
3512069e JG |
1620 | |
1621 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | |
1622 | break; | |
1623 | ||
1624 | case PTU: | |
8da23fc1 | 1625 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
73a97f4f DT |
1626 | /* fall through */ |
1627 | ||
1628 | case PENPARTNER: | |
1fab84aa | 1629 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
8da23fc1 | 1630 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1fab84aa | 1631 | __set_bit(BTN_STYLUS, input_dev->keybit); |
3512069e JG |
1632 | |
1633 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | |
73a97f4f | 1634 | break; |
cb734c03 HR |
1635 | |
1636 | case BAMBOO_PT: | |
1637 | __clear_bit(ABS_MISC, input_dev->absbit); | |
1638 | ||
3512069e JG |
1639 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
1640 | ||
8b4a0c1f | 1641 | if (features->device_type == BTN_TOOL_FINGER) { |
cb734c03 HR |
1642 | __set_bit(BTN_LEFT, input_dev->keybit); |
1643 | __set_bit(BTN_FORWARD, input_dev->keybit); | |
1644 | __set_bit(BTN_BACK, input_dev->keybit); | |
1645 | __set_bit(BTN_RIGHT, input_dev->keybit); | |
1646 | ||
1647 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | |
1648 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | |
b4adbbef | 1649 | input_mt_init_slots(input_dev, features->touch_max, 0); |
cb734c03 | 1650 | |
73149ab8 CB |
1651 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
1652 | __set_bit(BTN_TOOL_TRIPLETAP, | |
1653 | input_dev->keybit); | |
1654 | __set_bit(BTN_TOOL_QUADTAP, | |
1655 | input_dev->keybit); | |
1656 | ||
73149ab8 CB |
1657 | input_set_abs_params(input_dev, |
1658 | ABS_MT_TOUCH_MAJOR, | |
4e904954 JG |
1659 | 0, features->x_max, 0, 0); |
1660 | input_set_abs_params(input_dev, | |
1661 | ABS_MT_TOUCH_MINOR, | |
1662 | 0, features->y_max, 0, 0); | |
73149ab8 CB |
1663 | } |
1664 | ||
cb734c03 HR |
1665 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
1666 | 0, features->x_max, | |
1667 | features->x_fuzz, 0); | |
1668 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | |
1669 | 0, features->y_max, | |
1670 | features->y_fuzz, 0); | |
2aaacb15 CB |
1671 | } else if (features->device_type == BTN_TOOL_PEN) { |
1672 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | |
1673 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | |
1674 | __set_bit(BTN_STYLUS, input_dev->keybit); | |
1675 | __set_bit(BTN_STYLUS2, input_dev->keybit); | |
c18c2cec CB |
1676 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
1677 | features->distance_max, | |
1678 | 0, 0); | |
cb734c03 HR |
1679 | } |
1680 | break; | |
3bea733a | 1681 | } |
1963518b | 1682 | return 0; |
3bea733a PC |
1683 | } |
1684 | ||
e87a344d | 1685 | static const struct wacom_features wacom_features_0x00 = |
e35fb8c1 PC |
1686 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, |
1687 | 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; | |
e87a344d | 1688 | static const struct wacom_features wacom_features_0x10 = |
e35fb8c1 PC |
1689 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, |
1690 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1691 | static const struct wacom_features wacom_features_0x11 = |
e35fb8c1 PC |
1692 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, |
1693 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1694 | static const struct wacom_features wacom_features_0x12 = |
e35fb8c1 PC |
1695 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, |
1696 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1697 | static const struct wacom_features wacom_features_0x13 = |
e35fb8c1 PC |
1698 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, |
1699 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1700 | static const struct wacom_features wacom_features_0x14 = |
e35fb8c1 PC |
1701 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, |
1702 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1703 | static const struct wacom_features wacom_features_0x15 = |
e35fb8c1 PC |
1704 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, |
1705 | 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1706 | static const struct wacom_features wacom_features_0x16 = |
e35fb8c1 PC |
1707 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, |
1708 | 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1709 | static const struct wacom_features wacom_features_0x17 = |
e35fb8c1 PC |
1710 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, |
1711 | 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1712 | static const struct wacom_features wacom_features_0x18 = |
e35fb8c1 PC |
1713 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, |
1714 | 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1715 | static const struct wacom_features wacom_features_0x19 = |
e35fb8c1 PC |
1716 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, |
1717 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | |
e87a344d | 1718 | static const struct wacom_features wacom_features_0x60 = |
e35fb8c1 PC |
1719 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, |
1720 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | |
e87a344d | 1721 | static const struct wacom_features wacom_features_0x61 = |
e35fb8c1 PC |
1722 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, |
1723 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | |
e87a344d | 1724 | static const struct wacom_features wacom_features_0x62 = |
e35fb8c1 PC |
1725 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, |
1726 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | |
e87a344d | 1727 | static const struct wacom_features wacom_features_0x63 = |
e35fb8c1 PC |
1728 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, |
1729 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | |
e87a344d | 1730 | static const struct wacom_features wacom_features_0x64 = |
e35fb8c1 PC |
1731 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, |
1732 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | |
e87a344d | 1733 | static const struct wacom_features wacom_features_0x65 = |
e35fb8c1 PC |
1734 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, |
1735 | 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1736 | static const struct wacom_features wacom_features_0x69 = |
e35fb8c1 PC |
1737 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, |
1738 | 63, GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; | |
11d0cf88 PC |
1739 | static const struct wacom_features wacom_features_0x6A = |
1740 | { "Wacom Bamboo1 4x6", WACOM_PKGLEN_GRAPHIRE, 14760, 9225, 1023, | |
1741 | 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
1742 | static const struct wacom_features wacom_features_0x6B = | |
1743 | { "Wacom Bamboo1 5x8", WACOM_PKGLEN_GRAPHIRE, 21648, 13530, 1023, | |
1744 | 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1745 | static const struct wacom_features wacom_features_0x20 = |
e35fb8c1 PC |
1746 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, |
1747 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1748 | static const struct wacom_features wacom_features_0x21 = |
e35fb8c1 PC |
1749 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
1750 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1751 | static const struct wacom_features wacom_features_0x22 = |
e35fb8c1 PC |
1752 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, |
1753 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1754 | static const struct wacom_features wacom_features_0x23 = |
e35fb8c1 PC |
1755 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, |
1756 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1757 | static const struct wacom_features wacom_features_0x24 = |
e35fb8c1 PC |
1758 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, |
1759 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1760 | static const struct wacom_features wacom_features_0x30 = |
e35fb8c1 PC |
1761 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, |
1762 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1763 | static const struct wacom_features wacom_features_0x31 = |
e35fb8c1 PC |
1764 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, |
1765 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1766 | static const struct wacom_features wacom_features_0x32 = |
e35fb8c1 PC |
1767 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, |
1768 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1769 | static const struct wacom_features wacom_features_0x33 = |
e35fb8c1 PC |
1770 | { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, |
1771 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1772 | static const struct wacom_features wacom_features_0x34 = |
e35fb8c1 PC |
1773 | { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, |
1774 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1775 | static const struct wacom_features wacom_features_0x35 = |
e35fb8c1 PC |
1776 | { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, |
1777 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1778 | static const struct wacom_features wacom_features_0x37 = |
e35fb8c1 PC |
1779 | { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, |
1780 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1781 | static const struct wacom_features wacom_features_0x38 = |
e35fb8c1 PC |
1782 | { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, |
1783 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1784 | static const struct wacom_features wacom_features_0x39 = |
e35fb8c1 PC |
1785 | { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, |
1786 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1787 | static const struct wacom_features wacom_features_0xC4 = |
e35fb8c1 PC |
1788 | { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, |
1789 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1790 | static const struct wacom_features wacom_features_0xC0 = |
e35fb8c1 PC |
1791 | { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, |
1792 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1793 | static const struct wacom_features wacom_features_0xC2 = |
e35fb8c1 PC |
1794 | { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, |
1795 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1796 | static const struct wacom_features wacom_features_0x03 = |
e35fb8c1 PC |
1797 | { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, |
1798 | 0, PTU, WACOM_PL_RES, WACOM_PL_RES }; | |
e87a344d | 1799 | static const struct wacom_features wacom_features_0x41 = |
e35fb8c1 PC |
1800 | { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, |
1801 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1802 | static const struct wacom_features wacom_features_0x42 = |
e35fb8c1 PC |
1803 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
1804 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1805 | static const struct wacom_features wacom_features_0x43 = |
e35fb8c1 PC |
1806 | { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, |
1807 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1808 | static const struct wacom_features wacom_features_0x44 = |
e35fb8c1 PC |
1809 | { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, |
1810 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1811 | static const struct wacom_features wacom_features_0x45 = |
e35fb8c1 PC |
1812 | { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, |
1813 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1814 | static const struct wacom_features wacom_features_0xB0 = |
e35fb8c1 PC |
1815 | { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, |
1816 | 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1817 | static const struct wacom_features wacom_features_0xB1 = |
e35fb8c1 PC |
1818 | { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, |
1819 | 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1820 | static const struct wacom_features wacom_features_0xB2 = |
e35fb8c1 PC |
1821 | { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, |
1822 | 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1823 | static const struct wacom_features wacom_features_0xB3 = |
e35fb8c1 PC |
1824 | { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, |
1825 | 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1826 | static const struct wacom_features wacom_features_0xB4 = |
e35fb8c1 PC |
1827 | { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, |
1828 | 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1829 | static const struct wacom_features wacom_features_0xB5 = |
e35fb8c1 PC |
1830 | { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, |
1831 | 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1832 | static const struct wacom_features wacom_features_0xB7 = |
e35fb8c1 PC |
1833 | { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, |
1834 | 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1835 | static const struct wacom_features wacom_features_0xB8 = |
e35fb8c1 PC |
1836 | { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, |
1837 | 63, INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1838 | static const struct wacom_features wacom_features_0xB9 = |
e35fb8c1 PC |
1839 | { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, |
1840 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1841 | static const struct wacom_features wacom_features_0xBA = |
e35fb8c1 PC |
1842 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, |
1843 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1844 | static const struct wacom_features wacom_features_0xBB = |
e35fb8c1 PC |
1845 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, |
1846 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
3a4b4aaa | 1847 | static const struct wacom_features wacom_features_0xBC = |
e35fb8c1 PC |
1848 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, |
1849 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
9fee6195 JG |
1850 | static const struct wacom_features wacom_features_0x26 = |
1851 | { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | |
f393ee2b PC |
1852 | 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
1853 | .touch_max = 16 }; | |
9fee6195 JG |
1854 | static const struct wacom_features wacom_features_0x27 = |
1855 | { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, | |
f393ee2b PC |
1856 | 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
1857 | .touch_max = 16 }; | |
9fee6195 JG |
1858 | static const struct wacom_features wacom_features_0x28 = |
1859 | { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, | |
f393ee2b PC |
1860 | 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
1861 | .touch_max = 16 }; | |
9fee6195 JG |
1862 | static const struct wacom_features wacom_features_0x29 = |
1863 | { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | |
1864 | 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
1865 | static const struct wacom_features wacom_features_0x2A = | |
1866 | { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, | |
1867 | 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
803296b6 | 1868 | static const struct wacom_features wacom_features_0xF4 = |
6f4d0382 JG |
1869 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, |
1870 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
1871 | static const struct wacom_features wacom_features_0xF8 = | |
1872 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, | |
803296b6 | 1873 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
e87a344d | 1874 | static const struct wacom_features wacom_features_0x3F = |
e35fb8c1 PC |
1875 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, |
1876 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1877 | static const struct wacom_features wacom_features_0xC5 = |
e35fb8c1 PC |
1878 | { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, |
1879 | 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1880 | static const struct wacom_features wacom_features_0xC6 = |
e35fb8c1 PC |
1881 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, |
1882 | 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1883 | static const struct wacom_features wacom_features_0xC7 = |
e35fb8c1 PC |
1884 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, |
1885 | 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
c8f2edc5 | 1886 | static const struct wacom_features wacom_features_0xCE = |
e35fb8c1 PC |
1887 | { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511, |
1888 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
c8f2edc5 | 1889 | static const struct wacom_features wacom_features_0xF0 = |
e35fb8c1 PC |
1890 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, |
1891 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
3a4b4aaa | 1892 | static const struct wacom_features wacom_features_0xCC = |
e35fb8c1 PC |
1893 | { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047, |
1894 | 63, WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
d838c644 PC |
1895 | static const struct wacom_features wacom_features_0xFA = |
1896 | { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, | |
1897 | 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | |
e87a344d | 1898 | static const struct wacom_features wacom_features_0x90 = |
e35fb8c1 PC |
1899 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, |
1900 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1901 | static const struct wacom_features wacom_features_0x93 = |
e35fb8c1 PC |
1902 | { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, |
1903 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
11d0cf88 PC |
1904 | static const struct wacom_features wacom_features_0x97 = |
1905 | { "Wacom ISDv4 97", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 511, | |
1906 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1907 | static const struct wacom_features wacom_features_0x9A = |
e35fb8c1 PC |
1908 | { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, |
1909 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1910 | static const struct wacom_features wacom_features_0x9F = |
e35fb8c1 PC |
1911 | { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, |
1912 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1913 | static const struct wacom_features wacom_features_0xE2 = |
e35fb8c1 | 1914 | { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, |
f393ee2b PC |
1915 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1916 | .touch_max = 2 }; | |
e87a344d | 1917 | static const struct wacom_features wacom_features_0xE3 = |
e35fb8c1 | 1918 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, |
f393ee2b PC |
1919 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1920 | .touch_max = 2 }; | |
1963518b PC |
1921 | static const struct wacom_features wacom_features_0xE5 = |
1922 | { "Wacom ISDv4 E5", WACOM_PKGLEN_MTOUCH, 26202, 16325, 255, | |
1923 | 0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
26fcd2a7 MI |
1924 | static const struct wacom_features wacom_features_0xE6 = |
1925 | { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, | |
f393ee2b PC |
1926 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1927 | .touch_max = 2 }; | |
0d0e3064 CB |
1928 | static const struct wacom_features wacom_features_0xEC = |
1929 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, | |
1930 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
ac173837 PC |
1931 | static const struct wacom_features wacom_features_0xED = |
1932 | { "Wacom ISDv4 ED", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | |
1933 | 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
1934 | static const struct wacom_features wacom_features_0xEF = | |
1935 | { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | |
1936 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
e87a344d | 1937 | static const struct wacom_features wacom_features_0x47 = |
e35fb8c1 PC |
1938 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
1939 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
d3825d51 CB |
1940 | static const struct wacom_features wacom_features_0x84 = |
1941 | { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, | |
f393ee2b | 1942 | 0, WIRELESS, 0, 0, .touch_max = 16 }; |
7b824bbd | 1943 | static const struct wacom_features wacom_features_0xD0 = |
e35fb8c1 | 1944 | { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
f393ee2b PC |
1945 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1946 | .touch_max = 2 }; | |
7b824bbd | 1947 | static const struct wacom_features wacom_features_0xD1 = |
e35fb8c1 | 1948 | { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
f393ee2b PC |
1949 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1950 | .touch_max = 2 }; | |
7b824bbd | 1951 | static const struct wacom_features wacom_features_0xD2 = |
e35fb8c1 | 1952 | { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
c18c2cec | 1953 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
7b824bbd | 1954 | static const struct wacom_features wacom_features_0xD3 = |
ae927560 | 1955 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, |
f393ee2b PC |
1956 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1957 | .touch_max = 2 }; | |
57a7872f | 1958 | static const struct wacom_features wacom_features_0xD4 = |
a001a8f3 | 1959 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
c18c2cec | 1960 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
18adad1c | 1961 | static const struct wacom_features wacom_features_0xD5 = |
ae927560 | 1962 | { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, |
c18c2cec | 1963 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
7b824bbd | 1964 | static const struct wacom_features wacom_features_0xD6 = |
e35fb8c1 | 1965 | { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
f393ee2b PC |
1966 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1967 | .touch_max = 2 }; | |
7b824bbd | 1968 | static const struct wacom_features wacom_features_0xD7 = |
e35fb8c1 | 1969 | { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
f393ee2b PC |
1970 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1971 | .touch_max = 2 }; | |
7b824bbd | 1972 | static const struct wacom_features wacom_features_0xD8 = |
ae927560 | 1973 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, |
f393ee2b PC |
1974 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1975 | .touch_max = 2 }; | |
7b824bbd | 1976 | static const struct wacom_features wacom_features_0xDA = |
e35fb8c1 | 1977 | { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
f393ee2b PC |
1978 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1979 | .touch_max = 2 }; | |
47d09235 | 1980 | static struct wacom_features wacom_features_0xDB = |
ae927560 | 1981 | { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, |
f393ee2b PC |
1982 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1983 | .touch_max = 2 }; | |
73149ab8 CB |
1984 | static const struct wacom_features wacom_features_0xDD = |
1985 | { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, | |
1986 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
1987 | static const struct wacom_features wacom_features_0xDE = | |
1988 | { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, | |
f393ee2b PC |
1989 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1990 | .touch_max = 16 }; | |
73149ab8 CB |
1991 | static const struct wacom_features wacom_features_0xDF = |
1992 | { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, | |
f393ee2b PC |
1993 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
1994 | .touch_max = 16 }; | |
7b4b3068 | 1995 | static const struct wacom_features wacom_features_0x6004 = |
e35fb8c1 PC |
1996 | { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, |
1997 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | |
b036f6fb BB |
1998 | |
1999 | #define USB_DEVICE_WACOM(prod) \ | |
2000 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | |
2001 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | |
2002 | ||
1483f551 AR |
2003 | #define USB_DEVICE_DETAILED(prod, class, sub, proto) \ |
2004 | USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_WACOM, prod, class, \ | |
2005 | sub, proto), \ | |
2006 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | |
2007 | ||
7b4b3068 AR |
2008 | #define USB_DEVICE_LENOVO(prod) \ |
2009 | USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ | |
2010 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | |
2011 | ||
b036f6fb BB |
2012 | const struct usb_device_id wacom_ids[] = { |
2013 | { USB_DEVICE_WACOM(0x00) }, | |
2014 | { USB_DEVICE_WACOM(0x10) }, | |
2015 | { USB_DEVICE_WACOM(0x11) }, | |
2016 | { USB_DEVICE_WACOM(0x12) }, | |
2017 | { USB_DEVICE_WACOM(0x13) }, | |
2018 | { USB_DEVICE_WACOM(0x14) }, | |
2019 | { USB_DEVICE_WACOM(0x15) }, | |
2020 | { USB_DEVICE_WACOM(0x16) }, | |
2021 | { USB_DEVICE_WACOM(0x17) }, | |
2022 | { USB_DEVICE_WACOM(0x18) }, | |
2023 | { USB_DEVICE_WACOM(0x19) }, | |
2024 | { USB_DEVICE_WACOM(0x60) }, | |
2025 | { USB_DEVICE_WACOM(0x61) }, | |
2026 | { USB_DEVICE_WACOM(0x62) }, | |
2027 | { USB_DEVICE_WACOM(0x63) }, | |
2028 | { USB_DEVICE_WACOM(0x64) }, | |
2029 | { USB_DEVICE_WACOM(0x65) }, | |
2030 | { USB_DEVICE_WACOM(0x69) }, | |
11d0cf88 PC |
2031 | { USB_DEVICE_WACOM(0x6A) }, |
2032 | { USB_DEVICE_WACOM(0x6B) }, | |
b036f6fb BB |
2033 | { USB_DEVICE_WACOM(0x20) }, |
2034 | { USB_DEVICE_WACOM(0x21) }, | |
2035 | { USB_DEVICE_WACOM(0x22) }, | |
2036 | { USB_DEVICE_WACOM(0x23) }, | |
2037 | { USB_DEVICE_WACOM(0x24) }, | |
2038 | { USB_DEVICE_WACOM(0x30) }, | |
2039 | { USB_DEVICE_WACOM(0x31) }, | |
2040 | { USB_DEVICE_WACOM(0x32) }, | |
2041 | { USB_DEVICE_WACOM(0x33) }, | |
2042 | { USB_DEVICE_WACOM(0x34) }, | |
2043 | { USB_DEVICE_WACOM(0x35) }, | |
2044 | { USB_DEVICE_WACOM(0x37) }, | |
2045 | { USB_DEVICE_WACOM(0x38) }, | |
2046 | { USB_DEVICE_WACOM(0x39) }, | |
2047 | { USB_DEVICE_WACOM(0xC4) }, | |
2048 | { USB_DEVICE_WACOM(0xC0) }, | |
2049 | { USB_DEVICE_WACOM(0xC2) }, | |
2050 | { USB_DEVICE_WACOM(0x03) }, | |
2051 | { USB_DEVICE_WACOM(0x41) }, | |
2052 | { USB_DEVICE_WACOM(0x42) }, | |
2053 | { USB_DEVICE_WACOM(0x43) }, | |
2054 | { USB_DEVICE_WACOM(0x44) }, | |
2055 | { USB_DEVICE_WACOM(0x45) }, | |
2056 | { USB_DEVICE_WACOM(0xB0) }, | |
2057 | { USB_DEVICE_WACOM(0xB1) }, | |
2058 | { USB_DEVICE_WACOM(0xB2) }, | |
2059 | { USB_DEVICE_WACOM(0xB3) }, | |
2060 | { USB_DEVICE_WACOM(0xB4) }, | |
2061 | { USB_DEVICE_WACOM(0xB5) }, | |
2062 | { USB_DEVICE_WACOM(0xB7) }, | |
2063 | { USB_DEVICE_WACOM(0xB8) }, | |
2064 | { USB_DEVICE_WACOM(0xB9) }, | |
2065 | { USB_DEVICE_WACOM(0xBA) }, | |
2066 | { USB_DEVICE_WACOM(0xBB) }, | |
3a4b4aaa | 2067 | { USB_DEVICE_WACOM(0xBC) }, |
9fee6195 JG |
2068 | { USB_DEVICE_WACOM(0x26) }, |
2069 | { USB_DEVICE_WACOM(0x27) }, | |
2070 | { USB_DEVICE_WACOM(0x28) }, | |
2071 | { USB_DEVICE_WACOM(0x29) }, | |
2072 | { USB_DEVICE_WACOM(0x2A) }, | |
b036f6fb BB |
2073 | { USB_DEVICE_WACOM(0x3F) }, |
2074 | { USB_DEVICE_WACOM(0xC5) }, | |
2075 | { USB_DEVICE_WACOM(0xC6) }, | |
2076 | { USB_DEVICE_WACOM(0xC7) }, | |
1483f551 AR |
2077 | /* |
2078 | * DTU-2231 has two interfaces on the same configuration, | |
2079 | * only one is used. | |
2080 | */ | |
2081 | { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID, | |
2082 | USB_INTERFACE_SUBCLASS_BOOT, | |
2083 | USB_INTERFACE_PROTOCOL_MOUSE) }, | |
d3825d51 | 2084 | { USB_DEVICE_WACOM(0x84) }, |
cb734c03 | 2085 | { USB_DEVICE_WACOM(0xD0) }, |
2aaacb15 CB |
2086 | { USB_DEVICE_WACOM(0xD1) }, |
2087 | { USB_DEVICE_WACOM(0xD2) }, | |
2088 | { USB_DEVICE_WACOM(0xD3) }, | |
57a7872f | 2089 | { USB_DEVICE_WACOM(0xD4) }, |
18adad1c | 2090 | { USB_DEVICE_WACOM(0xD5) }, |
d38acb49 PC |
2091 | { USB_DEVICE_WACOM(0xD6) }, |
2092 | { USB_DEVICE_WACOM(0xD7) }, | |
a318e6b1 DF |
2093 | { USB_DEVICE_WACOM(0xD8) }, |
2094 | { USB_DEVICE_WACOM(0xDA) }, | |
47d09235 | 2095 | { USB_DEVICE_WACOM(0xDB) }, |
73149ab8 CB |
2096 | { USB_DEVICE_WACOM(0xDD) }, |
2097 | { USB_DEVICE_WACOM(0xDE) }, | |
2098 | { USB_DEVICE_WACOM(0xDF) }, | |
c8f2edc5 | 2099 | { USB_DEVICE_WACOM(0xF0) }, |
3a4b4aaa | 2100 | { USB_DEVICE_WACOM(0xCC) }, |
b036f6fb BB |
2101 | { USB_DEVICE_WACOM(0x90) }, |
2102 | { USB_DEVICE_WACOM(0x93) }, | |
11d0cf88 | 2103 | { USB_DEVICE_WACOM(0x97) }, |
b036f6fb BB |
2104 | { USB_DEVICE_WACOM(0x9A) }, |
2105 | { USB_DEVICE_WACOM(0x9F) }, | |
2106 | { USB_DEVICE_WACOM(0xE2) }, | |
2107 | { USB_DEVICE_WACOM(0xE3) }, | |
1963518b | 2108 | { USB_DEVICE_WACOM(0xE5) }, |
26fcd2a7 | 2109 | { USB_DEVICE_WACOM(0xE6) }, |
0d0e3064 | 2110 | { USB_DEVICE_WACOM(0xEC) }, |
ac173837 PC |
2111 | { USB_DEVICE_WACOM(0xED) }, |
2112 | { USB_DEVICE_WACOM(0xEF) }, | |
b036f6fb | 2113 | { USB_DEVICE_WACOM(0x47) }, |
803296b6 | 2114 | { USB_DEVICE_WACOM(0xF4) }, |
6f4d0382 | 2115 | { USB_DEVICE_WACOM(0xF8) }, |
d838c644 | 2116 | { USB_DEVICE_WACOM(0xFA) }, |
7b4b3068 | 2117 | { USB_DEVICE_LENOVO(0x6004) }, |
3bea733a PC |
2118 | { } |
2119 | }; | |
3bea733a | 2120 | MODULE_DEVICE_TABLE(usb, wacom_ids); |