2 * drivers/input/tablet/wacom_wac.c
4 * USB Wacom tablet support - Wacom specific code
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.
15 #include "wacom_wac.h"
17 #include <linux/input/mt.h>
19 /* resolution for penabled devices */
20 #define WACOM_PL_RES 20
21 #define WACOM_PENPRTN_RES 40
22 #define WACOM_VOLITO_RES 50
23 #define WACOM_GRAPHIRE_RES 80
24 #define WACOM_INTUOS_RES 100
25 #define WACOM_INTUOS3_RES 200
27 /* Newer Cintiq and DTU have an offset between tablet and screen areas */
28 #define WACOM_DTU_OFFSET 200
29 #define WACOM_CINTIQ_OFFSET 400
32 * Scale factor relating reported contact size to logical contact area.
33 * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo
35 #define WACOM_CONTACT_AREA_SCALE 2607
37 static bool touch_arbitration
= 1;
38 module_param(touch_arbitration
, bool, 0644);
39 MODULE_PARM_DESC(touch_arbitration
, " on (Y) off (N)");
41 static void wacom_report_numbered_buttons(struct input_dev
*input_dev
,
42 int button_count
, int mask
);
44 static int wacom_numbered_button_to_key(int n
);
46 static void wacom_update_led(struct wacom
*wacom
, int button_count
, int mask
,
49 * Percent of battery capacity for Graphire.
50 * 8th value means AC online and show 100% capacity.
52 static unsigned short batcap_gr
[8] = { 1, 15, 25, 35, 50, 70, 100, 100 };
55 * Percent of battery capacity for Intuos4 WL, AC has a separate bit.
57 static unsigned short batcap_i4
[8] = { 1, 15, 30, 45, 60, 70, 85, 100 };
59 static void __wacom_notify_battery(struct wacom_battery
*battery
,
60 int bat_capacity
, bool bat_charging
,
61 bool bat_connected
, bool ps_connected
)
63 bool changed
= battery
->battery_capacity
!= bat_capacity
||
64 battery
->bat_charging
!= bat_charging
||
65 battery
->bat_connected
!= bat_connected
||
66 battery
->ps_connected
!= ps_connected
;
69 battery
->battery_capacity
= bat_capacity
;
70 battery
->bat_charging
= bat_charging
;
71 battery
->bat_connected
= bat_connected
;
72 battery
->ps_connected
= ps_connected
;
75 power_supply_changed(battery
->battery
);
79 static void wacom_notify_battery(struct wacom_wac
*wacom_wac
,
80 int bat_capacity
, bool bat_charging
, bool bat_connected
,
83 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
85 __wacom_notify_battery(&wacom
->battery
, bat_capacity
, bat_charging
,
86 bat_connected
, ps_connected
);
89 static int wacom_penpartner_irq(struct wacom_wac
*wacom
)
91 unsigned char *data
= wacom
->data
;
92 struct input_dev
*input
= wacom
->pen_input
;
97 wacom
->tool
[0] = (data
[5] & 0x20) ? BTN_TOOL_RUBBER
: BTN_TOOL_PEN
;
98 wacom
->id
[0] = (data
[5] & 0x20) ? ERASER_DEVICE_ID
: STYLUS_DEVICE_ID
;
99 input_report_key(input
, wacom
->tool
[0], 1);
100 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* report tool id */
101 input_report_abs(input
, ABS_X
, get_unaligned_le16(&data
[1]));
102 input_report_abs(input
, ABS_Y
, get_unaligned_le16(&data
[3]));
103 input_report_abs(input
, ABS_PRESSURE
, (signed char)data
[6] + 127);
104 input_report_key(input
, BTN_TOUCH
, ((signed char)data
[6] > -127));
105 input_report_key(input
, BTN_STYLUS
, (data
[5] & 0x40));
107 input_report_key(input
, wacom
->tool
[0], 0);
108 input_report_abs(input
, ABS_MISC
, 0); /* report tool id */
109 input_report_abs(input
, ABS_PRESSURE
, -1);
110 input_report_key(input
, BTN_TOUCH
, 0);
115 input_report_key(input
, BTN_TOOL_PEN
, 1);
116 input_report_abs(input
, ABS_MISC
, STYLUS_DEVICE_ID
); /* report tool id */
117 input_report_abs(input
, ABS_X
, get_unaligned_le16(&data
[1]));
118 input_report_abs(input
, ABS_Y
, get_unaligned_le16(&data
[3]));
119 input_report_abs(input
, ABS_PRESSURE
, (signed char)data
[6] + 127);
120 input_report_key(input
, BTN_TOUCH
, ((signed char)data
[6] > -80) && !(data
[5] & 0x20));
121 input_report_key(input
, BTN_STYLUS
, (data
[5] & 0x40));
125 dev_dbg(input
->dev
.parent
,
126 "%s: received unknown report #%d\n", __func__
, data
[0]);
133 static int wacom_pl_irq(struct wacom_wac
*wacom
)
135 struct wacom_features
*features
= &wacom
->features
;
136 unsigned char *data
= wacom
->data
;
137 struct input_dev
*input
= wacom
->pen_input
;
140 if (data
[0] != WACOM_REPORT_PENABLED
) {
141 dev_dbg(input
->dev
.parent
,
142 "%s: received unknown report #%d\n", __func__
, data
[0]);
146 prox
= data
[1] & 0x40;
149 if ((data
[0] & 0x10) || (data
[4] & 0x20)) {
150 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
151 wacom
->id
[0] = ERASER_DEVICE_ID
;
154 wacom
->tool
[0] = BTN_TOOL_PEN
;
155 wacom
->id
[0] = STYLUS_DEVICE_ID
;
159 /* If the eraser is in prox, STYLUS2 is always set. If we
160 * mis-detected the type and notice that STYLUS2 isn't set
161 * then force the eraser out of prox and let the pen in.
163 if (wacom
->tool
[0] == BTN_TOOL_RUBBER
&& !(data
[4] & 0x20)) {
164 input_report_key(input
, BTN_TOOL_RUBBER
, 0);
165 input_report_abs(input
, ABS_MISC
, 0);
167 wacom
->tool
[0] = BTN_TOOL_PEN
;
168 wacom
->id
[0] = STYLUS_DEVICE_ID
;
172 pressure
= (signed char)((data
[7] << 1) | ((data
[4] >> 2) & 1));
173 if (features
->pressure_max
> 255)
174 pressure
= (pressure
<< 1) | ((data
[4] >> 6) & 1);
175 pressure
+= (features
->pressure_max
+ 1) / 2;
177 input_report_abs(input
, ABS_X
, data
[3] | (data
[2] << 7) | ((data
[1] & 0x03) << 14));
178 input_report_abs(input
, ABS_Y
, data
[6] | (data
[5] << 7) | ((data
[4] & 0x03) << 14));
179 input_report_abs(input
, ABS_PRESSURE
, pressure
);
181 input_report_key(input
, BTN_TOUCH
, data
[4] & 0x08);
182 input_report_key(input
, BTN_STYLUS
, data
[4] & 0x10);
183 /* Only allow the stylus2 button to be reported for the pen tool. */
184 input_report_key(input
, BTN_STYLUS2
, (wacom
->tool
[0] == BTN_TOOL_PEN
) && (data
[4] & 0x20));
189 input_report_key(input
, wacom
->tool
[0], prox
);
190 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]);
194 static int wacom_ptu_irq(struct wacom_wac
*wacom
)
196 unsigned char *data
= wacom
->data
;
197 struct input_dev
*input
= wacom
->pen_input
;
199 if (data
[0] != WACOM_REPORT_PENABLED
) {
200 dev_dbg(input
->dev
.parent
,
201 "%s: received unknown report #%d\n", __func__
, data
[0]);
205 if (data
[1] & 0x04) {
206 input_report_key(input
, BTN_TOOL_RUBBER
, data
[1] & 0x20);
207 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x08);
208 wacom
->id
[0] = ERASER_DEVICE_ID
;
210 input_report_key(input
, BTN_TOOL_PEN
, data
[1] & 0x20);
211 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x01);
212 wacom
->id
[0] = STYLUS_DEVICE_ID
;
214 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* report tool id */
215 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
216 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
217 input_report_abs(input
, ABS_PRESSURE
, le16_to_cpup((__le16
*)&data
[6]));
218 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
219 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x10);
223 static int wacom_dtu_irq(struct wacom_wac
*wacom
)
225 unsigned char *data
= wacom
->data
;
226 struct input_dev
*input
= wacom
->pen_input
;
227 int prox
= data
[1] & 0x20;
229 dev_dbg(input
->dev
.parent
,
230 "%s: received report #%d", __func__
, data
[0]);
233 /* Going into proximity select tool */
234 wacom
->tool
[0] = (data
[1] & 0x0c) ? BTN_TOOL_RUBBER
: BTN_TOOL_PEN
;
235 if (wacom
->tool
[0] == BTN_TOOL_PEN
)
236 wacom
->id
[0] = STYLUS_DEVICE_ID
;
238 wacom
->id
[0] = ERASER_DEVICE_ID
;
240 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
241 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x10);
242 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
243 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
244 input_report_abs(input
, ABS_PRESSURE
, ((data
[7] & 0x01) << 8) | data
[6]);
245 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x05);
246 if (!prox
) /* out-prox */
248 input_report_key(input
, wacom
->tool
[0], prox
);
249 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]);
253 static int wacom_dtus_irq(struct wacom_wac
*wacom
)
255 char *data
= wacom
->data
;
256 struct input_dev
*input
= wacom
->pen_input
;
257 unsigned short prox
, pressure
= 0;
259 if (data
[0] != WACOM_REPORT_DTUS
&& data
[0] != WACOM_REPORT_DTUSPAD
) {
260 dev_dbg(input
->dev
.parent
,
261 "%s: received unknown report #%d", __func__
, data
[0]);
263 } else if (data
[0] == WACOM_REPORT_DTUSPAD
) {
264 input
= wacom
->pad_input
;
265 input_report_key(input
, BTN_0
, (data
[1] & 0x01));
266 input_report_key(input
, BTN_1
, (data
[1] & 0x02));
267 input_report_key(input
, BTN_2
, (data
[1] & 0x04));
268 input_report_key(input
, BTN_3
, (data
[1] & 0x08));
269 input_report_abs(input
, ABS_MISC
,
270 data
[1] & 0x0f ? PAD_DEVICE_ID
: 0);
273 prox
= data
[1] & 0x80;
275 switch ((data
[1] >> 3) & 3) {
277 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
278 wacom
->id
[0] = ERASER_DEVICE_ID
;
282 wacom
->tool
[0] = BTN_TOOL_PEN
;
283 wacom
->id
[0] = STYLUS_DEVICE_ID
;
288 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x20);
289 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x40);
290 input_report_abs(input
, ABS_X
, get_unaligned_be16(&data
[3]));
291 input_report_abs(input
, ABS_Y
, get_unaligned_be16(&data
[5]));
292 pressure
= ((data
[1] & 0x03) << 8) | (data
[2] & 0xff);
293 input_report_abs(input
, ABS_PRESSURE
, pressure
);
294 input_report_key(input
, BTN_TOUCH
, pressure
> 10);
296 if (!prox
) /* out-prox */
298 input_report_key(input
, wacom
->tool
[0], prox
);
299 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]);
304 static int wacom_graphire_irq(struct wacom_wac
*wacom
)
306 struct wacom_features
*features
= &wacom
->features
;
307 unsigned char *data
= wacom
->data
;
308 struct input_dev
*input
= wacom
->pen_input
;
309 struct input_dev
*pad_input
= wacom
->pad_input
;
310 int battery_capacity
, ps_connected
;
315 if (features
->type
== GRAPHIRE_BT
) {
316 if (data
[0] != WACOM_REPORT_PENABLED_BT
) {
317 dev_dbg(input
->dev
.parent
,
318 "%s: received unknown report #%d\n", __func__
,
322 } else if (data
[0] != WACOM_REPORT_PENABLED
) {
323 dev_dbg(input
->dev
.parent
,
324 "%s: received unknown report #%d\n", __func__
, data
[0]);
328 prox
= data
[1] & 0x80;
329 if (prox
|| wacom
->id
[0]) {
331 switch ((data
[1] >> 5) & 3) {
334 wacom
->tool
[0] = BTN_TOOL_PEN
;
335 wacom
->id
[0] = STYLUS_DEVICE_ID
;
339 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
340 wacom
->id
[0] = ERASER_DEVICE_ID
;
343 case 2: /* Mouse with wheel */
344 input_report_key(input
, BTN_MIDDLE
, data
[1] & 0x04);
347 case 3: /* Mouse without wheel */
348 wacom
->tool
[0] = BTN_TOOL_MOUSE
;
349 wacom
->id
[0] = CURSOR_DEVICE_ID
;
353 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
354 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
355 if (wacom
->tool
[0] != BTN_TOOL_MOUSE
) {
356 if (features
->type
== GRAPHIRE_BT
)
357 input_report_abs(input
, ABS_PRESSURE
, data
[6] |
358 (((__u16
) (data
[1] & 0x08)) << 5));
360 input_report_abs(input
, ABS_PRESSURE
, data
[6] |
361 ((data
[7] & 0x03) << 8));
362 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x01);
363 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
364 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x04);
366 input_report_key(input
, BTN_LEFT
, data
[1] & 0x01);
367 input_report_key(input
, BTN_RIGHT
, data
[1] & 0x02);
368 if (features
->type
== WACOM_G4
||
369 features
->type
== WACOM_MO
) {
370 input_report_abs(input
, ABS_DISTANCE
, data
[6] & 0x3f);
371 rw
= (data
[7] & 0x04) - (data
[7] & 0x03);
372 } else if (features
->type
== GRAPHIRE_BT
) {
373 /* Compute distance between mouse and tablet */
374 rw
= 44 - (data
[6] >> 2);
375 rw
= clamp_val(rw
, 0, 31);
376 input_report_abs(input
, ABS_DISTANCE
, rw
);
377 if (((data
[1] >> 5) & 3) == 2) {
378 /* Mouse with wheel */
379 input_report_key(input
, BTN_MIDDLE
,
381 rw
= (data
[6] & 0x01) ? -1 :
382 (data
[6] & 0x02) ? 1 : 0;
387 input_report_abs(input
, ABS_DISTANCE
, data
[7] & 0x3f);
388 rw
= -(signed char)data
[6];
390 input_report_rel(input
, REL_WHEEL
, rw
);
395 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* report tool id */
396 input_report_key(input
, wacom
->tool
[0], prox
);
397 input_sync(input
); /* sync last event */
401 switch (features
->type
) {
403 prox
= data
[7] & 0xf8;
404 if (prox
|| wacom
->id
[1]) {
405 wacom
->id
[1] = PAD_DEVICE_ID
;
406 input_report_key(pad_input
, BTN_BACK
, (data
[7] & 0x40));
407 input_report_key(pad_input
, BTN_FORWARD
, (data
[7] & 0x80));
408 rw
= ((data
[7] & 0x18) >> 3) - ((data
[7] & 0x20) >> 3);
409 input_report_rel(pad_input
, REL_WHEEL
, rw
);
412 input_report_abs(pad_input
, ABS_MISC
, wacom
->id
[1]);
418 prox
= (data
[7] & 0xf8) || data
[8];
419 if (prox
|| wacom
->id
[1]) {
420 wacom
->id
[1] = PAD_DEVICE_ID
;
421 input_report_key(pad_input
, BTN_BACK
, (data
[7] & 0x08));
422 input_report_key(pad_input
, BTN_LEFT
, (data
[7] & 0x20));
423 input_report_key(pad_input
, BTN_FORWARD
, (data
[7] & 0x10));
424 input_report_key(pad_input
, BTN_RIGHT
, (data
[7] & 0x40));
425 input_report_abs(pad_input
, ABS_WHEEL
, (data
[8] & 0x7f));
428 input_report_abs(pad_input
, ABS_MISC
, wacom
->id
[1]);
433 prox
= data
[7] & 0x03;
434 if (prox
|| wacom
->id
[1]) {
435 wacom
->id
[1] = PAD_DEVICE_ID
;
436 input_report_key(pad_input
, BTN_0
, (data
[7] & 0x02));
437 input_report_key(pad_input
, BTN_1
, (data
[7] & 0x01));
440 input_report_abs(pad_input
, ABS_MISC
, wacom
->id
[1]);
446 /* Store current battery capacity and power supply state */
447 if (features
->type
== GRAPHIRE_BT
) {
448 rw
= (data
[7] >> 2 & 0x07);
449 battery_capacity
= batcap_gr
[rw
];
450 ps_connected
= rw
== 7;
451 wacom_notify_battery(wacom
, battery_capacity
, ps_connected
,
458 static void wacom_intuos_schedule_prox_event(struct wacom_wac
*wacom_wac
)
460 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
461 struct wacom_features
*features
= &wacom_wac
->features
;
462 struct hid_report
*r
;
463 struct hid_report_enum
*re
;
465 re
= &(wacom
->hdev
->report_enum
[HID_FEATURE_REPORT
]);
466 if (features
->type
== INTUOSHT2
)
467 r
= re
->report_id_hash
[WACOM_REPORT_INTUOSHT2_ID
];
469 r
= re
->report_id_hash
[WACOM_REPORT_INTUOS_ID1
];
471 hid_hw_request(wacom
->hdev
, r
, HID_REQ_GET_REPORT
);
475 static int wacom_intuos_pad(struct wacom_wac
*wacom
)
477 struct wacom_features
*features
= &wacom
->features
;
478 unsigned char *data
= wacom
->data
;
479 struct input_dev
*input
= wacom
->pad_input
;
481 int buttons
= 0, nbuttons
= features
->numbered_buttons
;
482 int keys
= 0, nkeys
= 0;
483 int ring1
= 0, ring2
= 0;
484 int strip1
= 0, strip2
= 0;
487 /* pad packets. Works as a second tool and is always in prox */
488 if (!(data
[0] == WACOM_REPORT_INTUOSPAD
|| data
[0] == WACOM_REPORT_INTUOS5PAD
||
489 data
[0] == WACOM_REPORT_CINTIQPAD
))
492 if (features
->type
>= INTUOS4S
&& features
->type
<= INTUOS4L
) {
493 buttons
= (data
[3] << 1) | (data
[2] & 0x01);
495 } else if (features
->type
== DTK
) {
497 } else if (features
->type
== WACOM_13HD
) {
498 buttons
= (data
[4] << 1) | (data
[3] & 0x01);
499 } else if (features
->type
== WACOM_24HD
) {
500 buttons
= (data
[8] << 8) | data
[6];
505 * Three "buttons" are available on the 24HD which are
506 * physically implemented as a touchstrip. Each button
507 * is approximately 3 bits wide with a 2 bit spacing.
508 * The raw touchstrip bits are stored at:
509 * ((data[3] & 0x1f) << 8) | data[4])
512 keys
= ((data
[3] & 0x1C) ? 1<<2 : 0) |
513 ((data
[4] & 0xE0) ? 1<<1 : 0) |
514 ((data
[4] & 0x07) ? 1<<0 : 0);
515 } else if (features
->type
== WACOM_27QHD
) {
517 keys
= data
[2] & 0x07;
519 input_report_abs(input
, ABS_X
, be16_to_cpup((__be16
*)&data
[4]));
520 input_report_abs(input
, ABS_Y
, be16_to_cpup((__be16
*)&data
[6]));
521 input_report_abs(input
, ABS_Z
, be16_to_cpup((__be16
*)&data
[8]));
522 } else if (features
->type
== CINTIQ_HYBRID
) {
524 * Do not send hardware buttons under Android. They
525 * are already sent to the system through GPIO (and
526 * have different meaning).
528 * d-pad right -> data[4] & 0x10
529 * d-pad up -> data[4] & 0x20
530 * d-pad left -> data[4] & 0x40
531 * d-pad down -> data[4] & 0x80
532 * d-pad center -> data[3] & 0x01
534 buttons
= (data
[4] << 1) | (data
[3] & 0x01);
535 } else if (features
->type
== CINTIQ_COMPANION_2
) {
536 /* d-pad right -> data[4] & 0x10
537 * d-pad up -> data[4] & 0x20
538 * d-pad left -> data[4] & 0x40
539 * d-pad down -> data[4] & 0x80
540 * d-pad center -> data[3] & 0x01
542 buttons
= ((data
[2] >> 4) << 7) |
543 ((data
[1] & 0x04) << 6) |
544 ((data
[2] & 0x0F) << 2) |
546 } else if (features
->type
>= INTUOS5S
&& features
->type
<= INTUOSPL
) {
548 * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in
549 * addition to the mechanical switch. Switch data is
550 * stored in data[4], capacitive data in data[5].
552 * Touch ring mode switch (data[3]) has no capacitive sensor
554 buttons
= (data
[4] << 1) | (data
[3] & 0x01);
557 if (features
->type
== WACOM_21UX2
|| features
->type
== WACOM_22HD
) {
558 buttons
= (data
[8] << 10) | ((data
[7] & 0x01) << 9) |
559 (data
[6] << 1) | (data
[5] & 0x01);
561 if (features
->type
== WACOM_22HD
) {
563 keys
= data
[9] & 0x07;
566 buttons
= ((data
[6] & 0x10) << 10) |
567 ((data
[5] & 0x10) << 9) |
568 ((data
[6] & 0x0F) << 4) |
571 strip1
= ((data
[1] & 0x1f) << 8) | data
[2];
572 strip2
= ((data
[3] & 0x1f) << 8) | data
[4];
575 prox
= (buttons
& ~(~0 << nbuttons
)) | (keys
& ~(~0 << nkeys
)) |
576 (ring1
& 0x80) | (ring2
& 0x80) | strip1
| strip2
;
578 wacom_report_numbered_buttons(input
, nbuttons
, buttons
);
580 for (i
= 0; i
< nkeys
; i
++)
581 input_report_key(input
, KEY_PROG1
+ i
, keys
& (1 << i
));
583 input_report_abs(input
, ABS_RX
, strip1
);
584 input_report_abs(input
, ABS_RY
, strip2
);
586 input_report_abs(input
, ABS_WHEEL
, (ring1
& 0x80) ? (ring1
& 0x7f) : 0);
587 input_report_abs(input
, ABS_THROTTLE
, (ring2
& 0x80) ? (ring2
& 0x7f) : 0);
589 input_report_key(input
, wacom
->tool
[1], prox
? 1 : 0);
590 input_report_abs(input
, ABS_MISC
, prox
? PAD_DEVICE_ID
: 0);
592 input_event(input
, EV_MSC
, MSC_SERIAL
, 0xffffffff);
597 static int wacom_intuos_id_mangle(int tool_id
)
599 return (tool_id
& ~0xFFF) << 4 | (tool_id
& 0xFFF);
602 static int wacom_intuos_get_tool_type(int tool_id
)
607 case 0x812: /* Inking pen */
608 case 0x801: /* Intuos3 Inking pen */
609 case 0x12802: /* Intuos4/5 Inking Pen */
611 tool_type
= BTN_TOOL_PENCIL
;
614 case 0x822: /* Pen */
617 case 0x823: /* Intuos3 Grip Pen */
618 case 0x813: /* Intuos3 Classic Pen */
619 case 0x885: /* Intuos3 Marker Pen */
620 case 0x802: /* Intuos4/5 13HD/24HD General Pen */
621 case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */
622 case 0x8e2: /* IntuosHT2 pen */
624 case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */
625 case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */
626 case 0x16802: /* Cintiq 13HD Pro Pen */
627 case 0x18802: /* DTH2242 Pen */
628 case 0x10802: /* Intuos4/5 13HD/24HD General Pen */
629 tool_type
= BTN_TOOL_PEN
;
632 case 0x832: /* Stroke pen */
634 tool_type
= BTN_TOOL_BRUSH
;
637 case 0x007: /* Mouse 4D and 2D */
640 case 0x017: /* Intuos3 2D Mouse */
641 case 0x806: /* Intuos4 Mouse */
642 tool_type
= BTN_TOOL_MOUSE
;
645 case 0x096: /* Lens cursor */
646 case 0x097: /* Intuos3 Lens cursor */
647 case 0x006: /* Intuos4 Lens cursor */
648 tool_type
= BTN_TOOL_LENS
;
651 case 0x82a: /* Eraser */
657 case 0x82b: /* Intuos3 Grip Pen Eraser */
658 case 0x81b: /* Intuos3 Classic Pen Eraser */
659 case 0x91b: /* Intuos3 Airbrush Eraser */
660 case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */
661 case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */
662 case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
663 case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */
664 case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
665 case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */
666 case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */
667 case 0x1880a: /* DTH2242 Eraser */
668 case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */
669 tool_type
= BTN_TOOL_RUBBER
;
675 case 0x913: /* Intuos3 Airbrush */
676 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */
677 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */
678 tool_type
= BTN_TOOL_AIRBRUSH
;
681 default: /* Unknown tool */
682 tool_type
= BTN_TOOL_PEN
;
688 static int wacom_intuos_inout(struct wacom_wac
*wacom
)
690 struct wacom_features
*features
= &wacom
->features
;
691 unsigned char *data
= wacom
->data
;
692 struct input_dev
*input
= wacom
->pen_input
;
693 int idx
= (features
->type
== INTUOS
) ? (data
[1] & 0x01) : 0;
695 if (!(((data
[1] & 0xfc) == 0xc0) || /* in prox */
696 ((data
[1] & 0xfe) == 0x20) || /* in range */
697 ((data
[1] & 0xfe) == 0x80))) /* out prox */
701 if ((data
[1] & 0xfc) == 0xc0) {
702 /* serial number of the tool */
703 wacom
->serial
[idx
] = ((data
[3] & 0x0f) << 28) +
704 (data
[4] << 20) + (data
[5] << 12) +
705 (data
[6] << 4) + (data
[7] >> 4);
707 wacom
->id
[idx
] = (data
[2] << 4) | (data
[3] >> 4) |
708 ((data
[7] & 0x0f) << 16) | ((data
[8] & 0xf0) << 8);
710 wacom
->tool
[idx
] = wacom_intuos_get_tool_type(wacom
->id
[idx
]);
712 wacom
->shared
->stylus_in_proximity
= true;
717 if ((data
[1] & 0xfe) == 0x20) {
718 if (features
->type
!= INTUOSHT2
)
719 wacom
->shared
->stylus_in_proximity
= true;
721 /* in Range while exiting */
722 if (wacom
->reporting_data
) {
723 input_report_key(input
, BTN_TOUCH
, 0);
724 input_report_abs(input
, ABS_PRESSURE
, 0);
725 input_report_abs(input
, ABS_DISTANCE
, wacom
->features
.distance_max
);
732 if ((data
[1] & 0xfe) == 0x80) {
733 wacom
->shared
->stylus_in_proximity
= false;
734 wacom
->reporting_data
= false;
736 /* don't report exit if we don't know the ID */
741 * Reset all states otherwise we lose the initial states
742 * when in-prox next time
744 input_report_abs(input
, ABS_X
, 0);
745 input_report_abs(input
, ABS_Y
, 0);
746 input_report_abs(input
, ABS_DISTANCE
, 0);
747 input_report_abs(input
, ABS_TILT_X
, 0);
748 input_report_abs(input
, ABS_TILT_Y
, 0);
749 if (wacom
->tool
[idx
] >= BTN_TOOL_MOUSE
) {
750 input_report_key(input
, BTN_LEFT
, 0);
751 input_report_key(input
, BTN_MIDDLE
, 0);
752 input_report_key(input
, BTN_RIGHT
, 0);
753 input_report_key(input
, BTN_SIDE
, 0);
754 input_report_key(input
, BTN_EXTRA
, 0);
755 input_report_abs(input
, ABS_THROTTLE
, 0);
756 input_report_abs(input
, ABS_RZ
, 0);
758 input_report_abs(input
, ABS_PRESSURE
, 0);
759 input_report_key(input
, BTN_STYLUS
, 0);
760 input_report_key(input
, BTN_STYLUS2
, 0);
761 input_report_key(input
, BTN_TOUCH
, 0);
762 input_report_abs(input
, ABS_WHEEL
, 0);
763 if (features
->type
>= INTUOS3S
)
764 input_report_abs(input
, ABS_Z
, 0);
766 input_report_key(input
, wacom
->tool
[idx
], 0);
767 input_report_abs(input
, ABS_MISC
, 0); /* reset tool id */
768 input_event(input
, EV_MSC
, MSC_SERIAL
, wacom
->serial
[idx
]);
776 static int wacom_remote_irq(struct wacom_wac
*wacom_wac
, size_t len
)
778 unsigned char *data
= wacom_wac
->data
;
779 struct input_dev
*input
;
780 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
781 struct wacom_remote
*remote
= wacom
->remote
;
782 int bat_charging
, bat_percent
, touch_ring_mode
;
787 if (data
[0] != WACOM_REPORT_REMOTE
) {
788 hid_dbg(wacom
->hdev
, "%s: received unknown report #%d",
793 serial
= data
[3] + (data
[4] << 8) + (data
[5] << 16);
794 wacom_wac
->id
[0] = PAD_DEVICE_ID
;
796 spin_lock_irqsave(&remote
->remote_lock
, flags
);
798 for (i
= 0; i
< WACOM_MAX_REMOTES
; i
++) {
799 if (remote
->remotes
[i
].serial
== serial
) {
805 if (index
< 0 || !remote
->remotes
[index
].registered
)
808 input
= remote
->remotes
[index
].input
;
810 input_report_key(input
, BTN_0
, (data
[9] & 0x01));
811 input_report_key(input
, BTN_1
, (data
[9] & 0x02));
812 input_report_key(input
, BTN_2
, (data
[9] & 0x04));
813 input_report_key(input
, BTN_3
, (data
[9] & 0x08));
814 input_report_key(input
, BTN_4
, (data
[9] & 0x10));
815 input_report_key(input
, BTN_5
, (data
[9] & 0x20));
816 input_report_key(input
, BTN_6
, (data
[9] & 0x40));
817 input_report_key(input
, BTN_7
, (data
[9] & 0x80));
819 input_report_key(input
, BTN_8
, (data
[10] & 0x01));
820 input_report_key(input
, BTN_9
, (data
[10] & 0x02));
821 input_report_key(input
, BTN_A
, (data
[10] & 0x04));
822 input_report_key(input
, BTN_B
, (data
[10] & 0x08));
823 input_report_key(input
, BTN_C
, (data
[10] & 0x10));
824 input_report_key(input
, BTN_X
, (data
[10] & 0x20));
825 input_report_key(input
, BTN_Y
, (data
[10] & 0x40));
826 input_report_key(input
, BTN_Z
, (data
[10] & 0x80));
828 input_report_key(input
, BTN_BASE
, (data
[11] & 0x01));
829 input_report_key(input
, BTN_BASE2
, (data
[11] & 0x02));
832 input_report_abs(input
, ABS_WHEEL
, (data
[12] & 0x7f));
834 input_report_abs(input
, ABS_WHEEL
, 0);
836 bat_percent
= data
[7] & 0x7f;
837 bat_charging
= !!(data
[7] & 0x80);
839 if (data
[9] | data
[10] | (data
[11] & 0x03) | data
[12])
840 input_report_abs(input
, ABS_MISC
, PAD_DEVICE_ID
);
842 input_report_abs(input
, ABS_MISC
, 0);
844 input_event(input
, EV_MSC
, MSC_SERIAL
, serial
);
848 /*Which mode select (LED light) is currently on?*/
849 touch_ring_mode
= (data
[11] & 0xC0) >> 6;
851 for (i
= 0; i
< WACOM_MAX_REMOTES
; i
++) {
852 if (remote
->remotes
[i
].serial
== serial
)
853 wacom
->led
.groups
[i
].select
= touch_ring_mode
;
856 __wacom_notify_battery(&remote
->remotes
[index
].battery
, bat_percent
,
857 bat_charging
, 1, bat_charging
);
860 spin_unlock_irqrestore(&remote
->remote_lock
, flags
);
864 static void wacom_remote_status_irq(struct wacom_wac
*wacom_wac
, size_t len
)
866 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
867 unsigned char *data
= wacom_wac
->data
;
868 struct wacom_remote
*remote
= wacom
->remote
;
869 struct wacom_remote_data remote_data
;
873 if (data
[0] != WACOM_REPORT_DEVICE_LIST
)
876 memset(&remote_data
, 0, sizeof(struct wacom_remote_data
));
878 for (i
= 0; i
< WACOM_MAX_REMOTES
; i
++) {
880 int serial
= (data
[j
+6] << 16) + (data
[j
+5] << 8) + data
[j
+4];
881 bool connected
= data
[j
+2];
883 remote_data
.remote
[i
].serial
= serial
;
884 remote_data
.remote
[i
].connected
= connected
;
887 spin_lock_irqsave(&remote
->remote_lock
, flags
);
889 ret
= kfifo_in(&remote
->remote_fifo
, &remote_data
, sizeof(remote_data
));
890 if (ret
!= sizeof(remote_data
)) {
891 spin_unlock_irqrestore(&remote
->remote_lock
, flags
);
892 hid_err(wacom
->hdev
, "Can't queue Remote status event.\n");
896 spin_unlock_irqrestore(&remote
->remote_lock
, flags
);
898 wacom_schedule_work(wacom_wac
, WACOM_WORKER_REMOTE
);
901 static inline bool report_touch_events(struct wacom_wac
*wacom
)
903 return (touch_arbitration
? !wacom
->shared
->stylus_in_proximity
: 1);
906 static inline bool delay_pen_events(struct wacom_wac
*wacom
)
908 return (wacom
->shared
->touch_down
&& touch_arbitration
);
911 static int wacom_intuos_general(struct wacom_wac
*wacom
)
913 struct wacom_features
*features
= &wacom
->features
;
914 unsigned char *data
= wacom
->data
;
915 struct input_dev
*input
= wacom
->pen_input
;
916 int idx
= (features
->type
== INTUOS
) ? (data
[1] & 0x01) : 0;
917 unsigned char type
= (data
[1] >> 1) & 0x0F;
918 unsigned int x
, y
, distance
, t
;
920 if (data
[0] != WACOM_REPORT_PENABLED
&& data
[0] != WACOM_REPORT_CINTIQ
&&
921 data
[0] != WACOM_REPORT_INTUOS_PEN
)
924 if (delay_pen_events(wacom
))
927 /* don't report events if we don't know the tool ID */
928 if (!wacom
->id
[idx
]) {
929 /* but reschedule a read of the current tool */
930 wacom_intuos_schedule_prox_event(wacom
);
935 * don't report events for invalid data
937 /* older I4 styli don't work with new Cintiqs */
938 if ((!((wacom
->id
[idx
] >> 16) & 0x01) &&
939 (features
->type
== WACOM_21UX2
)) ||
940 /* Only large Intuos support Lense Cursor */
941 (wacom
->tool
[idx
] == BTN_TOOL_LENS
&&
942 (features
->type
== INTUOS3
||
943 features
->type
== INTUOS3S
||
944 features
->type
== INTUOS4
||
945 features
->type
== INTUOS4S
||
946 features
->type
== INTUOS5
||
947 features
->type
== INTUOS5S
||
948 features
->type
== INTUOSPM
||
949 features
->type
== INTUOSPS
)) ||
950 /* Cintiq doesn't send data when RDY bit isn't set */
951 (features
->type
== CINTIQ
&& !(data
[1] & 0x40)))
954 x
= (be16_to_cpup((__be16
*)&data
[2]) << 1) | ((data
[9] >> 1) & 1);
955 y
= (be16_to_cpup((__be16
*)&data
[4]) << 1) | (data
[9] & 1);
956 distance
= data
[9] >> 2;
957 if (features
->type
< INTUOS3S
) {
962 input_report_abs(input
, ABS_X
, x
);
963 input_report_abs(input
, ABS_Y
, y
);
964 input_report_abs(input
, ABS_DISTANCE
, distance
);
971 /* general pen packet */
972 t
= (data
[6] << 3) | ((data
[7] & 0xC0) >> 5) | (data
[1] & 1);
973 if (features
->pressure_max
< 2047)
975 input_report_abs(input
, ABS_PRESSURE
, t
);
976 if (features
->type
!= INTUOSHT2
) {
977 input_report_abs(input
, ABS_TILT_X
,
978 (((data
[7] << 1) & 0x7e) | (data
[8] >> 7)) - 64);
979 input_report_abs(input
, ABS_TILT_Y
, (data
[8] & 0x7f) - 64);
981 input_report_key(input
, BTN_STYLUS
, data
[1] & 2);
982 input_report_key(input
, BTN_STYLUS2
, data
[1] & 4);
983 input_report_key(input
, BTN_TOUCH
, t
> 10);
987 /* airbrush second packet */
988 input_report_abs(input
, ABS_WHEEL
,
989 (data
[6] << 2) | ((data
[7] >> 6) & 3));
990 input_report_abs(input
, ABS_TILT_X
,
991 (((data
[7] << 1) & 0x7e) | (data
[8] >> 7)) - 64);
992 input_report_abs(input
, ABS_TILT_Y
, (data
[8] & 0x7f) - 64);
996 /* Rotation packet */
997 if (features
->type
>= INTUOS3S
) {
998 /* I3 marker pen rotation */
999 t
= (data
[6] << 3) | ((data
[7] >> 5) & 7);
1000 t
= (data
[7] & 0x20) ? ((t
> 900) ? ((t
-1) / 2 - 1350) :
1001 ((t
-1) / 2 + 450)) : (450 - t
/ 2) ;
1002 input_report_abs(input
, ABS_Z
, t
);
1004 /* 4D mouse 2nd packet */
1005 t
= (data
[6] << 3) | ((data
[7] >> 5) & 7);
1006 input_report_abs(input
, ABS_RZ
, (data
[7] & 0x20) ?
1007 ((t
- 1) / 2) : -t
/ 2);
1012 /* 4D mouse 1st packet */
1013 input_report_key(input
, BTN_LEFT
, data
[8] & 0x01);
1014 input_report_key(input
, BTN_MIDDLE
, data
[8] & 0x02);
1015 input_report_key(input
, BTN_RIGHT
, data
[8] & 0x04);
1017 input_report_key(input
, BTN_SIDE
, data
[8] & 0x20);
1018 input_report_key(input
, BTN_EXTRA
, data
[8] & 0x10);
1019 t
= (data
[6] << 2) | ((data
[7] >> 6) & 3);
1020 input_report_abs(input
, ABS_THROTTLE
, (data
[8] & 0x08) ? -t
: t
);
1025 input_report_key(input
, BTN_LEFT
, data
[6] & 0x01);
1026 input_report_key(input
, BTN_MIDDLE
, data
[6] & 0x02);
1027 input_report_key(input
, BTN_RIGHT
, data
[6] & 0x04);
1028 input_report_rel(input
, REL_WHEEL
, ((data
[7] & 0x80) >> 7)
1029 - ((data
[7] & 0x40) >> 6));
1030 input_report_key(input
, BTN_SIDE
, data
[6] & 0x08);
1031 input_report_key(input
, BTN_EXTRA
, data
[6] & 0x10);
1033 input_report_abs(input
, ABS_TILT_X
,
1034 (((data
[7] << 1) & 0x7e) | (data
[8] >> 7)) - 64);
1035 input_report_abs(input
, ABS_TILT_Y
, (data
[8] & 0x7f) - 64);
1039 if (wacom
->tool
[idx
] == BTN_TOOL_MOUSE
) {
1040 /* 2D mouse packet */
1041 input_report_key(input
, BTN_LEFT
, data
[8] & 0x04);
1042 input_report_key(input
, BTN_MIDDLE
, data
[8] & 0x08);
1043 input_report_key(input
, BTN_RIGHT
, data
[8] & 0x10);
1044 input_report_rel(input
, REL_WHEEL
, (data
[8] & 0x01)
1045 - ((data
[8] & 0x02) >> 1));
1047 /* I3 2D mouse side buttons */
1048 if (features
->type
>= INTUOS3S
&& features
->type
<= INTUOS3L
) {
1049 input_report_key(input
, BTN_SIDE
, data
[8] & 0x40);
1050 input_report_key(input
, BTN_EXTRA
, data
[8] & 0x20);
1053 else if (wacom
->tool
[idx
] == BTN_TOOL_LENS
) {
1054 /* Lens cursor packets */
1055 input_report_key(input
, BTN_LEFT
, data
[8] & 0x01);
1056 input_report_key(input
, BTN_MIDDLE
, data
[8] & 0x02);
1057 input_report_key(input
, BTN_RIGHT
, data
[8] & 0x04);
1058 input_report_key(input
, BTN_SIDE
, data
[8] & 0x10);
1059 input_report_key(input
, BTN_EXTRA
, data
[8] & 0x08);
1074 input_report_abs(input
, ABS_MISC
,
1075 wacom_intuos_id_mangle(wacom
->id
[idx
])); /* report tool id */
1076 input_report_key(input
, wacom
->tool
[idx
], 1);
1077 input_event(input
, EV_MSC
, MSC_SERIAL
, wacom
->serial
[idx
]);
1078 wacom
->reporting_data
= true;
1082 static int wacom_intuos_irq(struct wacom_wac
*wacom
)
1084 unsigned char *data
= wacom
->data
;
1085 struct input_dev
*input
= wacom
->pen_input
;
1088 if (data
[0] != WACOM_REPORT_PENABLED
&&
1089 data
[0] != WACOM_REPORT_INTUOS_ID1
&&
1090 data
[0] != WACOM_REPORT_INTUOS_ID2
&&
1091 data
[0] != WACOM_REPORT_INTUOSPAD
&&
1092 data
[0] != WACOM_REPORT_INTUOS_PEN
&&
1093 data
[0] != WACOM_REPORT_CINTIQ
&&
1094 data
[0] != WACOM_REPORT_CINTIQPAD
&&
1095 data
[0] != WACOM_REPORT_INTUOS5PAD
) {
1096 dev_dbg(input
->dev
.parent
,
1097 "%s: received unknown report #%d\n", __func__
, data
[0]);
1101 /* process pad events */
1102 result
= wacom_intuos_pad(wacom
);
1106 /* process in/out prox events */
1107 result
= wacom_intuos_inout(wacom
);
1111 /* process general packets */
1112 result
= wacom_intuos_general(wacom
);
1119 static int int_dist(int x1
, int y1
, int x2
, int y2
)
1124 return int_sqrt(x
*x
+ y
*y
);
1127 static void wacom_intuos_bt_process_data(struct wacom_wac
*wacom
,
1128 unsigned char *data
)
1130 memcpy(wacom
->data
, data
, 10);
1131 wacom_intuos_irq(wacom
);
1133 input_sync(wacom
->pen_input
);
1134 if (wacom
->pad_input
)
1135 input_sync(wacom
->pad_input
);
1138 static int wacom_intuos_bt_irq(struct wacom_wac
*wacom
, size_t len
)
1140 unsigned char data
[WACOM_PKGLEN_MAX
];
1142 unsigned power_raw
, battery_capacity
, bat_charging
, ps_connected
;
1144 memcpy(data
, wacom
->data
, len
);
1148 wacom_intuos_bt_process_data(wacom
, data
+ i
);
1152 wacom_intuos_bt_process_data(wacom
, data
+ i
);
1154 wacom_intuos_bt_process_data(wacom
, data
+ i
);
1156 power_raw
= data
[i
];
1157 bat_charging
= (power_raw
& 0x08) ? 1 : 0;
1158 ps_connected
= (power_raw
& 0x10) ? 1 : 0;
1159 battery_capacity
= batcap_i4
[power_raw
& 0x07];
1160 wacom_notify_battery(wacom
, battery_capacity
, bat_charging
,
1161 battery_capacity
|| bat_charging
,
1165 dev_dbg(wacom
->pen_input
->dev
.parent
,
1166 "Unknown report: %d,%d size:%zu\n",
1167 data
[0], data
[1], len
);
1173 static int wacom_wac_finger_count_touches(struct wacom_wac
*wacom
)
1175 struct input_dev
*input
= wacom
->touch_input
;
1176 unsigned touch_max
= wacom
->features
.touch_max
;
1184 return test_bit(BTN_TOUCH
, input
->key
) &&
1185 report_touch_events(wacom
);
1187 for (i
= 0; i
< input
->mt
->num_slots
; i
++) {
1188 struct input_mt_slot
*ps
= &input
->mt
->slots
[i
];
1189 int id
= input_mt_get_value(ps
, ABS_MT_TRACKING_ID
);
1197 static void wacom_intuos_pro2_bt_pen(struct wacom_wac
*wacom
)
1199 const int pen_frame_len
= 14;
1200 const int pen_frames
= 7;
1202 struct input_dev
*pen_input
= wacom
->pen_input
;
1203 unsigned char *data
= wacom
->data
;
1206 wacom
->serial
[0] = get_unaligned_le64(&data
[99]);
1207 wacom
->id
[0] = get_unaligned_le16(&data
[107]);
1208 if (wacom
->serial
[0] >> 52 == 1) {
1209 /* Add back in missing bits of ID for non-USI pens */
1210 wacom
->id
[0] |= (wacom
->serial
[0] >> 32) & 0xFFFFF;
1212 wacom
->tool
[0] = wacom_intuos_get_tool_type(wacom_intuos_id_mangle(wacom
->id
[0]));
1214 for (i
= 0; i
< pen_frames
; i
++) {
1215 unsigned char *frame
= &data
[i
*pen_frame_len
+ 1];
1216 bool valid
= frame
[0] & 0x80;
1217 bool prox
= frame
[0] & 0x40;
1218 bool range
= frame
[0] & 0x20;
1224 input_report_abs(pen_input
, ABS_X
, get_unaligned_le16(&frame
[1]));
1225 input_report_abs(pen_input
, ABS_Y
, get_unaligned_le16(&frame
[3]));
1226 input_report_abs(pen_input
, ABS_TILT_X
, frame
[7]);
1227 input_report_abs(pen_input
, ABS_TILT_Y
, frame
[8]);
1228 input_report_abs(pen_input
, ABS_Z
, get_unaligned_le16(&frame
[9]));
1229 input_report_abs(pen_input
, ABS_WHEEL
, get_unaligned_le16(&frame
[11]));
1231 input_report_abs(pen_input
, ABS_PRESSURE
, get_unaligned_le16(&frame
[5]));
1232 input_report_abs(pen_input
, ABS_DISTANCE
, range
? frame
[13] : wacom
->features
.distance_max
);
1234 input_report_key(pen_input
, BTN_TOUCH
, frame
[0] & 0x01);
1235 input_report_key(pen_input
, BTN_STYLUS
, frame
[0] & 0x02);
1236 input_report_key(pen_input
, BTN_STYLUS2
, frame
[0] & 0x04);
1238 input_report_key(pen_input
, wacom
->tool
[0], prox
);
1239 input_event(pen_input
, EV_MSC
, MSC_SERIAL
, wacom
->serial
[0]);
1240 input_report_abs(pen_input
, ABS_MISC
,
1241 wacom_intuos_id_mangle(wacom
->id
[0])); /* report tool id */
1243 wacom
->shared
->stylus_in_proximity
= prox
;
1245 input_sync(pen_input
);
1249 static void wacom_intuos_pro2_bt_touch(struct wacom_wac
*wacom
)
1251 const int finger_touch_len
= 8;
1252 const int finger_frames
= 4;
1253 const int finger_frame_len
= 43;
1255 struct input_dev
*touch_input
= wacom
->touch_input
;
1256 unsigned char *data
= wacom
->data
;
1257 int num_contacts_left
= 5;
1260 for (i
= 0; i
< finger_frames
; i
++) {
1261 unsigned char *frame
= &data
[i
*finger_frame_len
+ 109];
1262 int current_num_contacts
= frame
[0] & 0x7F;
1263 int contacts_to_send
;
1265 if (!(frame
[0] & 0x80))
1269 * First packet resets the counter since only the first
1270 * packet in series will have non-zero current_num_contacts.
1272 if (current_num_contacts
)
1273 wacom
->num_contacts_left
= current_num_contacts
;
1275 contacts_to_send
= min(num_contacts_left
, wacom
->num_contacts_left
);
1277 for (j
= 0; j
< contacts_to_send
; j
++) {
1278 unsigned char *touch
= &frame
[j
*finger_touch_len
+ 1];
1279 int slot
= input_mt_get_slot_by_key(touch_input
, touch
[0]);
1280 int x
= get_unaligned_le16(&touch
[2]);
1281 int y
= get_unaligned_le16(&touch
[4]);
1282 int w
= touch
[6] * input_abs_get_res(touch_input
, ABS_MT_POSITION_X
);
1283 int h
= touch
[7] * input_abs_get_res(touch_input
, ABS_MT_POSITION_Y
);
1288 input_mt_slot(touch_input
, slot
);
1289 input_mt_report_slot_state(touch_input
, MT_TOOL_FINGER
, touch
[1] & 0x01);
1290 input_report_abs(touch_input
, ABS_MT_POSITION_X
, x
);
1291 input_report_abs(touch_input
, ABS_MT_POSITION_Y
, y
);
1292 input_report_abs(touch_input
, ABS_MT_TOUCH_MAJOR
, max(w
, h
));
1293 input_report_abs(touch_input
, ABS_MT_TOUCH_MINOR
, min(w
, h
));
1294 input_report_abs(touch_input
, ABS_MT_ORIENTATION
, w
> h
);
1297 input_mt_sync_frame(touch_input
);
1299 wacom
->num_contacts_left
-= contacts_to_send
;
1300 if (wacom
->num_contacts_left
<= 0) {
1301 wacom
->num_contacts_left
= 0;
1302 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1306 input_report_switch(touch_input
, SW_MUTE_DEVICE
, !(data
[281] >> 7));
1307 input_sync(touch_input
);
1310 static void wacom_intuos_pro2_bt_pad(struct wacom_wac
*wacom
)
1312 struct input_dev
*pad_input
= wacom
->pad_input
;
1313 unsigned char *data
= wacom
->data
;
1315 int buttons
= (data
[282] << 1) | ((data
[281] >> 6) & 0x01);
1316 int ring
= data
[285];
1317 int prox
= buttons
| (ring
& 0x80);
1319 wacom_report_numbered_buttons(pad_input
, 9, buttons
);
1321 input_report_abs(pad_input
, ABS_WHEEL
, (ring
& 0x80) ? (ring
& 0x7f) : 0);
1323 input_report_key(pad_input
, wacom
->tool
[1], prox
? 1 : 0);
1324 input_report_abs(pad_input
, ABS_MISC
, prox
? PAD_DEVICE_ID
: 0);
1325 input_event(pad_input
, EV_MSC
, MSC_SERIAL
, 0xffffffff);
1327 input_sync(pad_input
);
1330 static void wacom_intuos_pro2_bt_battery(struct wacom_wac
*wacom
)
1332 unsigned char *data
= wacom
->data
;
1334 bool chg
= data
[284] & 0x80;
1335 int battery_status
= data
[284] & 0x7F;
1337 wacom_notify_battery(wacom
, battery_status
, chg
, 1, chg
);
1340 static int wacom_intuos_pro2_bt_irq(struct wacom_wac
*wacom
, size_t len
)
1342 unsigned char *data
= wacom
->data
;
1344 if (data
[0] != 0x80) {
1345 dev_dbg(wacom
->pen_input
->dev
.parent
,
1346 "%s: received unknown report #%d\n", __func__
, data
[0]);
1350 wacom_intuos_pro2_bt_pen(wacom
);
1351 wacom_intuos_pro2_bt_touch(wacom
);
1352 wacom_intuos_pro2_bt_pad(wacom
);
1353 wacom_intuos_pro2_bt_battery(wacom
);
1357 static int wacom_24hdt_irq(struct wacom_wac
*wacom
)
1359 struct input_dev
*input
= wacom
->touch_input
;
1360 unsigned char *data
= wacom
->data
;
1362 int current_num_contacts
= data
[61];
1363 int contacts_to_send
= 0;
1364 int num_contacts_left
= 4; /* maximum contacts per packet */
1365 int byte_per_packet
= WACOM_BYTES_PER_24HDT_PACKET
;
1368 if (wacom
->features
.type
== WACOM_27QHDT
) {
1369 current_num_contacts
= data
[63];
1370 num_contacts_left
= 10;
1371 byte_per_packet
= WACOM_BYTES_PER_QHDTHID_PACKET
;
1376 * First packet resets the counter since only the first
1377 * packet in series will have non-zero current_num_contacts.
1379 if (current_num_contacts
)
1380 wacom
->num_contacts_left
= current_num_contacts
;
1382 contacts_to_send
= min(num_contacts_left
, wacom
->num_contacts_left
);
1384 for (i
= 0; i
< contacts_to_send
; i
++) {
1385 int offset
= (byte_per_packet
* i
) + 1;
1386 bool touch
= (data
[offset
] & 0x1) && report_touch_events(wacom
);
1387 int slot
= input_mt_get_slot_by_key(input
, data
[offset
+ 1]);
1391 input_mt_slot(input
, slot
);
1392 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
1395 int t_x
= get_unaligned_le16(&data
[offset
+ 2]);
1396 int t_y
= get_unaligned_le16(&data
[offset
+ 4 + y_offset
]);
1398 input_report_abs(input
, ABS_MT_POSITION_X
, t_x
);
1399 input_report_abs(input
, ABS_MT_POSITION_Y
, t_y
);
1401 if (wacom
->features
.type
!= WACOM_27QHDT
) {
1402 int c_x
= get_unaligned_le16(&data
[offset
+ 4]);
1403 int c_y
= get_unaligned_le16(&data
[offset
+ 8]);
1404 int w
= get_unaligned_le16(&data
[offset
+ 10]);
1405 int h
= get_unaligned_le16(&data
[offset
+ 12]);
1407 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, min(w
,h
));
1408 input_report_abs(input
, ABS_MT_WIDTH_MAJOR
,
1409 min(w
, h
) + int_dist(t_x
, t_y
, c_x
, c_y
));
1410 input_report_abs(input
, ABS_MT_WIDTH_MINOR
, min(w
, h
));
1411 input_report_abs(input
, ABS_MT_ORIENTATION
, w
> h
);
1415 input_mt_sync_frame(input
);
1417 wacom
->num_contacts_left
-= contacts_to_send
;
1418 if (wacom
->num_contacts_left
<= 0) {
1419 wacom
->num_contacts_left
= 0;
1420 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1425 static int wacom_mt_touch(struct wacom_wac
*wacom
)
1427 struct input_dev
*input
= wacom
->touch_input
;
1428 unsigned char *data
= wacom
->data
;
1430 int current_num_contacts
= data
[2];
1431 int contacts_to_send
= 0;
1434 /* MTTPC does not support Height and Width */
1435 if (wacom
->features
.type
== MTTPC
|| wacom
->features
.type
== MTTPC_B
)
1439 * First packet resets the counter since only the first
1440 * packet in series will have non-zero current_num_contacts.
1442 if (current_num_contacts
)
1443 wacom
->num_contacts_left
= current_num_contacts
;
1445 /* There are at most 5 contacts per packet */
1446 contacts_to_send
= min(5, wacom
->num_contacts_left
);
1448 for (i
= 0; i
< contacts_to_send
; i
++) {
1449 int offset
= (WACOM_BYTES_PER_MT_PACKET
+ x_offset
) * i
+ 3;
1450 bool touch
= (data
[offset
] & 0x1) && report_touch_events(wacom
);
1451 int id
= get_unaligned_le16(&data
[offset
+ 1]);
1452 int slot
= input_mt_get_slot_by_key(input
, id
);
1457 input_mt_slot(input
, slot
);
1458 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
1460 int x
= get_unaligned_le16(&data
[offset
+ x_offset
+ 7]);
1461 int y
= get_unaligned_le16(&data
[offset
+ x_offset
+ 9]);
1462 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
1463 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
1466 input_mt_sync_frame(input
);
1468 wacom
->num_contacts_left
-= contacts_to_send
;
1469 if (wacom
->num_contacts_left
<= 0) {
1470 wacom
->num_contacts_left
= 0;
1471 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1476 static int wacom_tpc_mt_touch(struct wacom_wac
*wacom
)
1478 struct input_dev
*input
= wacom
->touch_input
;
1479 unsigned char *data
= wacom
->data
;
1482 for (i
= 0; i
< 2; i
++) {
1483 int p
= data
[1] & (1 << i
);
1484 bool touch
= p
&& report_touch_events(wacom
);
1486 input_mt_slot(input
, i
);
1487 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
1489 int x
= le16_to_cpup((__le16
*)&data
[i
* 2 + 2]) & 0x7fff;
1490 int y
= le16_to_cpup((__le16
*)&data
[i
* 2 + 6]) & 0x7fff;
1492 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
1493 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
1496 input_mt_sync_frame(input
);
1498 /* keep touch state for pen event */
1499 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1504 static int wacom_tpc_single_touch(struct wacom_wac
*wacom
, size_t len
)
1506 unsigned char *data
= wacom
->data
;
1507 struct input_dev
*input
= wacom
->touch_input
;
1508 bool prox
= report_touch_events(wacom
);
1511 if (wacom
->features
.touch_max
> 1 || len
> WACOM_PKGLEN_TPC2FG
)
1514 if (len
== WACOM_PKGLEN_TPC1FG
) {
1515 prox
= prox
&& (data
[0] & 0x01);
1516 x
= get_unaligned_le16(&data
[1]);
1517 y
= get_unaligned_le16(&data
[3]);
1518 } else if (len
== WACOM_PKGLEN_TPC1FG_B
) {
1519 prox
= prox
&& (data
[2] & 0x01);
1520 x
= get_unaligned_le16(&data
[3]);
1521 y
= get_unaligned_le16(&data
[5]);
1523 prox
= prox
&& (data
[1] & 0x01);
1524 x
= le16_to_cpup((__le16
*)&data
[2]);
1525 y
= le16_to_cpup((__le16
*)&data
[4]);
1529 input_report_abs(input
, ABS_X
, x
);
1530 input_report_abs(input
, ABS_Y
, y
);
1532 input_report_key(input
, BTN_TOUCH
, prox
);
1534 /* keep touch state for pen events */
1535 wacom
->shared
->touch_down
= prox
;
1540 static int wacom_tpc_pen(struct wacom_wac
*wacom
)
1542 unsigned char *data
= wacom
->data
;
1543 struct input_dev
*input
= wacom
->pen_input
;
1544 bool prox
= data
[1] & 0x20;
1546 if (!wacom
->shared
->stylus_in_proximity
) /* first in prox */
1547 /* Going into proximity select tool */
1548 wacom
->tool
[0] = (data
[1] & 0x0c) ? BTN_TOOL_RUBBER
: BTN_TOOL_PEN
;
1550 /* keep pen state for touch events */
1551 wacom
->shared
->stylus_in_proximity
= prox
;
1553 /* send pen events only when touch is up or forced out
1554 * or touch arbitration is off
1556 if (!delay_pen_events(wacom
)) {
1557 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
1558 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x10);
1559 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
1560 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
1561 input_report_abs(input
, ABS_PRESSURE
, ((data
[7] & 0x07) << 8) | data
[6]);
1562 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x05);
1563 input_report_key(input
, wacom
->tool
[0], prox
);
1570 static int wacom_tpc_irq(struct wacom_wac
*wacom
, size_t len
)
1572 unsigned char *data
= wacom
->data
;
1574 if (wacom
->pen_input
)
1575 dev_dbg(wacom
->pen_input
->dev
.parent
,
1576 "%s: received report #%d\n", __func__
, data
[0]);
1577 else if (wacom
->touch_input
)
1578 dev_dbg(wacom
->touch_input
->dev
.parent
,
1579 "%s: received report #%d\n", __func__
, data
[0]);
1582 case WACOM_PKGLEN_TPC1FG
:
1583 return wacom_tpc_single_touch(wacom
, len
);
1585 case WACOM_PKGLEN_TPC2FG
:
1586 return wacom_tpc_mt_touch(wacom
);
1588 case WACOM_PKGLEN_PENABLED
:
1589 return wacom_tpc_pen(wacom
);
1593 case WACOM_REPORT_TPC1FG
:
1594 case WACOM_REPORT_TPCHID
:
1595 case WACOM_REPORT_TPCST
:
1596 case WACOM_REPORT_TPC1FGE
:
1597 return wacom_tpc_single_touch(wacom
, len
);
1599 case WACOM_REPORT_TPCMT
:
1600 case WACOM_REPORT_TPCMT2
:
1601 return wacom_mt_touch(wacom
);
1603 case WACOM_REPORT_PENABLED
:
1604 return wacom_tpc_pen(wacom
);
1611 int wacom_equivalent_usage(int usage
)
1613 if ((usage
& HID_USAGE_PAGE
) == WACOM_HID_UP_WACOMDIGITIZER
) {
1614 int subpage
= (usage
& 0xFF00) << 8;
1615 int subusage
= (usage
& 0xFF);
1617 if (subpage
== WACOM_HID_SP_PAD
||
1618 subpage
== WACOM_HID_SP_BUTTON
||
1619 subpage
== WACOM_HID_SP_DIGITIZER
||
1620 subpage
== WACOM_HID_SP_DIGITIZERINFO
||
1621 usage
== WACOM_HID_WD_SENSE
||
1622 usage
== WACOM_HID_WD_SERIALHI
||
1623 usage
== WACOM_HID_WD_TOOLTYPE
||
1624 usage
== WACOM_HID_WD_DISTANCE
||
1625 usage
== WACOM_HID_WD_TOUCHSTRIP
||
1626 usage
== WACOM_HID_WD_TOUCHSTRIP2
||
1627 usage
== WACOM_HID_WD_TOUCHRING
||
1628 usage
== WACOM_HID_WD_TOUCHRINGSTATUS
) {
1632 if (subpage
== HID_UP_UNDEFINED
)
1633 subpage
= HID_UP_DIGITIZER
;
1635 return subpage
| subusage
;
1638 if ((usage
& HID_USAGE_PAGE
) == WACOM_HID_UP_WACOMTOUCH
) {
1639 int subpage
= (usage
& 0xFF00) << 8;
1640 int subusage
= (usage
& 0xFF);
1642 if (subpage
== HID_UP_UNDEFINED
)
1643 subpage
= WACOM_HID_SP_DIGITIZER
;
1645 return subpage
| subusage
;
1651 static void wacom_map_usage(struct input_dev
*input
, struct hid_usage
*usage
,
1652 struct hid_field
*field
, __u8 type
, __u16 code
, int fuzz
)
1654 struct wacom
*wacom
= input_get_drvdata(input
);
1655 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1656 struct wacom_features
*features
= &wacom_wac
->features
;
1657 int fmin
= field
->logical_minimum
;
1658 int fmax
= field
->logical_maximum
;
1659 unsigned int equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1660 int resolution_code
= code
;
1662 if (equivalent_usage
== HID_DG_TWIST
) {
1663 resolution_code
= ABS_RZ
;
1666 if (equivalent_usage
== HID_GD_X
) {
1667 fmin
+= features
->offset_left
;
1668 fmax
-= features
->offset_right
;
1670 if (equivalent_usage
== HID_GD_Y
) {
1671 fmin
+= features
->offset_top
;
1672 fmax
-= features
->offset_bottom
;
1678 set_bit(type
, input
->evbit
);
1682 input_set_abs_params(input
, code
, fmin
, fmax
, fuzz
, 0);
1683 input_abs_set_res(input
, code
,
1684 hidinput_calc_abs_res(field
, resolution_code
));
1687 input_set_capability(input
, EV_KEY
, code
);
1690 input_set_capability(input
, EV_MSC
, code
);
1693 input_set_capability(input
, EV_SW
, code
);
1698 static void wacom_wac_pad_usage_mapping(struct hid_device
*hdev
,
1699 struct hid_field
*field
, struct hid_usage
*usage
)
1701 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1702 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1703 struct wacom_features
*features
= &wacom_wac
->features
;
1704 struct input_dev
*input
= wacom_wac
->pad_input
;
1705 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1707 switch (equivalent_usage
) {
1708 case WACOM_HID_WD_BATTERY_LEVEL
:
1709 case WACOM_HID_WD_BATTERY_CHARGING
:
1710 features
->quirks
|= WACOM_QUIRK_BATTERY
;
1712 case WACOM_HID_WD_ACCELEROMETER_X
:
1713 __set_bit(INPUT_PROP_ACCELEROMETER
, input
->propbit
);
1714 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_X
, 0);
1715 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1717 case WACOM_HID_WD_ACCELEROMETER_Y
:
1718 __set_bit(INPUT_PROP_ACCELEROMETER
, input
->propbit
);
1719 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Y
, 0);
1720 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1722 case WACOM_HID_WD_ACCELEROMETER_Z
:
1723 __set_bit(INPUT_PROP_ACCELEROMETER
, input
->propbit
);
1724 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Z
, 0);
1725 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1727 case WACOM_HID_WD_BUTTONCENTER
:
1728 wacom
->generic_has_leds
= true;
1730 case WACOM_HID_WD_BUTTONHOME
:
1731 case WACOM_HID_WD_BUTTONUP
:
1732 case WACOM_HID_WD_BUTTONDOWN
:
1733 case WACOM_HID_WD_BUTTONLEFT
:
1734 case WACOM_HID_WD_BUTTONRIGHT
:
1735 wacom_map_usage(input
, usage
, field
, EV_KEY
,
1736 wacom_numbered_button_to_key(features
->numbered_buttons
),
1738 features
->numbered_buttons
++;
1739 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1741 case WACOM_HID_WD_TOUCHONOFF
:
1743 * This usage, which is used to mute touch events, comes
1744 * from the pad packet, but is reported on the touch
1745 * interface. Because the touch interface may not have
1746 * been created yet, we cannot call wacom_map_usage(). In
1747 * order to process this usage when we receive it, we set
1748 * the usage type and code directly.
1750 wacom_wac
->has_mute_touch_switch
= true;
1751 usage
->type
= EV_SW
;
1752 usage
->code
= SW_MUTE_DEVICE
;
1753 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1755 case WACOM_HID_WD_TOUCHSTRIP
:
1756 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_RX
, 0);
1757 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1759 case WACOM_HID_WD_TOUCHSTRIP2
:
1760 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_RY
, 0);
1761 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1763 case WACOM_HID_WD_TOUCHRING
:
1764 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_WHEEL
, 0);
1765 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1767 case WACOM_HID_WD_TOUCHRINGSTATUS
:
1768 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_WHEEL
, 0);
1769 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1771 case WACOM_HID_WD_BUTTONCONFIG
:
1772 wacom_map_usage(input
, usage
, field
, EV_KEY
, KEY_BUTTONCONFIG
, 0);
1773 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1775 case WACOM_HID_WD_ONSCREEN_KEYBOARD
:
1776 wacom_map_usage(input
, usage
, field
, EV_KEY
, KEY_ONSCREEN_KEYBOARD
, 0);
1777 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1779 case WACOM_HID_WD_CONTROLPANEL
:
1780 wacom_map_usage(input
, usage
, field
, EV_KEY
, KEY_CONTROLPANEL
, 0);
1781 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1783 case WACOM_HID_WD_MODE_CHANGE
:
1784 /* do not overwrite previous data */
1785 if (!wacom_wac
->has_mode_change
) {
1786 wacom_wac
->has_mode_change
= true;
1787 wacom_wac
->is_direct_mode
= true;
1789 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1793 switch (equivalent_usage
& 0xfffffff0) {
1794 case WACOM_HID_WD_EXPRESSKEY00
:
1795 wacom_map_usage(input
, usage
, field
, EV_KEY
,
1796 wacom_numbered_button_to_key(features
->numbered_buttons
),
1798 features
->numbered_buttons
++;
1799 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1804 static void wacom_wac_pad_battery_event(struct hid_device
*hdev
, struct hid_field
*field
,
1805 struct hid_usage
*usage
, __s32 value
)
1807 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1808 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1809 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1811 switch (equivalent_usage
) {
1812 case WACOM_HID_WD_BATTERY_LEVEL
:
1813 wacom_wac
->hid_data
.battery_capacity
= value
;
1814 wacom_wac
->hid_data
.bat_connected
= 1;
1817 case WACOM_HID_WD_BATTERY_CHARGING
:
1818 wacom_wac
->hid_data
.bat_charging
= value
;
1819 wacom_wac
->hid_data
.ps_connected
= value
;
1820 wacom_wac
->hid_data
.bat_connected
= 1;
1825 static void wacom_wac_pad_event(struct hid_device
*hdev
, struct hid_field
*field
,
1826 struct hid_usage
*usage
, __s32 value
)
1828 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1829 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1830 struct input_dev
*input
= wacom_wac
->pad_input
;
1831 struct wacom_features
*features
= &wacom_wac
->features
;
1832 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1836 * Avoid reporting this event and setting inrange_state if this usage
1837 * hasn't been mapped.
1839 if (!usage
->type
&& equivalent_usage
!= WACOM_HID_WD_MODE_CHANGE
)
1842 if (wacom_equivalent_usage(field
->physical
) == HID_DG_TABLETFUNCTIONKEY
) {
1843 if (usage
->hid
!= WACOM_HID_WD_TOUCHRING
)
1844 wacom_wac
->hid_data
.inrange_state
|= value
;
1847 switch (equivalent_usage
) {
1848 case WACOM_HID_WD_TOUCHRINGSTATUS
:
1850 input_event(input
, usage
->type
, usage
->code
, 0);
1853 case WACOM_HID_WD_TOUCHONOFF
:
1854 if (wacom_wac
->shared
->touch_input
) {
1855 input_report_switch(wacom_wac
->shared
->touch_input
,
1856 SW_MUTE_DEVICE
, !value
);
1857 input_sync(wacom_wac
->shared
->touch_input
);
1861 case WACOM_HID_WD_MODE_CHANGE
:
1862 if (wacom_wac
->is_direct_mode
!= value
) {
1863 wacom_wac
->is_direct_mode
= value
;
1864 wacom_schedule_work(&wacom
->wacom_wac
, WACOM_WORKER_MODE_CHANGE
);
1868 case WACOM_HID_WD_BUTTONCENTER
:
1869 for (i
= 0; i
< wacom
->led
.count
; i
++)
1870 wacom_update_led(wacom
, features
->numbered_buttons
,
1874 input_event(input
, usage
->type
, usage
->code
, value
);
1879 static void wacom_wac_pad_pre_report(struct hid_device
*hdev
,
1880 struct hid_report
*report
)
1882 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1883 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1885 wacom_wac
->hid_data
.inrange_state
= 0;
1888 static void wacom_wac_pad_battery_report(struct hid_device
*hdev
,
1889 struct hid_report
*report
)
1891 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1892 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1893 struct wacom_features
*features
= &wacom_wac
->features
;
1895 if (features
->quirks
& WACOM_QUIRK_BATTERY
) {
1896 int capacity
= wacom_wac
->hid_data
.battery_capacity
;
1897 bool charging
= wacom_wac
->hid_data
.bat_charging
;
1898 bool connected
= wacom_wac
->hid_data
.bat_connected
;
1899 bool powered
= wacom_wac
->hid_data
.ps_connected
;
1901 wacom_notify_battery(wacom_wac
, capacity
, charging
,
1902 connected
, powered
);
1906 static void wacom_wac_pad_report(struct hid_device
*hdev
,
1907 struct hid_report
*report
)
1909 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1910 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1911 struct input_dev
*input
= wacom_wac
->pad_input
;
1912 bool active
= wacom_wac
->hid_data
.inrange_state
!= 0;
1914 /* report prox for expresskey events */
1915 if (wacom_equivalent_usage(report
->field
[0]->physical
) == HID_DG_TABLETFUNCTIONKEY
) {
1916 input_event(input
, EV_ABS
, ABS_MISC
, active
? PAD_DEVICE_ID
: 0);
1922 static void wacom_wac_pen_usage_mapping(struct hid_device
*hdev
,
1923 struct hid_field
*field
, struct hid_usage
*usage
)
1925 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1926 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1927 struct wacom_features
*features
= &wacom_wac
->features
;
1928 struct input_dev
*input
= wacom_wac
->pen_input
;
1929 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1931 switch (equivalent_usage
) {
1933 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_X
, 4);
1936 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Y
, 4);
1938 case WACOM_HID_WD_DISTANCE
:
1940 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_DISTANCE
, 0);
1942 case HID_DG_TIPPRESSURE
:
1943 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_PRESSURE
, 0);
1945 case HID_DG_INRANGE
:
1946 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOOL_PEN
, 0);
1948 case HID_DG_BATTERYSTRENGTH
:
1949 features
->quirks
|= WACOM_QUIRK_BATTERY
;
1952 wacom_map_usage(input
, usage
, field
, EV_KEY
,
1953 BTN_TOOL_RUBBER
, 0);
1956 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_TILT_X
, 0);
1959 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_TILT_Y
, 0);
1962 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Z
, 0);
1965 case HID_DG_TIPSWITCH
:
1966 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOUCH
, 0);
1968 case HID_DG_BARRELSWITCH
:
1969 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_STYLUS
, 0);
1971 case HID_DG_BARRELSWITCH2
:
1972 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_STYLUS2
, 0);
1974 case HID_DG_TOOLSERIALNUMBER
:
1975 wacom_map_usage(input
, usage
, field
, EV_MSC
, MSC_SERIAL
, 0);
1977 case WACOM_HID_WD_SENSE
:
1978 features
->quirks
|= WACOM_QUIRK_SENSE
;
1979 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOOL_PEN
, 0);
1981 case WACOM_HID_WD_SERIALHI
:
1982 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_MISC
, 0);
1983 set_bit(EV_KEY
, input
->evbit
);
1984 input_set_capability(input
, EV_KEY
, BTN_TOOL_PEN
);
1985 input_set_capability(input
, EV_KEY
, BTN_TOOL_RUBBER
);
1986 input_set_capability(input
, EV_KEY
, BTN_TOOL_BRUSH
);
1987 input_set_capability(input
, EV_KEY
, BTN_TOOL_PENCIL
);
1988 input_set_capability(input
, EV_KEY
, BTN_TOOL_AIRBRUSH
);
1989 input_set_capability(input
, EV_KEY
, BTN_TOOL_MOUSE
);
1990 input_set_capability(input
, EV_KEY
, BTN_TOOL_LENS
);
1992 case WACOM_HID_WD_FINGERWHEEL
:
1993 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_WHEEL
, 0);
1998 static void wacom_wac_pen_event(struct hid_device
*hdev
, struct hid_field
*field
,
1999 struct hid_usage
*usage
, __s32 value
)
2001 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2002 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2003 struct wacom_features
*features
= &wacom_wac
->features
;
2004 struct input_dev
*input
= wacom_wac
->pen_input
;
2005 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
2007 switch (equivalent_usage
) {
2010 * HID_GD_Z "should increase as the control's position is
2011 * moved from high to low", while ABS_DISTANCE instead
2012 * increases in value as the tool moves from low to high.
2014 value
= field
->logical_maximum
- value
;
2016 case HID_DG_INRANGE
:
2017 wacom_wac
->hid_data
.inrange_state
= value
;
2018 if (!(features
->quirks
& WACOM_QUIRK_SENSE
))
2019 wacom_wac
->hid_data
.sense_state
= value
;
2021 case HID_DG_BATTERYSTRENGTH
:
2022 wacom_wac
->hid_data
.battery_capacity
= value
;
2023 wacom_wac
->hid_data
.bat_connected
= 1;
2026 wacom_wac
->hid_data
.invert_state
= value
;
2029 case HID_DG_TIPSWITCH
:
2030 wacom_wac
->hid_data
.tipswitch
|= value
;
2032 case HID_DG_TOOLSERIALNUMBER
:
2033 wacom_wac
->serial
[0] = (wacom_wac
->serial
[0] & ~0xFFFFFFFFULL
);
2034 wacom_wac
->serial
[0] |= value
;
2036 case WACOM_HID_WD_SENSE
:
2037 wacom_wac
->hid_data
.sense_state
= value
;
2039 case WACOM_HID_WD_SERIALHI
:
2040 wacom_wac
->serial
[0] = (wacom_wac
->serial
[0] & 0xFFFFFFFF);
2041 wacom_wac
->serial
[0] |= ((__u64
)value
) << 32;
2043 * Non-USI EMR devices may contain additional tool type
2044 * information here. See WACOM_HID_WD_TOOLTYPE case for
2047 if (value
>> 20 == 1) {
2048 wacom_wac
->id
[0] |= value
& 0xFFFFF;
2051 case WACOM_HID_WD_TOOLTYPE
:
2053 * Some devices (MobileStudio Pro, and possibly later
2054 * devices as well) do not return the complete tool
2055 * type in their WACOM_HID_WD_TOOLTYPE usage. Use a
2056 * bitwise OR so the complete value can be built
2059 wacom_wac
->id
[0] |= value
;
2061 case WACOM_HID_WD_OFFSETLEFT
:
2062 if (features
->offset_left
&& value
!= features
->offset_left
)
2063 hid_warn(hdev
, "%s: overriding exising left offset "
2064 "%d -> %d\n", __func__
, value
,
2065 features
->offset_left
);
2066 features
->offset_left
= value
;
2068 case WACOM_HID_WD_OFFSETRIGHT
:
2069 if (features
->offset_right
&& value
!= features
->offset_right
)
2070 hid_warn(hdev
, "%s: overriding exising right offset "
2071 "%d -> %d\n", __func__
, value
,
2072 features
->offset_right
);
2073 features
->offset_right
= value
;
2075 case WACOM_HID_WD_OFFSETTOP
:
2076 if (features
->offset_top
&& value
!= features
->offset_top
)
2077 hid_warn(hdev
, "%s: overriding exising top offset "
2078 "%d -> %d\n", __func__
, value
,
2079 features
->offset_top
);
2080 features
->offset_top
= value
;
2082 case WACOM_HID_WD_OFFSETBOTTOM
:
2083 if (features
->offset_bottom
&& value
!= features
->offset_bottom
)
2084 hid_warn(hdev
, "%s: overriding exising bottom offset "
2085 "%d -> %d\n", __func__
, value
,
2086 features
->offset_bottom
);
2087 features
->offset_bottom
= value
;
2091 /* send pen events only when touch is up or forced out
2092 * or touch arbitration is off
2094 if (!usage
->type
|| delay_pen_events(wacom_wac
))
2097 /* send pen events only when the pen is in/entering/leaving proximity */
2098 if (!wacom_wac
->hid_data
.inrange_state
&& !wacom_wac
->tool
[0])
2101 input_event(input
, usage
->type
, usage
->code
, value
);
2104 static void wacom_wac_pen_pre_report(struct hid_device
*hdev
,
2105 struct hid_report
*report
)
2110 static void wacom_wac_pen_report(struct hid_device
*hdev
,
2111 struct hid_report
*report
)
2113 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2114 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2115 struct input_dev
*input
= wacom_wac
->pen_input
;
2116 bool prox
= wacom_wac
->hid_data
.inrange_state
;
2117 bool range
= wacom_wac
->hid_data
.sense_state
;
2119 if (!wacom_wac
->tool
[0] && prox
) { /* first in prox */
2120 /* Going into proximity select tool */
2121 if (wacom_wac
->hid_data
.invert_state
)
2122 wacom_wac
->tool
[0] = BTN_TOOL_RUBBER
;
2123 else if (wacom_wac
->id
[0])
2124 wacom_wac
->tool
[0] = wacom_intuos_get_tool_type(wacom_wac
->id
[0]);
2126 wacom_wac
->tool
[0] = BTN_TOOL_PEN
;
2129 /* keep pen state for touch events */
2130 wacom_wac
->shared
->stylus_in_proximity
= range
;
2132 if (!delay_pen_events(wacom_wac
) && wacom_wac
->tool
[0]) {
2133 int id
= wacom_wac
->id
[0];
2136 * Non-USI EMR tools should have their IDs mangled to
2137 * match the legacy behavior of wacom_intuos_general
2139 if (wacom_wac
->serial
[0] >> 52 == 1)
2140 id
= wacom_intuos_id_mangle(id
);
2143 * To ensure compatibility with xf86-input-wacom, we should
2144 * report the BTN_TOOL_* event prior to the ABS_MISC or
2145 * MSC_SERIAL events.
2147 input_report_key(input
, BTN_TOUCH
,
2148 wacom_wac
->hid_data
.tipswitch
);
2149 input_report_key(input
, wacom_wac
->tool
[0], prox
);
2150 if (wacom_wac
->serial
[0]) {
2151 input_event(input
, EV_MSC
, MSC_SERIAL
, wacom_wac
->serial
[0]);
2152 input_report_abs(input
, ABS_MISC
, id
);
2155 wacom_wac
->hid_data
.tipswitch
= false;
2161 wacom_wac
->tool
[0] = 0;
2162 wacom_wac
->id
[0] = 0;
2166 static void wacom_wac_finger_usage_mapping(struct hid_device
*hdev
,
2167 struct hid_field
*field
, struct hid_usage
*usage
)
2169 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2170 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2171 struct input_dev
*input
= wacom_wac
->touch_input
;
2172 unsigned touch_max
= wacom_wac
->features
.touch_max
;
2173 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
2175 switch (equivalent_usage
) {
2178 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_X
, 4);
2180 wacom_map_usage(input
, usage
, field
, EV_ABS
,
2181 ABS_MT_POSITION_X
, 4);
2185 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Y
, 4);
2187 wacom_map_usage(input
, usage
, field
, EV_ABS
,
2188 ABS_MT_POSITION_Y
, 4);
2192 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_MT_TOUCH_MAJOR
, 0);
2193 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_MT_TOUCH_MINOR
, 0);
2194 input_set_abs_params(input
, ABS_MT_ORIENTATION
, 0, 1, 0, 0);
2196 case HID_DG_TIPSWITCH
:
2197 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOUCH
, 0);
2199 case HID_DG_CONTACTCOUNT
:
2200 wacom_wac
->hid_data
.cc_report
= field
->report
->id
;
2201 wacom_wac
->hid_data
.cc_index
= field
->index
;
2202 wacom_wac
->hid_data
.cc_value_index
= usage
->usage_index
;
2207 static void wacom_wac_finger_slot(struct wacom_wac
*wacom_wac
,
2208 struct input_dev
*input
)
2210 struct hid_data
*hid_data
= &wacom_wac
->hid_data
;
2211 bool mt
= wacom_wac
->features
.touch_max
> 1;
2212 bool prox
= hid_data
->tipswitch
&&
2213 report_touch_events(wacom_wac
);
2215 wacom_wac
->hid_data
.num_received
++;
2216 if (wacom_wac
->hid_data
.num_received
> wacom_wac
->hid_data
.num_expected
)
2222 slot
= input_mt_get_slot_by_key(input
, hid_data
->id
);
2223 input_mt_slot(input
, slot
);
2224 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, prox
);
2227 input_report_key(input
, BTN_TOUCH
, prox
);
2231 input_report_abs(input
, mt
? ABS_MT_POSITION_X
: ABS_X
,
2233 input_report_abs(input
, mt
? ABS_MT_POSITION_Y
: ABS_Y
,
2236 if (test_bit(ABS_MT_TOUCH_MAJOR
, input
->absbit
)) {
2237 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, max(hid_data
->width
, hid_data
->height
));
2238 input_report_abs(input
, ABS_MT_TOUCH_MINOR
, min(hid_data
->width
, hid_data
->height
));
2239 if (hid_data
->width
!= hid_data
->height
)
2240 input_report_abs(input
, ABS_MT_ORIENTATION
, hid_data
->width
<= hid_data
->height
? 0 : 1);
2245 static void wacom_wac_finger_event(struct hid_device
*hdev
,
2246 struct hid_field
*field
, struct hid_usage
*usage
, __s32 value
)
2248 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2249 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2250 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
2252 switch (equivalent_usage
) {
2254 wacom_wac
->hid_data
.x
= value
;
2257 wacom_wac
->hid_data
.y
= value
;
2260 wacom_wac
->hid_data
.width
= value
;
2263 wacom_wac
->hid_data
.height
= value
;
2265 case HID_DG_CONTACTID
:
2266 wacom_wac
->hid_data
.id
= value
;
2268 case HID_DG_TIPSWITCH
:
2269 wacom_wac
->hid_data
.tipswitch
= value
;
2274 if (usage
->usage_index
+ 1 == field
->report_count
) {
2275 if (equivalent_usage
== wacom_wac
->hid_data
.last_slot_field
)
2276 wacom_wac_finger_slot(wacom_wac
, wacom_wac
->touch_input
);
2280 static void wacom_wac_finger_pre_report(struct hid_device
*hdev
,
2281 struct hid_report
*report
)
2283 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2284 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2285 struct hid_data
* hid_data
= &wacom_wac
->hid_data
;
2288 for (i
= 0; i
< report
->maxfield
; i
++) {
2289 struct hid_field
*field
= report
->field
[i
];
2292 for (j
= 0; j
< field
->maxusage
; j
++) {
2293 struct hid_usage
*usage
= &field
->usage
[j
];
2294 unsigned int equivalent_usage
=
2295 wacom_equivalent_usage(usage
->hid
);
2297 switch (equivalent_usage
) {
2302 case HID_DG_CONTACTID
:
2303 case HID_DG_INRANGE
:
2305 case HID_DG_TIPSWITCH
:
2306 hid_data
->last_slot_field
= equivalent_usage
;
2308 case HID_DG_CONTACTCOUNT
:
2309 hid_data
->cc_report
= report
->id
;
2310 hid_data
->cc_index
= i
;
2311 hid_data
->cc_value_index
= j
;
2317 if (hid_data
->cc_report
!= 0 &&
2318 hid_data
->cc_index
>= 0) {
2319 struct hid_field
*field
= report
->field
[hid_data
->cc_index
];
2320 int value
= field
->value
[hid_data
->cc_value_index
];
2322 hid_data
->num_expected
= value
;
2325 hid_data
->num_expected
= wacom_wac
->features
.touch_max
;
2329 static void wacom_wac_finger_report(struct hid_device
*hdev
,
2330 struct hid_report
*report
)
2332 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2333 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2334 struct input_dev
*input
= wacom_wac
->touch_input
;
2335 unsigned touch_max
= wacom_wac
->features
.touch_max
;
2337 /* If more packets of data are expected, give us a chance to
2338 * process them rather than immediately syncing a partial
2341 if (wacom_wac
->hid_data
.num_received
< wacom_wac
->hid_data
.num_expected
)
2345 input_mt_sync_frame(input
);
2348 wacom_wac
->hid_data
.num_received
= 0;
2350 /* keep touch state for pen event */
2351 wacom_wac
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom_wac
);
2354 void wacom_wac_usage_mapping(struct hid_device
*hdev
,
2355 struct hid_field
*field
, struct hid_usage
*usage
)
2357 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2358 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2359 struct wacom_features
*features
= &wacom_wac
->features
;
2361 if (WACOM_DIRECT_DEVICE(field
))
2362 features
->device_type
|= WACOM_DEVICETYPE_DIRECT
;
2364 if (WACOM_PAD_FIELD(field
))
2365 wacom_wac_pad_usage_mapping(hdev
, field
, usage
);
2366 else if (WACOM_PEN_FIELD(field
))
2367 wacom_wac_pen_usage_mapping(hdev
, field
, usage
);
2368 else if (WACOM_FINGER_FIELD(field
))
2369 wacom_wac_finger_usage_mapping(hdev
, field
, usage
);
2372 void wacom_wac_event(struct hid_device
*hdev
, struct hid_field
*field
,
2373 struct hid_usage
*usage
, __s32 value
)
2375 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2377 if (wacom
->wacom_wac
.features
.type
!= HID_GENERIC
)
2380 if (value
> field
->logical_maximum
|| value
< field
->logical_minimum
)
2383 if (WACOM_PAD_FIELD(field
)) {
2384 wacom_wac_pad_battery_event(hdev
, field
, usage
, value
);
2385 if (wacom
->wacom_wac
.pad_input
)
2386 wacom_wac_pad_event(hdev
, field
, usage
, value
);
2387 } else if (WACOM_PEN_FIELD(field
) && wacom
->wacom_wac
.pen_input
)
2388 wacom_wac_pen_event(hdev
, field
, usage
, value
);
2389 else if (WACOM_FINGER_FIELD(field
) && wacom
->wacom_wac
.touch_input
)
2390 wacom_wac_finger_event(hdev
, field
, usage
, value
);
2393 static void wacom_report_events(struct hid_device
*hdev
, struct hid_report
*report
)
2397 for (r
= 0; r
< report
->maxfield
; r
++) {
2398 struct hid_field
*field
;
2401 field
= report
->field
[r
];
2402 count
= field
->report_count
;
2404 if (!(HID_MAIN_ITEM_VARIABLE
& field
->flags
))
2407 for (n
= 0; n
< count
; n
++)
2408 wacom_wac_event(hdev
, field
, &field
->usage
[n
], field
->value
[n
]);
2412 void wacom_wac_report(struct hid_device
*hdev
, struct hid_report
*report
)
2414 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2415 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2416 struct hid_field
*field
= report
->field
[0];
2418 if (wacom_wac
->features
.type
!= HID_GENERIC
)
2421 if (WACOM_PAD_FIELD(field
) && wacom
->wacom_wac
.pad_input
)
2422 wacom_wac_pad_pre_report(hdev
, report
);
2423 else if (WACOM_PEN_FIELD(field
) && wacom
->wacom_wac
.pen_input
)
2424 wacom_wac_pen_pre_report(hdev
, report
);
2425 else if (WACOM_FINGER_FIELD(field
) && wacom
->wacom_wac
.touch_input
)
2426 wacom_wac_finger_pre_report(hdev
, report
);
2428 wacom_report_events(hdev
, report
);
2431 * Non-input reports may be sent prior to the device being
2432 * completely initialized. Since only their events need
2433 * to be processed, exit after 'wacom_report_events' has
2434 * been called to prevent potential crashes in the report-
2435 * processing functions.
2437 if (report
->type
!= HID_INPUT_REPORT
)
2440 if (WACOM_PAD_FIELD(field
)) {
2441 wacom_wac_pad_battery_report(hdev
, report
);
2442 if (wacom
->wacom_wac
.pad_input
)
2443 wacom_wac_pad_report(hdev
, report
);
2444 } else if (WACOM_PEN_FIELD(field
) && wacom
->wacom_wac
.pen_input
)
2445 wacom_wac_pen_report(hdev
, report
);
2446 else if (WACOM_FINGER_FIELD(field
) && wacom
->wacom_wac
.touch_input
)
2447 wacom_wac_finger_report(hdev
, report
);
2450 static int wacom_bpt_touch(struct wacom_wac
*wacom
)
2452 struct wacom_features
*features
= &wacom
->features
;
2453 struct input_dev
*input
= wacom
->touch_input
;
2454 struct input_dev
*pad_input
= wacom
->pad_input
;
2455 unsigned char *data
= wacom
->data
;
2458 if (data
[0] != 0x02)
2461 for (i
= 0; i
< 2; i
++) {
2462 int offset
= (data
[1] & 0x80) ? (8 * i
) : (9 * i
);
2463 bool touch
= report_touch_events(wacom
)
2464 && (data
[offset
+ 3] & 0x80);
2466 input_mt_slot(input
, i
);
2467 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
2469 int x
= get_unaligned_be16(&data
[offset
+ 3]) & 0x7ff;
2470 int y
= get_unaligned_be16(&data
[offset
+ 5]) & 0x7ff;
2471 if (features
->quirks
& WACOM_QUIRK_BBTOUCH_LOWRES
) {
2475 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
2476 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
2480 input_mt_sync_frame(input
);
2482 input_report_key(pad_input
, BTN_LEFT
, (data
[1] & 0x08) != 0);
2483 input_report_key(pad_input
, BTN_FORWARD
, (data
[1] & 0x04) != 0);
2484 input_report_key(pad_input
, BTN_BACK
, (data
[1] & 0x02) != 0);
2485 input_report_key(pad_input
, BTN_RIGHT
, (data
[1] & 0x01) != 0);
2486 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
2491 static void wacom_bpt3_touch_msg(struct wacom_wac
*wacom
, unsigned char *data
)
2493 struct wacom_features
*features
= &wacom
->features
;
2494 struct input_dev
*input
= wacom
->touch_input
;
2495 bool touch
= data
[1] & 0x80;
2496 int slot
= input_mt_get_slot_by_key(input
, data
[0]);
2501 touch
= touch
&& report_touch_events(wacom
);
2503 input_mt_slot(input
, slot
);
2504 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
2507 int x
= (data
[2] << 4) | (data
[4] >> 4);
2508 int y
= (data
[3] << 4) | (data
[4] & 0x0f);
2511 if (features
->type
>= INTUOSPS
&& features
->type
<= INTUOSHT2
) {
2512 width
= data
[5] * 100;
2513 height
= data
[6] * 100;
2516 * "a" is a scaled-down area which we assume is
2517 * roughly circular and which can be described as:
2521 int x_res
= input_abs_get_res(input
, ABS_MT_POSITION_X
);
2522 int y_res
= input_abs_get_res(input
, ABS_MT_POSITION_Y
);
2523 width
= 2 * int_sqrt(a
* WACOM_CONTACT_AREA_SCALE
);
2524 height
= width
* y_res
/ x_res
;
2527 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
2528 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
2529 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, width
);
2530 input_report_abs(input
, ABS_MT_TOUCH_MINOR
, height
);
2534 static void wacom_bpt3_button_msg(struct wacom_wac
*wacom
, unsigned char *data
)
2536 struct input_dev
*input
= wacom
->pad_input
;
2537 struct wacom_features
*features
= &wacom
->features
;
2539 if (features
->type
== INTUOSHT
|| features
->type
== INTUOSHT2
) {
2540 input_report_key(input
, BTN_LEFT
, (data
[1] & 0x02) != 0);
2541 input_report_key(input
, BTN_BACK
, (data
[1] & 0x08) != 0);
2543 input_report_key(input
, BTN_BACK
, (data
[1] & 0x02) != 0);
2544 input_report_key(input
, BTN_LEFT
, (data
[1] & 0x08) != 0);
2546 input_report_key(input
, BTN_FORWARD
, (data
[1] & 0x04) != 0);
2547 input_report_key(input
, BTN_RIGHT
, (data
[1] & 0x01) != 0);
2550 static int wacom_bpt3_touch(struct wacom_wac
*wacom
)
2552 unsigned char *data
= wacom
->data
;
2553 int count
= data
[1] & 0x07;
2554 int touch_changed
= 0, i
;
2556 if (data
[0] != 0x02)
2559 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */
2560 for (i
= 0; i
< count
; i
++) {
2561 int offset
= (8 * i
) + 2;
2562 int msg_id
= data
[offset
];
2564 if (msg_id
>= 2 && msg_id
<= 17) {
2565 wacom_bpt3_touch_msg(wacom
, data
+ offset
);
2567 } else if (msg_id
== 128)
2568 wacom_bpt3_button_msg(wacom
, data
+ offset
);
2572 /* only update touch if we actually have a touchpad and touch data changed */
2573 if (wacom
->touch_input
&& touch_changed
) {
2574 input_mt_sync_frame(wacom
->touch_input
);
2575 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
2581 static int wacom_bpt_pen(struct wacom_wac
*wacom
)
2583 struct wacom_features
*features
= &wacom
->features
;
2584 struct input_dev
*input
= wacom
->pen_input
;
2585 unsigned char *data
= wacom
->data
;
2586 int prox
= 0, x
= 0, y
= 0, p
= 0, d
= 0, pen
= 0, btn1
= 0, btn2
= 0;
2588 if (data
[0] != WACOM_REPORT_PENABLED
)
2591 prox
= (data
[1] & 0x20) == 0x20;
2594 * All reports shared between PEN and RUBBER tool must be
2595 * forced to a known starting value (zero) when transitioning to
2598 * If not reset then, to userspace, it will look like lost events
2599 * if new tool comes in-prox with same values as previous tool sent.
2601 * Hardware does report zero in most out-of-prox cases but not all.
2603 if (!wacom
->shared
->stylus_in_proximity
) {
2604 if (data
[1] & 0x08) {
2605 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
2606 wacom
->id
[0] = ERASER_DEVICE_ID
;
2608 wacom
->tool
[0] = BTN_TOOL_PEN
;
2609 wacom
->id
[0] = STYLUS_DEVICE_ID
;
2613 wacom
->shared
->stylus_in_proximity
= prox
;
2614 if (delay_pen_events(wacom
))
2618 x
= le16_to_cpup((__le16
*)&data
[2]);
2619 y
= le16_to_cpup((__le16
*)&data
[4]);
2620 p
= le16_to_cpup((__le16
*)&data
[6]);
2622 * Convert distance from out prox to distance from tablet.
2623 * distance will be greater than distance_max once
2624 * touching and applying pressure; do not report negative
2627 if (data
[8] <= features
->distance_max
)
2628 d
= features
->distance_max
- data
[8];
2630 pen
= data
[1] & 0x01;
2631 btn1
= data
[1] & 0x02;
2632 btn2
= data
[1] & 0x04;
2637 input_report_key(input
, BTN_TOUCH
, pen
);
2638 input_report_key(input
, BTN_STYLUS
, btn1
);
2639 input_report_key(input
, BTN_STYLUS2
, btn2
);
2641 input_report_abs(input
, ABS_X
, x
);
2642 input_report_abs(input
, ABS_Y
, y
);
2643 input_report_abs(input
, ABS_PRESSURE
, p
);
2644 input_report_abs(input
, ABS_DISTANCE
, d
);
2646 input_report_key(input
, wacom
->tool
[0], prox
); /* PEN or RUBBER */
2647 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* TOOL ID */
2652 static int wacom_bpt_irq(struct wacom_wac
*wacom
, size_t len
)
2654 struct wacom_features
*features
= &wacom
->features
;
2656 if ((features
->type
== INTUOSHT2
) &&
2657 (features
->device_type
& WACOM_DEVICETYPE_PEN
))
2658 return wacom_intuos_irq(wacom
);
2659 else if (len
== WACOM_PKGLEN_BBTOUCH
)
2660 return wacom_bpt_touch(wacom
);
2661 else if (len
== WACOM_PKGLEN_BBTOUCH3
)
2662 return wacom_bpt3_touch(wacom
);
2663 else if (len
== WACOM_PKGLEN_BBFUN
|| len
== WACOM_PKGLEN_BBPEN
)
2664 return wacom_bpt_pen(wacom
);
2669 static void wacom_bamboo_pad_pen_event(struct wacom_wac
*wacom
,
2670 unsigned char *data
)
2672 unsigned char prefix
;
2675 * We need to reroute the event from the debug interface to the
2677 * We need to add the report ID to the actual pen report, so we
2678 * temporary overwrite the first byte to prevent having to kzalloc/kfree
2679 * and memcpy the report.
2682 data
[0] = WACOM_REPORT_BPAD_PEN
;
2685 * actually reroute the event.
2686 * No need to check if wacom->shared->pen is valid, hid_input_report()
2687 * will check for us.
2689 hid_input_report(wacom
->shared
->pen
, HID_INPUT_REPORT
, data
,
2690 WACOM_PKGLEN_PENABLED
, 1);
2695 static int wacom_bamboo_pad_touch_event(struct wacom_wac
*wacom
,
2696 unsigned char *data
)
2698 struct input_dev
*input
= wacom
->touch_input
;
2699 unsigned char *finger_data
, prefix
;
2706 for (id
= 0; id
< wacom
->features
.touch_max
; id
++) {
2707 valid
= !!(prefix
& BIT(id
)) &&
2708 report_touch_events(wacom
);
2710 input_mt_slot(input
, id
);
2711 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, valid
);
2716 finger_data
= data
+ 1 + id
* 3;
2717 x
= finger_data
[0] | ((finger_data
[1] & 0x0f) << 8);
2718 y
= (finger_data
[2] << 4) | (finger_data
[1] >> 4);
2720 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
2721 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
2724 input_mt_sync_frame(input
);
2726 input_report_key(input
, BTN_LEFT
, prefix
& 0x40);
2727 input_report_key(input
, BTN_RIGHT
, prefix
& 0x80);
2729 /* keep touch state for pen event */
2730 wacom
->shared
->touch_down
= !!prefix
&& report_touch_events(wacom
);
2735 static int wacom_bamboo_pad_irq(struct wacom_wac
*wacom
, size_t len
)
2737 unsigned char *data
= wacom
->data
;
2739 if (!((len
== WACOM_PKGLEN_BPAD_TOUCH
) ||
2740 (len
== WACOM_PKGLEN_BPAD_TOUCH_USB
)) ||
2741 (data
[0] != WACOM_REPORT_BPAD_TOUCH
))
2745 wacom_bamboo_pad_pen_event(wacom
, &data
[1]);
2748 return wacom_bamboo_pad_touch_event(wacom
, &data
[9]);
2753 static int wacom_wireless_irq(struct wacom_wac
*wacom
, size_t len
)
2755 unsigned char *data
= wacom
->data
;
2758 if (len
!= WACOM_PKGLEN_WIRELESS
|| data
[0] != WACOM_REPORT_WL
)
2761 connected
= data
[1] & 0x01;
2763 int pid
, battery
, charging
;
2765 if ((wacom
->shared
->type
== INTUOSHT
||
2766 wacom
->shared
->type
== INTUOSHT2
) &&
2767 wacom
->shared
->touch_input
&&
2768 wacom
->shared
->touch_max
) {
2769 input_report_switch(wacom
->shared
->touch_input
,
2770 SW_MUTE_DEVICE
, data
[5] & 0x40);
2771 input_sync(wacom
->shared
->touch_input
);
2774 pid
= get_unaligned_be16(&data
[6]);
2775 battery
= (data
[5] & 0x3f) * 100 / 31;
2776 charging
= !!(data
[5] & 0x80);
2777 if (wacom
->pid
!= pid
) {
2779 wacom_schedule_work(wacom
, WACOM_WORKER_WIRELESS
);
2782 wacom_notify_battery(wacom
, battery
, charging
, 1, 0);
2784 } else if (wacom
->pid
!= 0) {
2785 /* disconnected while previously connected */
2787 wacom_schedule_work(wacom
, WACOM_WORKER_WIRELESS
);
2788 wacom_notify_battery(wacom
, 0, 0, 0, 0);
2794 static int wacom_status_irq(struct wacom_wac
*wacom_wac
, size_t len
)
2796 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
2797 struct wacom_features
*features
= &wacom_wac
->features
;
2798 unsigned char *data
= wacom_wac
->data
;
2800 if (data
[0] != WACOM_REPORT_USB
)
2803 if ((features
->type
== INTUOSHT
||
2804 features
->type
== INTUOSHT2
) &&
2805 wacom_wac
->shared
->touch_input
&&
2806 features
->touch_max
) {
2807 input_report_switch(wacom_wac
->shared
->touch_input
,
2808 SW_MUTE_DEVICE
, data
[8] & 0x40);
2809 input_sync(wacom_wac
->shared
->touch_input
);
2812 if (data
[9] & 0x02) { /* wireless module is attached */
2813 int battery
= (data
[8] & 0x3f) * 100 / 31;
2814 bool charging
= !!(data
[8] & 0x80);
2816 wacom_notify_battery(wacom_wac
, battery
, charging
,
2817 battery
|| charging
, 1);
2819 if (!wacom
->battery
.battery
&&
2820 !(features
->quirks
& WACOM_QUIRK_BATTERY
)) {
2821 features
->quirks
|= WACOM_QUIRK_BATTERY
;
2822 wacom_schedule_work(wacom_wac
, WACOM_WORKER_BATTERY
);
2825 else if ((features
->quirks
& WACOM_QUIRK_BATTERY
) &&
2826 wacom
->battery
.battery
) {
2827 features
->quirks
&= ~WACOM_QUIRK_BATTERY
;
2828 wacom_schedule_work(wacom_wac
, WACOM_WORKER_BATTERY
);
2829 wacom_notify_battery(wacom_wac
, 0, 0, 0, 0);
2834 void wacom_wac_irq(struct wacom_wac
*wacom_wac
, size_t len
)
2838 switch (wacom_wac
->features
.type
) {
2840 sync
= wacom_penpartner_irq(wacom_wac
);
2844 sync
= wacom_pl_irq(wacom_wac
);
2851 sync
= wacom_graphire_irq(wacom_wac
);
2855 sync
= wacom_ptu_irq(wacom_wac
);
2859 sync
= wacom_dtu_irq(wacom_wac
);
2864 sync
= wacom_dtus_irq(wacom_wac
);
2883 case CINTIQ_COMPANION_2
:
2884 sync
= wacom_intuos_irq(wacom_wac
);
2888 sync
= wacom_intuos_bt_irq(wacom_wac
, len
);
2893 sync
= wacom_24hdt_irq(wacom_wac
);
2902 if (len
== WACOM_PKGLEN_BBTOUCH3
)
2903 sync
= wacom_bpt3_touch(wacom_wac
);
2904 else if (wacom_wac
->data
[0] == WACOM_REPORT_USB
)
2905 sync
= wacom_status_irq(wacom_wac
, len
);
2907 sync
= wacom_intuos_irq(wacom_wac
);
2911 sync
= wacom_intuos_pro2_bt_irq(wacom_wac
, len
);
2920 sync
= wacom_tpc_irq(wacom_wac
, len
);
2928 if (wacom_wac
->data
[0] == WACOM_REPORT_USB
)
2929 sync
= wacom_status_irq(wacom_wac
, len
);
2931 sync
= wacom_bpt_irq(wacom_wac
, len
);
2935 sync
= wacom_bamboo_pad_irq(wacom_wac
, len
);
2939 sync
= wacom_wireless_irq(wacom_wac
, len
);
2944 if (wacom_wac
->data
[0] == WACOM_REPORT_DEVICE_LIST
)
2945 wacom_remote_status_irq(wacom_wac
, len
);
2947 sync
= wacom_remote_irq(wacom_wac
, len
);
2956 if (wacom_wac
->pen_input
)
2957 input_sync(wacom_wac
->pen_input
);
2958 if (wacom_wac
->touch_input
)
2959 input_sync(wacom_wac
->touch_input
);
2960 if (wacom_wac
->pad_input
)
2961 input_sync(wacom_wac
->pad_input
);
2965 static void wacom_setup_basic_pro_pen(struct wacom_wac
*wacom_wac
)
2967 struct input_dev
*input_dev
= wacom_wac
->pen_input
;
2969 input_set_capability(input_dev
, EV_MSC
, MSC_SERIAL
);
2971 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
2972 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
2973 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
2975 input_set_abs_params(input_dev
, ABS_DISTANCE
,
2976 0, wacom_wac
->features
.distance_max
, wacom_wac
->features
.distance_fuzz
, 0);
2979 static void wacom_setup_cintiq(struct wacom_wac
*wacom_wac
)
2981 struct input_dev
*input_dev
= wacom_wac
->pen_input
;
2982 struct wacom_features
*features
= &wacom_wac
->features
;
2984 wacom_setup_basic_pro_pen(wacom_wac
);
2986 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
2987 __set_bit(BTN_TOOL_BRUSH
, input_dev
->keybit
);
2988 __set_bit(BTN_TOOL_PENCIL
, input_dev
->keybit
);
2989 __set_bit(BTN_TOOL_AIRBRUSH
, input_dev
->keybit
);
2991 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 1023, 0, 0);
2992 input_set_abs_params(input_dev
, ABS_TILT_X
, -64, 63, features
->tilt_fuzz
, 0);
2993 input_abs_set_res(input_dev
, ABS_TILT_X
, 57);
2994 input_set_abs_params(input_dev
, ABS_TILT_Y
, -64, 63, features
->tilt_fuzz
, 0);
2995 input_abs_set_res(input_dev
, ABS_TILT_Y
, 57);
2998 static void wacom_setup_intuos(struct wacom_wac
*wacom_wac
)
3000 struct input_dev
*input_dev
= wacom_wac
->pen_input
;
3002 input_set_capability(input_dev
, EV_REL
, REL_WHEEL
);
3004 wacom_setup_cintiq(wacom_wac
);
3006 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3007 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3008 __set_bit(BTN_MIDDLE
, input_dev
->keybit
);
3009 __set_bit(BTN_SIDE
, input_dev
->keybit
);
3010 __set_bit(BTN_EXTRA
, input_dev
->keybit
);
3011 __set_bit(BTN_TOOL_MOUSE
, input_dev
->keybit
);
3012 __set_bit(BTN_TOOL_LENS
, input_dev
->keybit
);
3014 input_set_abs_params(input_dev
, ABS_RZ
, -900, 899, 0, 0);
3015 input_abs_set_res(input_dev
, ABS_RZ
, 287);
3016 input_set_abs_params(input_dev
, ABS_THROTTLE
, -1023, 1023, 0, 0);
3019 void wacom_setup_device_quirks(struct wacom
*wacom
)
3021 struct wacom_features
*features
= &wacom
->wacom_wac
.features
;
3023 /* The pen and pad share the same interface on most devices */
3024 if (features
->type
== GRAPHIRE_BT
|| features
->type
== WACOM_G4
||
3025 features
->type
== DTUS
||
3026 (features
->type
>= INTUOS3S
&& features
->type
<= WACOM_MO
)) {
3027 if (features
->device_type
& WACOM_DEVICETYPE_PEN
)
3028 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3031 /* touch device found but size is not defined. use default */
3032 if (features
->device_type
& WACOM_DEVICETYPE_TOUCH
&& !features
->x_max
) {
3033 features
->x_max
= 1023;
3034 features
->y_max
= 1023;
3038 * Intuos5/Pro and Bamboo 3rd gen have no useful data about its
3039 * touch interface in its HID descriptor. If this is the touch
3040 * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the
3043 if ((features
->type
>= INTUOS5S
&& features
->type
<= INTUOSPL
) ||
3044 (features
->type
>= INTUOSHT
&& features
->type
<= BAMBOO_PT
)) {
3045 if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
) {
3046 if (features
->touch_max
)
3047 features
->device_type
|= WACOM_DEVICETYPE_TOUCH
;
3048 if (features
->type
>= INTUOSHT
&& features
->type
<= BAMBOO_PT
)
3049 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3051 features
->x_max
= 4096;
3052 features
->y_max
= 4096;
3054 else if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH
) {
3055 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3060 * Hack for the Bamboo One:
3061 * the device presents a PAD/Touch interface as most Bamboos and even
3062 * sends ghosts PAD data on it. However, later, we must disable this
3063 * ghost interface, and we can not detect it unless we set it here
3064 * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH.
3066 if (features
->type
== BAMBOO_PEN
&&
3067 features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
)
3068 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3071 * Raw Wacom-mode pen and touch events both come from interface
3072 * 0, whose HID descriptor has an application usage of 0xFF0D
3073 * (i.e., WACOM_HID_WD_DIGITIZER). We route pen packets back
3074 * out through the HID_GENERIC device created for interface 1,
3075 * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH.
3077 if (features
->type
== BAMBOO_PAD
)
3078 features
->device_type
= WACOM_DEVICETYPE_TOUCH
;
3080 if (features
->type
== REMOTE
)
3081 features
->device_type
= WACOM_DEVICETYPE_PAD
;
3083 if (features
->type
== INTUOSP2_BT
) {
3084 features
->device_type
|= WACOM_DEVICETYPE_PEN
|
3085 WACOM_DEVICETYPE_PAD
|
3086 WACOM_DEVICETYPE_TOUCH
;
3087 features
->quirks
|= WACOM_QUIRK_BATTERY
;
3090 switch (features
->type
) {
3101 case CINTIQ_COMPANION_2
:
3113 features
->device_type
|= WACOM_DEVICETYPE_DIRECT
;
3117 if (wacom
->hdev
->bus
== BUS_BLUETOOTH
)
3118 features
->quirks
|= WACOM_QUIRK_BATTERY
;
3120 /* quirk for bamboo touch with 2 low res touches */
3121 if ((features
->type
== BAMBOO_PT
|| features
->type
== BAMBOO_TOUCH
) &&
3122 features
->pktlen
== WACOM_PKGLEN_BBTOUCH
) {
3123 features
->x_max
<<= 5;
3124 features
->y_max
<<= 5;
3125 features
->x_fuzz
<<= 5;
3126 features
->y_fuzz
<<= 5;
3127 features
->quirks
|= WACOM_QUIRK_BBTOUCH_LOWRES
;
3130 if (features
->type
== WIRELESS
) {
3131 if (features
->device_type
== WACOM_DEVICETYPE_WL_MONITOR
) {
3132 features
->quirks
|= WACOM_QUIRK_BATTERY
;
3136 if (features
->type
== REMOTE
)
3137 features
->device_type
|= WACOM_DEVICETYPE_WL_MONITOR
;
3140 int wacom_setup_pen_input_capabilities(struct input_dev
*input_dev
,
3141 struct wacom_wac
*wacom_wac
)
3143 struct wacom_features
*features
= &wacom_wac
->features
;
3145 input_dev
->evbit
[0] |= BIT_MASK(EV_KEY
) | BIT_MASK(EV_ABS
);
3147 if (!(features
->device_type
& WACOM_DEVICETYPE_PEN
))
3150 if (features
->device_type
& WACOM_DEVICETYPE_DIRECT
)
3151 __set_bit(INPUT_PROP_DIRECT
, input_dev
->propbit
);
3153 __set_bit(INPUT_PROP_POINTER
, input_dev
->propbit
);
3155 if (features
->type
== HID_GENERIC
)
3156 /* setup has already been done */
3159 __set_bit(BTN_TOUCH
, input_dev
->keybit
);
3160 __set_bit(ABS_MISC
, input_dev
->absbit
);
3162 input_set_abs_params(input_dev
, ABS_X
, 0 + features
->offset_left
,
3163 features
->x_max
- features
->offset_right
,
3164 features
->x_fuzz
, 0);
3165 input_set_abs_params(input_dev
, ABS_Y
, 0 + features
->offset_top
,
3166 features
->y_max
- features
->offset_bottom
,
3167 features
->y_fuzz
, 0);
3168 input_set_abs_params(input_dev
, ABS_PRESSURE
, 0,
3169 features
->pressure_max
, features
->pressure_fuzz
, 0);
3171 /* penabled devices have fixed resolution for each model */
3172 input_abs_set_res(input_dev
, ABS_X
, features
->x_resolution
);
3173 input_abs_set_res(input_dev
, ABS_Y
, features
->y_resolution
);
3175 switch (features
->type
) {
3177 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3181 input_set_abs_params(input_dev
, ABS_DISTANCE
, 0,
3182 features
->distance_max
,
3183 features
->distance_fuzz
, 0);
3187 input_set_capability(input_dev
, EV_REL
, REL_WHEEL
);
3189 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3190 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3191 __set_bit(BTN_MIDDLE
, input_dev
->keybit
);
3193 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3194 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3195 __set_bit(BTN_TOOL_MOUSE
, input_dev
->keybit
);
3196 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3197 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3209 case CINTIQ_COMPANION_2
:
3210 input_set_abs_params(input_dev
, ABS_Z
, -900, 899, 0, 0);
3211 input_abs_set_res(input_dev
, ABS_Z
, 287);
3212 wacom_setup_cintiq(wacom_wac
);
3222 input_set_abs_params(input_dev
, ABS_Z
, -900, 899, 0, 0);
3223 input_abs_set_res(input_dev
, ABS_Z
, 287);
3227 wacom_setup_intuos(wacom_wac
);
3237 input_set_abs_params(input_dev
, ABS_DISTANCE
, 0,
3238 features
->distance_max
,
3239 features
->distance_fuzz
, 0);
3241 input_set_abs_params(input_dev
, ABS_Z
, -900, 899, 0, 0);
3242 input_abs_set_res(input_dev
, ABS_Z
, 287);
3244 wacom_setup_intuos(wacom_wac
);
3255 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3262 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3263 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3264 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3265 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3269 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3273 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3274 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3275 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3282 if (features
->type
== INTUOSHT2
) {
3283 wacom_setup_basic_pro_pen(wacom_wac
);
3285 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3286 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3287 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3288 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3289 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3290 input_set_abs_params(input_dev
, ABS_DISTANCE
, 0,
3291 features
->distance_max
,
3292 features
->distance_fuzz
, 0);
3296 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3302 int wacom_setup_touch_input_capabilities(struct input_dev
*input_dev
,
3303 struct wacom_wac
*wacom_wac
)
3305 struct wacom_features
*features
= &wacom_wac
->features
;
3307 input_dev
->evbit
[0] |= BIT_MASK(EV_KEY
) | BIT_MASK(EV_ABS
);
3309 if (!(features
->device_type
& WACOM_DEVICETYPE_TOUCH
))
3312 if (features
->device_type
& WACOM_DEVICETYPE_DIRECT
)
3313 __set_bit(INPUT_PROP_DIRECT
, input_dev
->propbit
);
3315 __set_bit(INPUT_PROP_POINTER
, input_dev
->propbit
);
3317 if (features
->type
== HID_GENERIC
)
3318 /* setup has already been done */
3321 __set_bit(BTN_TOUCH
, input_dev
->keybit
);
3323 if (features
->touch_max
== 1) {
3324 input_set_abs_params(input_dev
, ABS_X
, 0,
3325 features
->x_max
, features
->x_fuzz
, 0);
3326 input_set_abs_params(input_dev
, ABS_Y
, 0,
3327 features
->y_max
, features
->y_fuzz
, 0);
3328 input_abs_set_res(input_dev
, ABS_X
,
3329 features
->x_resolution
);
3330 input_abs_set_res(input_dev
, ABS_Y
,
3331 features
->y_resolution
);
3333 else if (features
->touch_max
> 1) {
3334 input_set_abs_params(input_dev
, ABS_MT_POSITION_X
, 0,
3335 features
->x_max
, features
->x_fuzz
, 0);
3336 input_set_abs_params(input_dev
, ABS_MT_POSITION_Y
, 0,
3337 features
->y_max
, features
->y_fuzz
, 0);
3338 input_abs_set_res(input_dev
, ABS_MT_POSITION_X
,
3339 features
->x_resolution
);
3340 input_abs_set_res(input_dev
, ABS_MT_POSITION_Y
,
3341 features
->y_resolution
);
3344 switch (features
->type
) {
3346 input_dev
->evbit
[0] |= BIT_MASK(EV_SW
);
3347 __set_bit(SW_MUTE_DEVICE
, input_dev
->swbit
);
3349 if (wacom_wac
->shared
->touch
->product
== 0x361) {
3350 input_set_abs_params(input_dev
, ABS_MT_POSITION_X
,
3352 input_set_abs_params(input_dev
, ABS_MT_POSITION_Y
,
3355 else if (wacom_wac
->shared
->touch
->product
== 0x360) {
3356 input_set_abs_params(input_dev
, ABS_MT_POSITION_X
,
3358 input_set_abs_params(input_dev
, ABS_MT_POSITION_Y
,
3361 input_abs_set_res(input_dev
, ABS_MT_POSITION_X
, 40);
3362 input_abs_set_res(input_dev
, ABS_MT_POSITION_X
, 40);
3372 input_set_abs_params(input_dev
, ABS_MT_TOUCH_MAJOR
, 0, features
->x_max
, 0, 0);
3373 input_set_abs_params(input_dev
, ABS_MT_TOUCH_MINOR
, 0, features
->y_max
, 0, 0);
3374 input_mt_init_slots(input_dev
, features
->touch_max
, INPUT_MT_POINTER
);
3378 input_set_abs_params(input_dev
, ABS_MT_TOUCH_MAJOR
, 0, features
->x_max
, 0, 0);
3379 input_set_abs_params(input_dev
, ABS_MT_WIDTH_MAJOR
, 0, features
->x_max
, 0, 0);
3380 input_set_abs_params(input_dev
, ABS_MT_WIDTH_MINOR
, 0, features
->y_max
, 0, 0);
3381 input_set_abs_params(input_dev
, ABS_MT_ORIENTATION
, 0, 1, 0, 0);
3389 input_mt_init_slots(input_dev
, features
->touch_max
, INPUT_MT_DIRECT
);
3398 input_dev
->evbit
[0] |= BIT_MASK(EV_SW
);
3399 __set_bit(SW_MUTE_DEVICE
, input_dev
->swbit
);
3404 if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
) {
3405 input_set_abs_params(input_dev
,
3407 0, features
->x_max
, 0, 0);
3408 input_set_abs_params(input_dev
,
3410 0, features
->y_max
, 0, 0);
3412 input_mt_init_slots(input_dev
, features
->touch_max
, INPUT_MT_POINTER
);
3416 input_mt_init_slots(input_dev
, features
->touch_max
,
3418 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3419 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3425 static int wacom_numbered_button_to_key(int n
)
3430 return BTN_A
+ (n
-10);
3432 return BTN_BASE
+ (n
-16);
3437 static void wacom_setup_numbered_buttons(struct input_dev
*input_dev
,
3442 for (i
= 0; i
< button_count
; i
++) {
3443 int key
= wacom_numbered_button_to_key(i
);
3446 __set_bit(key
, input_dev
->keybit
);
3450 static void wacom_24hd_update_leds(struct wacom
*wacom
, int mask
, int group
)
3452 struct wacom_led
*led
;
3454 bool updated
= false;
3457 * 24HD has LED group 1 to the left and LED group 0 to the right.
3458 * So group 0 matches the second half of the buttons and thus the mask
3459 * needs to be shifted.
3464 for (i
= 0; i
< 3; i
++) {
3465 led
= wacom_led_find(wacom
, group
, i
);
3467 hid_err(wacom
->hdev
, "can't find LED %d in group %d\n",
3471 if (!updated
&& mask
& BIT(i
)) {
3473 led_trigger_event(&led
->trigger
, LED_FULL
);
3480 static bool wacom_is_led_toggled(struct wacom
*wacom
, int button_count
,
3481 int mask
, int group
)
3483 int button_per_group
;
3486 * 21UX2 has LED group 1 to the left and LED group 0
3487 * to the right. We need to reverse the group to match this
3488 * historical behavior.
3490 if (wacom
->wacom_wac
.features
.type
== WACOM_21UX2
)
3493 button_per_group
= button_count
/wacom
->led
.count
;
3495 return mask
& (1 << (group
* button_per_group
));
3498 static void wacom_update_led(struct wacom
*wacom
, int button_count
, int mask
,
3501 struct wacom_led
*led
, *next_led
;
3505 if (wacom
->wacom_wac
.features
.type
== WACOM_24HD
)
3506 return wacom_24hd_update_leds(wacom
, mask
, group
);
3508 pressed
= wacom_is_led_toggled(wacom
, button_count
, mask
, group
);
3509 cur
= wacom
->led
.groups
[group
].select
;
3511 led
= wacom_led_find(wacom
, group
, cur
);
3513 hid_err(wacom
->hdev
, "can't find current LED %d in group %d\n",
3523 if (led
->held
&& pressed
)
3526 next_led
= wacom_led_next(wacom
, led
);
3528 hid_err(wacom
->hdev
, "can't find next LED in group %d\n",
3532 if (next_led
== led
)
3535 next_led
->held
= true;
3536 led_trigger_event(&next_led
->trigger
,
3537 wacom_leds_brightness_get(next_led
));
3540 static void wacom_report_numbered_buttons(struct input_dev
*input_dev
,
3541 int button_count
, int mask
)
3543 struct wacom
*wacom
= input_get_drvdata(input_dev
);
3546 for (i
= 0; i
< wacom
->led
.count
; i
++)
3547 wacom_update_led(wacom
, button_count
, mask
, i
);
3549 for (i
= 0; i
< button_count
; i
++) {
3550 int key
= wacom_numbered_button_to_key(i
);
3553 input_report_key(input_dev
, key
, mask
& (1 << i
));
3557 int wacom_setup_pad_input_capabilities(struct input_dev
*input_dev
,
3558 struct wacom_wac
*wacom_wac
)
3560 struct wacom_features
*features
= &wacom_wac
->features
;
3562 if ((features
->type
== HID_GENERIC
) && features
->numbered_buttons
> 0)
3563 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3565 if (!(features
->device_type
& WACOM_DEVICETYPE_PAD
))
3568 if (features
->type
== REMOTE
&& input_dev
== wacom_wac
->pad_input
)
3571 input_dev
->evbit
[0] |= BIT_MASK(EV_KEY
) | BIT_MASK(EV_ABS
);
3573 /* kept for making legacy xf86-input-wacom working with the wheels */
3574 __set_bit(ABS_MISC
, input_dev
->absbit
);
3576 /* kept for making legacy xf86-input-wacom accepting the pad */
3577 if (!(input_dev
->absinfo
&& (input_dev
->absinfo
[ABS_X
].minimum
||
3578 input_dev
->absinfo
[ABS_X
].maximum
)))
3579 input_set_abs_params(input_dev
, ABS_X
, 0, 1, 0, 0);
3580 if (!(input_dev
->absinfo
&& (input_dev
->absinfo
[ABS_Y
].minimum
||
3581 input_dev
->absinfo
[ABS_Y
].maximum
)))
3582 input_set_abs_params(input_dev
, ABS_Y
, 0, 1, 0, 0);
3584 /* kept for making udev and libwacom accepting the pad */
3585 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3587 wacom_setup_numbered_buttons(input_dev
, features
->numbered_buttons
);
3589 switch (features
->type
) {
3592 case CINTIQ_COMPANION_2
:
3599 __set_bit(BTN_BACK
, input_dev
->keybit
);
3600 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3601 __set_bit(BTN_FORWARD
, input_dev
->keybit
);
3602 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3603 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3607 __set_bit(BTN_BACK
, input_dev
->keybit
);
3608 __set_bit(BTN_FORWARD
, input_dev
->keybit
);
3609 input_set_capability(input_dev
, EV_REL
, REL_WHEEL
);
3613 __set_bit(KEY_PROG1
, input_dev
->keybit
);
3614 __set_bit(KEY_PROG2
, input_dev
->keybit
);
3615 __set_bit(KEY_PROG3
, input_dev
->keybit
);
3617 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3618 input_set_abs_params(input_dev
, ABS_THROTTLE
, 0, 71, 0, 0);
3622 __set_bit(KEY_PROG1
, input_dev
->keybit
);
3623 __set_bit(KEY_PROG2
, input_dev
->keybit
);
3624 __set_bit(KEY_PROG3
, input_dev
->keybit
);
3625 input_set_abs_params(input_dev
, ABS_X
, -2048, 2048, 0, 0);
3626 input_abs_set_res(input_dev
, ABS_X
, 1024); /* points/g */
3627 input_set_abs_params(input_dev
, ABS_Y
, -2048, 2048, 0, 0);
3628 input_abs_set_res(input_dev
, ABS_Y
, 1024);
3629 input_set_abs_params(input_dev
, ABS_Z
, -2048, 2048, 0, 0);
3630 input_abs_set_res(input_dev
, ABS_Z
, 1024);
3631 __set_bit(INPUT_PROP_ACCELEROMETER
, input_dev
->propbit
);
3635 __set_bit(KEY_PROG1
, input_dev
->keybit
);
3636 __set_bit(KEY_PROG2
, input_dev
->keybit
);
3637 __set_bit(KEY_PROG3
, input_dev
->keybit
);
3643 input_set_abs_params(input_dev
, ABS_RX
, 0, 4096, 0, 0);
3644 input_set_abs_params(input_dev
, ABS_RY
, 0, 4096, 0, 0);
3648 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3653 input_set_abs_params(input_dev
, ABS_RY
, 0, 4096, 0, 0);
3657 input_set_abs_params(input_dev
, ABS_RX
, 0, 4096, 0, 0);
3667 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3672 * For Bluetooth devices, the udev rule does not work correctly
3673 * for pads unless we add a stylus capability, which forces
3674 * ID_INPUT_TABLET to be set.
3676 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3682 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3689 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3691 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3692 __set_bit(BTN_FORWARD
, input_dev
->keybit
);
3693 __set_bit(BTN_BACK
, input_dev
->keybit
);
3694 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3699 input_set_capability(input_dev
, EV_MSC
, MSC_SERIAL
);
3700 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3707 /* no pad supported */
3713 static const struct wacom_features wacom_features_0x00
=
3714 { "Wacom Penpartner", 5040, 3780, 255, 0,
3715 PENPARTNER
, WACOM_PENPRTN_RES
, WACOM_PENPRTN_RES
};
3716 static const struct wacom_features wacom_features_0x10
=
3717 { "Wacom Graphire", 10206, 7422, 511, 63,
3718 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3719 static const struct wacom_features wacom_features_0x81
=
3720 { "Wacom Graphire BT", 16704, 12064, 511, 32,
3721 GRAPHIRE_BT
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
, 2 };
3722 static const struct wacom_features wacom_features_0x11
=
3723 { "Wacom Graphire2 4x5", 10206, 7422, 511, 63,
3724 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3725 static const struct wacom_features wacom_features_0x12
=
3726 { "Wacom Graphire2 5x7", 13918, 10206, 511, 63,
3727 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3728 static const struct wacom_features wacom_features_0x13
=
3729 { "Wacom Graphire3", 10208, 7424, 511, 63,
3730 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3731 static const struct wacom_features wacom_features_0x14
=
3732 { "Wacom Graphire3 6x8", 16704, 12064, 511, 63,
3733 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3734 static const struct wacom_features wacom_features_0x15
=
3735 { "Wacom Graphire4 4x5", 10208, 7424, 511, 63,
3736 WACOM_G4
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3737 static const struct wacom_features wacom_features_0x16
=
3738 { "Wacom Graphire4 6x8", 16704, 12064, 511, 63,
3739 WACOM_G4
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3740 static const struct wacom_features wacom_features_0x17
=
3741 { "Wacom BambooFun 4x5", 14760, 9225, 511, 63,
3742 WACOM_MO
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3743 static const struct wacom_features wacom_features_0x18
=
3744 { "Wacom BambooFun 6x8", 21648, 13530, 511, 63,
3745 WACOM_MO
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3746 static const struct wacom_features wacom_features_0x19
=
3747 { "Wacom Bamboo1 Medium", 16704, 12064, 511, 63,
3748 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3749 static const struct wacom_features wacom_features_0x60
=
3750 { "Wacom Volito", 5104, 3712, 511, 63,
3751 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3752 static const struct wacom_features wacom_features_0x61
=
3753 { "Wacom PenStation2", 3250, 2320, 255, 63,
3754 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3755 static const struct wacom_features wacom_features_0x62
=
3756 { "Wacom Volito2 4x5", 5104, 3712, 511, 63,
3757 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3758 static const struct wacom_features wacom_features_0x63
=
3759 { "Wacom Volito2 2x3", 3248, 2320, 511, 63,
3760 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3761 static const struct wacom_features wacom_features_0x64
=
3762 { "Wacom PenPartner2", 3250, 2320, 511, 63,
3763 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3764 static const struct wacom_features wacom_features_0x65
=
3765 { "Wacom Bamboo", 14760, 9225, 511, 63,
3766 WACOM_MO
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3767 static const struct wacom_features wacom_features_0x69
=
3768 { "Wacom Bamboo1", 5104, 3712, 511, 63,
3769 GRAPHIRE
, WACOM_PENPRTN_RES
, WACOM_PENPRTN_RES
};
3770 static const struct wacom_features wacom_features_0x6A
=
3771 { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63,
3772 GRAPHIRE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3773 static const struct wacom_features wacom_features_0x6B
=
3774 { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63,
3775 GRAPHIRE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3776 static const struct wacom_features wacom_features_0x20
=
3777 { "Wacom Intuos 4x5", 12700, 10600, 1023, 31,
3778 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3779 static const struct wacom_features wacom_features_0x21
=
3780 { "Wacom Intuos 6x8", 20320, 16240, 1023, 31,
3781 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3782 static const struct wacom_features wacom_features_0x22
=
3783 { "Wacom Intuos 9x12", 30480, 24060, 1023, 31,
3784 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3785 static const struct wacom_features wacom_features_0x23
=
3786 { "Wacom Intuos 12x12", 30480, 31680, 1023, 31,
3787 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3788 static const struct wacom_features wacom_features_0x24
=
3789 { "Wacom Intuos 12x18", 45720, 31680, 1023, 31,
3790 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3791 static const struct wacom_features wacom_features_0x30
=
3792 { "Wacom PL400", 5408, 4056, 255, 0,
3793 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3794 static const struct wacom_features wacom_features_0x31
=
3795 { "Wacom PL500", 6144, 4608, 255, 0,
3796 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3797 static const struct wacom_features wacom_features_0x32
=
3798 { "Wacom PL600", 6126, 4604, 255, 0,
3799 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3800 static const struct wacom_features wacom_features_0x33
=
3801 { "Wacom PL600SX", 6260, 5016, 255, 0,
3802 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3803 static const struct wacom_features wacom_features_0x34
=
3804 { "Wacom PL550", 6144, 4608, 511, 0,
3805 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3806 static const struct wacom_features wacom_features_0x35
=
3807 { "Wacom PL800", 7220, 5780, 511, 0,
3808 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3809 static const struct wacom_features wacom_features_0x37
=
3810 { "Wacom PL700", 6758, 5406, 511, 0,
3811 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3812 static const struct wacom_features wacom_features_0x38
=
3813 { "Wacom PL510", 6282, 4762, 511, 0,
3814 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3815 static const struct wacom_features wacom_features_0x39
=
3816 { "Wacom DTU710", 34080, 27660, 511, 0,
3817 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3818 static const struct wacom_features wacom_features_0xC4
=
3819 { "Wacom DTF521", 6282, 4762, 511, 0,
3820 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3821 static const struct wacom_features wacom_features_0xC0
=
3822 { "Wacom DTF720", 6858, 5506, 511, 0,
3823 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3824 static const struct wacom_features wacom_features_0xC2
=
3825 { "Wacom DTF720a", 6858, 5506, 511, 0,
3826 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3827 static const struct wacom_features wacom_features_0x03
=
3828 { "Wacom Cintiq Partner", 20480, 15360, 511, 0,
3829 PTU
, WACOM_PL_RES
, WACOM_PL_RES
};
3830 static const struct wacom_features wacom_features_0x41
=
3831 { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31,
3832 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3833 static const struct wacom_features wacom_features_0x42
=
3834 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
3835 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3836 static const struct wacom_features wacom_features_0x43
=
3837 { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31,
3838 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3839 static const struct wacom_features wacom_features_0x44
=
3840 { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31,
3841 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3842 static const struct wacom_features wacom_features_0x45
=
3843 { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31,
3844 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3845 static const struct wacom_features wacom_features_0xB0
=
3846 { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63,
3847 INTUOS3S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 4 };
3848 static const struct wacom_features wacom_features_0xB1
=
3849 { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63,
3850 INTUOS3
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3851 static const struct wacom_features wacom_features_0xB2
=
3852 { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63,
3853 INTUOS3
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3854 static const struct wacom_features wacom_features_0xB3
=
3855 { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63,
3856 INTUOS3L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3857 static const struct wacom_features wacom_features_0xB4
=
3858 { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63,
3859 INTUOS3L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3860 static const struct wacom_features wacom_features_0xB5
=
3861 { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63,
3862 INTUOS3
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3863 static const struct wacom_features wacom_features_0xB7
=
3864 { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63,
3865 INTUOS3S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 4 };
3866 static const struct wacom_features wacom_features_0xB8
=
3867 { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63,
3868 INTUOS4S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7 };
3869 static const struct wacom_features wacom_features_0xB9
=
3870 { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63,
3871 INTUOS4
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3872 static const struct wacom_features wacom_features_0xBA
=
3873 { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63,
3874 INTUOS4L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3875 static const struct wacom_features wacom_features_0xBB
=
3876 { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63,
3877 INTUOS4L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3878 static const struct wacom_features wacom_features_0xBC
=
3879 { "Wacom Intuos4 WL", 40640, 25400, 2047, 63,
3880 INTUOS4
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3881 static const struct wacom_features wacom_features_0xBD
=
3882 { "Wacom Intuos4 WL", 40640, 25400, 2047, 63,
3883 INTUOS4WL
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3884 static const struct wacom_features wacom_features_0x26
=
3885 { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63,
3886 INTUOS5S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7, .touch_max
= 16 };
3887 static const struct wacom_features wacom_features_0x27
=
3888 { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63,
3889 INTUOS5
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16 };
3890 static const struct wacom_features wacom_features_0x28
=
3891 { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63,
3892 INTUOS5L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16 };
3893 static const struct wacom_features wacom_features_0x29
=
3894 { "Wacom Intuos5 S", 31496, 19685, 2047, 63,
3895 INTUOS5S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7 };
3896 static const struct wacom_features wacom_features_0x2A
=
3897 { "Wacom Intuos5 M", 44704, 27940, 2047, 63,
3898 INTUOS5
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3899 static const struct wacom_features wacom_features_0x314
=
3900 { "Wacom Intuos Pro S", 31496, 19685, 2047, 63,
3901 INTUOSPS
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7, .touch_max
= 16,
3902 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3903 static const struct wacom_features wacom_features_0x315
=
3904 { "Wacom Intuos Pro M", 44704, 27940, 2047, 63,
3905 INTUOSPM
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16,
3906 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3907 static const struct wacom_features wacom_features_0x317
=
3908 { "Wacom Intuos Pro L", 65024, 40640, 2047, 63,
3909 INTUOSPL
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16,
3910 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3911 static const struct wacom_features wacom_features_0xF4
=
3912 { "Wacom Cintiq 24HD", 104480, 65600, 2047, 63,
3913 WACOM_24HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 16,
3914 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3915 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
3916 static const struct wacom_features wacom_features_0xF8
=
3917 { "Wacom Cintiq 24HD touch", 104480, 65600, 2047, 63, /* Pen */
3918 WACOM_24HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 16,
3919 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3920 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3921 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0xf6 };
3922 static const struct wacom_features wacom_features_0xF6
=
3923 { "Wacom Cintiq 24HD touch", .type
= WACOM_24HDT
, /* Touch */
3924 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0xf8, .touch_max
= 10,
3925 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3926 static const struct wacom_features wacom_features_0x32A
=
3927 { "Wacom Cintiq 27QHD", 120140, 67920, 2047, 63,
3928 WACOM_27QHD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 0,
3929 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3930 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
3931 static const struct wacom_features wacom_features_0x32B
=
3932 { "Wacom Cintiq 27QHD touch", 120140, 67920, 2047, 63,
3933 WACOM_27QHD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 0,
3934 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3935 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3936 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x32C };
3937 static const struct wacom_features wacom_features_0x32C
=
3938 { "Wacom Cintiq 27QHD touch", .type
= WACOM_27QHDT
,
3939 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x32B, .touch_max
= 10 };
3940 static const struct wacom_features wacom_features_0x3F
=
3941 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
3942 CINTIQ
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3943 static const struct wacom_features wacom_features_0xC5
=
3944 { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63,
3945 WACOM_BEE
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 10 };
3946 static const struct wacom_features wacom_features_0xC6
=
3947 { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
3948 WACOM_BEE
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 10 };
3949 static const struct wacom_features wacom_features_0x304
=
3950 { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63,
3951 WACOM_13HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
3952 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3953 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
3954 static const struct wacom_features wacom_features_0x333
=
3955 { "Wacom Cintiq 13HD touch", 59552, 33848, 2047, 63,
3956 WACOM_13HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
3957 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3958 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3959 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x335 };
3960 static const struct wacom_features wacom_features_0x335
=
3961 { "Wacom Cintiq 13HD touch", .type
= WACOM_24HDT
, /* Touch */
3962 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x333, .touch_max
= 10,
3963 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3964 static const struct wacom_features wacom_features_0xC7
=
3965 { "Wacom DTU1931", 37832, 30305, 511, 0,
3966 PL
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3967 static const struct wacom_features wacom_features_0xCE
=
3968 { "Wacom DTU2231", 47864, 27011, 511, 0,
3969 DTU
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
3970 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBMOUSE
};
3971 static const struct wacom_features wacom_features_0xF0
=
3972 { "Wacom DTU1631", 34623, 19553, 511, 0,
3973 DTU
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3974 static const struct wacom_features wacom_features_0xFB
=
3975 { "Wacom DTU1031", 22096, 13960, 511, 0,
3976 DTUS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 4,
3977 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
3978 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
3979 static const struct wacom_features wacom_features_0x32F
=
3980 { "Wacom DTU1031X", 22672, 12928, 511, 0,
3981 DTUSX
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 0,
3982 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
3983 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
3984 static const struct wacom_features wacom_features_0x336
=
3985 { "Wacom DTU1141", 23672, 13403, 1023, 0,
3986 DTUS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 4,
3987 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
3988 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
3989 static const struct wacom_features wacom_features_0x57
=
3990 { "Wacom DTK2241", 95840, 54260, 2047, 63,
3991 DTK
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 6,
3992 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3993 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
3994 static const struct wacom_features wacom_features_0x59
= /* Pen */
3995 { "Wacom DTH2242", 95840, 54260, 2047, 63,
3996 DTK
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 6,
3997 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3998 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3999 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x5D };
4000 static const struct wacom_features wacom_features_0x5D
= /* Touch */
4001 { "Wacom DTH2242", .type
= WACOM_24HDT
,
4002 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x59, .touch_max
= 10,
4003 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4004 static const struct wacom_features wacom_features_0xCC
=
4005 { "Wacom Cintiq 21UX2", 87200, 65600, 2047, 63,
4006 WACOM_21UX2
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 18,
4007 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4008 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
4009 static const struct wacom_features wacom_features_0xFA
=
4010 { "Wacom Cintiq 22HD", 95840, 54260, 2047, 63,
4011 WACOM_22HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 18,
4012 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4013 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
4014 static const struct wacom_features wacom_features_0x5B
=
4015 { "Wacom Cintiq 22HDT", 95840, 54260, 2047, 63,
4016 WACOM_22HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 18,
4017 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4018 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4019 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x5e };
4020 static const struct wacom_features wacom_features_0x5E
=
4021 { "Wacom Cintiq 22HDT", .type
= WACOM_24HDT
,
4022 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x5b, .touch_max
= 10,
4023 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4024 static const struct wacom_features wacom_features_0x90
=
4025 { "Wacom ISDv4 90", 26202, 16325, 255, 0,
4026 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4027 static const struct wacom_features wacom_features_0x93
=
4028 { "Wacom ISDv4 93", 26202, 16325, 255, 0,
4029 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4030 static const struct wacom_features wacom_features_0x97
=
4031 { "Wacom ISDv4 97", 26202, 16325, 511, 0,
4032 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4033 static const struct wacom_features wacom_features_0x9A
=
4034 { "Wacom ISDv4 9A", 26202, 16325, 255, 0,
4035 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4036 static const struct wacom_features wacom_features_0x9F
=
4037 { "Wacom ISDv4 9F", 26202, 16325, 255, 0,
4038 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4039 static const struct wacom_features wacom_features_0xE2
=
4040 { "Wacom ISDv4 E2", 26202, 16325, 255, 0,
4041 TABLETPC2FG
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4042 static const struct wacom_features wacom_features_0xE3
=
4043 { "Wacom ISDv4 E3", 26202, 16325, 255, 0,
4044 TABLETPC2FG
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4045 static const struct wacom_features wacom_features_0xE5
=
4046 { "Wacom ISDv4 E5", 26202, 16325, 255, 0,
4047 MTSCREEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4048 static const struct wacom_features wacom_features_0xE6
=
4049 { "Wacom ISDv4 E6", 27760, 15694, 255, 0,
4050 TABLETPC2FG
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4051 static const struct wacom_features wacom_features_0xEC
=
4052 { "Wacom ISDv4 EC", 25710, 14500, 255, 0,
4053 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4054 static const struct wacom_features wacom_features_0xED
=
4055 { "Wacom ISDv4 ED", 26202, 16325, 255, 0,
4056 TABLETPCE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4057 static const struct wacom_features wacom_features_0xEF
=
4058 { "Wacom ISDv4 EF", 26202, 16325, 255, 0,
4059 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4060 static const struct wacom_features wacom_features_0x100
=
4061 { "Wacom ISDv4 100", 26202, 16325, 255, 0,
4062 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4063 static const struct wacom_features wacom_features_0x101
=
4064 { "Wacom ISDv4 101", 26202, 16325, 255, 0,
4065 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4066 static const struct wacom_features wacom_features_0x10D
=
4067 { "Wacom ISDv4 10D", 26202, 16325, 255, 0,
4068 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4069 static const struct wacom_features wacom_features_0x10E
=
4070 { "Wacom ISDv4 10E", 27760, 15694, 255, 0,
4071 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4072 static const struct wacom_features wacom_features_0x10F
=
4073 { "Wacom ISDv4 10F", 27760, 15694, 255, 0,
4074 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4075 static const struct wacom_features wacom_features_0x116
=
4076 { "Wacom ISDv4 116", 26202, 16325, 255, 0,
4077 TABLETPCE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4078 static const struct wacom_features wacom_features_0x12C
=
4079 { "Wacom ISDv4 12C", 27848, 15752, 2047, 0,
4080 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4081 static const struct wacom_features wacom_features_0x4001
=
4082 { "Wacom ISDv4 4001", 26202, 16325, 255, 0,
4083 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4084 static const struct wacom_features wacom_features_0x4004
=
4085 { "Wacom ISDv4 4004", 11060, 6220, 255, 0,
4086 MTTPC_B
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4087 static const struct wacom_features wacom_features_0x5000
=
4088 { "Wacom ISDv4 5000", 27848, 15752, 1023, 0,
4089 MTTPC_B
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4090 static const struct wacom_features wacom_features_0x5002
=
4091 { "Wacom ISDv4 5002", 29576, 16724, 1023, 0,
4092 MTTPC_B
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4093 static const struct wacom_features wacom_features_0x47
=
4094 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4095 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4096 static const struct wacom_features wacom_features_0x84
=
4097 { "Wacom Wireless Receiver", .type
= WIRELESS
, .touch_max
= 16 };
4098 static const struct wacom_features wacom_features_0xD0
=
4099 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31,
4100 BAMBOO_TOUCH
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4101 static const struct wacom_features wacom_features_0xD1
=
4102 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31,
4103 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4104 static const struct wacom_features wacom_features_0xD2
=
4105 { "Wacom Bamboo Craft", 14720, 9200, 1023, 31,
4106 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4107 static const struct wacom_features wacom_features_0xD3
=
4108 { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31,
4109 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4110 static const struct wacom_features wacom_features_0xD4
=
4111 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31,
4112 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4113 static const struct wacom_features wacom_features_0xD5
=
4114 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31,
4115 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4116 static const struct wacom_features wacom_features_0xD6
=
4117 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31,
4118 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4119 static const struct wacom_features wacom_features_0xD7
=
4120 { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31,
4121 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4122 static const struct wacom_features wacom_features_0xD8
=
4123 { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31,
4124 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4125 static const struct wacom_features wacom_features_0xDA
=
4126 { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31,
4127 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4128 static const struct wacom_features wacom_features_0xDB
=
4129 { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31,
4130 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4131 static const struct wacom_features wacom_features_0xDD
=
4132 { "Wacom Bamboo Connect", 14720, 9200, 1023, 31,
4133 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4134 static const struct wacom_features wacom_features_0xDE
=
4135 { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31,
4136 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16 };
4137 static const struct wacom_features wacom_features_0xDF
=
4138 { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31,
4139 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16 };
4140 static const struct wacom_features wacom_features_0x300
=
4141 { "Wacom Bamboo One S", 14720, 9225, 1023, 31,
4142 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4143 static const struct wacom_features wacom_features_0x301
=
4144 { "Wacom Bamboo One M", 21648, 13530, 1023, 31,
4145 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4146 static const struct wacom_features wacom_features_0x302
=
4147 { "Wacom Intuos PT S", 15200, 9500, 1023, 31,
4148 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4149 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4150 static const struct wacom_features wacom_features_0x303
=
4151 { "Wacom Intuos PT M", 21600, 13500, 1023, 31,
4152 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4153 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4154 static const struct wacom_features wacom_features_0x30E
=
4155 { "Wacom Intuos S", 15200, 9500, 1023, 31,
4156 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4157 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4158 static const struct wacom_features wacom_features_0x6004
=
4159 { "ISD-V4", 12800, 8000, 255, 0,
4160 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4161 static const struct wacom_features wacom_features_0x307
=
4162 { "Wacom ISDv5 307", 59552, 33848, 2047, 63,
4163 CINTIQ_HYBRID
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
4164 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4165 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4166 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x309 };
4167 static const struct wacom_features wacom_features_0x309
=
4168 { "Wacom ISDv5 309", .type
= WACOM_24HDT
, /* Touch */
4169 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x0307, .touch_max
= 10,
4170 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4171 static const struct wacom_features wacom_features_0x30A
=
4172 { "Wacom ISDv5 30A", 59552, 33848, 2047, 63,
4173 CINTIQ_HYBRID
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
4174 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4175 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4176 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x30C };
4177 static const struct wacom_features wacom_features_0x30C
=
4178 { "Wacom ISDv5 30C", .type
= WACOM_24HDT
, /* Touch */
4179 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x30A, .touch_max
= 10,
4180 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4181 static const struct wacom_features wacom_features_0x318
=
4182 { "Wacom USB Bamboo PAD", 4095, 4095, /* Touch */
4183 .type
= BAMBOO_PAD
, 35, 48, .touch_max
= 4 };
4184 static const struct wacom_features wacom_features_0x319
=
4185 { "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */
4186 .type
= BAMBOO_PAD
, 35, 48, .touch_max
= 4 };
4187 static const struct wacom_features wacom_features_0x325
=
4188 { "Wacom ISDv5 325", 59552, 33848, 2047, 63,
4189 CINTIQ_COMPANION_2
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 11,
4190 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4191 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4192 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x326 };
4193 static const struct wacom_features wacom_features_0x326
= /* Touch */
4194 { "Wacom ISDv5 326", .type
= HID_GENERIC
, .oVid
= USB_VENDOR_ID_WACOM
,
4196 static const struct wacom_features wacom_features_0x323
=
4197 { "Wacom Intuos P M", 21600, 13500, 1023, 31,
4198 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4199 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4200 static const struct wacom_features wacom_features_0x331
=
4201 { "Wacom Express Key Remote", .type
= REMOTE
,
4202 .numbered_buttons
= 18, .check_for_hid_type
= true,
4203 .hid_type
= HID_TYPE_USBNONE
};
4204 static const struct wacom_features wacom_features_0x33B
=
4205 { "Wacom Intuos S 2", 15200, 9500, 2047, 63,
4206 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4207 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4208 static const struct wacom_features wacom_features_0x33C
=
4209 { "Wacom Intuos PT S 2", 15200, 9500, 2047, 63,
4210 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4211 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4212 static const struct wacom_features wacom_features_0x33D
=
4213 { "Wacom Intuos P M 2", 21600, 13500, 2047, 63,
4214 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4215 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4216 static const struct wacom_features wacom_features_0x33E
=
4217 { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
4218 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4219 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4220 static const struct wacom_features wacom_features_0x343
=
4221 { "Wacom DTK1651", 34816, 19759, 1023, 0,
4222 DTUS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 4,
4223 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
4224 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
4225 static const struct wacom_features wacom_features_0x360
=
4226 { "Wacom Intuos Pro M", 44800, 29600, 8191, 63,
4227 INTUOSP2_BT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 9, .touch_max
= 10 };
4228 static const struct wacom_features wacom_features_0x361
=
4229 { "Wacom Intuos Pro L", 62200, 43200, 8191, 63,
4230 INTUOSP2_BT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 9, .touch_max
= 10 };
4232 static const struct wacom_features wacom_features_HID_ANY_ID
=
4233 { "Wacom HID", .type
= HID_GENERIC
, .oVid
= HID_ANY_ID
, .oPid
= HID_ANY_ID
};
4235 #define USB_DEVICE_WACOM(prod) \
4236 HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
4237 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4239 #define BT_DEVICE_WACOM(prod) \
4240 HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
4241 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4243 #define I2C_DEVICE_WACOM(prod) \
4244 HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
4245 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4247 #define USB_DEVICE_LENOVO(prod) \
4248 HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
4249 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4251 const struct hid_device_id wacom_ids
[] = {
4252 { USB_DEVICE_WACOM(0x00) },
4253 { USB_DEVICE_WACOM(0x03) },
4254 { USB_DEVICE_WACOM(0x10) },
4255 { USB_DEVICE_WACOM(0x11) },
4256 { USB_DEVICE_WACOM(0x12) },
4257 { USB_DEVICE_WACOM(0x13) },
4258 { USB_DEVICE_WACOM(0x14) },
4259 { USB_DEVICE_WACOM(0x15) },
4260 { USB_DEVICE_WACOM(0x16) },
4261 { USB_DEVICE_WACOM(0x17) },
4262 { USB_DEVICE_WACOM(0x18) },
4263 { USB_DEVICE_WACOM(0x19) },
4264 { USB_DEVICE_WACOM(0x20) },
4265 { USB_DEVICE_WACOM(0x21) },
4266 { USB_DEVICE_WACOM(0x22) },
4267 { USB_DEVICE_WACOM(0x23) },
4268 { USB_DEVICE_WACOM(0x24) },
4269 { USB_DEVICE_WACOM(0x26) },
4270 { USB_DEVICE_WACOM(0x27) },
4271 { USB_DEVICE_WACOM(0x28) },
4272 { USB_DEVICE_WACOM(0x29) },
4273 { USB_DEVICE_WACOM(0x2A) },
4274 { USB_DEVICE_WACOM(0x30) },
4275 { USB_DEVICE_WACOM(0x31) },
4276 { USB_DEVICE_WACOM(0x32) },
4277 { USB_DEVICE_WACOM(0x33) },
4278 { USB_DEVICE_WACOM(0x34) },
4279 { USB_DEVICE_WACOM(0x35) },
4280 { USB_DEVICE_WACOM(0x37) },
4281 { USB_DEVICE_WACOM(0x38) },
4282 { USB_DEVICE_WACOM(0x39) },
4283 { USB_DEVICE_WACOM(0x3F) },
4284 { USB_DEVICE_WACOM(0x41) },
4285 { USB_DEVICE_WACOM(0x42) },
4286 { USB_DEVICE_WACOM(0x43) },
4287 { USB_DEVICE_WACOM(0x44) },
4288 { USB_DEVICE_WACOM(0x45) },
4289 { USB_DEVICE_WACOM(0x47) },
4290 { USB_DEVICE_WACOM(0x57) },
4291 { USB_DEVICE_WACOM(0x59) },
4292 { USB_DEVICE_WACOM(0x5B) },
4293 { USB_DEVICE_WACOM(0x5D) },
4294 { USB_DEVICE_WACOM(0x5E) },
4295 { USB_DEVICE_WACOM(0x60) },
4296 { USB_DEVICE_WACOM(0x61) },
4297 { USB_DEVICE_WACOM(0x62) },
4298 { USB_DEVICE_WACOM(0x63) },
4299 { USB_DEVICE_WACOM(0x64) },
4300 { USB_DEVICE_WACOM(0x65) },
4301 { USB_DEVICE_WACOM(0x69) },
4302 { USB_DEVICE_WACOM(0x6A) },
4303 { USB_DEVICE_WACOM(0x6B) },
4304 { BT_DEVICE_WACOM(0x81) },
4305 { USB_DEVICE_WACOM(0x84) },
4306 { USB_DEVICE_WACOM(0x90) },
4307 { USB_DEVICE_WACOM(0x93) },
4308 { USB_DEVICE_WACOM(0x97) },
4309 { USB_DEVICE_WACOM(0x9A) },
4310 { USB_DEVICE_WACOM(0x9F) },
4311 { USB_DEVICE_WACOM(0xB0) },
4312 { USB_DEVICE_WACOM(0xB1) },
4313 { USB_DEVICE_WACOM(0xB2) },
4314 { USB_DEVICE_WACOM(0xB3) },
4315 { USB_DEVICE_WACOM(0xB4) },
4316 { USB_DEVICE_WACOM(0xB5) },
4317 { USB_DEVICE_WACOM(0xB7) },
4318 { USB_DEVICE_WACOM(0xB8) },
4319 { USB_DEVICE_WACOM(0xB9) },
4320 { USB_DEVICE_WACOM(0xBA) },
4321 { USB_DEVICE_WACOM(0xBB) },
4322 { USB_DEVICE_WACOM(0xBC) },
4323 { BT_DEVICE_WACOM(0xBD) },
4324 { USB_DEVICE_WACOM(0xC0) },
4325 { USB_DEVICE_WACOM(0xC2) },
4326 { USB_DEVICE_WACOM(0xC4) },
4327 { USB_DEVICE_WACOM(0xC5) },
4328 { USB_DEVICE_WACOM(0xC6) },
4329 { USB_DEVICE_WACOM(0xC7) },
4330 { USB_DEVICE_WACOM(0xCC) },
4331 { USB_DEVICE_WACOM(0xCE) },
4332 { USB_DEVICE_WACOM(0xD0) },
4333 { USB_DEVICE_WACOM(0xD1) },
4334 { USB_DEVICE_WACOM(0xD2) },
4335 { USB_DEVICE_WACOM(0xD3) },
4336 { USB_DEVICE_WACOM(0xD4) },
4337 { USB_DEVICE_WACOM(0xD5) },
4338 { USB_DEVICE_WACOM(0xD6) },
4339 { USB_DEVICE_WACOM(0xD7) },
4340 { USB_DEVICE_WACOM(0xD8) },
4341 { USB_DEVICE_WACOM(0xDA) },
4342 { USB_DEVICE_WACOM(0xDB) },
4343 { USB_DEVICE_WACOM(0xDD) },
4344 { USB_DEVICE_WACOM(0xDE) },
4345 { USB_DEVICE_WACOM(0xDF) },
4346 { USB_DEVICE_WACOM(0xE2) },
4347 { USB_DEVICE_WACOM(0xE3) },
4348 { USB_DEVICE_WACOM(0xE5) },
4349 { USB_DEVICE_WACOM(0xE6) },
4350 { USB_DEVICE_WACOM(0xEC) },
4351 { USB_DEVICE_WACOM(0xED) },
4352 { USB_DEVICE_WACOM(0xEF) },
4353 { USB_DEVICE_WACOM(0xF0) },
4354 { USB_DEVICE_WACOM(0xF4) },
4355 { USB_DEVICE_WACOM(0xF6) },
4356 { USB_DEVICE_WACOM(0xF8) },
4357 { USB_DEVICE_WACOM(0xFA) },
4358 { USB_DEVICE_WACOM(0xFB) },
4359 { USB_DEVICE_WACOM(0x100) },
4360 { USB_DEVICE_WACOM(0x101) },
4361 { USB_DEVICE_WACOM(0x10D) },
4362 { USB_DEVICE_WACOM(0x10E) },
4363 { USB_DEVICE_WACOM(0x10F) },
4364 { USB_DEVICE_WACOM(0x116) },
4365 { USB_DEVICE_WACOM(0x12C) },
4366 { USB_DEVICE_WACOM(0x300) },
4367 { USB_DEVICE_WACOM(0x301) },
4368 { USB_DEVICE_WACOM(0x302) },
4369 { USB_DEVICE_WACOM(0x303) },
4370 { USB_DEVICE_WACOM(0x304) },
4371 { USB_DEVICE_WACOM(0x307) },
4372 { USB_DEVICE_WACOM(0x309) },
4373 { USB_DEVICE_WACOM(0x30A) },
4374 { USB_DEVICE_WACOM(0x30C) },
4375 { USB_DEVICE_WACOM(0x30E) },
4376 { USB_DEVICE_WACOM(0x314) },
4377 { USB_DEVICE_WACOM(0x315) },
4378 { USB_DEVICE_WACOM(0x317) },
4379 { USB_DEVICE_WACOM(0x318) },
4380 { USB_DEVICE_WACOM(0x319) },
4381 { USB_DEVICE_WACOM(0x323) },
4382 { USB_DEVICE_WACOM(0x325) },
4383 { USB_DEVICE_WACOM(0x326) },
4384 { USB_DEVICE_WACOM(0x32A) },
4385 { USB_DEVICE_WACOM(0x32B) },
4386 { USB_DEVICE_WACOM(0x32C) },
4387 { USB_DEVICE_WACOM(0x32F) },
4388 { USB_DEVICE_WACOM(0x331) },
4389 { USB_DEVICE_WACOM(0x333) },
4390 { USB_DEVICE_WACOM(0x335) },
4391 { USB_DEVICE_WACOM(0x336) },
4392 { USB_DEVICE_WACOM(0x33B) },
4393 { USB_DEVICE_WACOM(0x33C) },
4394 { USB_DEVICE_WACOM(0x33D) },
4395 { USB_DEVICE_WACOM(0x33E) },
4396 { USB_DEVICE_WACOM(0x343) },
4397 { BT_DEVICE_WACOM(0x360) },
4398 { BT_DEVICE_WACOM(0x361) },
4399 { USB_DEVICE_WACOM(0x4001) },
4400 { USB_DEVICE_WACOM(0x4004) },
4401 { USB_DEVICE_WACOM(0x5000) },
4402 { USB_DEVICE_WACOM(0x5002) },
4403 { USB_DEVICE_LENOVO(0x6004) },
4405 { USB_DEVICE_WACOM(HID_ANY_ID
) },
4406 { I2C_DEVICE_WACOM(HID_ANY_ID
) },
4407 { BT_DEVICE_WACOM(HID_ANY_ID
) },
4410 MODULE_DEVICE_TABLE(hid
, wacom_ids
);