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_status
, int bat_capacity
,
61 bool bat_charging
, bool bat_connected
,
64 bool changed
= battery
->bat_status
!= bat_status
||
65 battery
->battery_capacity
!= bat_capacity
||
66 battery
->bat_charging
!= bat_charging
||
67 battery
->bat_connected
!= bat_connected
||
68 battery
->ps_connected
!= ps_connected
;
71 battery
->bat_status
= bat_status
;
72 battery
->battery_capacity
= bat_capacity
;
73 battery
->bat_charging
= bat_charging
;
74 battery
->bat_connected
= bat_connected
;
75 battery
->ps_connected
= ps_connected
;
78 power_supply_changed(battery
->battery
);
82 static void wacom_notify_battery(struct wacom_wac
*wacom_wac
,
83 int bat_status
, int bat_capacity
, bool bat_charging
,
84 bool bat_connected
, bool ps_connected
)
86 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
88 __wacom_notify_battery(&wacom
->battery
, bat_status
, bat_capacity
,
89 bat_charging
, bat_connected
, ps_connected
);
92 static int wacom_penpartner_irq(struct wacom_wac
*wacom
)
94 unsigned char *data
= wacom
->data
;
95 struct input_dev
*input
= wacom
->pen_input
;
100 wacom
->tool
[0] = (data
[5] & 0x20) ? BTN_TOOL_RUBBER
: BTN_TOOL_PEN
;
101 wacom
->id
[0] = (data
[5] & 0x20) ? ERASER_DEVICE_ID
: STYLUS_DEVICE_ID
;
102 input_report_key(input
, wacom
->tool
[0], 1);
103 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* report tool id */
104 input_report_abs(input
, ABS_X
, get_unaligned_le16(&data
[1]));
105 input_report_abs(input
, ABS_Y
, get_unaligned_le16(&data
[3]));
106 input_report_abs(input
, ABS_PRESSURE
, (signed char)data
[6] + 127);
107 input_report_key(input
, BTN_TOUCH
, ((signed char)data
[6] > -127));
108 input_report_key(input
, BTN_STYLUS
, (data
[5] & 0x40));
110 input_report_key(input
, wacom
->tool
[0], 0);
111 input_report_abs(input
, ABS_MISC
, 0); /* report tool id */
112 input_report_abs(input
, ABS_PRESSURE
, -1);
113 input_report_key(input
, BTN_TOUCH
, 0);
118 input_report_key(input
, BTN_TOOL_PEN
, 1);
119 input_report_abs(input
, ABS_MISC
, STYLUS_DEVICE_ID
); /* report tool id */
120 input_report_abs(input
, ABS_X
, get_unaligned_le16(&data
[1]));
121 input_report_abs(input
, ABS_Y
, get_unaligned_le16(&data
[3]));
122 input_report_abs(input
, ABS_PRESSURE
, (signed char)data
[6] + 127);
123 input_report_key(input
, BTN_TOUCH
, ((signed char)data
[6] > -80) && !(data
[5] & 0x20));
124 input_report_key(input
, BTN_STYLUS
, (data
[5] & 0x40));
128 dev_dbg(input
->dev
.parent
,
129 "%s: received unknown report #%d\n", __func__
, data
[0]);
136 static int wacom_pl_irq(struct wacom_wac
*wacom
)
138 struct wacom_features
*features
= &wacom
->features
;
139 unsigned char *data
= wacom
->data
;
140 struct input_dev
*input
= wacom
->pen_input
;
143 if (data
[0] != WACOM_REPORT_PENABLED
) {
144 dev_dbg(input
->dev
.parent
,
145 "%s: received unknown report #%d\n", __func__
, data
[0]);
149 prox
= data
[1] & 0x40;
152 if ((data
[0] & 0x10) || (data
[4] & 0x20)) {
153 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
154 wacom
->id
[0] = ERASER_DEVICE_ID
;
157 wacom
->tool
[0] = BTN_TOOL_PEN
;
158 wacom
->id
[0] = STYLUS_DEVICE_ID
;
162 /* If the eraser is in prox, STYLUS2 is always set. If we
163 * mis-detected the type and notice that STYLUS2 isn't set
164 * then force the eraser out of prox and let the pen in.
166 if (wacom
->tool
[0] == BTN_TOOL_RUBBER
&& !(data
[4] & 0x20)) {
167 input_report_key(input
, BTN_TOOL_RUBBER
, 0);
168 input_report_abs(input
, ABS_MISC
, 0);
170 wacom
->tool
[0] = BTN_TOOL_PEN
;
171 wacom
->id
[0] = STYLUS_DEVICE_ID
;
175 pressure
= (signed char)((data
[7] << 1) | ((data
[4] >> 2) & 1));
176 if (features
->pressure_max
> 255)
177 pressure
= (pressure
<< 1) | ((data
[4] >> 6) & 1);
178 pressure
+= (features
->pressure_max
+ 1) / 2;
180 input_report_abs(input
, ABS_X
, data
[3] | (data
[2] << 7) | ((data
[1] & 0x03) << 14));
181 input_report_abs(input
, ABS_Y
, data
[6] | (data
[5] << 7) | ((data
[4] & 0x03) << 14));
182 input_report_abs(input
, ABS_PRESSURE
, pressure
);
184 input_report_key(input
, BTN_TOUCH
, data
[4] & 0x08);
185 input_report_key(input
, BTN_STYLUS
, data
[4] & 0x10);
186 /* Only allow the stylus2 button to be reported for the pen tool. */
187 input_report_key(input
, BTN_STYLUS2
, (wacom
->tool
[0] == BTN_TOOL_PEN
) && (data
[4] & 0x20));
192 input_report_key(input
, wacom
->tool
[0], prox
);
193 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]);
197 static int wacom_ptu_irq(struct wacom_wac
*wacom
)
199 unsigned char *data
= wacom
->data
;
200 struct input_dev
*input
= wacom
->pen_input
;
202 if (data
[0] != WACOM_REPORT_PENABLED
) {
203 dev_dbg(input
->dev
.parent
,
204 "%s: received unknown report #%d\n", __func__
, data
[0]);
208 if (data
[1] & 0x04) {
209 input_report_key(input
, BTN_TOOL_RUBBER
, data
[1] & 0x20);
210 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x08);
211 wacom
->id
[0] = ERASER_DEVICE_ID
;
213 input_report_key(input
, BTN_TOOL_PEN
, data
[1] & 0x20);
214 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x01);
215 wacom
->id
[0] = STYLUS_DEVICE_ID
;
217 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* report tool id */
218 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
219 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
220 input_report_abs(input
, ABS_PRESSURE
, le16_to_cpup((__le16
*)&data
[6]));
221 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
222 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x10);
226 static int wacom_dtu_irq(struct wacom_wac
*wacom
)
228 unsigned char *data
= wacom
->data
;
229 struct input_dev
*input
= wacom
->pen_input
;
230 int prox
= data
[1] & 0x20;
232 dev_dbg(input
->dev
.parent
,
233 "%s: received report #%d", __func__
, data
[0]);
236 /* Going into proximity select tool */
237 wacom
->tool
[0] = (data
[1] & 0x0c) ? BTN_TOOL_RUBBER
: BTN_TOOL_PEN
;
238 if (wacom
->tool
[0] == BTN_TOOL_PEN
)
239 wacom
->id
[0] = STYLUS_DEVICE_ID
;
241 wacom
->id
[0] = ERASER_DEVICE_ID
;
243 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
244 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x10);
245 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
246 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
247 input_report_abs(input
, ABS_PRESSURE
, ((data
[7] & 0x01) << 8) | data
[6]);
248 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x05);
249 if (!prox
) /* out-prox */
251 input_report_key(input
, wacom
->tool
[0], prox
);
252 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]);
256 static int wacom_dtus_irq(struct wacom_wac
*wacom
)
258 char *data
= wacom
->data
;
259 struct input_dev
*input
= wacom
->pen_input
;
260 unsigned short prox
, pressure
= 0;
262 if (data
[0] != WACOM_REPORT_DTUS
&& data
[0] != WACOM_REPORT_DTUSPAD
) {
263 dev_dbg(input
->dev
.parent
,
264 "%s: received unknown report #%d", __func__
, data
[0]);
266 } else if (data
[0] == WACOM_REPORT_DTUSPAD
) {
267 input
= wacom
->pad_input
;
268 input_report_key(input
, BTN_0
, (data
[1] & 0x01));
269 input_report_key(input
, BTN_1
, (data
[1] & 0x02));
270 input_report_key(input
, BTN_2
, (data
[1] & 0x04));
271 input_report_key(input
, BTN_3
, (data
[1] & 0x08));
272 input_report_abs(input
, ABS_MISC
,
273 data
[1] & 0x0f ? PAD_DEVICE_ID
: 0);
276 prox
= data
[1] & 0x80;
278 switch ((data
[1] >> 3) & 3) {
280 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
281 wacom
->id
[0] = ERASER_DEVICE_ID
;
285 wacom
->tool
[0] = BTN_TOOL_PEN
;
286 wacom
->id
[0] = STYLUS_DEVICE_ID
;
291 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x20);
292 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x40);
293 input_report_abs(input
, ABS_X
, get_unaligned_be16(&data
[3]));
294 input_report_abs(input
, ABS_Y
, get_unaligned_be16(&data
[5]));
295 pressure
= ((data
[1] & 0x03) << 8) | (data
[2] & 0xff);
296 input_report_abs(input
, ABS_PRESSURE
, pressure
);
297 input_report_key(input
, BTN_TOUCH
, pressure
> 10);
299 if (!prox
) /* out-prox */
301 input_report_key(input
, wacom
->tool
[0], prox
);
302 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]);
307 static int wacom_graphire_irq(struct wacom_wac
*wacom
)
309 struct wacom_features
*features
= &wacom
->features
;
310 unsigned char *data
= wacom
->data
;
311 struct input_dev
*input
= wacom
->pen_input
;
312 struct input_dev
*pad_input
= wacom
->pad_input
;
313 int battery_capacity
, ps_connected
;
318 if (features
->type
== GRAPHIRE_BT
) {
319 if (data
[0] != WACOM_REPORT_PENABLED_BT
) {
320 dev_dbg(input
->dev
.parent
,
321 "%s: received unknown report #%d\n", __func__
,
325 } else if (data
[0] != WACOM_REPORT_PENABLED
) {
326 dev_dbg(input
->dev
.parent
,
327 "%s: received unknown report #%d\n", __func__
, data
[0]);
331 prox
= data
[1] & 0x80;
332 if (prox
|| wacom
->id
[0]) {
334 switch ((data
[1] >> 5) & 3) {
337 wacom
->tool
[0] = BTN_TOOL_PEN
;
338 wacom
->id
[0] = STYLUS_DEVICE_ID
;
342 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
343 wacom
->id
[0] = ERASER_DEVICE_ID
;
346 case 2: /* Mouse with wheel */
347 input_report_key(input
, BTN_MIDDLE
, data
[1] & 0x04);
350 case 3: /* Mouse without wheel */
351 wacom
->tool
[0] = BTN_TOOL_MOUSE
;
352 wacom
->id
[0] = CURSOR_DEVICE_ID
;
356 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
357 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
358 if (wacom
->tool
[0] != BTN_TOOL_MOUSE
) {
359 if (features
->type
== GRAPHIRE_BT
)
360 input_report_abs(input
, ABS_PRESSURE
, data
[6] |
361 (((__u16
) (data
[1] & 0x08)) << 5));
363 input_report_abs(input
, ABS_PRESSURE
, data
[6] |
364 ((data
[7] & 0x03) << 8));
365 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x01);
366 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
367 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x04);
369 input_report_key(input
, BTN_LEFT
, data
[1] & 0x01);
370 input_report_key(input
, BTN_RIGHT
, data
[1] & 0x02);
371 if (features
->type
== WACOM_G4
||
372 features
->type
== WACOM_MO
) {
373 input_report_abs(input
, ABS_DISTANCE
, data
[6] & 0x3f);
374 rw
= (data
[7] & 0x04) - (data
[7] & 0x03);
375 } else if (features
->type
== GRAPHIRE_BT
) {
376 /* Compute distance between mouse and tablet */
377 rw
= 44 - (data
[6] >> 2);
378 rw
= clamp_val(rw
, 0, 31);
379 input_report_abs(input
, ABS_DISTANCE
, rw
);
380 if (((data
[1] >> 5) & 3) == 2) {
381 /* Mouse with wheel */
382 input_report_key(input
, BTN_MIDDLE
,
384 rw
= (data
[6] & 0x01) ? -1 :
385 (data
[6] & 0x02) ? 1 : 0;
390 input_report_abs(input
, ABS_DISTANCE
, data
[7] & 0x3f);
391 rw
= -(signed char)data
[6];
393 input_report_rel(input
, REL_WHEEL
, rw
);
398 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* report tool id */
399 input_report_key(input
, wacom
->tool
[0], prox
);
400 input_sync(input
); /* sync last event */
404 switch (features
->type
) {
406 prox
= data
[7] & 0xf8;
407 if (prox
|| wacom
->id
[1]) {
408 wacom
->id
[1] = PAD_DEVICE_ID
;
409 input_report_key(pad_input
, BTN_BACK
, (data
[7] & 0x40));
410 input_report_key(pad_input
, BTN_FORWARD
, (data
[7] & 0x80));
411 rw
= ((data
[7] & 0x18) >> 3) - ((data
[7] & 0x20) >> 3);
412 input_report_rel(pad_input
, REL_WHEEL
, rw
);
415 input_report_abs(pad_input
, ABS_MISC
, wacom
->id
[1]);
421 prox
= (data
[7] & 0xf8) || data
[8];
422 if (prox
|| wacom
->id
[1]) {
423 wacom
->id
[1] = PAD_DEVICE_ID
;
424 input_report_key(pad_input
, BTN_BACK
, (data
[7] & 0x08));
425 input_report_key(pad_input
, BTN_LEFT
, (data
[7] & 0x20));
426 input_report_key(pad_input
, BTN_FORWARD
, (data
[7] & 0x10));
427 input_report_key(pad_input
, BTN_RIGHT
, (data
[7] & 0x40));
428 input_report_abs(pad_input
, ABS_WHEEL
, (data
[8] & 0x7f));
431 input_report_abs(pad_input
, ABS_MISC
, wacom
->id
[1]);
436 prox
= data
[7] & 0x03;
437 if (prox
|| wacom
->id
[1]) {
438 wacom
->id
[1] = PAD_DEVICE_ID
;
439 input_report_key(pad_input
, BTN_0
, (data
[7] & 0x02));
440 input_report_key(pad_input
, BTN_1
, (data
[7] & 0x01));
443 input_report_abs(pad_input
, ABS_MISC
, wacom
->id
[1]);
449 /* Store current battery capacity and power supply state */
450 if (features
->type
== GRAPHIRE_BT
) {
451 rw
= (data
[7] >> 2 & 0x07);
452 battery_capacity
= batcap_gr
[rw
];
453 ps_connected
= rw
== 7;
454 wacom_notify_battery(wacom
, WACOM_POWER_SUPPLY_STATUS_AUTO
,
455 battery_capacity
, ps_connected
, 1,
462 static void wacom_intuos_schedule_prox_event(struct wacom_wac
*wacom_wac
)
464 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
465 struct wacom_features
*features
= &wacom_wac
->features
;
466 struct hid_report
*r
;
467 struct hid_report_enum
*re
;
469 re
= &(wacom
->hdev
->report_enum
[HID_FEATURE_REPORT
]);
470 if (features
->type
== INTUOSHT2
)
471 r
= re
->report_id_hash
[WACOM_REPORT_INTUOSHT2_ID
];
473 r
= re
->report_id_hash
[WACOM_REPORT_INTUOS_ID1
];
475 hid_hw_request(wacom
->hdev
, r
, HID_REQ_GET_REPORT
);
479 static int wacom_intuos_pad(struct wacom_wac
*wacom
)
481 struct wacom_features
*features
= &wacom
->features
;
482 unsigned char *data
= wacom
->data
;
483 struct input_dev
*input
= wacom
->pad_input
;
485 int buttons
= 0, nbuttons
= features
->numbered_buttons
;
486 int keys
= 0, nkeys
= 0;
487 int ring1
= 0, ring2
= 0;
488 int strip1
= 0, strip2
= 0;
491 /* pad packets. Works as a second tool and is always in prox */
492 if (!(data
[0] == WACOM_REPORT_INTUOSPAD
|| data
[0] == WACOM_REPORT_INTUOS5PAD
||
493 data
[0] == WACOM_REPORT_CINTIQPAD
))
496 if (features
->type
>= INTUOS4S
&& features
->type
<= INTUOS4L
) {
497 buttons
= (data
[3] << 1) | (data
[2] & 0x01);
499 } else if (features
->type
== DTK
) {
501 } else if (features
->type
== WACOM_13HD
) {
502 buttons
= (data
[4] << 1) | (data
[3] & 0x01);
503 } else if (features
->type
== WACOM_24HD
) {
504 buttons
= (data
[8] << 8) | data
[6];
509 * Three "buttons" are available on the 24HD which are
510 * physically implemented as a touchstrip. Each button
511 * is approximately 3 bits wide with a 2 bit spacing.
512 * The raw touchstrip bits are stored at:
513 * ((data[3] & 0x1f) << 8) | data[4])
516 keys
= ((data
[3] & 0x1C) ? 1<<2 : 0) |
517 ((data
[4] & 0xE0) ? 1<<1 : 0) |
518 ((data
[4] & 0x07) ? 1<<0 : 0);
519 } else if (features
->type
== WACOM_27QHD
) {
521 keys
= data
[2] & 0x07;
523 input_report_abs(input
, ABS_X
, be16_to_cpup((__be16
*)&data
[4]));
524 input_report_abs(input
, ABS_Y
, be16_to_cpup((__be16
*)&data
[6]));
525 input_report_abs(input
, ABS_Z
, be16_to_cpup((__be16
*)&data
[8]));
526 } else if (features
->type
== CINTIQ_HYBRID
) {
528 * Do not send hardware buttons under Android. They
529 * are already sent to the system through GPIO (and
530 * have different meaning).
532 * d-pad right -> data[4] & 0x10
533 * d-pad up -> data[4] & 0x20
534 * d-pad left -> data[4] & 0x40
535 * d-pad down -> data[4] & 0x80
536 * d-pad center -> data[3] & 0x01
538 buttons
= (data
[4] << 1) | (data
[3] & 0x01);
539 } else if (features
->type
== CINTIQ_COMPANION_2
) {
540 /* d-pad right -> data[4] & 0x10
541 * d-pad up -> data[4] & 0x20
542 * d-pad left -> data[4] & 0x40
543 * d-pad down -> data[4] & 0x80
544 * d-pad center -> data[3] & 0x01
546 buttons
= ((data
[2] >> 4) << 7) |
547 ((data
[1] & 0x04) << 6) |
548 ((data
[2] & 0x0F) << 2) |
550 } else if (features
->type
>= INTUOS5S
&& features
->type
<= INTUOSPL
) {
552 * ExpressKeys on Intuos5/Intuos Pro have a capacitive sensor in
553 * addition to the mechanical switch. Switch data is
554 * stored in data[4], capacitive data in data[5].
556 * Touch ring mode switch (data[3]) has no capacitive sensor
558 buttons
= (data
[4] << 1) | (data
[3] & 0x01);
561 if (features
->type
== WACOM_21UX2
|| features
->type
== WACOM_22HD
) {
562 buttons
= (data
[8] << 10) | ((data
[7] & 0x01) << 9) |
563 (data
[6] << 1) | (data
[5] & 0x01);
565 if (features
->type
== WACOM_22HD
) {
567 keys
= data
[9] & 0x07;
570 buttons
= ((data
[6] & 0x10) << 10) |
571 ((data
[5] & 0x10) << 9) |
572 ((data
[6] & 0x0F) << 4) |
575 strip1
= ((data
[1] & 0x1f) << 8) | data
[2];
576 strip2
= ((data
[3] & 0x1f) << 8) | data
[4];
579 prox
= (buttons
& ~(~0 << nbuttons
)) | (keys
& ~(~0 << nkeys
)) |
580 (ring1
& 0x80) | (ring2
& 0x80) | strip1
| strip2
;
582 wacom_report_numbered_buttons(input
, nbuttons
, buttons
);
584 for (i
= 0; i
< nkeys
; i
++)
585 input_report_key(input
, KEY_PROG1
+ i
, keys
& (1 << i
));
587 input_report_abs(input
, ABS_RX
, strip1
);
588 input_report_abs(input
, ABS_RY
, strip2
);
590 input_report_abs(input
, ABS_WHEEL
, (ring1
& 0x80) ? (ring1
& 0x7f) : 0);
591 input_report_abs(input
, ABS_THROTTLE
, (ring2
& 0x80) ? (ring2
& 0x7f) : 0);
593 input_report_key(input
, wacom
->tool
[1], prox
? 1 : 0);
594 input_report_abs(input
, ABS_MISC
, prox
? PAD_DEVICE_ID
: 0);
596 input_event(input
, EV_MSC
, MSC_SERIAL
, 0xffffffff);
601 static int wacom_intuos_id_mangle(int tool_id
)
603 return (tool_id
& ~0xFFF) << 4 | (tool_id
& 0xFFF);
606 static int wacom_intuos_get_tool_type(int tool_id
)
611 case 0x812: /* Inking pen */
612 case 0x801: /* Intuos3 Inking pen */
613 case 0x12802: /* Intuos4/5 Inking Pen */
615 tool_type
= BTN_TOOL_PENCIL
;
618 case 0x822: /* Pen */
621 case 0x823: /* Intuos3 Grip Pen */
622 case 0x813: /* Intuos3 Classic Pen */
623 case 0x885: /* Intuos3 Marker Pen */
624 case 0x802: /* Intuos4/5 13HD/24HD General Pen */
625 case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */
626 case 0x8e2: /* IntuosHT2 pen */
628 case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */
629 case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */
630 case 0x16802: /* Cintiq 13HD Pro Pen */
631 case 0x18802: /* DTH2242 Pen */
632 case 0x10802: /* Intuos4/5 13HD/24HD General Pen */
633 tool_type
= BTN_TOOL_PEN
;
636 case 0x832: /* Stroke pen */
638 tool_type
= BTN_TOOL_BRUSH
;
641 case 0x007: /* Mouse 4D and 2D */
644 case 0x017: /* Intuos3 2D Mouse */
645 case 0x806: /* Intuos4 Mouse */
646 tool_type
= BTN_TOOL_MOUSE
;
649 case 0x096: /* Lens cursor */
650 case 0x097: /* Intuos3 Lens cursor */
651 case 0x006: /* Intuos4 Lens cursor */
652 tool_type
= BTN_TOOL_LENS
;
655 case 0x82a: /* Eraser */
661 case 0x82b: /* Intuos3 Grip Pen Eraser */
662 case 0x81b: /* Intuos3 Classic Pen Eraser */
663 case 0x91b: /* Intuos3 Airbrush Eraser */
664 case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */
665 case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */
666 case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
667 case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */
668 case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
669 case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */
670 case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */
671 case 0x1880a: /* DTH2242 Eraser */
672 case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */
673 tool_type
= BTN_TOOL_RUBBER
;
679 case 0x913: /* Intuos3 Airbrush */
680 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */
681 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */
682 tool_type
= BTN_TOOL_AIRBRUSH
;
685 default: /* Unknown tool */
686 tool_type
= BTN_TOOL_PEN
;
692 static int wacom_intuos_inout(struct wacom_wac
*wacom
)
694 struct wacom_features
*features
= &wacom
->features
;
695 unsigned char *data
= wacom
->data
;
696 struct input_dev
*input
= wacom
->pen_input
;
697 int idx
= (features
->type
== INTUOS
) ? (data
[1] & 0x01) : 0;
699 if (!(((data
[1] & 0xfc) == 0xc0) || /* in prox */
700 ((data
[1] & 0xfe) == 0x20) || /* in range */
701 ((data
[1] & 0xfe) == 0x80))) /* out prox */
705 if ((data
[1] & 0xfc) == 0xc0) {
706 /* serial number of the tool */
707 wacom
->serial
[idx
] = ((data
[3] & 0x0f) << 28) +
708 (data
[4] << 20) + (data
[5] << 12) +
709 (data
[6] << 4) + (data
[7] >> 4);
711 wacom
->id
[idx
] = (data
[2] << 4) | (data
[3] >> 4) |
712 ((data
[7] & 0x0f) << 16) | ((data
[8] & 0xf0) << 8);
714 wacom
->tool
[idx
] = wacom_intuos_get_tool_type(wacom
->id
[idx
]);
716 wacom
->shared
->stylus_in_proximity
= true;
721 if ((data
[1] & 0xfe) == 0x20) {
722 if (features
->type
!= INTUOSHT2
)
723 wacom
->shared
->stylus_in_proximity
= true;
725 /* in Range while exiting */
726 if (wacom
->reporting_data
) {
727 input_report_key(input
, BTN_TOUCH
, 0);
728 input_report_abs(input
, ABS_PRESSURE
, 0);
729 input_report_abs(input
, ABS_DISTANCE
, wacom
->features
.distance_max
);
736 if ((data
[1] & 0xfe) == 0x80) {
737 wacom
->shared
->stylus_in_proximity
= false;
738 wacom
->reporting_data
= false;
740 /* don't report exit if we don't know the ID */
745 * Reset all states otherwise we lose the initial states
746 * when in-prox next time
748 input_report_abs(input
, ABS_X
, 0);
749 input_report_abs(input
, ABS_Y
, 0);
750 input_report_abs(input
, ABS_DISTANCE
, 0);
751 input_report_abs(input
, ABS_TILT_X
, 0);
752 input_report_abs(input
, ABS_TILT_Y
, 0);
753 if (wacom
->tool
[idx
] >= BTN_TOOL_MOUSE
) {
754 input_report_key(input
, BTN_LEFT
, 0);
755 input_report_key(input
, BTN_MIDDLE
, 0);
756 input_report_key(input
, BTN_RIGHT
, 0);
757 input_report_key(input
, BTN_SIDE
, 0);
758 input_report_key(input
, BTN_EXTRA
, 0);
759 input_report_abs(input
, ABS_THROTTLE
, 0);
760 input_report_abs(input
, ABS_RZ
, 0);
762 input_report_abs(input
, ABS_PRESSURE
, 0);
763 input_report_key(input
, BTN_STYLUS
, 0);
764 input_report_key(input
, BTN_STYLUS2
, 0);
765 input_report_key(input
, BTN_TOUCH
, 0);
766 input_report_abs(input
, ABS_WHEEL
, 0);
767 if (features
->type
>= INTUOS3S
)
768 input_report_abs(input
, ABS_Z
, 0);
770 input_report_key(input
, wacom
->tool
[idx
], 0);
771 input_report_abs(input
, ABS_MISC
, 0); /* reset tool id */
772 input_event(input
, EV_MSC
, MSC_SERIAL
, wacom
->serial
[idx
]);
780 static inline bool report_touch_events(struct wacom_wac
*wacom
)
782 return (touch_arbitration
? !wacom
->shared
->stylus_in_proximity
: 1);
785 static inline bool delay_pen_events(struct wacom_wac
*wacom
)
787 return (wacom
->shared
->touch_down
&& touch_arbitration
);
790 static int wacom_intuos_general(struct wacom_wac
*wacom
)
792 struct wacom_features
*features
= &wacom
->features
;
793 unsigned char *data
= wacom
->data
;
794 struct input_dev
*input
= wacom
->pen_input
;
795 int idx
= (features
->type
== INTUOS
) ? (data
[1] & 0x01) : 0;
796 unsigned char type
= (data
[1] >> 1) & 0x0F;
797 unsigned int x
, y
, distance
, t
;
799 if (data
[0] != WACOM_REPORT_PENABLED
&& data
[0] != WACOM_REPORT_CINTIQ
&&
800 data
[0] != WACOM_REPORT_INTUOS_PEN
)
803 if (delay_pen_events(wacom
))
806 /* don't report events if we don't know the tool ID */
807 if (!wacom
->id
[idx
]) {
808 /* but reschedule a read of the current tool */
809 wacom_intuos_schedule_prox_event(wacom
);
814 * don't report events for invalid data
816 /* older I4 styli don't work with new Cintiqs */
817 if ((!((wacom
->id
[idx
] >> 16) & 0x01) &&
818 (features
->type
== WACOM_21UX2
)) ||
819 /* Only large Intuos support Lense Cursor */
820 (wacom
->tool
[idx
] == BTN_TOOL_LENS
&&
821 (features
->type
== INTUOS3
||
822 features
->type
== INTUOS3S
||
823 features
->type
== INTUOS4
||
824 features
->type
== INTUOS4S
||
825 features
->type
== INTUOS5
||
826 features
->type
== INTUOS5S
||
827 features
->type
== INTUOSPM
||
828 features
->type
== INTUOSPS
)) ||
829 /* Cintiq doesn't send data when RDY bit isn't set */
830 (features
->type
== CINTIQ
&& !(data
[1] & 0x40)))
833 x
= (be16_to_cpup((__be16
*)&data
[2]) << 1) | ((data
[9] >> 1) & 1);
834 y
= (be16_to_cpup((__be16
*)&data
[4]) << 1) | (data
[9] & 1);
835 distance
= data
[9] >> 2;
836 if (features
->type
< INTUOS3S
) {
841 input_report_abs(input
, ABS_X
, x
);
842 input_report_abs(input
, ABS_Y
, y
);
843 input_report_abs(input
, ABS_DISTANCE
, distance
);
850 /* general pen packet */
851 t
= (data
[6] << 3) | ((data
[7] & 0xC0) >> 5) | (data
[1] & 1);
852 if (features
->pressure_max
< 2047)
854 input_report_abs(input
, ABS_PRESSURE
, t
);
855 if (features
->type
!= INTUOSHT2
) {
856 input_report_abs(input
, ABS_TILT_X
,
857 (((data
[7] << 1) & 0x7e) | (data
[8] >> 7)) - 64);
858 input_report_abs(input
, ABS_TILT_Y
, (data
[8] & 0x7f) - 64);
860 input_report_key(input
, BTN_STYLUS
, data
[1] & 2);
861 input_report_key(input
, BTN_STYLUS2
, data
[1] & 4);
862 input_report_key(input
, BTN_TOUCH
, t
> 10);
866 /* airbrush second packet */
867 input_report_abs(input
, ABS_WHEEL
,
868 (data
[6] << 2) | ((data
[7] >> 6) & 3));
869 input_report_abs(input
, ABS_TILT_X
,
870 (((data
[7] << 1) & 0x7e) | (data
[8] >> 7)) - 64);
871 input_report_abs(input
, ABS_TILT_Y
, (data
[8] & 0x7f) - 64);
875 /* Rotation packet */
876 if (features
->type
>= INTUOS3S
) {
877 /* I3 marker pen rotation */
878 t
= (data
[6] << 3) | ((data
[7] >> 5) & 7);
879 t
= (data
[7] & 0x20) ? ((t
> 900) ? ((t
-1) / 2 - 1350) :
880 ((t
-1) / 2 + 450)) : (450 - t
/ 2) ;
881 input_report_abs(input
, ABS_Z
, t
);
883 /* 4D mouse 2nd packet */
884 t
= (data
[6] << 3) | ((data
[7] >> 5) & 7);
885 input_report_abs(input
, ABS_RZ
, (data
[7] & 0x20) ?
886 ((t
- 1) / 2) : -t
/ 2);
891 /* 4D mouse 1st packet */
892 input_report_key(input
, BTN_LEFT
, data
[8] & 0x01);
893 input_report_key(input
, BTN_MIDDLE
, data
[8] & 0x02);
894 input_report_key(input
, BTN_RIGHT
, data
[8] & 0x04);
896 input_report_key(input
, BTN_SIDE
, data
[8] & 0x20);
897 input_report_key(input
, BTN_EXTRA
, data
[8] & 0x10);
898 t
= (data
[6] << 2) | ((data
[7] >> 6) & 3);
899 input_report_abs(input
, ABS_THROTTLE
, (data
[8] & 0x08) ? -t
: t
);
904 input_report_key(input
, BTN_LEFT
, data
[6] & 0x01);
905 input_report_key(input
, BTN_MIDDLE
, data
[6] & 0x02);
906 input_report_key(input
, BTN_RIGHT
, data
[6] & 0x04);
907 input_report_rel(input
, REL_WHEEL
, ((data
[7] & 0x80) >> 7)
908 - ((data
[7] & 0x40) >> 6));
909 input_report_key(input
, BTN_SIDE
, data
[6] & 0x08);
910 input_report_key(input
, BTN_EXTRA
, data
[6] & 0x10);
912 input_report_abs(input
, ABS_TILT_X
,
913 (((data
[7] << 1) & 0x7e) | (data
[8] >> 7)) - 64);
914 input_report_abs(input
, ABS_TILT_Y
, (data
[8] & 0x7f) - 64);
918 if (wacom
->tool
[idx
] == BTN_TOOL_MOUSE
) {
919 /* 2D mouse packet */
920 input_report_key(input
, BTN_LEFT
, data
[8] & 0x04);
921 input_report_key(input
, BTN_MIDDLE
, data
[8] & 0x08);
922 input_report_key(input
, BTN_RIGHT
, data
[8] & 0x10);
923 input_report_rel(input
, REL_WHEEL
, (data
[8] & 0x01)
924 - ((data
[8] & 0x02) >> 1));
926 /* I3 2D mouse side buttons */
927 if (features
->type
>= INTUOS3S
&& features
->type
<= INTUOS3L
) {
928 input_report_key(input
, BTN_SIDE
, data
[8] & 0x40);
929 input_report_key(input
, BTN_EXTRA
, data
[8] & 0x20);
932 else if (wacom
->tool
[idx
] == BTN_TOOL_LENS
) {
933 /* Lens cursor packets */
934 input_report_key(input
, BTN_LEFT
, data
[8] & 0x01);
935 input_report_key(input
, BTN_MIDDLE
, data
[8] & 0x02);
936 input_report_key(input
, BTN_RIGHT
, data
[8] & 0x04);
937 input_report_key(input
, BTN_SIDE
, data
[8] & 0x10);
938 input_report_key(input
, BTN_EXTRA
, data
[8] & 0x08);
953 input_report_abs(input
, ABS_MISC
,
954 wacom_intuos_id_mangle(wacom
->id
[idx
])); /* report tool id */
955 input_report_key(input
, wacom
->tool
[idx
], 1);
956 input_event(input
, EV_MSC
, MSC_SERIAL
, wacom
->serial
[idx
]);
957 wacom
->reporting_data
= true;
961 static int wacom_intuos_irq(struct wacom_wac
*wacom
)
963 unsigned char *data
= wacom
->data
;
964 struct input_dev
*input
= wacom
->pen_input
;
967 if (data
[0] != WACOM_REPORT_PENABLED
&&
968 data
[0] != WACOM_REPORT_INTUOS_ID1
&&
969 data
[0] != WACOM_REPORT_INTUOS_ID2
&&
970 data
[0] != WACOM_REPORT_INTUOSPAD
&&
971 data
[0] != WACOM_REPORT_INTUOS_PEN
&&
972 data
[0] != WACOM_REPORT_CINTIQ
&&
973 data
[0] != WACOM_REPORT_CINTIQPAD
&&
974 data
[0] != WACOM_REPORT_INTUOS5PAD
) {
975 dev_dbg(input
->dev
.parent
,
976 "%s: received unknown report #%d\n", __func__
, data
[0]);
980 /* process pad events */
981 result
= wacom_intuos_pad(wacom
);
985 /* process in/out prox events */
986 result
= wacom_intuos_inout(wacom
);
990 /* process general packets */
991 result
= wacom_intuos_general(wacom
);
998 static int wacom_remote_irq(struct wacom_wac
*wacom_wac
, size_t len
)
1000 unsigned char *data
= wacom_wac
->data
;
1001 struct input_dev
*input
;
1002 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
1003 struct wacom_remote
*remote
= wacom
->remote
;
1004 int bat_charging
, bat_percent
, touch_ring_mode
;
1007 unsigned long flags
;
1009 if (data
[0] != WACOM_REPORT_REMOTE
) {
1010 hid_dbg(wacom
->hdev
, "%s: received unknown report #%d",
1015 serial
= data
[3] + (data
[4] << 8) + (data
[5] << 16);
1016 wacom_wac
->id
[0] = PAD_DEVICE_ID
;
1018 spin_lock_irqsave(&remote
->remote_lock
, flags
);
1020 for (i
= 0; i
< WACOM_MAX_REMOTES
; i
++) {
1021 if (remote
->remotes
[i
].serial
== serial
) {
1027 if (index
< 0 || !remote
->remotes
[index
].registered
)
1030 input
= remote
->remotes
[index
].input
;
1032 input_report_key(input
, BTN_0
, (data
[9] & 0x01));
1033 input_report_key(input
, BTN_1
, (data
[9] & 0x02));
1034 input_report_key(input
, BTN_2
, (data
[9] & 0x04));
1035 input_report_key(input
, BTN_3
, (data
[9] & 0x08));
1036 input_report_key(input
, BTN_4
, (data
[9] & 0x10));
1037 input_report_key(input
, BTN_5
, (data
[9] & 0x20));
1038 input_report_key(input
, BTN_6
, (data
[9] & 0x40));
1039 input_report_key(input
, BTN_7
, (data
[9] & 0x80));
1041 input_report_key(input
, BTN_8
, (data
[10] & 0x01));
1042 input_report_key(input
, BTN_9
, (data
[10] & 0x02));
1043 input_report_key(input
, BTN_A
, (data
[10] & 0x04));
1044 input_report_key(input
, BTN_B
, (data
[10] & 0x08));
1045 input_report_key(input
, BTN_C
, (data
[10] & 0x10));
1046 input_report_key(input
, BTN_X
, (data
[10] & 0x20));
1047 input_report_key(input
, BTN_Y
, (data
[10] & 0x40));
1048 input_report_key(input
, BTN_Z
, (data
[10] & 0x80));
1050 input_report_key(input
, BTN_BASE
, (data
[11] & 0x01));
1051 input_report_key(input
, BTN_BASE2
, (data
[11] & 0x02));
1053 if (data
[12] & 0x80)
1054 input_report_abs(input
, ABS_WHEEL
, (data
[12] & 0x7f));
1056 input_report_abs(input
, ABS_WHEEL
, 0);
1058 bat_percent
= data
[7] & 0x7f;
1059 bat_charging
= !!(data
[7] & 0x80);
1061 if (data
[9] | data
[10] | (data
[11] & 0x03) | data
[12])
1062 input_report_abs(input
, ABS_MISC
, PAD_DEVICE_ID
);
1064 input_report_abs(input
, ABS_MISC
, 0);
1066 input_event(input
, EV_MSC
, MSC_SERIAL
, serial
);
1070 /*Which mode select (LED light) is currently on?*/
1071 touch_ring_mode
= (data
[11] & 0xC0) >> 6;
1073 for (i
= 0; i
< WACOM_MAX_REMOTES
; i
++) {
1074 if (remote
->remotes
[i
].serial
== serial
)
1075 wacom
->led
.groups
[i
].select
= touch_ring_mode
;
1078 __wacom_notify_battery(&remote
->remotes
[index
].battery
,
1079 WACOM_POWER_SUPPLY_STATUS_AUTO
, bat_percent
,
1080 bat_charging
, 1, bat_charging
);
1083 spin_unlock_irqrestore(&remote
->remote_lock
, flags
);
1087 static void wacom_remote_status_irq(struct wacom_wac
*wacom_wac
, size_t len
)
1089 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
1090 unsigned char *data
= wacom_wac
->data
;
1091 struct wacom_remote
*remote
= wacom
->remote
;
1092 struct wacom_remote_data remote_data
;
1093 unsigned long flags
;
1096 if (data
[0] != WACOM_REPORT_DEVICE_LIST
)
1099 memset(&remote_data
, 0, sizeof(struct wacom_remote_data
));
1101 for (i
= 0; i
< WACOM_MAX_REMOTES
; i
++) {
1103 int serial
= (data
[j
+6] << 16) + (data
[j
+5] << 8) + data
[j
+4];
1104 bool connected
= data
[j
+2];
1106 remote_data
.remote
[i
].serial
= serial
;
1107 remote_data
.remote
[i
].connected
= connected
;
1110 spin_lock_irqsave(&remote
->remote_lock
, flags
);
1112 ret
= kfifo_in(&remote
->remote_fifo
, &remote_data
, sizeof(remote_data
));
1113 if (ret
!= sizeof(remote_data
)) {
1114 spin_unlock_irqrestore(&remote
->remote_lock
, flags
);
1115 hid_err(wacom
->hdev
, "Can't queue Remote status event.\n");
1119 spin_unlock_irqrestore(&remote
->remote_lock
, flags
);
1121 wacom_schedule_work(wacom_wac
, WACOM_WORKER_REMOTE
);
1124 static int int_dist(int x1
, int y1
, int x2
, int y2
)
1129 return int_sqrt(x
*x
+ y
*y
);
1132 static void wacom_intuos_bt_process_data(struct wacom_wac
*wacom
,
1133 unsigned char *data
)
1135 memcpy(wacom
->data
, data
, 10);
1136 wacom_intuos_irq(wacom
);
1138 input_sync(wacom
->pen_input
);
1139 if (wacom
->pad_input
)
1140 input_sync(wacom
->pad_input
);
1143 static int wacom_intuos_bt_irq(struct wacom_wac
*wacom
, size_t len
)
1145 unsigned char data
[WACOM_PKGLEN_MAX
];
1147 unsigned power_raw
, battery_capacity
, bat_charging
, ps_connected
;
1149 memcpy(data
, wacom
->data
, len
);
1153 wacom_intuos_bt_process_data(wacom
, data
+ i
);
1157 wacom_intuos_bt_process_data(wacom
, data
+ i
);
1159 wacom_intuos_bt_process_data(wacom
, data
+ i
);
1161 power_raw
= data
[i
];
1162 bat_charging
= (power_raw
& 0x08) ? 1 : 0;
1163 ps_connected
= (power_raw
& 0x10) ? 1 : 0;
1164 battery_capacity
= batcap_i4
[power_raw
& 0x07];
1165 wacom_notify_battery(wacom
, WACOM_POWER_SUPPLY_STATUS_AUTO
,
1166 battery_capacity
, bat_charging
,
1167 battery_capacity
|| bat_charging
,
1171 dev_dbg(wacom
->pen_input
->dev
.parent
,
1172 "Unknown report: %d,%d size:%zu\n",
1173 data
[0], data
[1], len
);
1179 static int wacom_wac_finger_count_touches(struct wacom_wac
*wacom
)
1181 struct input_dev
*input
= wacom
->touch_input
;
1182 unsigned touch_max
= wacom
->features
.touch_max
;
1190 return test_bit(BTN_TOUCH
, input
->key
) &&
1191 report_touch_events(wacom
);
1193 for (i
= 0; i
< input
->mt
->num_slots
; i
++) {
1194 struct input_mt_slot
*ps
= &input
->mt
->slots
[i
];
1195 int id
= input_mt_get_value(ps
, ABS_MT_TRACKING_ID
);
1203 static void wacom_intuos_pro2_bt_pen(struct wacom_wac
*wacom
)
1205 const int pen_frame_len
= 14;
1206 const int pen_frames
= 7;
1208 struct input_dev
*pen_input
= wacom
->pen_input
;
1209 unsigned char *data
= wacom
->data
;
1212 wacom
->serial
[0] = get_unaligned_le64(&data
[99]);
1213 wacom
->id
[0] = get_unaligned_le16(&data
[107]);
1214 if (wacom
->serial
[0] >> 52 == 1) {
1215 /* Add back in missing bits of ID for non-USI pens */
1216 wacom
->id
[0] |= (wacom
->serial
[0] >> 32) & 0xFFFFF;
1218 wacom
->tool
[0] = wacom_intuos_get_tool_type(wacom_intuos_id_mangle(wacom
->id
[0]));
1220 for (i
= 0; i
< pen_frames
; i
++) {
1221 unsigned char *frame
= &data
[i
*pen_frame_len
+ 1];
1222 bool valid
= frame
[0] & 0x80;
1223 bool prox
= frame
[0] & 0x40;
1224 bool range
= frame
[0] & 0x20;
1230 input_report_abs(pen_input
, ABS_X
, get_unaligned_le16(&frame
[1]));
1231 input_report_abs(pen_input
, ABS_Y
, get_unaligned_le16(&frame
[3]));
1232 input_report_abs(pen_input
, ABS_TILT_X
, frame
[7]);
1233 input_report_abs(pen_input
, ABS_TILT_Y
, frame
[8]);
1234 input_report_abs(pen_input
, ABS_Z
, get_unaligned_le16(&frame
[9]));
1235 input_report_abs(pen_input
, ABS_WHEEL
, get_unaligned_le16(&frame
[11]));
1237 input_report_abs(pen_input
, ABS_PRESSURE
, get_unaligned_le16(&frame
[5]));
1238 input_report_abs(pen_input
, ABS_DISTANCE
, range
? frame
[13] : wacom
->features
.distance_max
);
1240 input_report_key(pen_input
, BTN_TOUCH
, frame
[0] & 0x01);
1241 input_report_key(pen_input
, BTN_STYLUS
, frame
[0] & 0x02);
1242 input_report_key(pen_input
, BTN_STYLUS2
, frame
[0] & 0x04);
1244 input_report_key(pen_input
, wacom
->tool
[0], prox
);
1245 input_event(pen_input
, EV_MSC
, MSC_SERIAL
, wacom
->serial
[0]);
1246 input_report_abs(pen_input
, ABS_MISC
,
1247 wacom_intuos_id_mangle(wacom
->id
[0])); /* report tool id */
1249 wacom
->shared
->stylus_in_proximity
= prox
;
1251 input_sync(pen_input
);
1255 static void wacom_intuos_pro2_bt_touch(struct wacom_wac
*wacom
)
1257 const int finger_touch_len
= 8;
1258 const int finger_frames
= 4;
1259 const int finger_frame_len
= 43;
1261 struct input_dev
*touch_input
= wacom
->touch_input
;
1262 unsigned char *data
= wacom
->data
;
1263 int num_contacts_left
= 5;
1266 for (i
= 0; i
< finger_frames
; i
++) {
1267 unsigned char *frame
= &data
[i
*finger_frame_len
+ 109];
1268 int current_num_contacts
= frame
[0] & 0x7F;
1269 int contacts_to_send
;
1271 if (!(frame
[0] & 0x80))
1275 * First packet resets the counter since only the first
1276 * packet in series will have non-zero current_num_contacts.
1278 if (current_num_contacts
)
1279 wacom
->num_contacts_left
= current_num_contacts
;
1281 contacts_to_send
= min(num_contacts_left
, wacom
->num_contacts_left
);
1283 for (j
= 0; j
< contacts_to_send
; j
++) {
1284 unsigned char *touch
= &frame
[j
*finger_touch_len
+ 1];
1285 int slot
= input_mt_get_slot_by_key(touch_input
, touch
[0]);
1286 int x
= get_unaligned_le16(&touch
[2]);
1287 int y
= get_unaligned_le16(&touch
[4]);
1288 int w
= touch
[6] * input_abs_get_res(touch_input
, ABS_MT_POSITION_X
);
1289 int h
= touch
[7] * input_abs_get_res(touch_input
, ABS_MT_POSITION_Y
);
1294 input_mt_slot(touch_input
, slot
);
1295 input_mt_report_slot_state(touch_input
, MT_TOOL_FINGER
, touch
[1] & 0x01);
1296 input_report_abs(touch_input
, ABS_MT_POSITION_X
, x
);
1297 input_report_abs(touch_input
, ABS_MT_POSITION_Y
, y
);
1298 input_report_abs(touch_input
, ABS_MT_TOUCH_MAJOR
, max(w
, h
));
1299 input_report_abs(touch_input
, ABS_MT_TOUCH_MINOR
, min(w
, h
));
1300 input_report_abs(touch_input
, ABS_MT_ORIENTATION
, w
> h
);
1303 input_mt_sync_frame(touch_input
);
1305 wacom
->num_contacts_left
-= contacts_to_send
;
1306 if (wacom
->num_contacts_left
<= 0) {
1307 wacom
->num_contacts_left
= 0;
1308 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1312 input_report_switch(touch_input
, SW_MUTE_DEVICE
, !(data
[281] >> 7));
1313 input_sync(touch_input
);
1316 static void wacom_intuos_pro2_bt_pad(struct wacom_wac
*wacom
)
1318 struct input_dev
*pad_input
= wacom
->pad_input
;
1319 unsigned char *data
= wacom
->data
;
1321 int buttons
= (data
[282] << 1) | ((data
[281] >> 6) & 0x01);
1322 int ring
= data
[285];
1323 int prox
= buttons
| (ring
& 0x80);
1325 wacom_report_numbered_buttons(pad_input
, 9, buttons
);
1327 input_report_abs(pad_input
, ABS_WHEEL
, (ring
& 0x80) ? (ring
& 0x7f) : 0);
1329 input_report_key(pad_input
, wacom
->tool
[1], prox
? 1 : 0);
1330 input_report_abs(pad_input
, ABS_MISC
, prox
? PAD_DEVICE_ID
: 0);
1331 input_event(pad_input
, EV_MSC
, MSC_SERIAL
, 0xffffffff);
1333 input_sync(pad_input
);
1336 static void wacom_intuos_pro2_bt_battery(struct wacom_wac
*wacom
)
1338 unsigned char *data
= wacom
->data
;
1340 bool chg
= data
[284] & 0x80;
1341 int battery_status
= data
[284] & 0x7F;
1343 wacom_notify_battery(wacom
, WACOM_POWER_SUPPLY_STATUS_AUTO
,
1344 battery_status
, chg
, 1, chg
);
1347 static int wacom_intuos_pro2_bt_irq(struct wacom_wac
*wacom
, size_t len
)
1349 unsigned char *data
= wacom
->data
;
1351 if (data
[0] != 0x80) {
1352 dev_dbg(wacom
->pen_input
->dev
.parent
,
1353 "%s: received unknown report #%d\n", __func__
, data
[0]);
1357 wacom_intuos_pro2_bt_pen(wacom
);
1358 wacom_intuos_pro2_bt_touch(wacom
);
1359 wacom_intuos_pro2_bt_pad(wacom
);
1360 wacom_intuos_pro2_bt_battery(wacom
);
1364 static int wacom_24hdt_irq(struct wacom_wac
*wacom
)
1366 struct input_dev
*input
= wacom
->touch_input
;
1367 unsigned char *data
= wacom
->data
;
1369 int current_num_contacts
= data
[61];
1370 int contacts_to_send
= 0;
1371 int num_contacts_left
= 4; /* maximum contacts per packet */
1372 int byte_per_packet
= WACOM_BYTES_PER_24HDT_PACKET
;
1375 if (wacom
->features
.type
== WACOM_27QHDT
) {
1376 current_num_contacts
= data
[63];
1377 num_contacts_left
= 10;
1378 byte_per_packet
= WACOM_BYTES_PER_QHDTHID_PACKET
;
1383 * First packet resets the counter since only the first
1384 * packet in series will have non-zero current_num_contacts.
1386 if (current_num_contacts
)
1387 wacom
->num_contacts_left
= current_num_contacts
;
1389 contacts_to_send
= min(num_contacts_left
, wacom
->num_contacts_left
);
1391 for (i
= 0; i
< contacts_to_send
; i
++) {
1392 int offset
= (byte_per_packet
* i
) + 1;
1393 bool touch
= (data
[offset
] & 0x1) && report_touch_events(wacom
);
1394 int slot
= input_mt_get_slot_by_key(input
, data
[offset
+ 1]);
1398 input_mt_slot(input
, slot
);
1399 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
1402 int t_x
= get_unaligned_le16(&data
[offset
+ 2]);
1403 int t_y
= get_unaligned_le16(&data
[offset
+ 4 + y_offset
]);
1405 input_report_abs(input
, ABS_MT_POSITION_X
, t_x
);
1406 input_report_abs(input
, ABS_MT_POSITION_Y
, t_y
);
1408 if (wacom
->features
.type
!= WACOM_27QHDT
) {
1409 int c_x
= get_unaligned_le16(&data
[offset
+ 4]);
1410 int c_y
= get_unaligned_le16(&data
[offset
+ 8]);
1411 int w
= get_unaligned_le16(&data
[offset
+ 10]);
1412 int h
= get_unaligned_le16(&data
[offset
+ 12]);
1414 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, min(w
,h
));
1415 input_report_abs(input
, ABS_MT_WIDTH_MAJOR
,
1416 min(w
, h
) + int_dist(t_x
, t_y
, c_x
, c_y
));
1417 input_report_abs(input
, ABS_MT_WIDTH_MINOR
, min(w
, h
));
1418 input_report_abs(input
, ABS_MT_ORIENTATION
, w
> h
);
1422 input_mt_sync_frame(input
);
1424 wacom
->num_contacts_left
-= contacts_to_send
;
1425 if (wacom
->num_contacts_left
<= 0) {
1426 wacom
->num_contacts_left
= 0;
1427 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1432 static int wacom_mt_touch(struct wacom_wac
*wacom
)
1434 struct input_dev
*input
= wacom
->touch_input
;
1435 unsigned char *data
= wacom
->data
;
1437 int current_num_contacts
= data
[2];
1438 int contacts_to_send
= 0;
1441 /* MTTPC does not support Height and Width */
1442 if (wacom
->features
.type
== MTTPC
|| wacom
->features
.type
== MTTPC_B
)
1446 * First packet resets the counter since only the first
1447 * packet in series will have non-zero current_num_contacts.
1449 if (current_num_contacts
)
1450 wacom
->num_contacts_left
= current_num_contacts
;
1452 /* There are at most 5 contacts per packet */
1453 contacts_to_send
= min(5, wacom
->num_contacts_left
);
1455 for (i
= 0; i
< contacts_to_send
; i
++) {
1456 int offset
= (WACOM_BYTES_PER_MT_PACKET
+ x_offset
) * i
+ 3;
1457 bool touch
= (data
[offset
] & 0x1) && report_touch_events(wacom
);
1458 int id
= get_unaligned_le16(&data
[offset
+ 1]);
1459 int slot
= input_mt_get_slot_by_key(input
, id
);
1464 input_mt_slot(input
, slot
);
1465 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
1467 int x
= get_unaligned_le16(&data
[offset
+ x_offset
+ 7]);
1468 int y
= get_unaligned_le16(&data
[offset
+ x_offset
+ 9]);
1469 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
1470 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
1473 input_mt_sync_frame(input
);
1475 wacom
->num_contacts_left
-= contacts_to_send
;
1476 if (wacom
->num_contacts_left
<= 0) {
1477 wacom
->num_contacts_left
= 0;
1478 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1483 static int wacom_tpc_mt_touch(struct wacom_wac
*wacom
)
1485 struct input_dev
*input
= wacom
->touch_input
;
1486 unsigned char *data
= wacom
->data
;
1489 for (i
= 0; i
< 2; i
++) {
1490 int p
= data
[1] & (1 << i
);
1491 bool touch
= p
&& report_touch_events(wacom
);
1493 input_mt_slot(input
, i
);
1494 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
1496 int x
= le16_to_cpup((__le16
*)&data
[i
* 2 + 2]) & 0x7fff;
1497 int y
= le16_to_cpup((__le16
*)&data
[i
* 2 + 6]) & 0x7fff;
1499 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
1500 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
1503 input_mt_sync_frame(input
);
1505 /* keep touch state for pen event */
1506 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
1511 static int wacom_tpc_single_touch(struct wacom_wac
*wacom
, size_t len
)
1513 unsigned char *data
= wacom
->data
;
1514 struct input_dev
*input
= wacom
->touch_input
;
1515 bool prox
= report_touch_events(wacom
);
1518 if (wacom
->features
.touch_max
> 1 || len
> WACOM_PKGLEN_TPC2FG
)
1521 if (len
== WACOM_PKGLEN_TPC1FG
) {
1522 prox
= prox
&& (data
[0] & 0x01);
1523 x
= get_unaligned_le16(&data
[1]);
1524 y
= get_unaligned_le16(&data
[3]);
1525 } else if (len
== WACOM_PKGLEN_TPC1FG_B
) {
1526 prox
= prox
&& (data
[2] & 0x01);
1527 x
= get_unaligned_le16(&data
[3]);
1528 y
= get_unaligned_le16(&data
[5]);
1530 prox
= prox
&& (data
[1] & 0x01);
1531 x
= le16_to_cpup((__le16
*)&data
[2]);
1532 y
= le16_to_cpup((__le16
*)&data
[4]);
1536 input_report_abs(input
, ABS_X
, x
);
1537 input_report_abs(input
, ABS_Y
, y
);
1539 input_report_key(input
, BTN_TOUCH
, prox
);
1541 /* keep touch state for pen events */
1542 wacom
->shared
->touch_down
= prox
;
1547 static int wacom_tpc_pen(struct wacom_wac
*wacom
)
1549 unsigned char *data
= wacom
->data
;
1550 struct input_dev
*input
= wacom
->pen_input
;
1551 bool prox
= data
[1] & 0x20;
1553 if (!wacom
->shared
->stylus_in_proximity
) /* first in prox */
1554 /* Going into proximity select tool */
1555 wacom
->tool
[0] = (data
[1] & 0x0c) ? BTN_TOOL_RUBBER
: BTN_TOOL_PEN
;
1557 /* keep pen state for touch events */
1558 wacom
->shared
->stylus_in_proximity
= prox
;
1560 /* send pen events only when touch is up or forced out
1561 * or touch arbitration is off
1563 if (!delay_pen_events(wacom
)) {
1564 input_report_key(input
, BTN_STYLUS
, data
[1] & 0x02);
1565 input_report_key(input
, BTN_STYLUS2
, data
[1] & 0x10);
1566 input_report_abs(input
, ABS_X
, le16_to_cpup((__le16
*)&data
[2]));
1567 input_report_abs(input
, ABS_Y
, le16_to_cpup((__le16
*)&data
[4]));
1568 input_report_abs(input
, ABS_PRESSURE
, ((data
[7] & 0x07) << 8) | data
[6]);
1569 input_report_key(input
, BTN_TOUCH
, data
[1] & 0x05);
1570 input_report_key(input
, wacom
->tool
[0], prox
);
1577 static int wacom_tpc_irq(struct wacom_wac
*wacom
, size_t len
)
1579 unsigned char *data
= wacom
->data
;
1581 if (wacom
->pen_input
)
1582 dev_dbg(wacom
->pen_input
->dev
.parent
,
1583 "%s: received report #%d\n", __func__
, data
[0]);
1584 else if (wacom
->touch_input
)
1585 dev_dbg(wacom
->touch_input
->dev
.parent
,
1586 "%s: received report #%d\n", __func__
, data
[0]);
1589 case WACOM_PKGLEN_TPC1FG
:
1590 return wacom_tpc_single_touch(wacom
, len
);
1592 case WACOM_PKGLEN_TPC2FG
:
1593 return wacom_tpc_mt_touch(wacom
);
1595 case WACOM_PKGLEN_PENABLED
:
1596 return wacom_tpc_pen(wacom
);
1600 case WACOM_REPORT_TPC1FG
:
1601 case WACOM_REPORT_TPCHID
:
1602 case WACOM_REPORT_TPCST
:
1603 case WACOM_REPORT_TPC1FGE
:
1604 return wacom_tpc_single_touch(wacom
, len
);
1606 case WACOM_REPORT_TPCMT
:
1607 case WACOM_REPORT_TPCMT2
:
1608 return wacom_mt_touch(wacom
);
1610 case WACOM_REPORT_PENABLED
:
1611 return wacom_tpc_pen(wacom
);
1618 int wacom_equivalent_usage(int usage
)
1620 if ((usage
& HID_USAGE_PAGE
) == WACOM_HID_UP_WACOMDIGITIZER
) {
1621 int subpage
= (usage
& 0xFF00) << 8;
1622 int subusage
= (usage
& 0xFF);
1624 if (subpage
== WACOM_HID_SP_PAD
||
1625 subpage
== WACOM_HID_SP_BUTTON
||
1626 subpage
== WACOM_HID_SP_DIGITIZER
||
1627 subpage
== WACOM_HID_SP_DIGITIZERINFO
||
1628 usage
== WACOM_HID_WD_SENSE
||
1629 usage
== WACOM_HID_WD_SERIALHI
||
1630 usage
== WACOM_HID_WD_TOOLTYPE
||
1631 usage
== WACOM_HID_WD_DISTANCE
||
1632 usage
== WACOM_HID_WD_TOUCHSTRIP
||
1633 usage
== WACOM_HID_WD_TOUCHSTRIP2
||
1634 usage
== WACOM_HID_WD_TOUCHRING
||
1635 usage
== WACOM_HID_WD_TOUCHRINGSTATUS
) {
1639 if (subpage
== HID_UP_UNDEFINED
)
1640 subpage
= HID_UP_DIGITIZER
;
1642 return subpage
| subusage
;
1645 if ((usage
& HID_USAGE_PAGE
) == WACOM_HID_UP_WACOMTOUCH
) {
1646 int subpage
= (usage
& 0xFF00) << 8;
1647 int subusage
= (usage
& 0xFF);
1649 if (subpage
== HID_UP_UNDEFINED
)
1650 subpage
= WACOM_HID_SP_DIGITIZER
;
1652 return subpage
| subusage
;
1658 static void wacom_map_usage(struct input_dev
*input
, struct hid_usage
*usage
,
1659 struct hid_field
*field
, __u8 type
, __u16 code
, int fuzz
)
1661 struct wacom
*wacom
= input_get_drvdata(input
);
1662 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1663 struct wacom_features
*features
= &wacom_wac
->features
;
1664 int fmin
= field
->logical_minimum
;
1665 int fmax
= field
->logical_maximum
;
1666 unsigned int equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1667 int resolution_code
= code
;
1669 if (equivalent_usage
== HID_DG_TWIST
) {
1670 resolution_code
= ABS_RZ
;
1673 if (equivalent_usage
== HID_GD_X
) {
1674 fmin
+= features
->offset_left
;
1675 fmax
-= features
->offset_right
;
1677 if (equivalent_usage
== HID_GD_Y
) {
1678 fmin
+= features
->offset_top
;
1679 fmax
-= features
->offset_bottom
;
1685 set_bit(type
, input
->evbit
);
1689 input_set_abs_params(input
, code
, fmin
, fmax
, fuzz
, 0);
1690 input_abs_set_res(input
, code
,
1691 hidinput_calc_abs_res(field
, resolution_code
));
1694 input_set_capability(input
, EV_KEY
, code
);
1697 input_set_capability(input
, EV_MSC
, code
);
1700 input_set_capability(input
, EV_SW
, code
);
1705 static void wacom_wac_pad_usage_mapping(struct hid_device
*hdev
,
1706 struct hid_field
*field
, struct hid_usage
*usage
)
1708 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1709 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1710 struct wacom_features
*features
= &wacom_wac
->features
;
1711 struct input_dev
*input
= wacom_wac
->pad_input
;
1712 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1714 switch (equivalent_usage
) {
1715 case WACOM_HID_WD_BATTERY_LEVEL
:
1716 case WACOM_HID_WD_BATTERY_CHARGING
:
1717 features
->quirks
|= WACOM_QUIRK_BATTERY
;
1719 case WACOM_HID_WD_ACCELEROMETER_X
:
1720 __set_bit(INPUT_PROP_ACCELEROMETER
, input
->propbit
);
1721 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_X
, 0);
1722 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1724 case WACOM_HID_WD_ACCELEROMETER_Y
:
1725 __set_bit(INPUT_PROP_ACCELEROMETER
, input
->propbit
);
1726 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Y
, 0);
1727 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1729 case WACOM_HID_WD_ACCELEROMETER_Z
:
1730 __set_bit(INPUT_PROP_ACCELEROMETER
, input
->propbit
);
1731 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Z
, 0);
1732 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1734 case WACOM_HID_WD_BUTTONCENTER
:
1735 wacom
->generic_has_leds
= true;
1737 case WACOM_HID_WD_BUTTONHOME
:
1738 case WACOM_HID_WD_BUTTONUP
:
1739 case WACOM_HID_WD_BUTTONDOWN
:
1740 case WACOM_HID_WD_BUTTONLEFT
:
1741 case WACOM_HID_WD_BUTTONRIGHT
:
1742 wacom_map_usage(input
, usage
, field
, EV_KEY
,
1743 wacom_numbered_button_to_key(features
->numbered_buttons
),
1745 features
->numbered_buttons
++;
1746 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1748 case WACOM_HID_WD_TOUCHONOFF
:
1749 case WACOM_HID_WD_MUTE_DEVICE
:
1751 * This usage, which is used to mute touch events, comes
1752 * from the pad packet, but is reported on the touch
1753 * interface. Because the touch interface may not have
1754 * been created yet, we cannot call wacom_map_usage(). In
1755 * order to process this usage when we receive it, we set
1756 * the usage type and code directly.
1758 wacom_wac
->has_mute_touch_switch
= true;
1759 usage
->type
= EV_SW
;
1760 usage
->code
= SW_MUTE_DEVICE
;
1761 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1763 case WACOM_HID_WD_TOUCHSTRIP
:
1764 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_RX
, 0);
1765 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1767 case WACOM_HID_WD_TOUCHSTRIP2
:
1768 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_RY
, 0);
1769 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1771 case WACOM_HID_WD_TOUCHRING
:
1772 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_WHEEL
, 0);
1773 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1775 case WACOM_HID_WD_TOUCHRINGSTATUS
:
1776 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_WHEEL
, 0);
1777 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1779 case WACOM_HID_WD_BUTTONCONFIG
:
1780 wacom_map_usage(input
, usage
, field
, EV_KEY
, KEY_BUTTONCONFIG
, 0);
1781 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1783 case WACOM_HID_WD_ONSCREEN_KEYBOARD
:
1784 wacom_map_usage(input
, usage
, field
, EV_KEY
, KEY_ONSCREEN_KEYBOARD
, 0);
1785 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1787 case WACOM_HID_WD_CONTROLPANEL
:
1788 wacom_map_usage(input
, usage
, field
, EV_KEY
, KEY_CONTROLPANEL
, 0);
1789 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1791 case WACOM_HID_WD_MODE_CHANGE
:
1792 /* do not overwrite previous data */
1793 if (!wacom_wac
->has_mode_change
) {
1794 wacom_wac
->has_mode_change
= true;
1795 wacom_wac
->is_direct_mode
= true;
1797 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1801 switch (equivalent_usage
& 0xfffffff0) {
1802 case WACOM_HID_WD_EXPRESSKEY00
:
1803 wacom_map_usage(input
, usage
, field
, EV_KEY
,
1804 wacom_numbered_button_to_key(features
->numbered_buttons
),
1806 features
->numbered_buttons
++;
1807 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
1812 static void wacom_wac_pad_battery_event(struct hid_device
*hdev
, struct hid_field
*field
,
1813 struct hid_usage
*usage
, __s32 value
)
1815 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1816 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1817 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1819 switch (equivalent_usage
) {
1820 case WACOM_HID_WD_BATTERY_LEVEL
:
1821 value
= value
* 100 / (field
->logical_maximum
- field
->logical_minimum
);
1822 wacom_wac
->hid_data
.battery_capacity
= value
;
1823 wacom_wac
->hid_data
.bat_connected
= 1;
1824 wacom_wac
->hid_data
.bat_status
= WACOM_POWER_SUPPLY_STATUS_AUTO
;
1827 case WACOM_HID_WD_BATTERY_CHARGING
:
1828 wacom_wac
->hid_data
.bat_charging
= value
;
1829 wacom_wac
->hid_data
.ps_connected
= value
;
1830 wacom_wac
->hid_data
.bat_connected
= 1;
1835 static void wacom_wac_pad_event(struct hid_device
*hdev
, struct hid_field
*field
,
1836 struct hid_usage
*usage
, __s32 value
)
1838 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1839 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1840 struct input_dev
*input
= wacom_wac
->pad_input
;
1841 struct wacom_features
*features
= &wacom_wac
->features
;
1842 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1844 bool is_touch_on
= value
;
1847 * Avoid reporting this event and setting inrange_state if this usage
1848 * hasn't been mapped.
1850 if (!usage
->type
&& equivalent_usage
!= WACOM_HID_WD_MODE_CHANGE
)
1853 if (wacom_equivalent_usage(field
->physical
) == HID_DG_TABLETFUNCTIONKEY
) {
1854 if (usage
->hid
!= WACOM_HID_WD_TOUCHRING
)
1855 wacom_wac
->hid_data
.inrange_state
|= value
;
1858 switch (equivalent_usage
) {
1859 case WACOM_HID_WD_TOUCHRINGSTATUS
:
1861 input_event(input
, usage
->type
, usage
->code
, 0);
1864 case WACOM_HID_WD_MUTE_DEVICE
:
1865 if (wacom_wac
->shared
->touch_input
&& value
) {
1866 wacom_wac
->shared
->is_touch_on
= !wacom_wac
->shared
->is_touch_on
;
1867 is_touch_on
= wacom_wac
->shared
->is_touch_on
;
1871 case WACOM_HID_WD_TOUCHONOFF
:
1872 if (wacom_wac
->shared
->touch_input
) {
1873 input_report_switch(wacom_wac
->shared
->touch_input
,
1874 SW_MUTE_DEVICE
, !is_touch_on
);
1875 input_sync(wacom_wac
->shared
->touch_input
);
1879 case WACOM_HID_WD_MODE_CHANGE
:
1880 if (wacom_wac
->is_direct_mode
!= value
) {
1881 wacom_wac
->is_direct_mode
= value
;
1882 wacom_schedule_work(&wacom
->wacom_wac
, WACOM_WORKER_MODE_CHANGE
);
1886 case WACOM_HID_WD_BUTTONCENTER
:
1887 for (i
= 0; i
< wacom
->led
.count
; i
++)
1888 wacom_update_led(wacom
, features
->numbered_buttons
,
1892 input_event(input
, usage
->type
, usage
->code
, value
);
1894 wacom_wac
->hid_data
.pad_input_event_flag
= true;
1899 static void wacom_wac_pad_pre_report(struct hid_device
*hdev
,
1900 struct hid_report
*report
)
1902 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1903 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1905 wacom_wac
->hid_data
.inrange_state
= 0;
1908 static void wacom_wac_pad_battery_report(struct hid_device
*hdev
,
1909 struct hid_report
*report
)
1911 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1912 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1913 struct wacom_features
*features
= &wacom_wac
->features
;
1915 if (features
->quirks
& WACOM_QUIRK_BATTERY
) {
1916 int status
= wacom_wac
->hid_data
.bat_status
;
1917 int capacity
= wacom_wac
->hid_data
.battery_capacity
;
1918 bool charging
= wacom_wac
->hid_data
.bat_charging
;
1919 bool connected
= wacom_wac
->hid_data
.bat_connected
;
1920 bool powered
= wacom_wac
->hid_data
.ps_connected
;
1922 wacom_notify_battery(wacom_wac
, status
, capacity
,
1923 charging
, connected
, powered
);
1927 static void wacom_wac_pad_report(struct hid_device
*hdev
,
1928 struct hid_report
*report
)
1930 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1931 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1932 struct input_dev
*input
= wacom_wac
->pad_input
;
1933 bool active
= wacom_wac
->hid_data
.inrange_state
!= 0;
1935 /* report prox for expresskey events */
1936 if ((wacom_equivalent_usage(report
->field
[0]->physical
) == HID_DG_TABLETFUNCTIONKEY
) &&
1937 wacom_wac
->hid_data
.pad_input_event_flag
) {
1938 input_event(input
, EV_ABS
, ABS_MISC
, active
? PAD_DEVICE_ID
: 0);
1941 wacom_wac
->hid_data
.pad_input_event_flag
= false;
1946 static void wacom_wac_pen_usage_mapping(struct hid_device
*hdev
,
1947 struct hid_field
*field
, struct hid_usage
*usage
)
1949 struct wacom
*wacom
= hid_get_drvdata(hdev
);
1950 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
1951 struct wacom_features
*features
= &wacom_wac
->features
;
1952 struct input_dev
*input
= wacom_wac
->pen_input
;
1953 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
1955 switch (equivalent_usage
) {
1957 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_X
, 4);
1960 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Y
, 4);
1962 case WACOM_HID_WD_DISTANCE
:
1964 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_DISTANCE
, 0);
1966 case HID_DG_TIPPRESSURE
:
1967 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_PRESSURE
, 0);
1969 case HID_DG_INRANGE
:
1970 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOOL_PEN
, 0);
1972 case HID_DG_BATTERYSTRENGTH
:
1973 features
->quirks
|= WACOM_QUIRK_BATTERY
;
1976 wacom_map_usage(input
, usage
, field
, EV_KEY
,
1977 BTN_TOOL_RUBBER
, 0);
1980 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_TILT_X
, 0);
1983 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_TILT_Y
, 0);
1986 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Z
, 0);
1989 case HID_DG_TIPSWITCH
:
1990 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOUCH
, 0);
1992 case HID_DG_BARRELSWITCH
:
1993 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_STYLUS
, 0);
1995 case HID_DG_BARRELSWITCH2
:
1996 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_STYLUS2
, 0);
1998 case HID_DG_TOOLSERIALNUMBER
:
1999 wacom_map_usage(input
, usage
, field
, EV_MSC
, MSC_SERIAL
, 0);
2001 case WACOM_HID_WD_SENSE
:
2002 features
->quirks
|= WACOM_QUIRK_SENSE
;
2003 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOOL_PEN
, 0);
2005 case WACOM_HID_WD_SERIALHI
:
2006 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_MISC
, 0);
2007 set_bit(EV_KEY
, input
->evbit
);
2008 input_set_capability(input
, EV_KEY
, BTN_TOOL_PEN
);
2009 input_set_capability(input
, EV_KEY
, BTN_TOOL_RUBBER
);
2010 input_set_capability(input
, EV_KEY
, BTN_TOOL_BRUSH
);
2011 input_set_capability(input
, EV_KEY
, BTN_TOOL_PENCIL
);
2012 input_set_capability(input
, EV_KEY
, BTN_TOOL_AIRBRUSH
);
2013 if (!(features
->device_type
& WACOM_DEVICETYPE_DIRECT
)) {
2014 input_set_capability(input
, EV_KEY
, BTN_TOOL_MOUSE
);
2015 input_set_capability(input
, EV_KEY
, BTN_TOOL_LENS
);
2018 case WACOM_HID_WD_FINGERWHEEL
:
2019 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_WHEEL
, 0);
2024 static void wacom_wac_pen_event(struct hid_device
*hdev
, struct hid_field
*field
,
2025 struct hid_usage
*usage
, __s32 value
)
2027 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2028 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2029 struct wacom_features
*features
= &wacom_wac
->features
;
2030 struct input_dev
*input
= wacom_wac
->pen_input
;
2031 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
2033 switch (equivalent_usage
) {
2036 * HID_GD_Z "should increase as the control's position is
2037 * moved from high to low", while ABS_DISTANCE instead
2038 * increases in value as the tool moves from low to high.
2040 value
= field
->logical_maximum
- value
;
2042 case HID_DG_INRANGE
:
2043 wacom_wac
->hid_data
.inrange_state
= value
;
2044 if (!(features
->quirks
& WACOM_QUIRK_SENSE
))
2045 wacom_wac
->hid_data
.sense_state
= value
;
2047 case HID_DG_BATTERYSTRENGTH
:
2049 wacom_wac
->hid_data
.bat_status
= POWER_SUPPLY_STATUS_UNKNOWN
;
2052 value
= value
* 100 / (field
->logical_maximum
- field
->logical_minimum
);
2053 wacom_wac
->hid_data
.battery_capacity
= value
;
2054 wacom_wac
->hid_data
.bat_connected
= 1;
2055 wacom_wac
->hid_data
.bat_status
= WACOM_POWER_SUPPLY_STATUS_AUTO
;
2059 wacom_wac
->hid_data
.invert_state
= value
;
2062 case HID_DG_TIPSWITCH
:
2063 wacom_wac
->hid_data
.tipswitch
|= value
;
2065 case HID_DG_TOOLSERIALNUMBER
:
2066 wacom_wac
->serial
[0] = (wacom_wac
->serial
[0] & ~0xFFFFFFFFULL
);
2067 wacom_wac
->serial
[0] |= (__u32
)value
;
2069 case WACOM_HID_WD_SENSE
:
2070 wacom_wac
->hid_data
.sense_state
= value
;
2072 case WACOM_HID_WD_SERIALHI
:
2073 wacom_wac
->serial
[0] = (wacom_wac
->serial
[0] & 0xFFFFFFFF);
2074 wacom_wac
->serial
[0] |= ((__u64
)value
) << 32;
2076 * Non-USI EMR devices may contain additional tool type
2077 * information here. See WACOM_HID_WD_TOOLTYPE case for
2080 if (value
>> 20 == 1) {
2081 wacom_wac
->id
[0] |= value
& 0xFFFFF;
2084 case WACOM_HID_WD_TOOLTYPE
:
2086 * Some devices (MobileStudio Pro, and possibly later
2087 * devices as well) do not return the complete tool
2088 * type in their WACOM_HID_WD_TOOLTYPE usage. Use a
2089 * bitwise OR so the complete value can be built
2092 wacom_wac
->id
[0] |= value
;
2094 case WACOM_HID_WD_OFFSETLEFT
:
2095 if (features
->offset_left
&& value
!= features
->offset_left
)
2096 hid_warn(hdev
, "%s: overriding exising left offset "
2097 "%d -> %d\n", __func__
, value
,
2098 features
->offset_left
);
2099 features
->offset_left
= value
;
2101 case WACOM_HID_WD_OFFSETRIGHT
:
2102 if (features
->offset_right
&& value
!= features
->offset_right
)
2103 hid_warn(hdev
, "%s: overriding exising right offset "
2104 "%d -> %d\n", __func__
, value
,
2105 features
->offset_right
);
2106 features
->offset_right
= value
;
2108 case WACOM_HID_WD_OFFSETTOP
:
2109 if (features
->offset_top
&& value
!= features
->offset_top
)
2110 hid_warn(hdev
, "%s: overriding exising top offset "
2111 "%d -> %d\n", __func__
, value
,
2112 features
->offset_top
);
2113 features
->offset_top
= value
;
2115 case WACOM_HID_WD_OFFSETBOTTOM
:
2116 if (features
->offset_bottom
&& value
!= features
->offset_bottom
)
2117 hid_warn(hdev
, "%s: overriding exising bottom offset "
2118 "%d -> %d\n", __func__
, value
,
2119 features
->offset_bottom
);
2120 features
->offset_bottom
= value
;
2124 /* send pen events only when touch is up or forced out
2125 * or touch arbitration is off
2127 if (!usage
->type
|| delay_pen_events(wacom_wac
))
2130 /* send pen events only when the pen is in/entering/leaving proximity */
2131 if (!wacom_wac
->hid_data
.inrange_state
&& !wacom_wac
->tool
[0])
2134 input_event(input
, usage
->type
, usage
->code
, value
);
2137 static void wacom_wac_pen_pre_report(struct hid_device
*hdev
,
2138 struct hid_report
*report
)
2143 static void wacom_wac_pen_report(struct hid_device
*hdev
,
2144 struct hid_report
*report
)
2146 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2147 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2148 struct input_dev
*input
= wacom_wac
->pen_input
;
2149 bool prox
= wacom_wac
->hid_data
.inrange_state
;
2150 bool range
= wacom_wac
->hid_data
.sense_state
;
2152 if (!wacom_wac
->tool
[0] && prox
) { /* first in prox */
2153 /* Going into proximity select tool */
2154 if (wacom_wac
->hid_data
.invert_state
)
2155 wacom_wac
->tool
[0] = BTN_TOOL_RUBBER
;
2156 else if (wacom_wac
->id
[0])
2157 wacom_wac
->tool
[0] = wacom_intuos_get_tool_type(wacom_wac
->id
[0]);
2159 wacom_wac
->tool
[0] = BTN_TOOL_PEN
;
2162 /* keep pen state for touch events */
2163 wacom_wac
->shared
->stylus_in_proximity
= range
;
2165 if (!delay_pen_events(wacom_wac
) && wacom_wac
->tool
[0]) {
2166 int id
= wacom_wac
->id
[0];
2169 * Non-USI EMR tools should have their IDs mangled to
2170 * match the legacy behavior of wacom_intuos_general
2172 if (wacom_wac
->serial
[0] >> 52 == 1)
2173 id
= wacom_intuos_id_mangle(id
);
2176 * To ensure compatibility with xf86-input-wacom, we should
2177 * report the BTN_TOOL_* event prior to the ABS_MISC or
2178 * MSC_SERIAL events.
2180 input_report_key(input
, BTN_TOUCH
,
2181 wacom_wac
->hid_data
.tipswitch
);
2182 input_report_key(input
, wacom_wac
->tool
[0], prox
);
2183 if (wacom_wac
->serial
[0]) {
2184 input_event(input
, EV_MSC
, MSC_SERIAL
, wacom_wac
->serial
[0]);
2185 input_report_abs(input
, ABS_MISC
, id
);
2188 wacom_wac
->hid_data
.tipswitch
= false;
2193 wacom_wac_pad_battery_report(hdev
, report
);
2196 wacom_wac
->tool
[0] = 0;
2197 wacom_wac
->id
[0] = 0;
2201 static void wacom_wac_finger_usage_mapping(struct hid_device
*hdev
,
2202 struct hid_field
*field
, struct hid_usage
*usage
)
2204 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2205 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2206 struct input_dev
*input
= wacom_wac
->touch_input
;
2207 unsigned touch_max
= wacom_wac
->features
.touch_max
;
2208 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
2210 switch (equivalent_usage
) {
2213 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_X
, 4);
2215 wacom_map_usage(input
, usage
, field
, EV_ABS
,
2216 ABS_MT_POSITION_X
, 4);
2220 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_Y
, 4);
2222 wacom_map_usage(input
, usage
, field
, EV_ABS
,
2223 ABS_MT_POSITION_Y
, 4);
2227 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_MT_TOUCH_MAJOR
, 0);
2228 wacom_map_usage(input
, usage
, field
, EV_ABS
, ABS_MT_TOUCH_MINOR
, 0);
2229 input_set_abs_params(input
, ABS_MT_ORIENTATION
, 0, 1, 0, 0);
2231 case HID_DG_TIPSWITCH
:
2232 wacom_map_usage(input
, usage
, field
, EV_KEY
, BTN_TOUCH
, 0);
2234 case HID_DG_CONTACTCOUNT
:
2235 wacom_wac
->hid_data
.cc_report
= field
->report
->id
;
2236 wacom_wac
->hid_data
.cc_index
= field
->index
;
2237 wacom_wac
->hid_data
.cc_value_index
= usage
->usage_index
;
2239 case HID_DG_CONTACTID
:
2240 if ((field
->logical_maximum
- field
->logical_minimum
) < touch_max
) {
2242 * The HID descriptor for G11 sensors leaves logical
2243 * maximum set to '1' despite it being a multitouch
2244 * device. Override to a sensible number.
2246 field
->logical_maximum
= 255;
2252 static void wacom_wac_finger_slot(struct wacom_wac
*wacom_wac
,
2253 struct input_dev
*input
)
2255 struct hid_data
*hid_data
= &wacom_wac
->hid_data
;
2256 bool mt
= wacom_wac
->features
.touch_max
> 1;
2257 bool prox
= hid_data
->tipswitch
&&
2258 report_touch_events(wacom_wac
);
2260 if (wacom_wac
->shared
->has_mute_touch_switch
&&
2261 !wacom_wac
->shared
->is_touch_on
) {
2262 if (!wacom_wac
->shared
->touch_down
)
2267 wacom_wac
->hid_data
.num_received
++;
2268 if (wacom_wac
->hid_data
.num_received
> wacom_wac
->hid_data
.num_expected
)
2274 slot
= input_mt_get_slot_by_key(input
, hid_data
->id
);
2275 input_mt_slot(input
, slot
);
2276 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, prox
);
2279 input_report_key(input
, BTN_TOUCH
, prox
);
2283 input_report_abs(input
, mt
? ABS_MT_POSITION_X
: ABS_X
,
2285 input_report_abs(input
, mt
? ABS_MT_POSITION_Y
: ABS_Y
,
2288 if (test_bit(ABS_MT_TOUCH_MAJOR
, input
->absbit
)) {
2289 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, max(hid_data
->width
, hid_data
->height
));
2290 input_report_abs(input
, ABS_MT_TOUCH_MINOR
, min(hid_data
->width
, hid_data
->height
));
2291 if (hid_data
->width
!= hid_data
->height
)
2292 input_report_abs(input
, ABS_MT_ORIENTATION
, hid_data
->width
<= hid_data
->height
? 0 : 1);
2297 static void wacom_wac_finger_event(struct hid_device
*hdev
,
2298 struct hid_field
*field
, struct hid_usage
*usage
, __s32 value
)
2300 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2301 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2302 unsigned equivalent_usage
= wacom_equivalent_usage(usage
->hid
);
2304 switch (equivalent_usage
) {
2306 wacom_wac
->hid_data
.x
= value
;
2309 wacom_wac
->hid_data
.y
= value
;
2312 wacom_wac
->hid_data
.width
= value
;
2315 wacom_wac
->hid_data
.height
= value
;
2317 case HID_DG_CONTACTID
:
2318 wacom_wac
->hid_data
.id
= value
;
2320 case HID_DG_TIPSWITCH
:
2321 wacom_wac
->hid_data
.tipswitch
= value
;
2326 if (usage
->usage_index
+ 1 == field
->report_count
) {
2327 if (equivalent_usage
== wacom_wac
->hid_data
.last_slot_field
)
2328 wacom_wac_finger_slot(wacom_wac
, wacom_wac
->touch_input
);
2332 static void wacom_wac_finger_pre_report(struct hid_device
*hdev
,
2333 struct hid_report
*report
)
2335 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2336 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2337 struct hid_data
* hid_data
= &wacom_wac
->hid_data
;
2340 for (i
= 0; i
< report
->maxfield
; i
++) {
2341 struct hid_field
*field
= report
->field
[i
];
2344 for (j
= 0; j
< field
->maxusage
; j
++) {
2345 struct hid_usage
*usage
= &field
->usage
[j
];
2346 unsigned int equivalent_usage
=
2347 wacom_equivalent_usage(usage
->hid
);
2349 switch (equivalent_usage
) {
2354 case HID_DG_CONTACTID
:
2355 case HID_DG_INRANGE
:
2357 case HID_DG_TIPSWITCH
:
2358 hid_data
->last_slot_field
= equivalent_usage
;
2360 case HID_DG_CONTACTCOUNT
:
2361 hid_data
->cc_report
= report
->id
;
2362 hid_data
->cc_index
= i
;
2363 hid_data
->cc_value_index
= j
;
2369 if (hid_data
->cc_report
!= 0 &&
2370 hid_data
->cc_index
>= 0) {
2371 struct hid_field
*field
= report
->field
[hid_data
->cc_index
];
2372 int value
= field
->value
[hid_data
->cc_value_index
];
2374 hid_data
->num_expected
= value
;
2377 hid_data
->num_expected
= wacom_wac
->features
.touch_max
;
2381 static void wacom_wac_finger_report(struct hid_device
*hdev
,
2382 struct hid_report
*report
)
2384 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2385 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2386 struct input_dev
*input
= wacom_wac
->touch_input
;
2387 unsigned touch_max
= wacom_wac
->features
.touch_max
;
2389 /* If more packets of data are expected, give us a chance to
2390 * process them rather than immediately syncing a partial
2393 if (wacom_wac
->hid_data
.num_received
< wacom_wac
->hid_data
.num_expected
)
2397 input_mt_sync_frame(input
);
2400 wacom_wac
->hid_data
.num_received
= 0;
2402 /* keep touch state for pen event */
2403 wacom_wac
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom_wac
);
2406 void wacom_wac_usage_mapping(struct hid_device
*hdev
,
2407 struct hid_field
*field
, struct hid_usage
*usage
)
2409 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2410 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2411 struct wacom_features
*features
= &wacom_wac
->features
;
2413 if (WACOM_DIRECT_DEVICE(field
))
2414 features
->device_type
|= WACOM_DEVICETYPE_DIRECT
;
2416 if (WACOM_PAD_FIELD(field
))
2417 wacom_wac_pad_usage_mapping(hdev
, field
, usage
);
2418 else if (WACOM_PEN_FIELD(field
))
2419 wacom_wac_pen_usage_mapping(hdev
, field
, usage
);
2420 else if (WACOM_FINGER_FIELD(field
))
2421 wacom_wac_finger_usage_mapping(hdev
, field
, usage
);
2424 void wacom_wac_event(struct hid_device
*hdev
, struct hid_field
*field
,
2425 struct hid_usage
*usage
, __s32 value
)
2427 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2429 if (wacom
->wacom_wac
.features
.type
!= HID_GENERIC
)
2432 if (value
> field
->logical_maximum
|| value
< field
->logical_minimum
)
2435 if (WACOM_PAD_FIELD(field
)) {
2436 wacom_wac_pad_battery_event(hdev
, field
, usage
, value
);
2437 if (wacom
->wacom_wac
.pad_input
)
2438 wacom_wac_pad_event(hdev
, field
, usage
, value
);
2439 } else if (WACOM_PEN_FIELD(field
) && wacom
->wacom_wac
.pen_input
)
2440 wacom_wac_pen_event(hdev
, field
, usage
, value
);
2441 else if (WACOM_FINGER_FIELD(field
) && wacom
->wacom_wac
.touch_input
)
2442 wacom_wac_finger_event(hdev
, field
, usage
, value
);
2445 static void wacom_report_events(struct hid_device
*hdev
, struct hid_report
*report
)
2449 for (r
= 0; r
< report
->maxfield
; r
++) {
2450 struct hid_field
*field
;
2453 field
= report
->field
[r
];
2454 count
= field
->report_count
;
2456 if (!(HID_MAIN_ITEM_VARIABLE
& field
->flags
))
2459 for (n
= 0; n
< count
; n
++)
2460 wacom_wac_event(hdev
, field
, &field
->usage
[n
], field
->value
[n
]);
2464 void wacom_wac_report(struct hid_device
*hdev
, struct hid_report
*report
)
2466 struct wacom
*wacom
= hid_get_drvdata(hdev
);
2467 struct wacom_wac
*wacom_wac
= &wacom
->wacom_wac
;
2468 struct hid_field
*field
= report
->field
[0];
2470 if (wacom_wac
->features
.type
!= HID_GENERIC
)
2473 if (WACOM_PAD_FIELD(field
) && wacom
->wacom_wac
.pad_input
)
2474 wacom_wac_pad_pre_report(hdev
, report
);
2475 else if (WACOM_PEN_FIELD(field
) && wacom
->wacom_wac
.pen_input
)
2476 wacom_wac_pen_pre_report(hdev
, report
);
2477 else if (WACOM_FINGER_FIELD(field
) && wacom
->wacom_wac
.touch_input
)
2478 wacom_wac_finger_pre_report(hdev
, report
);
2480 wacom_report_events(hdev
, report
);
2483 * Non-input reports may be sent prior to the device being
2484 * completely initialized. Since only their events need
2485 * to be processed, exit after 'wacom_report_events' has
2486 * been called to prevent potential crashes in the report-
2487 * processing functions.
2489 if (report
->type
!= HID_INPUT_REPORT
)
2492 if (WACOM_PAD_FIELD(field
)) {
2493 wacom_wac_pad_battery_report(hdev
, report
);
2494 if (wacom
->wacom_wac
.pad_input
)
2495 wacom_wac_pad_report(hdev
, report
);
2496 } else if (WACOM_PEN_FIELD(field
) && wacom
->wacom_wac
.pen_input
)
2497 wacom_wac_pen_report(hdev
, report
);
2498 else if (WACOM_FINGER_FIELD(field
) && wacom
->wacom_wac
.touch_input
)
2499 wacom_wac_finger_report(hdev
, report
);
2502 static int wacom_bpt_touch(struct wacom_wac
*wacom
)
2504 struct wacom_features
*features
= &wacom
->features
;
2505 struct input_dev
*input
= wacom
->touch_input
;
2506 struct input_dev
*pad_input
= wacom
->pad_input
;
2507 unsigned char *data
= wacom
->data
;
2510 if (data
[0] != 0x02)
2513 for (i
= 0; i
< 2; i
++) {
2514 int offset
= (data
[1] & 0x80) ? (8 * i
) : (9 * i
);
2515 bool touch
= report_touch_events(wacom
)
2516 && (data
[offset
+ 3] & 0x80);
2518 input_mt_slot(input
, i
);
2519 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
2521 int x
= get_unaligned_be16(&data
[offset
+ 3]) & 0x7ff;
2522 int y
= get_unaligned_be16(&data
[offset
+ 5]) & 0x7ff;
2523 if (features
->quirks
& WACOM_QUIRK_BBTOUCH_LOWRES
) {
2527 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
2528 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
2532 input_mt_sync_frame(input
);
2534 input_report_key(pad_input
, BTN_LEFT
, (data
[1] & 0x08) != 0);
2535 input_report_key(pad_input
, BTN_FORWARD
, (data
[1] & 0x04) != 0);
2536 input_report_key(pad_input
, BTN_BACK
, (data
[1] & 0x02) != 0);
2537 input_report_key(pad_input
, BTN_RIGHT
, (data
[1] & 0x01) != 0);
2538 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
2543 static void wacom_bpt3_touch_msg(struct wacom_wac
*wacom
, unsigned char *data
)
2545 struct wacom_features
*features
= &wacom
->features
;
2546 struct input_dev
*input
= wacom
->touch_input
;
2547 bool touch
= data
[1] & 0x80;
2548 int slot
= input_mt_get_slot_by_key(input
, data
[0]);
2553 touch
= touch
&& report_touch_events(wacom
);
2555 input_mt_slot(input
, slot
);
2556 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, touch
);
2559 int x
= (data
[2] << 4) | (data
[4] >> 4);
2560 int y
= (data
[3] << 4) | (data
[4] & 0x0f);
2563 if (features
->type
>= INTUOSPS
&& features
->type
<= INTUOSHT2
) {
2564 width
= data
[5] * 100;
2565 height
= data
[6] * 100;
2568 * "a" is a scaled-down area which we assume is
2569 * roughly circular and which can be described as:
2573 int x_res
= input_abs_get_res(input
, ABS_MT_POSITION_X
);
2574 int y_res
= input_abs_get_res(input
, ABS_MT_POSITION_Y
);
2575 width
= 2 * int_sqrt(a
* WACOM_CONTACT_AREA_SCALE
);
2576 height
= width
* y_res
/ x_res
;
2579 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
2580 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
2581 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, width
);
2582 input_report_abs(input
, ABS_MT_TOUCH_MINOR
, height
);
2586 static void wacom_bpt3_button_msg(struct wacom_wac
*wacom
, unsigned char *data
)
2588 struct input_dev
*input
= wacom
->pad_input
;
2589 struct wacom_features
*features
= &wacom
->features
;
2591 if (features
->type
== INTUOSHT
|| features
->type
== INTUOSHT2
) {
2592 input_report_key(input
, BTN_LEFT
, (data
[1] & 0x02) != 0);
2593 input_report_key(input
, BTN_BACK
, (data
[1] & 0x08) != 0);
2595 input_report_key(input
, BTN_BACK
, (data
[1] & 0x02) != 0);
2596 input_report_key(input
, BTN_LEFT
, (data
[1] & 0x08) != 0);
2598 input_report_key(input
, BTN_FORWARD
, (data
[1] & 0x04) != 0);
2599 input_report_key(input
, BTN_RIGHT
, (data
[1] & 0x01) != 0);
2602 static int wacom_bpt3_touch(struct wacom_wac
*wacom
)
2604 unsigned char *data
= wacom
->data
;
2605 int count
= data
[1] & 0x07;
2606 int touch_changed
= 0, i
;
2608 if (data
[0] != 0x02)
2611 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */
2612 for (i
= 0; i
< count
; i
++) {
2613 int offset
= (8 * i
) + 2;
2614 int msg_id
= data
[offset
];
2616 if (msg_id
>= 2 && msg_id
<= 17) {
2617 wacom_bpt3_touch_msg(wacom
, data
+ offset
);
2619 } else if (msg_id
== 128)
2620 wacom_bpt3_button_msg(wacom
, data
+ offset
);
2624 /* only update touch if we actually have a touchpad and touch data changed */
2625 if (wacom
->touch_input
&& touch_changed
) {
2626 input_mt_sync_frame(wacom
->touch_input
);
2627 wacom
->shared
->touch_down
= wacom_wac_finger_count_touches(wacom
);
2633 static int wacom_bpt_pen(struct wacom_wac
*wacom
)
2635 struct wacom_features
*features
= &wacom
->features
;
2636 struct input_dev
*input
= wacom
->pen_input
;
2637 unsigned char *data
= wacom
->data
;
2638 int prox
= 0, x
= 0, y
= 0, p
= 0, d
= 0, pen
= 0, btn1
= 0, btn2
= 0;
2640 if (data
[0] != WACOM_REPORT_PENABLED
)
2643 prox
= (data
[1] & 0x20) == 0x20;
2646 * All reports shared between PEN and RUBBER tool must be
2647 * forced to a known starting value (zero) when transitioning to
2650 * If not reset then, to userspace, it will look like lost events
2651 * if new tool comes in-prox with same values as previous tool sent.
2653 * Hardware does report zero in most out-of-prox cases but not all.
2655 if (!wacom
->shared
->stylus_in_proximity
) {
2656 if (data
[1] & 0x08) {
2657 wacom
->tool
[0] = BTN_TOOL_RUBBER
;
2658 wacom
->id
[0] = ERASER_DEVICE_ID
;
2660 wacom
->tool
[0] = BTN_TOOL_PEN
;
2661 wacom
->id
[0] = STYLUS_DEVICE_ID
;
2665 wacom
->shared
->stylus_in_proximity
= prox
;
2666 if (delay_pen_events(wacom
))
2670 x
= le16_to_cpup((__le16
*)&data
[2]);
2671 y
= le16_to_cpup((__le16
*)&data
[4]);
2672 p
= le16_to_cpup((__le16
*)&data
[6]);
2674 * Convert distance from out prox to distance from tablet.
2675 * distance will be greater than distance_max once
2676 * touching and applying pressure; do not report negative
2679 if (data
[8] <= features
->distance_max
)
2680 d
= features
->distance_max
- data
[8];
2682 pen
= data
[1] & 0x01;
2683 btn1
= data
[1] & 0x02;
2684 btn2
= data
[1] & 0x04;
2689 input_report_key(input
, BTN_TOUCH
, pen
);
2690 input_report_key(input
, BTN_STYLUS
, btn1
);
2691 input_report_key(input
, BTN_STYLUS2
, btn2
);
2693 input_report_abs(input
, ABS_X
, x
);
2694 input_report_abs(input
, ABS_Y
, y
);
2695 input_report_abs(input
, ABS_PRESSURE
, p
);
2696 input_report_abs(input
, ABS_DISTANCE
, d
);
2698 input_report_key(input
, wacom
->tool
[0], prox
); /* PEN or RUBBER */
2699 input_report_abs(input
, ABS_MISC
, wacom
->id
[0]); /* TOOL ID */
2704 static int wacom_bpt_irq(struct wacom_wac
*wacom
, size_t len
)
2706 struct wacom_features
*features
= &wacom
->features
;
2708 if ((features
->type
== INTUOSHT2
) &&
2709 (features
->device_type
& WACOM_DEVICETYPE_PEN
))
2710 return wacom_intuos_irq(wacom
);
2711 else if (len
== WACOM_PKGLEN_BBTOUCH
)
2712 return wacom_bpt_touch(wacom
);
2713 else if (len
== WACOM_PKGLEN_BBTOUCH3
)
2714 return wacom_bpt3_touch(wacom
);
2715 else if (len
== WACOM_PKGLEN_BBFUN
|| len
== WACOM_PKGLEN_BBPEN
)
2716 return wacom_bpt_pen(wacom
);
2721 static void wacom_bamboo_pad_pen_event(struct wacom_wac
*wacom
,
2722 unsigned char *data
)
2724 unsigned char prefix
;
2727 * We need to reroute the event from the debug interface to the
2729 * We need to add the report ID to the actual pen report, so we
2730 * temporary overwrite the first byte to prevent having to kzalloc/kfree
2731 * and memcpy the report.
2734 data
[0] = WACOM_REPORT_BPAD_PEN
;
2737 * actually reroute the event.
2738 * No need to check if wacom->shared->pen is valid, hid_input_report()
2739 * will check for us.
2741 hid_input_report(wacom
->shared
->pen
, HID_INPUT_REPORT
, data
,
2742 WACOM_PKGLEN_PENABLED
, 1);
2747 static int wacom_bamboo_pad_touch_event(struct wacom_wac
*wacom
,
2748 unsigned char *data
)
2750 struct input_dev
*input
= wacom
->touch_input
;
2751 unsigned char *finger_data
, prefix
;
2758 for (id
= 0; id
< wacom
->features
.touch_max
; id
++) {
2759 valid
= !!(prefix
& BIT(id
)) &&
2760 report_touch_events(wacom
);
2762 input_mt_slot(input
, id
);
2763 input_mt_report_slot_state(input
, MT_TOOL_FINGER
, valid
);
2768 finger_data
= data
+ 1 + id
* 3;
2769 x
= finger_data
[0] | ((finger_data
[1] & 0x0f) << 8);
2770 y
= (finger_data
[2] << 4) | (finger_data
[1] >> 4);
2772 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
2773 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
2776 input_mt_sync_frame(input
);
2778 input_report_key(input
, BTN_LEFT
, prefix
& 0x40);
2779 input_report_key(input
, BTN_RIGHT
, prefix
& 0x80);
2781 /* keep touch state for pen event */
2782 wacom
->shared
->touch_down
= !!prefix
&& report_touch_events(wacom
);
2787 static int wacom_bamboo_pad_irq(struct wacom_wac
*wacom
, size_t len
)
2789 unsigned char *data
= wacom
->data
;
2791 if (!((len
== WACOM_PKGLEN_BPAD_TOUCH
) ||
2792 (len
== WACOM_PKGLEN_BPAD_TOUCH_USB
)) ||
2793 (data
[0] != WACOM_REPORT_BPAD_TOUCH
))
2797 wacom_bamboo_pad_pen_event(wacom
, &data
[1]);
2800 return wacom_bamboo_pad_touch_event(wacom
, &data
[9]);
2805 static int wacom_wireless_irq(struct wacom_wac
*wacom
, size_t len
)
2807 unsigned char *data
= wacom
->data
;
2810 if (len
!= WACOM_PKGLEN_WIRELESS
|| data
[0] != WACOM_REPORT_WL
)
2813 connected
= data
[1] & 0x01;
2815 int pid
, battery
, charging
;
2817 if ((wacom
->shared
->type
== INTUOSHT
||
2818 wacom
->shared
->type
== INTUOSHT2
) &&
2819 wacom
->shared
->touch_input
&&
2820 wacom
->shared
->touch_max
) {
2821 input_report_switch(wacom
->shared
->touch_input
,
2822 SW_MUTE_DEVICE
, data
[5] & 0x40);
2823 input_sync(wacom
->shared
->touch_input
);
2826 pid
= get_unaligned_be16(&data
[6]);
2827 battery
= (data
[5] & 0x3f) * 100 / 31;
2828 charging
= !!(data
[5] & 0x80);
2829 if (wacom
->pid
!= pid
) {
2831 wacom_schedule_work(wacom
, WACOM_WORKER_WIRELESS
);
2834 wacom_notify_battery(wacom
, WACOM_POWER_SUPPLY_STATUS_AUTO
,
2835 battery
, charging
, 1, 0);
2837 } else if (wacom
->pid
!= 0) {
2838 /* disconnected while previously connected */
2840 wacom_schedule_work(wacom
, WACOM_WORKER_WIRELESS
);
2841 wacom_notify_battery(wacom
, POWER_SUPPLY_STATUS_UNKNOWN
, 0, 0, 0, 0);
2847 static int wacom_status_irq(struct wacom_wac
*wacom_wac
, size_t len
)
2849 struct wacom
*wacom
= container_of(wacom_wac
, struct wacom
, wacom_wac
);
2850 struct wacom_features
*features
= &wacom_wac
->features
;
2851 unsigned char *data
= wacom_wac
->data
;
2853 if (data
[0] != WACOM_REPORT_USB
)
2856 if ((features
->type
== INTUOSHT
||
2857 features
->type
== INTUOSHT2
) &&
2858 wacom_wac
->shared
->touch_input
&&
2859 features
->touch_max
) {
2860 input_report_switch(wacom_wac
->shared
->touch_input
,
2861 SW_MUTE_DEVICE
, data
[8] & 0x40);
2862 input_sync(wacom_wac
->shared
->touch_input
);
2865 if (data
[9] & 0x02) { /* wireless module is attached */
2866 int battery
= (data
[8] & 0x3f) * 100 / 31;
2867 bool charging
= !!(data
[8] & 0x80);
2869 wacom_notify_battery(wacom_wac
, WACOM_POWER_SUPPLY_STATUS_AUTO
,
2870 battery
, charging
, battery
|| charging
, 1);
2872 if (!wacom
->battery
.battery
&&
2873 !(features
->quirks
& WACOM_QUIRK_BATTERY
)) {
2874 features
->quirks
|= WACOM_QUIRK_BATTERY
;
2875 wacom_schedule_work(wacom_wac
, WACOM_WORKER_BATTERY
);
2878 else if ((features
->quirks
& WACOM_QUIRK_BATTERY
) &&
2879 wacom
->battery
.battery
) {
2880 features
->quirks
&= ~WACOM_QUIRK_BATTERY
;
2881 wacom_schedule_work(wacom_wac
, WACOM_WORKER_BATTERY
);
2882 wacom_notify_battery(wacom_wac
, POWER_SUPPLY_STATUS_UNKNOWN
, 0, 0, 0, 0);
2887 void wacom_wac_irq(struct wacom_wac
*wacom_wac
, size_t len
)
2891 switch (wacom_wac
->features
.type
) {
2893 sync
= wacom_penpartner_irq(wacom_wac
);
2897 sync
= wacom_pl_irq(wacom_wac
);
2904 sync
= wacom_graphire_irq(wacom_wac
);
2908 sync
= wacom_ptu_irq(wacom_wac
);
2912 sync
= wacom_dtu_irq(wacom_wac
);
2917 sync
= wacom_dtus_irq(wacom_wac
);
2936 case CINTIQ_COMPANION_2
:
2937 sync
= wacom_intuos_irq(wacom_wac
);
2941 sync
= wacom_intuos_bt_irq(wacom_wac
, len
);
2946 sync
= wacom_24hdt_irq(wacom_wac
);
2955 if (len
== WACOM_PKGLEN_BBTOUCH3
)
2956 sync
= wacom_bpt3_touch(wacom_wac
);
2957 else if (wacom_wac
->data
[0] == WACOM_REPORT_USB
)
2958 sync
= wacom_status_irq(wacom_wac
, len
);
2960 sync
= wacom_intuos_irq(wacom_wac
);
2964 sync
= wacom_intuos_pro2_bt_irq(wacom_wac
, len
);
2973 sync
= wacom_tpc_irq(wacom_wac
, len
);
2981 if (wacom_wac
->data
[0] == WACOM_REPORT_USB
)
2982 sync
= wacom_status_irq(wacom_wac
, len
);
2984 sync
= wacom_bpt_irq(wacom_wac
, len
);
2988 sync
= wacom_bamboo_pad_irq(wacom_wac
, len
);
2992 sync
= wacom_wireless_irq(wacom_wac
, len
);
2997 if (wacom_wac
->data
[0] == WACOM_REPORT_DEVICE_LIST
)
2998 wacom_remote_status_irq(wacom_wac
, len
);
3000 sync
= wacom_remote_irq(wacom_wac
, len
);
3009 if (wacom_wac
->pen_input
)
3010 input_sync(wacom_wac
->pen_input
);
3011 if (wacom_wac
->touch_input
)
3012 input_sync(wacom_wac
->touch_input
);
3013 if (wacom_wac
->pad_input
)
3014 input_sync(wacom_wac
->pad_input
);
3018 static void wacom_setup_basic_pro_pen(struct wacom_wac
*wacom_wac
)
3020 struct input_dev
*input_dev
= wacom_wac
->pen_input
;
3022 input_set_capability(input_dev
, EV_MSC
, MSC_SERIAL
);
3024 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3025 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3026 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3028 input_set_abs_params(input_dev
, ABS_DISTANCE
,
3029 0, wacom_wac
->features
.distance_max
, wacom_wac
->features
.distance_fuzz
, 0);
3032 static void wacom_setup_cintiq(struct wacom_wac
*wacom_wac
)
3034 struct input_dev
*input_dev
= wacom_wac
->pen_input
;
3035 struct wacom_features
*features
= &wacom_wac
->features
;
3037 wacom_setup_basic_pro_pen(wacom_wac
);
3039 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3040 __set_bit(BTN_TOOL_BRUSH
, input_dev
->keybit
);
3041 __set_bit(BTN_TOOL_PENCIL
, input_dev
->keybit
);
3042 __set_bit(BTN_TOOL_AIRBRUSH
, input_dev
->keybit
);
3044 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 1023, 0, 0);
3045 input_set_abs_params(input_dev
, ABS_TILT_X
, -64, 63, features
->tilt_fuzz
, 0);
3046 input_abs_set_res(input_dev
, ABS_TILT_X
, 57);
3047 input_set_abs_params(input_dev
, ABS_TILT_Y
, -64, 63, features
->tilt_fuzz
, 0);
3048 input_abs_set_res(input_dev
, ABS_TILT_Y
, 57);
3051 static void wacom_setup_intuos(struct wacom_wac
*wacom_wac
)
3053 struct input_dev
*input_dev
= wacom_wac
->pen_input
;
3055 input_set_capability(input_dev
, EV_REL
, REL_WHEEL
);
3057 wacom_setup_cintiq(wacom_wac
);
3059 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3060 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3061 __set_bit(BTN_MIDDLE
, input_dev
->keybit
);
3062 __set_bit(BTN_SIDE
, input_dev
->keybit
);
3063 __set_bit(BTN_EXTRA
, input_dev
->keybit
);
3064 __set_bit(BTN_TOOL_MOUSE
, input_dev
->keybit
);
3065 __set_bit(BTN_TOOL_LENS
, input_dev
->keybit
);
3067 input_set_abs_params(input_dev
, ABS_RZ
, -900, 899, 0, 0);
3068 input_abs_set_res(input_dev
, ABS_RZ
, 287);
3069 input_set_abs_params(input_dev
, ABS_THROTTLE
, -1023, 1023, 0, 0);
3072 void wacom_setup_device_quirks(struct wacom
*wacom
)
3074 struct wacom_features
*features
= &wacom
->wacom_wac
.features
;
3076 /* The pen and pad share the same interface on most devices */
3077 if (features
->type
== GRAPHIRE_BT
|| features
->type
== WACOM_G4
||
3078 features
->type
== DTUS
||
3079 (features
->type
>= INTUOS3S
&& features
->type
<= WACOM_MO
)) {
3080 if (features
->device_type
& WACOM_DEVICETYPE_PEN
)
3081 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3084 /* touch device found but size is not defined. use default */
3085 if (features
->device_type
& WACOM_DEVICETYPE_TOUCH
&& !features
->x_max
) {
3086 features
->x_max
= 1023;
3087 features
->y_max
= 1023;
3091 * Intuos5/Pro and Bamboo 3rd gen have no useful data about its
3092 * touch interface in its HID descriptor. If this is the touch
3093 * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the
3096 if ((features
->type
>= INTUOS5S
&& features
->type
<= INTUOSPL
) ||
3097 (features
->type
>= INTUOSHT
&& features
->type
<= BAMBOO_PT
)) {
3098 if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
) {
3099 if (features
->touch_max
)
3100 features
->device_type
|= WACOM_DEVICETYPE_TOUCH
;
3101 if (features
->type
>= INTUOSHT
&& features
->type
<= BAMBOO_PT
)
3102 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3104 features
->x_max
= 4096;
3105 features
->y_max
= 4096;
3107 else if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH
) {
3108 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3113 * Hack for the Bamboo One:
3114 * the device presents a PAD/Touch interface as most Bamboos and even
3115 * sends ghosts PAD data on it. However, later, we must disable this
3116 * ghost interface, and we can not detect it unless we set it here
3117 * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH.
3119 if (features
->type
== BAMBOO_PEN
&&
3120 features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
)
3121 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3124 * Raw Wacom-mode pen and touch events both come from interface
3125 * 0, whose HID descriptor has an application usage of 0xFF0D
3126 * (i.e., WACOM_HID_WD_DIGITIZER). We route pen packets back
3127 * out through the HID_GENERIC device created for interface 1,
3128 * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH.
3130 if (features
->type
== BAMBOO_PAD
)
3131 features
->device_type
= WACOM_DEVICETYPE_TOUCH
;
3133 if (features
->type
== REMOTE
)
3134 features
->device_type
= WACOM_DEVICETYPE_PAD
;
3136 if (features
->type
== INTUOSP2_BT
) {
3137 features
->device_type
|= WACOM_DEVICETYPE_PEN
|
3138 WACOM_DEVICETYPE_PAD
|
3139 WACOM_DEVICETYPE_TOUCH
;
3140 features
->quirks
|= WACOM_QUIRK_BATTERY
;
3143 switch (features
->type
) {
3154 case CINTIQ_COMPANION_2
:
3166 features
->device_type
|= WACOM_DEVICETYPE_DIRECT
;
3170 if (wacom
->hdev
->bus
== BUS_BLUETOOTH
)
3171 features
->quirks
|= WACOM_QUIRK_BATTERY
;
3173 /* quirk for bamboo touch with 2 low res touches */
3174 if ((features
->type
== BAMBOO_PT
|| features
->type
== BAMBOO_TOUCH
) &&
3175 features
->pktlen
== WACOM_PKGLEN_BBTOUCH
) {
3176 features
->x_max
<<= 5;
3177 features
->y_max
<<= 5;
3178 features
->x_fuzz
<<= 5;
3179 features
->y_fuzz
<<= 5;
3180 features
->quirks
|= WACOM_QUIRK_BBTOUCH_LOWRES
;
3183 if (features
->type
== WIRELESS
) {
3184 if (features
->device_type
== WACOM_DEVICETYPE_WL_MONITOR
) {
3185 features
->quirks
|= WACOM_QUIRK_BATTERY
;
3189 if (features
->type
== REMOTE
)
3190 features
->device_type
|= WACOM_DEVICETYPE_WL_MONITOR
;
3193 int wacom_setup_pen_input_capabilities(struct input_dev
*input_dev
,
3194 struct wacom_wac
*wacom_wac
)
3196 struct wacom_features
*features
= &wacom_wac
->features
;
3198 input_dev
->evbit
[0] |= BIT_MASK(EV_KEY
) | BIT_MASK(EV_ABS
);
3200 if (!(features
->device_type
& WACOM_DEVICETYPE_PEN
))
3203 if (features
->device_type
& WACOM_DEVICETYPE_DIRECT
)
3204 __set_bit(INPUT_PROP_DIRECT
, input_dev
->propbit
);
3206 __set_bit(INPUT_PROP_POINTER
, input_dev
->propbit
);
3208 if (features
->type
== HID_GENERIC
)
3209 /* setup has already been done */
3212 __set_bit(BTN_TOUCH
, input_dev
->keybit
);
3213 __set_bit(ABS_MISC
, input_dev
->absbit
);
3215 input_set_abs_params(input_dev
, ABS_X
, 0 + features
->offset_left
,
3216 features
->x_max
- features
->offset_right
,
3217 features
->x_fuzz
, 0);
3218 input_set_abs_params(input_dev
, ABS_Y
, 0 + features
->offset_top
,
3219 features
->y_max
- features
->offset_bottom
,
3220 features
->y_fuzz
, 0);
3221 input_set_abs_params(input_dev
, ABS_PRESSURE
, 0,
3222 features
->pressure_max
, features
->pressure_fuzz
, 0);
3224 /* penabled devices have fixed resolution for each model */
3225 input_abs_set_res(input_dev
, ABS_X
, features
->x_resolution
);
3226 input_abs_set_res(input_dev
, ABS_Y
, features
->y_resolution
);
3228 switch (features
->type
) {
3230 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3234 input_set_abs_params(input_dev
, ABS_DISTANCE
, 0,
3235 features
->distance_max
,
3236 features
->distance_fuzz
, 0);
3240 input_set_capability(input_dev
, EV_REL
, REL_WHEEL
);
3242 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3243 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3244 __set_bit(BTN_MIDDLE
, input_dev
->keybit
);
3246 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3247 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3248 __set_bit(BTN_TOOL_MOUSE
, input_dev
->keybit
);
3249 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3250 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3262 case CINTIQ_COMPANION_2
:
3263 input_set_abs_params(input_dev
, ABS_Z
, -900, 899, 0, 0);
3264 input_abs_set_res(input_dev
, ABS_Z
, 287);
3265 wacom_setup_cintiq(wacom_wac
);
3275 input_set_abs_params(input_dev
, ABS_Z
, -900, 899, 0, 0);
3276 input_abs_set_res(input_dev
, ABS_Z
, 287);
3280 wacom_setup_intuos(wacom_wac
);
3290 input_set_abs_params(input_dev
, ABS_DISTANCE
, 0,
3291 features
->distance_max
,
3292 features
->distance_fuzz
, 0);
3294 input_set_abs_params(input_dev
, ABS_Z
, -900, 899, 0, 0);
3295 input_abs_set_res(input_dev
, ABS_Z
, 287);
3297 wacom_setup_intuos(wacom_wac
);
3308 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3315 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3316 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3317 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3318 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3322 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3326 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3327 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3328 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3335 if (features
->type
== INTUOSHT2
) {
3336 wacom_setup_basic_pro_pen(wacom_wac
);
3338 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3339 __set_bit(BTN_TOOL_PEN
, input_dev
->keybit
);
3340 __set_bit(BTN_TOOL_RUBBER
, input_dev
->keybit
);
3341 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3342 __set_bit(BTN_STYLUS2
, input_dev
->keybit
);
3343 input_set_abs_params(input_dev
, ABS_DISTANCE
, 0,
3344 features
->distance_max
,
3345 features
->distance_fuzz
, 0);
3349 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3355 int wacom_setup_touch_input_capabilities(struct input_dev
*input_dev
,
3356 struct wacom_wac
*wacom_wac
)
3358 struct wacom_features
*features
= &wacom_wac
->features
;
3360 input_dev
->evbit
[0] |= BIT_MASK(EV_KEY
) | BIT_MASK(EV_ABS
);
3362 if (!(features
->device_type
& WACOM_DEVICETYPE_TOUCH
))
3365 if (features
->device_type
& WACOM_DEVICETYPE_DIRECT
)
3366 __set_bit(INPUT_PROP_DIRECT
, input_dev
->propbit
);
3368 __set_bit(INPUT_PROP_POINTER
, input_dev
->propbit
);
3370 if (features
->type
== HID_GENERIC
)
3371 /* setup has already been done */
3374 __set_bit(BTN_TOUCH
, input_dev
->keybit
);
3376 if (features
->touch_max
== 1) {
3377 input_set_abs_params(input_dev
, ABS_X
, 0,
3378 features
->x_max
, features
->x_fuzz
, 0);
3379 input_set_abs_params(input_dev
, ABS_Y
, 0,
3380 features
->y_max
, features
->y_fuzz
, 0);
3381 input_abs_set_res(input_dev
, ABS_X
,
3382 features
->x_resolution
);
3383 input_abs_set_res(input_dev
, ABS_Y
,
3384 features
->y_resolution
);
3386 else if (features
->touch_max
> 1) {
3387 input_set_abs_params(input_dev
, ABS_MT_POSITION_X
, 0,
3388 features
->x_max
, features
->x_fuzz
, 0);
3389 input_set_abs_params(input_dev
, ABS_MT_POSITION_Y
, 0,
3390 features
->y_max
, features
->y_fuzz
, 0);
3391 input_abs_set_res(input_dev
, ABS_MT_POSITION_X
,
3392 features
->x_resolution
);
3393 input_abs_set_res(input_dev
, ABS_MT_POSITION_Y
,
3394 features
->y_resolution
);
3397 switch (features
->type
) {
3399 input_dev
->evbit
[0] |= BIT_MASK(EV_SW
);
3400 __set_bit(SW_MUTE_DEVICE
, input_dev
->swbit
);
3402 if (wacom_wac
->shared
->touch
->product
== 0x361) {
3403 input_set_abs_params(input_dev
, ABS_MT_POSITION_X
,
3405 input_set_abs_params(input_dev
, ABS_MT_POSITION_Y
,
3408 else if (wacom_wac
->shared
->touch
->product
== 0x360) {
3409 input_set_abs_params(input_dev
, ABS_MT_POSITION_X
,
3411 input_set_abs_params(input_dev
, ABS_MT_POSITION_Y
,
3414 input_abs_set_res(input_dev
, ABS_MT_POSITION_X
, 40);
3415 input_abs_set_res(input_dev
, ABS_MT_POSITION_X
, 40);
3425 input_set_abs_params(input_dev
, ABS_MT_TOUCH_MAJOR
, 0, features
->x_max
, 0, 0);
3426 input_set_abs_params(input_dev
, ABS_MT_TOUCH_MINOR
, 0, features
->y_max
, 0, 0);
3427 input_mt_init_slots(input_dev
, features
->touch_max
, INPUT_MT_POINTER
);
3431 input_set_abs_params(input_dev
, ABS_MT_TOUCH_MAJOR
, 0, features
->x_max
, 0, 0);
3432 input_set_abs_params(input_dev
, ABS_MT_WIDTH_MAJOR
, 0, features
->x_max
, 0, 0);
3433 input_set_abs_params(input_dev
, ABS_MT_WIDTH_MINOR
, 0, features
->y_max
, 0, 0);
3434 input_set_abs_params(input_dev
, ABS_MT_ORIENTATION
, 0, 1, 0, 0);
3442 input_mt_init_slots(input_dev
, features
->touch_max
, INPUT_MT_DIRECT
);
3451 input_dev
->evbit
[0] |= BIT_MASK(EV_SW
);
3452 __set_bit(SW_MUTE_DEVICE
, input_dev
->swbit
);
3457 if (features
->pktlen
== WACOM_PKGLEN_BBTOUCH3
) {
3458 input_set_abs_params(input_dev
,
3460 0, features
->x_max
, 0, 0);
3461 input_set_abs_params(input_dev
,
3463 0, features
->y_max
, 0, 0);
3465 input_mt_init_slots(input_dev
, features
->touch_max
, INPUT_MT_POINTER
);
3469 input_mt_init_slots(input_dev
, features
->touch_max
,
3471 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3472 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3478 static int wacom_numbered_button_to_key(int n
)
3483 return BTN_A
+ (n
-10);
3485 return BTN_BASE
+ (n
-16);
3490 static void wacom_setup_numbered_buttons(struct input_dev
*input_dev
,
3495 for (i
= 0; i
< button_count
; i
++) {
3496 int key
= wacom_numbered_button_to_key(i
);
3499 __set_bit(key
, input_dev
->keybit
);
3503 static void wacom_24hd_update_leds(struct wacom
*wacom
, int mask
, int group
)
3505 struct wacom_led
*led
;
3507 bool updated
= false;
3510 * 24HD has LED group 1 to the left and LED group 0 to the right.
3511 * So group 0 matches the second half of the buttons and thus the mask
3512 * needs to be shifted.
3517 for (i
= 0; i
< 3; i
++) {
3518 led
= wacom_led_find(wacom
, group
, i
);
3520 hid_err(wacom
->hdev
, "can't find LED %d in group %d\n",
3524 if (!updated
&& mask
& BIT(i
)) {
3526 led_trigger_event(&led
->trigger
, LED_FULL
);
3533 static bool wacom_is_led_toggled(struct wacom
*wacom
, int button_count
,
3534 int mask
, int group
)
3536 int button_per_group
;
3539 * 21UX2 has LED group 1 to the left and LED group 0
3540 * to the right. We need to reverse the group to match this
3541 * historical behavior.
3543 if (wacom
->wacom_wac
.features
.type
== WACOM_21UX2
)
3546 button_per_group
= button_count
/wacom
->led
.count
;
3548 return mask
& (1 << (group
* button_per_group
));
3551 static void wacom_update_led(struct wacom
*wacom
, int button_count
, int mask
,
3554 struct wacom_led
*led
, *next_led
;
3558 if (wacom
->wacom_wac
.features
.type
== WACOM_24HD
)
3559 return wacom_24hd_update_leds(wacom
, mask
, group
);
3561 pressed
= wacom_is_led_toggled(wacom
, button_count
, mask
, group
);
3562 cur
= wacom
->led
.groups
[group
].select
;
3564 led
= wacom_led_find(wacom
, group
, cur
);
3566 hid_err(wacom
->hdev
, "can't find current LED %d in group %d\n",
3576 if (led
->held
&& pressed
)
3579 next_led
= wacom_led_next(wacom
, led
);
3581 hid_err(wacom
->hdev
, "can't find next LED in group %d\n",
3585 if (next_led
== led
)
3588 next_led
->held
= true;
3589 led_trigger_event(&next_led
->trigger
,
3590 wacom_leds_brightness_get(next_led
));
3593 static void wacom_report_numbered_buttons(struct input_dev
*input_dev
,
3594 int button_count
, int mask
)
3596 struct wacom
*wacom
= input_get_drvdata(input_dev
);
3599 for (i
= 0; i
< wacom
->led
.count
; i
++)
3600 wacom_update_led(wacom
, button_count
, mask
, i
);
3602 for (i
= 0; i
< button_count
; i
++) {
3603 int key
= wacom_numbered_button_to_key(i
);
3606 input_report_key(input_dev
, key
, mask
& (1 << i
));
3610 int wacom_setup_pad_input_capabilities(struct input_dev
*input_dev
,
3611 struct wacom_wac
*wacom_wac
)
3613 struct wacom_features
*features
= &wacom_wac
->features
;
3615 if ((features
->type
== HID_GENERIC
) && features
->numbered_buttons
> 0)
3616 features
->device_type
|= WACOM_DEVICETYPE_PAD
;
3618 if (!(features
->device_type
& WACOM_DEVICETYPE_PAD
))
3621 if (features
->type
== REMOTE
&& input_dev
== wacom_wac
->pad_input
)
3624 input_dev
->evbit
[0] |= BIT_MASK(EV_KEY
) | BIT_MASK(EV_ABS
);
3626 /* kept for making legacy xf86-input-wacom working with the wheels */
3627 __set_bit(ABS_MISC
, input_dev
->absbit
);
3629 /* kept for making legacy xf86-input-wacom accepting the pad */
3630 if (!(input_dev
->absinfo
&& (input_dev
->absinfo
[ABS_X
].minimum
||
3631 input_dev
->absinfo
[ABS_X
].maximum
)))
3632 input_set_abs_params(input_dev
, ABS_X
, 0, 1, 0, 0);
3633 if (!(input_dev
->absinfo
&& (input_dev
->absinfo
[ABS_Y
].minimum
||
3634 input_dev
->absinfo
[ABS_Y
].maximum
)))
3635 input_set_abs_params(input_dev
, ABS_Y
, 0, 1, 0, 0);
3637 /* kept for making udev and libwacom accepting the pad */
3638 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3640 wacom_setup_numbered_buttons(input_dev
, features
->numbered_buttons
);
3642 switch (features
->type
) {
3645 case CINTIQ_COMPANION_2
:
3652 __set_bit(BTN_BACK
, input_dev
->keybit
);
3653 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3654 __set_bit(BTN_FORWARD
, input_dev
->keybit
);
3655 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3656 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3660 __set_bit(BTN_BACK
, input_dev
->keybit
);
3661 __set_bit(BTN_FORWARD
, input_dev
->keybit
);
3662 input_set_capability(input_dev
, EV_REL
, REL_WHEEL
);
3666 __set_bit(KEY_PROG1
, input_dev
->keybit
);
3667 __set_bit(KEY_PROG2
, input_dev
->keybit
);
3668 __set_bit(KEY_PROG3
, input_dev
->keybit
);
3670 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3671 input_set_abs_params(input_dev
, ABS_THROTTLE
, 0, 71, 0, 0);
3675 __set_bit(KEY_PROG1
, input_dev
->keybit
);
3676 __set_bit(KEY_PROG2
, input_dev
->keybit
);
3677 __set_bit(KEY_PROG3
, input_dev
->keybit
);
3678 input_set_abs_params(input_dev
, ABS_X
, -2048, 2048, 0, 0);
3679 input_abs_set_res(input_dev
, ABS_X
, 1024); /* points/g */
3680 input_set_abs_params(input_dev
, ABS_Y
, -2048, 2048, 0, 0);
3681 input_abs_set_res(input_dev
, ABS_Y
, 1024);
3682 input_set_abs_params(input_dev
, ABS_Z
, -2048, 2048, 0, 0);
3683 input_abs_set_res(input_dev
, ABS_Z
, 1024);
3684 __set_bit(INPUT_PROP_ACCELEROMETER
, input_dev
->propbit
);
3688 __set_bit(KEY_PROG1
, input_dev
->keybit
);
3689 __set_bit(KEY_PROG2
, input_dev
->keybit
);
3690 __set_bit(KEY_PROG3
, input_dev
->keybit
);
3696 input_set_abs_params(input_dev
, ABS_RX
, 0, 4096, 0, 0);
3697 input_set_abs_params(input_dev
, ABS_RY
, 0, 4096, 0, 0);
3701 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3706 input_set_abs_params(input_dev
, ABS_RY
, 0, 4096, 0, 0);
3710 input_set_abs_params(input_dev
, ABS_RX
, 0, 4096, 0, 0);
3720 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3725 * For Bluetooth devices, the udev rule does not work correctly
3726 * for pads unless we add a stylus capability, which forces
3727 * ID_INPUT_TABLET to be set.
3729 __set_bit(BTN_STYLUS
, input_dev
->keybit
);
3735 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3742 __clear_bit(ABS_MISC
, input_dev
->absbit
);
3744 __set_bit(BTN_LEFT
, input_dev
->keybit
);
3745 __set_bit(BTN_FORWARD
, input_dev
->keybit
);
3746 __set_bit(BTN_BACK
, input_dev
->keybit
);
3747 __set_bit(BTN_RIGHT
, input_dev
->keybit
);
3752 input_set_capability(input_dev
, EV_MSC
, MSC_SERIAL
);
3753 input_set_abs_params(input_dev
, ABS_WHEEL
, 0, 71, 0, 0);
3760 /* no pad supported */
3766 static const struct wacom_features wacom_features_0x00
=
3767 { "Wacom Penpartner", 5040, 3780, 255, 0,
3768 PENPARTNER
, WACOM_PENPRTN_RES
, WACOM_PENPRTN_RES
};
3769 static const struct wacom_features wacom_features_0x10
=
3770 { "Wacom Graphire", 10206, 7422, 511, 63,
3771 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3772 static const struct wacom_features wacom_features_0x81
=
3773 { "Wacom Graphire BT", 16704, 12064, 511, 32,
3774 GRAPHIRE_BT
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
, 2 };
3775 static const struct wacom_features wacom_features_0x11
=
3776 { "Wacom Graphire2 4x5", 10206, 7422, 511, 63,
3777 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3778 static const struct wacom_features wacom_features_0x12
=
3779 { "Wacom Graphire2 5x7", 13918, 10206, 511, 63,
3780 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3781 static const struct wacom_features wacom_features_0x13
=
3782 { "Wacom Graphire3", 10208, 7424, 511, 63,
3783 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3784 static const struct wacom_features wacom_features_0x14
=
3785 { "Wacom Graphire3 6x8", 16704, 12064, 511, 63,
3786 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3787 static const struct wacom_features wacom_features_0x15
=
3788 { "Wacom Graphire4 4x5", 10208, 7424, 511, 63,
3789 WACOM_G4
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3790 static const struct wacom_features wacom_features_0x16
=
3791 { "Wacom Graphire4 6x8", 16704, 12064, 511, 63,
3792 WACOM_G4
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3793 static const struct wacom_features wacom_features_0x17
=
3794 { "Wacom BambooFun 4x5", 14760, 9225, 511, 63,
3795 WACOM_MO
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3796 static const struct wacom_features wacom_features_0x18
=
3797 { "Wacom BambooFun 6x8", 21648, 13530, 511, 63,
3798 WACOM_MO
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3799 static const struct wacom_features wacom_features_0x19
=
3800 { "Wacom Bamboo1 Medium", 16704, 12064, 511, 63,
3801 GRAPHIRE
, WACOM_GRAPHIRE_RES
, WACOM_GRAPHIRE_RES
};
3802 static const struct wacom_features wacom_features_0x60
=
3803 { "Wacom Volito", 5104, 3712, 511, 63,
3804 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3805 static const struct wacom_features wacom_features_0x61
=
3806 { "Wacom PenStation2", 3250, 2320, 255, 63,
3807 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3808 static const struct wacom_features wacom_features_0x62
=
3809 { "Wacom Volito2 4x5", 5104, 3712, 511, 63,
3810 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3811 static const struct wacom_features wacom_features_0x63
=
3812 { "Wacom Volito2 2x3", 3248, 2320, 511, 63,
3813 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3814 static const struct wacom_features wacom_features_0x64
=
3815 { "Wacom PenPartner2", 3250, 2320, 511, 63,
3816 GRAPHIRE
, WACOM_VOLITO_RES
, WACOM_VOLITO_RES
};
3817 static const struct wacom_features wacom_features_0x65
=
3818 { "Wacom Bamboo", 14760, 9225, 511, 63,
3819 WACOM_MO
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3820 static const struct wacom_features wacom_features_0x69
=
3821 { "Wacom Bamboo1", 5104, 3712, 511, 63,
3822 GRAPHIRE
, WACOM_PENPRTN_RES
, WACOM_PENPRTN_RES
};
3823 static const struct wacom_features wacom_features_0x6A
=
3824 { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63,
3825 GRAPHIRE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3826 static const struct wacom_features wacom_features_0x6B
=
3827 { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63,
3828 GRAPHIRE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3829 static const struct wacom_features wacom_features_0x20
=
3830 { "Wacom Intuos 4x5", 12700, 10600, 1023, 31,
3831 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3832 static const struct wacom_features wacom_features_0x21
=
3833 { "Wacom Intuos 6x8", 20320, 16240, 1023, 31,
3834 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3835 static const struct wacom_features wacom_features_0x22
=
3836 { "Wacom Intuos 9x12", 30480, 24060, 1023, 31,
3837 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3838 static const struct wacom_features wacom_features_0x23
=
3839 { "Wacom Intuos 12x12", 30480, 31680, 1023, 31,
3840 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3841 static const struct wacom_features wacom_features_0x24
=
3842 { "Wacom Intuos 12x18", 45720, 31680, 1023, 31,
3843 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3844 static const struct wacom_features wacom_features_0x30
=
3845 { "Wacom PL400", 5408, 4056, 255, 0,
3846 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3847 static const struct wacom_features wacom_features_0x31
=
3848 { "Wacom PL500", 6144, 4608, 255, 0,
3849 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3850 static const struct wacom_features wacom_features_0x32
=
3851 { "Wacom PL600", 6126, 4604, 255, 0,
3852 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3853 static const struct wacom_features wacom_features_0x33
=
3854 { "Wacom PL600SX", 6260, 5016, 255, 0,
3855 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3856 static const struct wacom_features wacom_features_0x34
=
3857 { "Wacom PL550", 6144, 4608, 511, 0,
3858 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3859 static const struct wacom_features wacom_features_0x35
=
3860 { "Wacom PL800", 7220, 5780, 511, 0,
3861 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3862 static const struct wacom_features wacom_features_0x37
=
3863 { "Wacom PL700", 6758, 5406, 511, 0,
3864 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3865 static const struct wacom_features wacom_features_0x38
=
3866 { "Wacom PL510", 6282, 4762, 511, 0,
3867 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3868 static const struct wacom_features wacom_features_0x39
=
3869 { "Wacom DTU710", 34080, 27660, 511, 0,
3870 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3871 static const struct wacom_features wacom_features_0xC4
=
3872 { "Wacom DTF521", 6282, 4762, 511, 0,
3873 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3874 static const struct wacom_features wacom_features_0xC0
=
3875 { "Wacom DTF720", 6858, 5506, 511, 0,
3876 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3877 static const struct wacom_features wacom_features_0xC2
=
3878 { "Wacom DTF720a", 6858, 5506, 511, 0,
3879 PL
, WACOM_PL_RES
, WACOM_PL_RES
};
3880 static const struct wacom_features wacom_features_0x03
=
3881 { "Wacom Cintiq Partner", 20480, 15360, 511, 0,
3882 PTU
, WACOM_PL_RES
, WACOM_PL_RES
};
3883 static const struct wacom_features wacom_features_0x41
=
3884 { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31,
3885 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3886 static const struct wacom_features wacom_features_0x42
=
3887 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
3888 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3889 static const struct wacom_features wacom_features_0x43
=
3890 { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31,
3891 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3892 static const struct wacom_features wacom_features_0x44
=
3893 { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31,
3894 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3895 static const struct wacom_features wacom_features_0x45
=
3896 { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31,
3897 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
3898 static const struct wacom_features wacom_features_0xB0
=
3899 { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63,
3900 INTUOS3S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 4 };
3901 static const struct wacom_features wacom_features_0xB1
=
3902 { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63,
3903 INTUOS3
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3904 static const struct wacom_features wacom_features_0xB2
=
3905 { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63,
3906 INTUOS3
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3907 static const struct wacom_features wacom_features_0xB3
=
3908 { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63,
3909 INTUOS3L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3910 static const struct wacom_features wacom_features_0xB4
=
3911 { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63,
3912 INTUOS3L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3913 static const struct wacom_features wacom_features_0xB5
=
3914 { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63,
3915 INTUOS3
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3916 static const struct wacom_features wacom_features_0xB7
=
3917 { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63,
3918 INTUOS3S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 4 };
3919 static const struct wacom_features wacom_features_0xB8
=
3920 { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63,
3921 INTUOS4S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7 };
3922 static const struct wacom_features wacom_features_0xB9
=
3923 { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63,
3924 INTUOS4
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3925 static const struct wacom_features wacom_features_0xBA
=
3926 { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63,
3927 INTUOS4L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3928 static const struct wacom_features wacom_features_0xBB
=
3929 { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63,
3930 INTUOS4L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3931 static const struct wacom_features wacom_features_0xBC
=
3932 { "Wacom Intuos4 WL", 40640, 25400, 2047, 63,
3933 INTUOS4
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3934 static const struct wacom_features wacom_features_0xBD
=
3935 { "Wacom Intuos4 WL", 40640, 25400, 2047, 63,
3936 INTUOS4WL
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3937 static const struct wacom_features wacom_features_0x26
=
3938 { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63,
3939 INTUOS5S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7, .touch_max
= 16 };
3940 static const struct wacom_features wacom_features_0x27
=
3941 { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63,
3942 INTUOS5
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16 };
3943 static const struct wacom_features wacom_features_0x28
=
3944 { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63,
3945 INTUOS5L
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16 };
3946 static const struct wacom_features wacom_features_0x29
=
3947 { "Wacom Intuos5 S", 31496, 19685, 2047, 63,
3948 INTUOS5S
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7 };
3949 static const struct wacom_features wacom_features_0x2A
=
3950 { "Wacom Intuos5 M", 44704, 27940, 2047, 63,
3951 INTUOS5
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9 };
3952 static const struct wacom_features wacom_features_0x314
=
3953 { "Wacom Intuos Pro S", 31496, 19685, 2047, 63,
3954 INTUOSPS
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 7, .touch_max
= 16,
3955 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3956 static const struct wacom_features wacom_features_0x315
=
3957 { "Wacom Intuos Pro M", 44704, 27940, 2047, 63,
3958 INTUOSPM
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16,
3959 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3960 static const struct wacom_features wacom_features_0x317
=
3961 { "Wacom Intuos Pro L", 65024, 40640, 2047, 63,
3962 INTUOSPL
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 16,
3963 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3964 static const struct wacom_features wacom_features_0xF4
=
3965 { "Wacom Cintiq 24HD", 104480, 65600, 2047, 63,
3966 WACOM_24HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 16,
3967 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3968 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
3969 static const struct wacom_features wacom_features_0xF8
=
3970 { "Wacom Cintiq 24HD touch", 104480, 65600, 2047, 63, /* Pen */
3971 WACOM_24HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 16,
3972 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3973 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3974 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0xf6 };
3975 static const struct wacom_features wacom_features_0xF6
=
3976 { "Wacom Cintiq 24HD touch", .type
= WACOM_24HDT
, /* Touch */
3977 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0xf8, .touch_max
= 10,
3978 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
3979 static const struct wacom_features wacom_features_0x32A
=
3980 { "Wacom Cintiq 27QHD", 120140, 67920, 2047, 63,
3981 WACOM_27QHD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 0,
3982 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3983 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
3984 static const struct wacom_features wacom_features_0x32B
=
3985 { "Wacom Cintiq 27QHD touch", 120140, 67920, 2047, 63,
3986 WACOM_27QHD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 0,
3987 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3988 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
3989 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x32C };
3990 static const struct wacom_features wacom_features_0x32C
=
3991 { "Wacom Cintiq 27QHD touch", .type
= WACOM_27QHDT
,
3992 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x32B, .touch_max
= 10 };
3993 static const struct wacom_features wacom_features_0x3F
=
3994 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
3995 CINTIQ
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 8 };
3996 static const struct wacom_features wacom_features_0xC5
=
3997 { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63,
3998 WACOM_BEE
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 10 };
3999 static const struct wacom_features wacom_features_0xC6
=
4000 { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
4001 WACOM_BEE
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 10 };
4002 static const struct wacom_features wacom_features_0x304
=
4003 { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63,
4004 WACOM_13HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
4005 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4006 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
4007 static const struct wacom_features wacom_features_0x333
=
4008 { "Wacom Cintiq 13HD touch", 59552, 33848, 2047, 63,
4009 WACOM_13HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
4010 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4011 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4012 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x335 };
4013 static const struct wacom_features wacom_features_0x335
=
4014 { "Wacom Cintiq 13HD touch", .type
= WACOM_24HDT
, /* Touch */
4015 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x333, .touch_max
= 10,
4016 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4017 static const struct wacom_features wacom_features_0xC7
=
4018 { "Wacom DTU1931", 37832, 30305, 511, 0,
4019 PL
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4020 static const struct wacom_features wacom_features_0xCE
=
4021 { "Wacom DTU2231", 47864, 27011, 511, 0,
4022 DTU
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4023 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBMOUSE
};
4024 static const struct wacom_features wacom_features_0xF0
=
4025 { "Wacom DTU1631", 34623, 19553, 511, 0,
4026 DTU
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4027 static const struct wacom_features wacom_features_0xFB
=
4028 { "Wacom DTU1031", 22096, 13960, 511, 0,
4029 DTUS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 4,
4030 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
4031 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
4032 static const struct wacom_features wacom_features_0x32F
=
4033 { "Wacom DTU1031X", 22672, 12928, 511, 0,
4034 DTUSX
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 0,
4035 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
4036 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
4037 static const struct wacom_features wacom_features_0x336
=
4038 { "Wacom DTU1141", 23672, 13403, 1023, 0,
4039 DTUS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 4,
4040 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
4041 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
4042 static const struct wacom_features wacom_features_0x57
=
4043 { "Wacom DTK2241", 95840, 54260, 2047, 63,
4044 DTK
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 6,
4045 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4046 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
4047 static const struct wacom_features wacom_features_0x59
= /* Pen */
4048 { "Wacom DTH2242", 95840, 54260, 2047, 63,
4049 DTK
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 6,
4050 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4051 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4052 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x5D };
4053 static const struct wacom_features wacom_features_0x5D
= /* Touch */
4054 { "Wacom DTH2242", .type
= WACOM_24HDT
,
4055 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x59, .touch_max
= 10,
4056 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4057 static const struct wacom_features wacom_features_0xCC
=
4058 { "Wacom Cintiq 21UX2", 87200, 65600, 2047, 63,
4059 WACOM_21UX2
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 18,
4060 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4061 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
4062 static const struct wacom_features wacom_features_0xFA
=
4063 { "Wacom Cintiq 22HD", 95840, 54260, 2047, 63,
4064 WACOM_22HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 18,
4065 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4066 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
};
4067 static const struct wacom_features wacom_features_0x5B
=
4068 { "Wacom Cintiq 22HDT", 95840, 54260, 2047, 63,
4069 WACOM_22HD
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 18,
4070 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4071 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4072 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x5e };
4073 static const struct wacom_features wacom_features_0x5E
=
4074 { "Wacom Cintiq 22HDT", .type
= WACOM_24HDT
,
4075 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x5b, .touch_max
= 10,
4076 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4077 static const struct wacom_features wacom_features_0x90
=
4078 { "Wacom ISDv4 90", 26202, 16325, 255, 0,
4079 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4080 static const struct wacom_features wacom_features_0x93
=
4081 { "Wacom ISDv4 93", 26202, 16325, 255, 0,
4082 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4083 static const struct wacom_features wacom_features_0x97
=
4084 { "Wacom ISDv4 97", 26202, 16325, 511, 0,
4085 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4086 static const struct wacom_features wacom_features_0x9A
=
4087 { "Wacom ISDv4 9A", 26202, 16325, 255, 0,
4088 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4089 static const struct wacom_features wacom_features_0x9F
=
4090 { "Wacom ISDv4 9F", 26202, 16325, 255, 0,
4091 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4092 static const struct wacom_features wacom_features_0xE2
=
4093 { "Wacom ISDv4 E2", 26202, 16325, 255, 0,
4094 TABLETPC2FG
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4095 static const struct wacom_features wacom_features_0xE3
=
4096 { "Wacom ISDv4 E3", 26202, 16325, 255, 0,
4097 TABLETPC2FG
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4098 static const struct wacom_features wacom_features_0xE5
=
4099 { "Wacom ISDv4 E5", 26202, 16325, 255, 0,
4100 MTSCREEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4101 static const struct wacom_features wacom_features_0xE6
=
4102 { "Wacom ISDv4 E6", 27760, 15694, 255, 0,
4103 TABLETPC2FG
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4104 static const struct wacom_features wacom_features_0xEC
=
4105 { "Wacom ISDv4 EC", 25710, 14500, 255, 0,
4106 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4107 static const struct wacom_features wacom_features_0xED
=
4108 { "Wacom ISDv4 ED", 26202, 16325, 255, 0,
4109 TABLETPCE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4110 static const struct wacom_features wacom_features_0xEF
=
4111 { "Wacom ISDv4 EF", 26202, 16325, 255, 0,
4112 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4113 static const struct wacom_features wacom_features_0x100
=
4114 { "Wacom ISDv4 100", 26202, 16325, 255, 0,
4115 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4116 static const struct wacom_features wacom_features_0x101
=
4117 { "Wacom ISDv4 101", 26202, 16325, 255, 0,
4118 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4119 static const struct wacom_features wacom_features_0x10D
=
4120 { "Wacom ISDv4 10D", 26202, 16325, 255, 0,
4121 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4122 static const struct wacom_features wacom_features_0x10E
=
4123 { "Wacom ISDv4 10E", 27760, 15694, 255, 0,
4124 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4125 static const struct wacom_features wacom_features_0x10F
=
4126 { "Wacom ISDv4 10F", 27760, 15694, 255, 0,
4127 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4128 static const struct wacom_features wacom_features_0x116
=
4129 { "Wacom ISDv4 116", 26202, 16325, 255, 0,
4130 TABLETPCE
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4131 static const struct wacom_features wacom_features_0x12C
=
4132 { "Wacom ISDv4 12C", 27848, 15752, 2047, 0,
4133 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4134 static const struct wacom_features wacom_features_0x4001
=
4135 { "Wacom ISDv4 4001", 26202, 16325, 255, 0,
4136 MTTPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4137 static const struct wacom_features wacom_features_0x4004
=
4138 { "Wacom ISDv4 4004", 11060, 6220, 255, 0,
4139 MTTPC_B
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4140 static const struct wacom_features wacom_features_0x5000
=
4141 { "Wacom ISDv4 5000", 27848, 15752, 1023, 0,
4142 MTTPC_B
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4143 static const struct wacom_features wacom_features_0x5002
=
4144 { "Wacom ISDv4 5002", 29576, 16724, 1023, 0,
4145 MTTPC_B
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4146 static const struct wacom_features wacom_features_0x47
=
4147 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4148 INTUOS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4149 static const struct wacom_features wacom_features_0x84
=
4150 { "Wacom Wireless Receiver", .type
= WIRELESS
, .touch_max
= 16 };
4151 static const struct wacom_features wacom_features_0xD0
=
4152 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31,
4153 BAMBOO_TOUCH
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4154 static const struct wacom_features wacom_features_0xD1
=
4155 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31,
4156 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4157 static const struct wacom_features wacom_features_0xD2
=
4158 { "Wacom Bamboo Craft", 14720, 9200, 1023, 31,
4159 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4160 static const struct wacom_features wacom_features_0xD3
=
4161 { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31,
4162 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4163 static const struct wacom_features wacom_features_0xD4
=
4164 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31,
4165 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4166 static const struct wacom_features wacom_features_0xD5
=
4167 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31,
4168 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4169 static const struct wacom_features wacom_features_0xD6
=
4170 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31,
4171 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4172 static const struct wacom_features wacom_features_0xD7
=
4173 { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31,
4174 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4175 static const struct wacom_features wacom_features_0xD8
=
4176 { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31,
4177 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4178 static const struct wacom_features wacom_features_0xDA
=
4179 { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31,
4180 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4181 static const struct wacom_features wacom_features_0xDB
=
4182 { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31,
4183 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 2 };
4184 static const struct wacom_features wacom_features_0xDD
=
4185 { "Wacom Bamboo Connect", 14720, 9200, 1023, 31,
4186 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4187 static const struct wacom_features wacom_features_0xDE
=
4188 { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31,
4189 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16 };
4190 static const struct wacom_features wacom_features_0xDF
=
4191 { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31,
4192 BAMBOO_PT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16 };
4193 static const struct wacom_features wacom_features_0x300
=
4194 { "Wacom Bamboo One S", 14720, 9225, 1023, 31,
4195 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4196 static const struct wacom_features wacom_features_0x301
=
4197 { "Wacom Bamboo One M", 21648, 13530, 1023, 31,
4198 BAMBOO_PEN
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4199 static const struct wacom_features wacom_features_0x302
=
4200 { "Wacom Intuos PT S", 15200, 9500, 1023, 31,
4201 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4202 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4203 static const struct wacom_features wacom_features_0x303
=
4204 { "Wacom Intuos PT M", 21600, 13500, 1023, 31,
4205 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4206 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4207 static const struct wacom_features wacom_features_0x30E
=
4208 { "Wacom Intuos S", 15200, 9500, 1023, 31,
4209 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4210 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4211 static const struct wacom_features wacom_features_0x6004
=
4212 { "ISD-V4", 12800, 8000, 255, 0,
4213 TABLETPC
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
};
4214 static const struct wacom_features wacom_features_0x307
=
4215 { "Wacom ISDv5 307", 59552, 33848, 2047, 63,
4216 CINTIQ_HYBRID
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
4217 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4218 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4219 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x309 };
4220 static const struct wacom_features wacom_features_0x309
=
4221 { "Wacom ISDv5 309", .type
= WACOM_24HDT
, /* Touch */
4222 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x0307, .touch_max
= 10,
4223 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4224 static const struct wacom_features wacom_features_0x30A
=
4225 { "Wacom ISDv5 30A", 59552, 33848, 2047, 63,
4226 CINTIQ_HYBRID
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9,
4227 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4228 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4229 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x30C };
4230 static const struct wacom_features wacom_features_0x30C
=
4231 { "Wacom ISDv5 30C", .type
= WACOM_24HDT
, /* Touch */
4232 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x30A, .touch_max
= 10,
4233 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4234 static const struct wacom_features wacom_features_0x318
=
4235 { "Wacom USB Bamboo PAD", 4095, 4095, /* Touch */
4236 .type
= BAMBOO_PAD
, 35, 48, .touch_max
= 4 };
4237 static const struct wacom_features wacom_features_0x319
=
4238 { "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */
4239 .type
= BAMBOO_PAD
, 35, 48, .touch_max
= 4 };
4240 static const struct wacom_features wacom_features_0x325
=
4241 { "Wacom ISDv5 325", 59552, 33848, 2047, 63,
4242 CINTIQ_COMPANION_2
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 11,
4243 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4244 WACOM_CINTIQ_OFFSET
, WACOM_CINTIQ_OFFSET
,
4245 .oVid
= USB_VENDOR_ID_WACOM
, .oPid
= 0x326 };
4246 static const struct wacom_features wacom_features_0x326
= /* Touch */
4247 { "Wacom ISDv5 326", .type
= HID_GENERIC
, .oVid
= USB_VENDOR_ID_WACOM
,
4249 static const struct wacom_features wacom_features_0x323
=
4250 { "Wacom Intuos P M", 21600, 13500, 1023, 31,
4251 INTUOSHT
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4252 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4253 static const struct wacom_features wacom_features_0x331
=
4254 { "Wacom Express Key Remote", .type
= REMOTE
,
4255 .numbered_buttons
= 18, .check_for_hid_type
= true,
4256 .hid_type
= HID_TYPE_USBNONE
};
4257 static const struct wacom_features wacom_features_0x33B
=
4258 { "Wacom Intuos S 2", 15200, 9500, 2047, 63,
4259 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4260 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4261 static const struct wacom_features wacom_features_0x33C
=
4262 { "Wacom Intuos PT S 2", 15200, 9500, 2047, 63,
4263 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4264 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4265 static const struct wacom_features wacom_features_0x33D
=
4266 { "Wacom Intuos P M 2", 21600, 13500, 2047, 63,
4267 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
,
4268 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4269 static const struct wacom_features wacom_features_0x33E
=
4270 { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
4271 INTUOSHT2
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, .touch_max
= 16,
4272 .check_for_hid_type
= true, .hid_type
= HID_TYPE_USBNONE
};
4273 static const struct wacom_features wacom_features_0x343
=
4274 { "Wacom DTK1651", 34816, 19759, 1023, 0,
4275 DTUS
, WACOM_INTUOS_RES
, WACOM_INTUOS_RES
, 4,
4276 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
,
4277 WACOM_DTU_OFFSET
, WACOM_DTU_OFFSET
};
4278 static const struct wacom_features wacom_features_0x360
=
4279 { "Wacom Intuos Pro M", 44800, 29600, 8191, 63,
4280 INTUOSP2_BT
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 10 };
4281 static const struct wacom_features wacom_features_0x361
=
4282 { "Wacom Intuos Pro L", 62200, 43200, 8191, 63,
4283 INTUOSP2_BT
, WACOM_INTUOS3_RES
, WACOM_INTUOS3_RES
, 9, .touch_max
= 10 };
4285 static const struct wacom_features wacom_features_HID_ANY_ID
=
4286 { "Wacom HID", .type
= HID_GENERIC
, .oVid
= HID_ANY_ID
, .oPid
= HID_ANY_ID
};
4288 #define USB_DEVICE_WACOM(prod) \
4289 HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
4290 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4292 #define BT_DEVICE_WACOM(prod) \
4293 HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
4294 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4296 #define I2C_DEVICE_WACOM(prod) \
4297 HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
4298 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4300 #define USB_DEVICE_LENOVO(prod) \
4301 HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
4302 .driver_data = (kernel_ulong_t)&wacom_features_##prod
4304 const struct hid_device_id wacom_ids
[] = {
4305 { USB_DEVICE_WACOM(0x00) },
4306 { USB_DEVICE_WACOM(0x03) },
4307 { USB_DEVICE_WACOM(0x10) },
4308 { USB_DEVICE_WACOM(0x11) },
4309 { USB_DEVICE_WACOM(0x12) },
4310 { USB_DEVICE_WACOM(0x13) },
4311 { USB_DEVICE_WACOM(0x14) },
4312 { USB_DEVICE_WACOM(0x15) },
4313 { USB_DEVICE_WACOM(0x16) },
4314 { USB_DEVICE_WACOM(0x17) },
4315 { USB_DEVICE_WACOM(0x18) },
4316 { USB_DEVICE_WACOM(0x19) },
4317 { USB_DEVICE_WACOM(0x20) },
4318 { USB_DEVICE_WACOM(0x21) },
4319 { USB_DEVICE_WACOM(0x22) },
4320 { USB_DEVICE_WACOM(0x23) },
4321 { USB_DEVICE_WACOM(0x24) },
4322 { USB_DEVICE_WACOM(0x26) },
4323 { USB_DEVICE_WACOM(0x27) },
4324 { USB_DEVICE_WACOM(0x28) },
4325 { USB_DEVICE_WACOM(0x29) },
4326 { USB_DEVICE_WACOM(0x2A) },
4327 { USB_DEVICE_WACOM(0x30) },
4328 { USB_DEVICE_WACOM(0x31) },
4329 { USB_DEVICE_WACOM(0x32) },
4330 { USB_DEVICE_WACOM(0x33) },
4331 { USB_DEVICE_WACOM(0x34) },
4332 { USB_DEVICE_WACOM(0x35) },
4333 { USB_DEVICE_WACOM(0x37) },
4334 { USB_DEVICE_WACOM(0x38) },
4335 { USB_DEVICE_WACOM(0x39) },
4336 { USB_DEVICE_WACOM(0x3F) },
4337 { USB_DEVICE_WACOM(0x41) },
4338 { USB_DEVICE_WACOM(0x42) },
4339 { USB_DEVICE_WACOM(0x43) },
4340 { USB_DEVICE_WACOM(0x44) },
4341 { USB_DEVICE_WACOM(0x45) },
4342 { USB_DEVICE_WACOM(0x47) },
4343 { USB_DEVICE_WACOM(0x57) },
4344 { USB_DEVICE_WACOM(0x59) },
4345 { USB_DEVICE_WACOM(0x5B) },
4346 { USB_DEVICE_WACOM(0x5D) },
4347 { USB_DEVICE_WACOM(0x5E) },
4348 { USB_DEVICE_WACOM(0x60) },
4349 { USB_DEVICE_WACOM(0x61) },
4350 { USB_DEVICE_WACOM(0x62) },
4351 { USB_DEVICE_WACOM(0x63) },
4352 { USB_DEVICE_WACOM(0x64) },
4353 { USB_DEVICE_WACOM(0x65) },
4354 { USB_DEVICE_WACOM(0x69) },
4355 { USB_DEVICE_WACOM(0x6A) },
4356 { USB_DEVICE_WACOM(0x6B) },
4357 { BT_DEVICE_WACOM(0x81) },
4358 { USB_DEVICE_WACOM(0x84) },
4359 { USB_DEVICE_WACOM(0x90) },
4360 { USB_DEVICE_WACOM(0x93) },
4361 { USB_DEVICE_WACOM(0x97) },
4362 { USB_DEVICE_WACOM(0x9A) },
4363 { USB_DEVICE_WACOM(0x9F) },
4364 { USB_DEVICE_WACOM(0xB0) },
4365 { USB_DEVICE_WACOM(0xB1) },
4366 { USB_DEVICE_WACOM(0xB2) },
4367 { USB_DEVICE_WACOM(0xB3) },
4368 { USB_DEVICE_WACOM(0xB4) },
4369 { USB_DEVICE_WACOM(0xB5) },
4370 { USB_DEVICE_WACOM(0xB7) },
4371 { USB_DEVICE_WACOM(0xB8) },
4372 { USB_DEVICE_WACOM(0xB9) },
4373 { USB_DEVICE_WACOM(0xBA) },
4374 { USB_DEVICE_WACOM(0xBB) },
4375 { USB_DEVICE_WACOM(0xBC) },
4376 { BT_DEVICE_WACOM(0xBD) },
4377 { USB_DEVICE_WACOM(0xC0) },
4378 { USB_DEVICE_WACOM(0xC2) },
4379 { USB_DEVICE_WACOM(0xC4) },
4380 { USB_DEVICE_WACOM(0xC5) },
4381 { USB_DEVICE_WACOM(0xC6) },
4382 { USB_DEVICE_WACOM(0xC7) },
4383 { USB_DEVICE_WACOM(0xCC) },
4384 { USB_DEVICE_WACOM(0xCE) },
4385 { USB_DEVICE_WACOM(0xD0) },
4386 { USB_DEVICE_WACOM(0xD1) },
4387 { USB_DEVICE_WACOM(0xD2) },
4388 { USB_DEVICE_WACOM(0xD3) },
4389 { USB_DEVICE_WACOM(0xD4) },
4390 { USB_DEVICE_WACOM(0xD5) },
4391 { USB_DEVICE_WACOM(0xD6) },
4392 { USB_DEVICE_WACOM(0xD7) },
4393 { USB_DEVICE_WACOM(0xD8) },
4394 { USB_DEVICE_WACOM(0xDA) },
4395 { USB_DEVICE_WACOM(0xDB) },
4396 { USB_DEVICE_WACOM(0xDD) },
4397 { USB_DEVICE_WACOM(0xDE) },
4398 { USB_DEVICE_WACOM(0xDF) },
4399 { USB_DEVICE_WACOM(0xE2) },
4400 { USB_DEVICE_WACOM(0xE3) },
4401 { USB_DEVICE_WACOM(0xE5) },
4402 { USB_DEVICE_WACOM(0xE6) },
4403 { USB_DEVICE_WACOM(0xEC) },
4404 { USB_DEVICE_WACOM(0xED) },
4405 { USB_DEVICE_WACOM(0xEF) },
4406 { USB_DEVICE_WACOM(0xF0) },
4407 { USB_DEVICE_WACOM(0xF4) },
4408 { USB_DEVICE_WACOM(0xF6) },
4409 { USB_DEVICE_WACOM(0xF8) },
4410 { USB_DEVICE_WACOM(0xFA) },
4411 { USB_DEVICE_WACOM(0xFB) },
4412 { USB_DEVICE_WACOM(0x100) },
4413 { USB_DEVICE_WACOM(0x101) },
4414 { USB_DEVICE_WACOM(0x10D) },
4415 { USB_DEVICE_WACOM(0x10E) },
4416 { USB_DEVICE_WACOM(0x10F) },
4417 { USB_DEVICE_WACOM(0x116) },
4418 { USB_DEVICE_WACOM(0x12C) },
4419 { USB_DEVICE_WACOM(0x300) },
4420 { USB_DEVICE_WACOM(0x301) },
4421 { USB_DEVICE_WACOM(0x302) },
4422 { USB_DEVICE_WACOM(0x303) },
4423 { USB_DEVICE_WACOM(0x304) },
4424 { USB_DEVICE_WACOM(0x307) },
4425 { USB_DEVICE_WACOM(0x309) },
4426 { USB_DEVICE_WACOM(0x30A) },
4427 { USB_DEVICE_WACOM(0x30C) },
4428 { USB_DEVICE_WACOM(0x30E) },
4429 { USB_DEVICE_WACOM(0x314) },
4430 { USB_DEVICE_WACOM(0x315) },
4431 { USB_DEVICE_WACOM(0x317) },
4432 { USB_DEVICE_WACOM(0x318) },
4433 { USB_DEVICE_WACOM(0x319) },
4434 { USB_DEVICE_WACOM(0x323) },
4435 { USB_DEVICE_WACOM(0x325) },
4436 { USB_DEVICE_WACOM(0x326) },
4437 { USB_DEVICE_WACOM(0x32A) },
4438 { USB_DEVICE_WACOM(0x32B) },
4439 { USB_DEVICE_WACOM(0x32C) },
4440 { USB_DEVICE_WACOM(0x32F) },
4441 { USB_DEVICE_WACOM(0x331) },
4442 { USB_DEVICE_WACOM(0x333) },
4443 { USB_DEVICE_WACOM(0x335) },
4444 { USB_DEVICE_WACOM(0x336) },
4445 { USB_DEVICE_WACOM(0x33B) },
4446 { USB_DEVICE_WACOM(0x33C) },
4447 { USB_DEVICE_WACOM(0x33D) },
4448 { USB_DEVICE_WACOM(0x33E) },
4449 { USB_DEVICE_WACOM(0x343) },
4450 { BT_DEVICE_WACOM(0x360) },
4451 { BT_DEVICE_WACOM(0x361) },
4452 { USB_DEVICE_WACOM(0x4001) },
4453 { USB_DEVICE_WACOM(0x4004) },
4454 { USB_DEVICE_WACOM(0x5000) },
4455 { USB_DEVICE_WACOM(0x5002) },
4456 { USB_DEVICE_LENOVO(0x6004) },
4458 { USB_DEVICE_WACOM(HID_ANY_ID
) },
4459 { I2C_DEVICE_WACOM(HID_ANY_ID
) },
4460 { BT_DEVICE_WACOM(HID_ANY_ID
) },
4463 MODULE_DEVICE_TABLE(hid
, wacom_ids
);