Lines Matching +full:0 +full:- +full:1023
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * USB Wacom tablet support - Wacom specific code
29 * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo
60 bool changed = battery->bat_status != bat_status || in __wacom_notify_battery()
61 battery->battery_capacity != bat_capacity || in __wacom_notify_battery()
62 battery->bat_charging != bat_charging || in __wacom_notify_battery()
63 battery->bat_connected != bat_connected || in __wacom_notify_battery()
64 battery->ps_connected != ps_connected; in __wacom_notify_battery()
67 battery->bat_status = bat_status; in __wacom_notify_battery()
68 battery->battery_capacity = bat_capacity; in __wacom_notify_battery()
69 battery->bat_charging = bat_charging; in __wacom_notify_battery()
70 battery->bat_connected = bat_connected; in __wacom_notify_battery()
71 battery->ps_connected = ps_connected; in __wacom_notify_battery()
73 if (battery->battery) in __wacom_notify_battery()
74 power_supply_changed(battery->battery); in __wacom_notify_battery()
84 __wacom_notify_battery(&wacom->battery, bat_status, bat_capacity, in wacom_notify_battery()
90 unsigned char *data = wacom->data; in wacom_penpartner_irq()
91 struct input_dev *input = wacom->pen_input; in wacom_penpartner_irq()
93 switch (data[0]) { in wacom_penpartner_irq()
95 if (data[5] & 0x80) { in wacom_penpartner_irq()
96 wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_penpartner_irq()
97 wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; in wacom_penpartner_irq()
98 input_report_key(input, wacom->tool[0], 1); in wacom_penpartner_irq()
99 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_penpartner_irq()
103 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); in wacom_penpartner_irq()
104 input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); in wacom_penpartner_irq()
106 input_report_key(input, wacom->tool[0], 0); in wacom_penpartner_irq()
107 input_report_abs(input, ABS_MISC, 0); /* report tool id */ in wacom_penpartner_irq()
108 input_report_abs(input, ABS_PRESSURE, -1); in wacom_penpartner_irq()
109 input_report_key(input, BTN_TOUCH, 0); in wacom_penpartner_irq()
119 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); in wacom_penpartner_irq()
120 input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); in wacom_penpartner_irq()
124 dev_dbg(input->dev.parent, in wacom_penpartner_irq()
125 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_penpartner_irq()
126 return 0; in wacom_penpartner_irq()
134 struct wacom_features *features = &wacom->features; in wacom_pl_irq()
135 unsigned char *data = wacom->data; in wacom_pl_irq()
136 struct input_dev *input = wacom->pen_input; in wacom_pl_irq()
139 if (data[0] != WACOM_REPORT_PENABLED) { in wacom_pl_irq()
140 dev_dbg(input->dev.parent, in wacom_pl_irq()
141 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_pl_irq()
142 return 0; in wacom_pl_irq()
145 prox = data[1] & 0x40; in wacom_pl_irq()
147 if (!wacom->id[0]) { in wacom_pl_irq()
148 if ((data[0] & 0x10) || (data[4] & 0x20)) { in wacom_pl_irq()
149 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_pl_irq()
150 wacom->id[0] = ERASER_DEVICE_ID; in wacom_pl_irq()
153 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
154 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
159 * mis-detected the type and notice that STYLUS2 isn't set in wacom_pl_irq()
162 if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { in wacom_pl_irq()
163 input_report_key(input, BTN_TOOL_RUBBER, 0); in wacom_pl_irq()
164 input_report_abs(input, ABS_MISC, 0); in wacom_pl_irq()
166 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
167 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
172 if (features->pressure_max > 255) in wacom_pl_irq()
174 pressure += (features->pressure_max + 1) / 2; in wacom_pl_irq()
176 input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); in wacom_pl_irq()
177 input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); in wacom_pl_irq()
180 input_report_key(input, BTN_TOUCH, data[4] & 0x08); in wacom_pl_irq()
181 input_report_key(input, BTN_STYLUS, data[4] & 0x10); in wacom_pl_irq()
183 input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); in wacom_pl_irq()
187 wacom->id[0] = 0; in wacom_pl_irq()
188 input_report_key(input, wacom->tool[0], prox); in wacom_pl_irq()
189 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_pl_irq()
195 unsigned char *data = wacom->data; in wacom_ptu_irq()
196 struct input_dev *input = wacom->pen_input; in wacom_ptu_irq()
198 if (data[0] != WACOM_REPORT_PENABLED) { in wacom_ptu_irq()
199 dev_dbg(input->dev.parent, in wacom_ptu_irq()
200 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_ptu_irq()
201 return 0; in wacom_ptu_irq()
204 if (data[1] & 0x04) { in wacom_ptu_irq()
205 input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20); in wacom_ptu_irq()
206 input_report_key(input, BTN_TOUCH, data[1] & 0x08); in wacom_ptu_irq()
207 wacom->id[0] = ERASER_DEVICE_ID; in wacom_ptu_irq()
209 input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20); in wacom_ptu_irq()
210 input_report_key(input, BTN_TOUCH, data[1] & 0x01); in wacom_ptu_irq()
211 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_ptu_irq()
213 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_ptu_irq()
217 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_ptu_irq()
218 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_ptu_irq()
224 unsigned char *data = wacom->data; in wacom_dtu_irq()
225 struct input_dev *input = wacom->pen_input; in wacom_dtu_irq()
226 int prox = data[1] & 0x20; in wacom_dtu_irq()
228 dev_dbg(input->dev.parent, in wacom_dtu_irq()
229 "%s: received report #%d", __func__, data[0]); in wacom_dtu_irq()
233 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_dtu_irq()
234 if (wacom->tool[0] == BTN_TOOL_PEN) in wacom_dtu_irq()
235 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtu_irq()
237 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtu_irq()
239 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_dtu_irq()
240 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_dtu_irq()
243 input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]); in wacom_dtu_irq()
244 input_report_key(input, BTN_TOUCH, data[1] & 0x05); in wacom_dtu_irq()
245 if (!prox) /* out-prox */ in wacom_dtu_irq()
246 wacom->id[0] = 0; in wacom_dtu_irq()
247 input_report_key(input, wacom->tool[0], prox); in wacom_dtu_irq()
248 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtu_irq()
254 unsigned char *data = wacom->data; in wacom_dtus_irq()
255 struct input_dev *input = wacom->pen_input; in wacom_dtus_irq()
256 unsigned short prox, pressure = 0; in wacom_dtus_irq()
258 if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { in wacom_dtus_irq()
259 dev_dbg(input->dev.parent, in wacom_dtus_irq()
260 "%s: received unknown report #%d", __func__, data[0]); in wacom_dtus_irq()
261 return 0; in wacom_dtus_irq()
262 } else if (data[0] == WACOM_REPORT_DTUSPAD) { in wacom_dtus_irq()
263 input = wacom->pad_input; in wacom_dtus_irq()
264 input_report_key(input, BTN_0, (data[1] & 0x01)); in wacom_dtus_irq()
265 input_report_key(input, BTN_1, (data[1] & 0x02)); in wacom_dtus_irq()
266 input_report_key(input, BTN_2, (data[1] & 0x04)); in wacom_dtus_irq()
267 input_report_key(input, BTN_3, (data[1] & 0x08)); in wacom_dtus_irq()
269 data[1] & 0x0f ? PAD_DEVICE_ID : 0); in wacom_dtus_irq()
272 prox = data[1] & 0x80; in wacom_dtus_irq()
276 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_dtus_irq()
277 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtus_irq()
281 wacom->tool[0] = BTN_TOOL_PEN; in wacom_dtus_irq()
282 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtus_irq()
287 input_report_key(input, BTN_STYLUS, data[1] & 0x20); in wacom_dtus_irq()
288 input_report_key(input, BTN_STYLUS2, data[1] & 0x40); in wacom_dtus_irq()
291 pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff); in wacom_dtus_irq()
295 if (!prox) /* out-prox */ in wacom_dtus_irq()
296 wacom->id[0] = 0; in wacom_dtus_irq()
297 input_report_key(input, wacom->tool[0], prox); in wacom_dtus_irq()
298 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtus_irq()
305 struct wacom_features *features = &wacom->features; in wacom_graphire_irq()
306 unsigned char *data = wacom->data; in wacom_graphire_irq()
307 struct input_dev *input = wacom->pen_input; in wacom_graphire_irq()
308 struct input_dev *pad_input = wacom->pad_input; in wacom_graphire_irq()
311 int rw = 0; in wacom_graphire_irq()
312 int retval = 0; in wacom_graphire_irq()
314 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
315 if (data[0] != WACOM_REPORT_PENABLED_BT) { in wacom_graphire_irq()
316 dev_dbg(input->dev.parent, in wacom_graphire_irq()
318 data[0]); in wacom_graphire_irq()
321 } else if (data[0] != WACOM_REPORT_PENABLED) { in wacom_graphire_irq()
322 dev_dbg(input->dev.parent, in wacom_graphire_irq()
323 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_graphire_irq()
327 prox = data[1] & 0x80; in wacom_graphire_irq()
328 if (prox || wacom->id[0]) { in wacom_graphire_irq()
332 case 0: /* Pen */ in wacom_graphire_irq()
333 wacom->tool[0] = BTN_TOOL_PEN; in wacom_graphire_irq()
334 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_graphire_irq()
338 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_graphire_irq()
339 wacom->id[0] = ERASER_DEVICE_ID; in wacom_graphire_irq()
343 input_report_key(input, BTN_MIDDLE, data[1] & 0x04); in wacom_graphire_irq()
347 wacom->tool[0] = BTN_TOOL_MOUSE; in wacom_graphire_irq()
348 wacom->id[0] = CURSOR_DEVICE_ID; in wacom_graphire_irq()
354 if (wacom->tool[0] != BTN_TOOL_MOUSE) { in wacom_graphire_irq()
355 if (features->type == GRAPHIRE_BT) in wacom_graphire_irq()
357 (((__u16) (data[1] & 0x08)) << 5)); in wacom_graphire_irq()
360 ((data[7] & 0x03) << 8)); in wacom_graphire_irq()
361 input_report_key(input, BTN_TOUCH, data[1] & 0x01); in wacom_graphire_irq()
362 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_graphire_irq()
363 input_report_key(input, BTN_STYLUS2, data[1] & 0x04); in wacom_graphire_irq()
365 input_report_key(input, BTN_LEFT, data[1] & 0x01); in wacom_graphire_irq()
366 input_report_key(input, BTN_RIGHT, data[1] & 0x02); in wacom_graphire_irq()
367 if (features->type == WACOM_G4 || in wacom_graphire_irq()
368 features->type == WACOM_MO) { in wacom_graphire_irq()
369 input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); in wacom_graphire_irq()
370 rw = (data[7] & 0x04) - (data[7] & 0x03); in wacom_graphire_irq()
371 } else if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
373 rw = 44 - (data[6] >> 2); in wacom_graphire_irq()
374 rw = clamp_val(rw, 0, 31); in wacom_graphire_irq()
379 data[1] & 0x04); in wacom_graphire_irq()
380 rw = (data[6] & 0x01) ? -1 : in wacom_graphire_irq()
381 (data[6] & 0x02) ? 1 : 0; in wacom_graphire_irq()
383 rw = 0; in wacom_graphire_irq()
386 input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); in wacom_graphire_irq()
387 rw = -(signed char)data[6]; in wacom_graphire_irq()
393 wacom->id[0] = 0; in wacom_graphire_irq()
394 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_graphire_irq()
395 input_report_key(input, wacom->tool[0], prox); in wacom_graphire_irq()
400 switch (features->type) { in wacom_graphire_irq()
402 prox = data[7] & 0xf8; in wacom_graphire_irq()
403 if (prox || wacom->id[1]) { in wacom_graphire_irq()
404 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
405 input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); in wacom_graphire_irq()
406 input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); in wacom_graphire_irq()
407 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); in wacom_graphire_irq()
410 wacom->id[1] = 0; in wacom_graphire_irq()
411 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
417 prox = (data[7] & 0xf8) || data[8]; in wacom_graphire_irq()
418 if (prox || wacom->id[1]) { in wacom_graphire_irq()
419 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
420 input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); in wacom_graphire_irq()
421 input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); in wacom_graphire_irq()
422 input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); in wacom_graphire_irq()
423 input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); in wacom_graphire_irq()
424 input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); in wacom_graphire_irq()
426 wacom->id[1] = 0; in wacom_graphire_irq()
427 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
432 prox = data[7] & 0x03; in wacom_graphire_irq()
433 if (prox || wacom->id[1]) { in wacom_graphire_irq()
434 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
435 input_report_key(pad_input, BTN_0, (data[7] & 0x02)); in wacom_graphire_irq()
436 input_report_key(pad_input, BTN_1, (data[7] & 0x01)); in wacom_graphire_irq()
438 wacom->id[1] = 0; in wacom_graphire_irq()
439 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
446 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
447 rw = (data[7] >> 2 & 0x07); in wacom_graphire_irq()
461 struct wacom_features *features = &wacom_wac->features; in wacom_intuos_schedule_prox_event()
465 re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); in wacom_intuos_schedule_prox_event()
466 if (features->type == INTUOSHT2) in wacom_intuos_schedule_prox_event()
467 r = re->report_id_hash[WACOM_REPORT_INTUOSHT2_ID]; in wacom_intuos_schedule_prox_event()
469 r = re->report_id_hash[WACOM_REPORT_INTUOS_ID1]; in wacom_intuos_schedule_prox_event()
471 hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); in wacom_intuos_schedule_prox_event()
477 struct wacom_features *features = &wacom->features; in wacom_intuos_pad()
478 unsigned char *data = wacom->data; in wacom_intuos_pad()
479 struct input_dev *input = wacom->pad_input; in wacom_intuos_pad()
481 int buttons = 0, nbuttons = features->numbered_buttons; in wacom_intuos_pad()
482 int keys = 0, nkeys = 0; in wacom_intuos_pad()
483 int ring1 = 0, ring2 = 0; in wacom_intuos_pad()
484 int strip1 = 0, strip2 = 0; in wacom_intuos_pad()
490 if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD || in wacom_intuos_pad()
491 data[0] == WACOM_REPORT_CINTIQPAD)) in wacom_intuos_pad()
492 return 0; in wacom_intuos_pad()
494 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { in wacom_intuos_pad()
495 buttons = (data[3] << 1) | (data[2] & 0x01); in wacom_intuos_pad()
497 } else if (features->type == DTK) { in wacom_intuos_pad()
499 } else if (features->type == WACOM_13HD) { in wacom_intuos_pad()
500 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
501 } else if (features->type == WACOM_24HD) { in wacom_intuos_pad()
511 * ((data[3] & 0x1f) << 8) | data[4]) in wacom_intuos_pad()
514 keys = ((data[3] & 0x1C) ? 1<<2 : 0) | in wacom_intuos_pad()
515 ((data[4] & 0xE0) ? 1<<1 : 0) | in wacom_intuos_pad()
516 ((data[4] & 0x07) ? 1<<0 : 0); in wacom_intuos_pad()
517 keyboard = !!(data[4] & 0xE0); in wacom_intuos_pad()
518 info = !!(data[3] & 0x1C); in wacom_intuos_pad()
520 if (features->oPid) { in wacom_intuos_pad()
521 mute_touch = !!(data[4] & 0x07); in wacom_intuos_pad()
523 wacom->shared->is_touch_on = in wacom_intuos_pad()
524 !wacom->shared->is_touch_on; in wacom_intuos_pad()
526 wrench = !!(data[4] & 0x07); in wacom_intuos_pad()
528 } else if (features->type == WACOM_27QHD) { in wacom_intuos_pad()
530 keys = data[2] & 0x07; in wacom_intuos_pad()
532 wrench = !!(data[2] & 0x01); in wacom_intuos_pad()
533 keyboard = !!(data[2] & 0x02); in wacom_intuos_pad()
535 if (features->oPid) { in wacom_intuos_pad()
536 mute_touch = !!(data[2] & 0x04); in wacom_intuos_pad()
538 wacom->shared->is_touch_on = in wacom_intuos_pad()
539 !wacom->shared->is_touch_on; in wacom_intuos_pad()
541 menu = !!(data[2] & 0x04); in wacom_intuos_pad()
546 } else if (features->type == CINTIQ_HYBRID) { in wacom_intuos_pad()
552 * d-pad right -> data[4] & 0x10 in wacom_intuos_pad()
553 * d-pad up -> data[4] & 0x20 in wacom_intuos_pad()
554 * d-pad left -> data[4] & 0x40 in wacom_intuos_pad()
555 * d-pad down -> data[4] & 0x80 in wacom_intuos_pad()
556 * d-pad center -> data[3] & 0x01 in wacom_intuos_pad()
558 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
559 } else if (features->type == CINTIQ_COMPANION_2) { in wacom_intuos_pad()
560 /* d-pad right -> data[2] & 0x10 in wacom_intuos_pad()
561 * d-pad up -> data[2] & 0x20 in wacom_intuos_pad()
562 * d-pad left -> data[2] & 0x40 in wacom_intuos_pad()
563 * d-pad down -> data[2] & 0x80 in wacom_intuos_pad()
564 * d-pad center -> data[1] & 0x01 in wacom_intuos_pad()
567 ((data[1] & 0x04) << 4) | in wacom_intuos_pad()
568 ((data[2] & 0x0F) << 2) | in wacom_intuos_pad()
569 (data[1] & 0x03); in wacom_intuos_pad()
570 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { in wacom_intuos_pad()
578 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
581 if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { in wacom_intuos_pad()
582 buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) | in wacom_intuos_pad()
583 (data[6] << 1) | (data[5] & 0x01); in wacom_intuos_pad()
585 if (features->type == WACOM_22HD) { in wacom_intuos_pad()
587 keys = data[9] & 0x07; in wacom_intuos_pad()
589 info = !!(data[9] & 0x01); in wacom_intuos_pad()
590 wrench = !!(data[9] & 0x02); in wacom_intuos_pad()
593 buttons = ((data[6] & 0x10) << 5) | in wacom_intuos_pad()
594 ((data[5] & 0x10) << 4) | in wacom_intuos_pad()
595 ((data[6] & 0x0F) << 4) | in wacom_intuos_pad()
596 (data[5] & 0x0F); in wacom_intuos_pad()
598 strip1 = ((data[1] & 0x1f) << 8) | data[2]; in wacom_intuos_pad()
599 strip2 = ((data[3] & 0x1f) << 8) | data[4]; in wacom_intuos_pad()
602 prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) | in wacom_intuos_pad()
603 (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; in wacom_intuos_pad()
607 for (i = 0; i < nkeys; i++) in wacom_intuos_pad()
615 if (wacom->shared && wacom->shared->touch_input) { in wacom_intuos_pad()
616 input_report_switch(wacom->shared->touch_input, in wacom_intuos_pad()
618 !wacom->shared->is_touch_on); in wacom_intuos_pad()
619 input_sync(wacom->shared->touch_input); in wacom_intuos_pad()
625 input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0); in wacom_intuos_pad()
626 input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0); in wacom_intuos_pad()
628 input_report_key(input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pad()
629 input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pad()
631 input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_pad()
638 return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); in wacom_intuos_id_mangle()
646 case 0x812: /* Inking pen */ in wacom_intuos_get_tool_type()
647 case 0x801: /* Intuos3 Inking pen */ in wacom_intuos_get_tool_type()
648 case 0x12802: /* Intuos4/5 Inking Pen */ in wacom_intuos_get_tool_type()
649 case 0x012: in wacom_intuos_get_tool_type()
653 case 0x822: /* Pen */ in wacom_intuos_get_tool_type()
654 case 0x842: in wacom_intuos_get_tool_type()
655 case 0x852: in wacom_intuos_get_tool_type()
656 case 0x823: /* Intuos3 Grip Pen */ in wacom_intuos_get_tool_type()
657 case 0x813: /* Intuos3 Classic Pen */ in wacom_intuos_get_tool_type()
658 case 0x885: /* Intuos3 Marker Pen */ in wacom_intuos_get_tool_type()
659 case 0x802: /* Intuos4/5 13HD/24HD General Pen */ in wacom_intuos_get_tool_type()
660 case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ in wacom_intuos_get_tool_type()
661 case 0x8e2: /* IntuosHT2 pen */ in wacom_intuos_get_tool_type()
662 case 0x022: in wacom_intuos_get_tool_type()
663 case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ in wacom_intuos_get_tool_type()
664 case 0x10842: /* MobileStudio Pro Pro Pen slim */ in wacom_intuos_get_tool_type()
665 case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ in wacom_intuos_get_tool_type()
666 case 0x16802: /* Cintiq 13HD Pro Pen */ in wacom_intuos_get_tool_type()
667 case 0x18802: /* DTH2242 Pen */ in wacom_intuos_get_tool_type()
668 case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ in wacom_intuos_get_tool_type()
672 case 0x832: /* Stroke pen */ in wacom_intuos_get_tool_type()
673 case 0x032: in wacom_intuos_get_tool_type()
677 case 0x007: /* Mouse 4D and 2D */ in wacom_intuos_get_tool_type()
678 case 0x09c: in wacom_intuos_get_tool_type()
679 case 0x094: in wacom_intuos_get_tool_type()
680 case 0x017: /* Intuos3 2D Mouse */ in wacom_intuos_get_tool_type()
681 case 0x806: /* Intuos4 Mouse */ in wacom_intuos_get_tool_type()
685 case 0x096: /* Lens cursor */ in wacom_intuos_get_tool_type()
686 case 0x097: /* Intuos3 Lens cursor */ in wacom_intuos_get_tool_type()
687 case 0x006: /* Intuos4 Lens cursor */ in wacom_intuos_get_tool_type()
691 case 0x82a: /* Eraser */ in wacom_intuos_get_tool_type()
692 case 0x84a: in wacom_intuos_get_tool_type()
693 case 0x85a: in wacom_intuos_get_tool_type()
694 case 0x91a: in wacom_intuos_get_tool_type()
695 case 0xd1a: in wacom_intuos_get_tool_type()
696 case 0x0fa: in wacom_intuos_get_tool_type()
697 case 0x82b: /* Intuos3 Grip Pen Eraser */ in wacom_intuos_get_tool_type()
698 case 0x81b: /* Intuos3 Classic Pen Eraser */ in wacom_intuos_get_tool_type()
699 case 0x91b: /* Intuos3 Airbrush Eraser */ in wacom_intuos_get_tool_type()
700 case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */ in wacom_intuos_get_tool_type()
701 case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */ in wacom_intuos_get_tool_type()
702 case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ in wacom_intuos_get_tool_type()
703 case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */ in wacom_intuos_get_tool_type()
704 case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ in wacom_intuos_get_tool_type()
705 case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */ in wacom_intuos_get_tool_type()
706 case 0x1084a: /* MobileStudio Pro Pro Pen slim Eraser */ in wacom_intuos_get_tool_type()
707 case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */ in wacom_intuos_get_tool_type()
708 case 0x1880a: /* DTH2242 Eraser */ in wacom_intuos_get_tool_type()
709 case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */ in wacom_intuos_get_tool_type()
713 case 0xd12: in wacom_intuos_get_tool_type()
714 case 0x912: in wacom_intuos_get_tool_type()
715 case 0x112: in wacom_intuos_get_tool_type()
716 case 0x913: /* Intuos3 Airbrush */ in wacom_intuos_get_tool_type()
717 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ in wacom_intuos_get_tool_type()
718 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ in wacom_intuos_get_tool_type()
731 struct input_dev *input = wacom->pen_input; in wacom_exit_report()
732 struct wacom_features *features = &wacom->features; in wacom_exit_report()
733 unsigned char *data = wacom->data; in wacom_exit_report()
734 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_exit_report()
738 * when in-prox next time in wacom_exit_report()
740 input_report_abs(input, ABS_X, 0); in wacom_exit_report()
741 input_report_abs(input, ABS_Y, 0); in wacom_exit_report()
742 input_report_abs(input, ABS_DISTANCE, 0); in wacom_exit_report()
743 input_report_abs(input, ABS_TILT_X, 0); in wacom_exit_report()
744 input_report_abs(input, ABS_TILT_Y, 0); in wacom_exit_report()
745 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { in wacom_exit_report()
746 input_report_key(input, BTN_LEFT, 0); in wacom_exit_report()
747 input_report_key(input, BTN_MIDDLE, 0); in wacom_exit_report()
748 input_report_key(input, BTN_RIGHT, 0); in wacom_exit_report()
749 input_report_key(input, BTN_SIDE, 0); in wacom_exit_report()
750 input_report_key(input, BTN_EXTRA, 0); in wacom_exit_report()
751 input_report_abs(input, ABS_THROTTLE, 0); in wacom_exit_report()
752 input_report_abs(input, ABS_RZ, 0); in wacom_exit_report()
754 input_report_abs(input, ABS_PRESSURE, 0); in wacom_exit_report()
755 input_report_key(input, BTN_STYLUS, 0); in wacom_exit_report()
756 input_report_key(input, BTN_STYLUS2, 0); in wacom_exit_report()
757 input_report_key(input, BTN_TOUCH, 0); in wacom_exit_report()
758 input_report_abs(input, ABS_WHEEL, 0); in wacom_exit_report()
759 if (features->type >= INTUOS3S) in wacom_exit_report()
760 input_report_abs(input, ABS_Z, 0); in wacom_exit_report()
762 input_report_key(input, wacom->tool[idx], 0); in wacom_exit_report()
763 input_report_abs(input, ABS_MISC, 0); /* reset tool id */ in wacom_exit_report()
764 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_exit_report()
765 wacom->id[idx] = 0; in wacom_exit_report()
770 struct wacom_features *features = &wacom->features; in wacom_intuos_inout()
771 unsigned char *data = wacom->data; in wacom_intuos_inout()
772 struct input_dev *input = wacom->pen_input; in wacom_intuos_inout()
773 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_inout()
775 if (!(((data[1] & 0xfc) == 0xc0) || /* in prox */ in wacom_intuos_inout()
776 ((data[1] & 0xfe) == 0x20) || /* in range */ in wacom_intuos_inout()
777 ((data[1] & 0xfe) == 0x80))) /* out prox */ in wacom_intuos_inout()
778 return 0; in wacom_intuos_inout()
781 if ((data[1] & 0xfc) == 0xc0) { in wacom_intuos_inout()
783 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + in wacom_intuos_inout()
787 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | in wacom_intuos_inout()
788 ((data[7] & 0x0f) << 16) | ((data[8] & 0xf0) << 8); in wacom_intuos_inout()
790 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); in wacom_intuos_inout()
792 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
797 if ((data[1] & 0xfe) == 0x20) { in wacom_intuos_inout()
798 if (features->type != INTUOSHT2) in wacom_intuos_inout()
799 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
802 if (wacom->reporting_data) { in wacom_intuos_inout()
803 input_report_key(input, BTN_TOUCH, 0); in wacom_intuos_inout()
804 input_report_abs(input, ABS_PRESSURE, 0); in wacom_intuos_inout()
805 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); in wacom_intuos_inout()
812 if ((data[1] & 0xfe) == 0x80) { in wacom_intuos_inout()
813 wacom->shared->stylus_in_proximity = false; in wacom_intuos_inout()
814 wacom->reporting_data = false; in wacom_intuos_inout()
817 if (!wacom->id[idx]) in wacom_intuos_inout()
824 return 0; in wacom_intuos_inout()
829 return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1); in report_touch_events()
834 return (wacom->shared->touch_down && touch_arbitration); in delay_pen_events()
839 struct wacom_features *features = &wacom->features; in wacom_intuos_general()
840 unsigned char *data = wacom->data; in wacom_intuos_general()
841 struct input_dev *input = wacom->pen_input; in wacom_intuos_general()
842 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_general()
843 unsigned char type = (data[1] >> 1) & 0x0F; in wacom_intuos_general()
846 if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_CINTIQ && in wacom_intuos_general()
847 data[0] != WACOM_REPORT_INTUOS_PEN) in wacom_intuos_general()
848 return 0; in wacom_intuos_general()
854 if (!wacom->id[idx]) { in wacom_intuos_general()
864 if ((!((wacom->id[idx] >> 16) & 0x01) && in wacom_intuos_general()
865 (features->type == WACOM_21UX2)) || in wacom_intuos_general()
867 (wacom->tool[idx] == BTN_TOOL_LENS && in wacom_intuos_general()
868 (features->type == INTUOS3 || in wacom_intuos_general()
869 features->type == INTUOS3S || in wacom_intuos_general()
870 features->type == INTUOS4 || in wacom_intuos_general()
871 features->type == INTUOS4S || in wacom_intuos_general()
872 features->type == INTUOS5 || in wacom_intuos_general()
873 features->type == INTUOS5S || in wacom_intuos_general()
874 features->type == INTUOSPM || in wacom_intuos_general()
875 features->type == INTUOSPS)) || in wacom_intuos_general()
877 (features->type == CINTIQ && !(data[1] & 0x40))) in wacom_intuos_general()
883 if (features->type < INTUOS3S) { in wacom_intuos_general()
888 if (features->type == INTUOSHT2) in wacom_intuos_general()
889 distance = features->distance_max - distance; in wacom_intuos_general()
895 case 0x00: in wacom_intuos_general()
896 case 0x01: in wacom_intuos_general()
897 case 0x02: in wacom_intuos_general()
898 case 0x03: in wacom_intuos_general()
900 t = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | (data[1] & 1); in wacom_intuos_general()
901 if (features->pressure_max < 2047) in wacom_intuos_general()
904 if (features->type != INTUOSHT2) { in wacom_intuos_general()
906 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
907 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
914 case 0x0a: in wacom_intuos_general()
919 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
920 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
923 case 0x05: in wacom_intuos_general()
925 if (features->type >= INTUOS3S) { in wacom_intuos_general()
928 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : in wacom_intuos_general()
929 ((t-1) / 2 + 450)) : (450 - t / 2) ; in wacom_intuos_general()
934 input_report_abs(input, ABS_RZ, (data[7] & 0x20) ? in wacom_intuos_general()
935 ((t - 1) / 2) : -t / 2); in wacom_intuos_general()
939 case 0x04: in wacom_intuos_general()
941 input_report_key(input, BTN_LEFT, data[8] & 0x01); in wacom_intuos_general()
942 input_report_key(input, BTN_MIDDLE, data[8] & 0x02); in wacom_intuos_general()
943 input_report_key(input, BTN_RIGHT, data[8] & 0x04); in wacom_intuos_general()
945 input_report_key(input, BTN_SIDE, data[8] & 0x20); in wacom_intuos_general()
946 input_report_key(input, BTN_EXTRA, data[8] & 0x10); in wacom_intuos_general()
948 input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); in wacom_intuos_general()
951 case 0x06: in wacom_intuos_general()
953 input_report_key(input, BTN_LEFT, data[6] & 0x01); in wacom_intuos_general()
954 input_report_key(input, BTN_MIDDLE, data[6] & 0x02); in wacom_intuos_general()
955 input_report_key(input, BTN_RIGHT, data[6] & 0x04); in wacom_intuos_general()
956 input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) in wacom_intuos_general()
957 - ((data[7] & 0x40) >> 6)); in wacom_intuos_general()
958 input_report_key(input, BTN_SIDE, data[6] & 0x08); in wacom_intuos_general()
959 input_report_key(input, BTN_EXTRA, data[6] & 0x10); in wacom_intuos_general()
962 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
963 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
966 case 0x08: in wacom_intuos_general()
967 if (wacom->tool[idx] == BTN_TOOL_MOUSE) { in wacom_intuos_general()
969 input_report_key(input, BTN_LEFT, data[8] & 0x04); in wacom_intuos_general()
970 input_report_key(input, BTN_MIDDLE, data[8] & 0x08); in wacom_intuos_general()
971 input_report_key(input, BTN_RIGHT, data[8] & 0x10); in wacom_intuos_general()
972 input_report_rel(input, REL_WHEEL, (data[8] & 0x01) in wacom_intuos_general()
973 - ((data[8] & 0x02) >> 1)); in wacom_intuos_general()
976 if (features->type >= INTUOS3S && features->type <= INTUOS3L) { in wacom_intuos_general()
977 input_report_key(input, BTN_SIDE, data[8] & 0x40); in wacom_intuos_general()
978 input_report_key(input, BTN_EXTRA, data[8] & 0x20); in wacom_intuos_general()
981 else if (wacom->tool[idx] == BTN_TOOL_LENS) { in wacom_intuos_general()
983 input_report_key(input, BTN_LEFT, data[8] & 0x01); in wacom_intuos_general()
984 input_report_key(input, BTN_MIDDLE, data[8] & 0x02); in wacom_intuos_general()
985 input_report_key(input, BTN_RIGHT, data[8] & 0x04); in wacom_intuos_general()
986 input_report_key(input, BTN_SIDE, data[8] & 0x10); in wacom_intuos_general()
987 input_report_key(input, BTN_EXTRA, data[8] & 0x08); in wacom_intuos_general()
991 case 0x07: in wacom_intuos_general()
992 case 0x09: in wacom_intuos_general()
993 case 0x0b: in wacom_intuos_general()
994 case 0x0c: in wacom_intuos_general()
995 case 0x0d: in wacom_intuos_general()
996 case 0x0e: in wacom_intuos_general()
997 case 0x0f: in wacom_intuos_general()
1003 wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */ in wacom_intuos_general()
1004 input_report_key(input, wacom->tool[idx], 1); in wacom_intuos_general()
1005 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_intuos_general()
1006 wacom->reporting_data = true; in wacom_intuos_general()
1012 unsigned char *data = wacom->data; in wacom_intuos_irq()
1013 struct input_dev *input = wacom->pen_input; in wacom_intuos_irq()
1016 if (data[0] != WACOM_REPORT_PENABLED && in wacom_intuos_irq()
1017 data[0] != WACOM_REPORT_INTUOS_ID1 && in wacom_intuos_irq()
1018 data[0] != WACOM_REPORT_INTUOS_ID2 && in wacom_intuos_irq()
1019 data[0] != WACOM_REPORT_INTUOSPAD && in wacom_intuos_irq()
1020 data[0] != WACOM_REPORT_INTUOS_PEN && in wacom_intuos_irq()
1021 data[0] != WACOM_REPORT_CINTIQ && in wacom_intuos_irq()
1022 data[0] != WACOM_REPORT_CINTIQPAD && in wacom_intuos_irq()
1023 data[0] != WACOM_REPORT_INTUOS5PAD) { in wacom_intuos_irq()
1024 dev_dbg(input->dev.parent, in wacom_intuos_irq()
1025 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_intuos_irq()
1026 return 0; in wacom_intuos_irq()
1037 return result - 1; in wacom_intuos_irq()
1042 return result - 1; in wacom_intuos_irq()
1044 return 0; in wacom_intuos_irq()
1049 unsigned char *data = wacom_wac->data; in wacom_remote_irq()
1052 struct wacom_remote *remote = wacom->remote; in wacom_remote_irq()
1055 int i, index = -1; in wacom_remote_irq()
1058 if (data[0] != WACOM_REPORT_REMOTE) { in wacom_remote_irq()
1059 hid_dbg(wacom->hdev, "%s: received unknown report #%d", in wacom_remote_irq()
1060 __func__, data[0]); in wacom_remote_irq()
1061 return 0; in wacom_remote_irq()
1065 wacom_wac->id[0] = PAD_DEVICE_ID; in wacom_remote_irq()
1067 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_irq()
1069 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_irq()
1070 if (remote->remotes[i].serial == serial) { in wacom_remote_irq()
1076 if (index < 0 || !remote->remotes[index].registered) in wacom_remote_irq()
1079 input = remote->remotes[index].input; in wacom_remote_irq()
1081 input_report_key(input, BTN_0, (data[9] & 0x01)); in wacom_remote_irq()
1082 input_report_key(input, BTN_1, (data[9] & 0x02)); in wacom_remote_irq()
1083 input_report_key(input, BTN_2, (data[9] & 0x04)); in wacom_remote_irq()
1084 input_report_key(input, BTN_3, (data[9] & 0x08)); in wacom_remote_irq()
1085 input_report_key(input, BTN_4, (data[9] & 0x10)); in wacom_remote_irq()
1086 input_report_key(input, BTN_5, (data[9] & 0x20)); in wacom_remote_irq()
1087 input_report_key(input, BTN_6, (data[9] & 0x40)); in wacom_remote_irq()
1088 input_report_key(input, BTN_7, (data[9] & 0x80)); in wacom_remote_irq()
1090 input_report_key(input, BTN_8, (data[10] & 0x01)); in wacom_remote_irq()
1091 input_report_key(input, BTN_9, (data[10] & 0x02)); in wacom_remote_irq()
1092 input_report_key(input, BTN_A, (data[10] & 0x04)); in wacom_remote_irq()
1093 input_report_key(input, BTN_B, (data[10] & 0x08)); in wacom_remote_irq()
1094 input_report_key(input, BTN_C, (data[10] & 0x10)); in wacom_remote_irq()
1095 input_report_key(input, BTN_X, (data[10] & 0x20)); in wacom_remote_irq()
1096 input_report_key(input, BTN_Y, (data[10] & 0x40)); in wacom_remote_irq()
1097 input_report_key(input, BTN_Z, (data[10] & 0x80)); in wacom_remote_irq()
1099 input_report_key(input, BTN_BASE, (data[11] & 0x01)); in wacom_remote_irq()
1100 input_report_key(input, BTN_BASE2, (data[11] & 0x02)); in wacom_remote_irq()
1102 if (data[12] & 0x80) in wacom_remote_irq()
1103 input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f) - 1); in wacom_remote_irq()
1105 input_report_abs(input, ABS_WHEEL, 0); in wacom_remote_irq()
1107 bat_percent = data[7] & 0x7f; in wacom_remote_irq()
1108 bat_charging = !!(data[7] & 0x80); in wacom_remote_irq()
1110 if (data[9] | data[10] | (data[11] & 0x03) | data[12]) in wacom_remote_irq()
1113 input_report_abs(input, ABS_MISC, 0); in wacom_remote_irq()
1120 touch_ring_mode = (data[11] & 0xC0) >> 6; in wacom_remote_irq()
1122 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_irq()
1123 if (remote->remotes[i].serial == serial) in wacom_remote_irq()
1124 wacom->led.groups[i].select = touch_ring_mode; in wacom_remote_irq()
1127 __wacom_notify_battery(&remote->remotes[index].battery, in wacom_remote_irq()
1132 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_irq()
1133 return 0; in wacom_remote_irq()
1139 unsigned char *data = wacom_wac->data; in wacom_remote_status_irq()
1140 struct wacom_remote *remote = wacom->remote; in wacom_remote_status_irq()
1145 if (data[0] != WACOM_REPORT_DEVICE_LIST) in wacom_remote_status_irq()
1148 memset(&remote_data, 0, sizeof(struct wacom_remote_data)); in wacom_remote_status_irq()
1150 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_status_irq()
1159 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_status_irq()
1161 ret = kfifo_in(&remote->remote_fifo, &remote_data, sizeof(remote_data)); in wacom_remote_status_irq()
1163 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1164 hid_err(wacom->hdev, "Can't queue Remote status event.\n"); in wacom_remote_status_irq()
1168 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1175 int x = x2 - x1; in int_dist()
1176 int y = y2 - y1; in int_dist()
1184 memcpy(wacom->data, data, 10); in wacom_intuos_bt_process_data()
1187 input_sync(wacom->pen_input); in wacom_intuos_bt_process_data()
1188 if (wacom->pad_input) in wacom_intuos_bt_process_data()
1189 input_sync(wacom->pad_input); in wacom_intuos_bt_process_data()
1198 memcpy(data, wacom->data, len); in wacom_intuos_bt_irq()
1200 switch (data[0]) { in wacom_intuos_bt_irq()
1201 case 0x04: in wacom_intuos_bt_irq()
1205 case 0x03: in wacom_intuos_bt_irq()
1211 bat_charging = (power_raw & 0x08) ? 1 : 0; in wacom_intuos_bt_irq()
1212 ps_connected = (power_raw & 0x10) ? 1 : 0; in wacom_intuos_bt_irq()
1213 battery_capacity = batcap_i4[power_raw & 0x07]; in wacom_intuos_bt_irq()
1220 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_bt_irq()
1222 data[0], data[1], len); in wacom_intuos_bt_irq()
1223 return 0; in wacom_intuos_bt_irq()
1225 return 0; in wacom_intuos_bt_irq()
1230 struct input_dev *input = wacom->touch_input; in wacom_wac_finger_count_touches()
1231 unsigned touch_max = wacom->features.touch_max; in wacom_wac_finger_count_touches()
1232 int count = 0; in wacom_wac_finger_count_touches()
1236 return 0; in wacom_wac_finger_count_touches()
1239 return test_bit(BTN_TOUCH, input->key) && in wacom_wac_finger_count_touches()
1242 for (i = 0; i < input->mt->num_slots; i++) { in wacom_wac_finger_count_touches()
1243 struct input_mt_slot *ps = &input->mt->slots[i]; in wacom_wac_finger_count_touches()
1245 if (id >= 0) in wacom_wac_finger_count_touches()
1256 struct input_dev *pen_input = wacom->pen_input; in wacom_intuos_pro2_bt_pen()
1257 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pen()
1260 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1261 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1262 wacom->serial[0] = get_unaligned_le64(&data[99]); in wacom_intuos_pro2_bt_pen()
1263 wacom->id[0] = get_unaligned_le16(&data[107]); in wacom_intuos_pro2_bt_pen()
1267 wacom->serial[0] = get_unaligned_le64(&data[33]); in wacom_intuos_pro2_bt_pen()
1268 wacom->id[0] = get_unaligned_le16(&data[41]); in wacom_intuos_pro2_bt_pen()
1273 if (wacom->serial[0] >> 52 == 1) { in wacom_intuos_pro2_bt_pen()
1274 /* Add back in missing bits of ID for non-USI pens */ in wacom_intuos_pro2_bt_pen()
1275 wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF; in wacom_intuos_pro2_bt_pen()
1278 for (i = 0; i < pen_frames; i++) { in wacom_intuos_pro2_bt_pen()
1280 bool valid = frame[0] & 0x80; in wacom_intuos_pro2_bt_pen()
1281 bool prox = frame[0] & 0x40; in wacom_intuos_pro2_bt_pen()
1282 bool range = frame[0] & 0x20; in wacom_intuos_pro2_bt_pen()
1283 bool invert = frame[0] & 0x10; in wacom_intuos_pro2_bt_pen()
1289 wacom->shared->stylus_in_proximity = false; in wacom_intuos_pro2_bt_pen()
1293 wacom->tool[0] = 0; in wacom_intuos_pro2_bt_pen()
1294 wacom->id[0] = 0; in wacom_intuos_pro2_bt_pen()
1295 wacom->serial[0] = 0; in wacom_intuos_pro2_bt_pen()
1300 if (!wacom->tool[0]) { /* first in range */ in wacom_intuos_pro2_bt_pen()
1303 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_intuos_pro2_bt_pen()
1304 else if (wacom->id[0]) in wacom_intuos_pro2_bt_pen()
1305 wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]); in wacom_intuos_pro2_bt_pen()
1307 wacom->tool[0] = BTN_TOOL_PEN; in wacom_intuos_pro2_bt_pen()
1313 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1314 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1321 rotation -= 1800; in wacom_intuos_pro2_bt_pen()
1332 if (wacom->tool[0]) { in wacom_intuos_pro2_bt_pen()
1334 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1335 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1337 range ? frame[13] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1340 range ? frame[7] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1343 input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x09); in wacom_intuos_pro2_bt_pen()
1344 input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02); in wacom_intuos_pro2_bt_pen()
1345 input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04); in wacom_intuos_pro2_bt_pen()
1347 input_report_key(pen_input, wacom->tool[0], prox); in wacom_intuos_pro2_bt_pen()
1348 input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]); in wacom_intuos_pro2_bt_pen()
1350 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */ in wacom_intuos_pro2_bt_pen()
1353 wacom->shared->stylus_in_proximity = prox; in wacom_intuos_pro2_bt_pen()
1365 struct input_dev *touch_input = wacom->touch_input; in wacom_intuos_pro2_bt_touch()
1366 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_touch()
1370 for (i = 0; i < finger_frames; i++) { in wacom_intuos_pro2_bt_touch()
1372 int current_num_contacts = frame[0] & 0x7F; in wacom_intuos_pro2_bt_touch()
1375 if (!(frame[0] & 0x80)) in wacom_intuos_pro2_bt_touch()
1380 * packet in series will have non-zero current_num_contacts. in wacom_intuos_pro2_bt_touch()
1383 wacom->num_contacts_left = current_num_contacts; in wacom_intuos_pro2_bt_touch()
1385 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_intuos_pro2_bt_touch()
1387 for (j = 0; j < contacts_to_send; j++) { in wacom_intuos_pro2_bt_touch()
1389 int slot = input_mt_get_slot_by_key(touch_input, touch[0]); in wacom_intuos_pro2_bt_touch()
1395 if (slot < 0) in wacom_intuos_pro2_bt_touch()
1399 input_mt_report_slot_state(touch_input, MT_TOOL_FINGER, touch[1] & 0x01); in wacom_intuos_pro2_bt_touch()
1409 wacom->num_contacts_left -= contacts_to_send; in wacom_intuos_pro2_bt_touch()
1410 if (wacom->num_contacts_left <= 0) { in wacom_intuos_pro2_bt_touch()
1411 wacom->num_contacts_left = 0; in wacom_intuos_pro2_bt_touch()
1412 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_intuos_pro2_bt_touch()
1417 if (wacom->num_contacts_left == 0) { in wacom_intuos_pro2_bt_touch()
1428 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_pro2_bt_pad()
1429 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pad()
1430 int nbuttons = wacom->features.numbered_buttons; in wacom_intuos_pro2_bt_pad()
1433 int center = (data[281] & 0x40) >> 6; in wacom_intuos_pro2_bt_pad()
1434 int ring = data[285] & 0x7F; in wacom_intuos_pro2_bt_pad()
1435 bool ringstatus = data[285] & 0x80; in wacom_intuos_pro2_bt_pad()
1438 /* Fix touchring data: userspace expects 0 at left and increasing clockwise */ in wacom_intuos_pro2_bt_pad()
1439 ring = 71 - ring; in wacom_intuos_pro2_bt_pad()
1442 ring -= 72; in wacom_intuos_pro2_bt_pad()
1445 expresskeys | (center << (nbuttons - 1))); in wacom_intuos_pro2_bt_pad()
1447 input_report_abs(pad_input, ABS_WHEEL, ringstatus ? ring : 0); in wacom_intuos_pro2_bt_pad()
1449 input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pro2_bt_pad()
1450 input_report_abs(pad_input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pro2_bt_pad()
1451 input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_pro2_bt_pad()
1458 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_battery()
1460 bool chg = data[284] & 0x80; in wacom_intuos_pro2_bt_battery()
1461 int battery_status = data[284] & 0x7F; in wacom_intuos_pro2_bt_battery()
1469 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_gen3_bt_pad()
1470 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_pad()
1476 input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0); in wacom_intuos_gen3_bt_pad()
1477 input_report_abs(pad_input, ABS_MISC, buttons ? PAD_DEVICE_ID : 0); in wacom_intuos_gen3_bt_pad()
1478 input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_gen3_bt_pad()
1485 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_battery()
1487 bool chg = data[45] & 0x80; in wacom_intuos_gen3_bt_battery()
1488 int battery_status = data[45] & 0x7F; in wacom_intuos_gen3_bt_battery()
1496 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_irq()
1498 if (data[0] != 0x80 && data[0] != 0x81) { in wacom_intuos_pro2_bt_irq()
1499 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_pro2_bt_irq()
1500 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_intuos_pro2_bt_irq()
1501 return 0; in wacom_intuos_pro2_bt_irq()
1505 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_irq()
1506 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_irq()
1514 return 0; in wacom_intuos_pro2_bt_irq()
1519 struct input_dev *input = wacom->touch_input; in wacom_24hdt_irq()
1520 unsigned char *data = wacom->data; in wacom_24hdt_irq()
1523 int contacts_to_send = 0; in wacom_24hdt_irq()
1528 if (wacom->shared->has_mute_touch_switch && in wacom_24hdt_irq()
1529 !wacom->shared->is_touch_on) { in wacom_24hdt_irq()
1530 if (!wacom->shared->touch_down) in wacom_24hdt_irq()
1531 return 0; in wacom_24hdt_irq()
1534 if (wacom->features.type == WACOM_27QHDT) { in wacom_24hdt_irq()
1538 y_offset = 0; in wacom_24hdt_irq()
1543 * packet in series will have non-zero current_num_contacts. in wacom_24hdt_irq()
1546 wacom->num_contacts_left = current_num_contacts; in wacom_24hdt_irq()
1548 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_24hdt_irq()
1550 for (i = 0; i < contacts_to_send; i++) { in wacom_24hdt_irq()
1552 bool touch = (data[offset] & 0x1) && report_touch_events(wacom); in wacom_24hdt_irq()
1555 if (slot < 0) in wacom_24hdt_irq()
1567 if (wacom->features.type != WACOM_27QHDT) { in wacom_24hdt_irq()
1583 wacom->num_contacts_left -= contacts_to_send; in wacom_24hdt_irq()
1584 if (wacom->num_contacts_left <= 0) { in wacom_24hdt_irq()
1585 wacom->num_contacts_left = 0; in wacom_24hdt_irq()
1586 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_24hdt_irq()
1593 struct input_dev *input = wacom->touch_input; in wacom_mt_touch()
1594 unsigned char *data = wacom->data; in wacom_mt_touch()
1597 int contacts_to_send = 0; in wacom_mt_touch()
1598 int x_offset = 0; in wacom_mt_touch()
1601 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) in wacom_mt_touch()
1602 x_offset = -4; in wacom_mt_touch()
1606 * packet in series will have non-zero current_num_contacts. in wacom_mt_touch()
1609 wacom->num_contacts_left = current_num_contacts; in wacom_mt_touch()
1612 contacts_to_send = min(5, wacom->num_contacts_left); in wacom_mt_touch()
1614 for (i = 0; i < contacts_to_send; i++) { in wacom_mt_touch()
1616 bool touch = (data[offset] & 0x1) && report_touch_events(wacom); in wacom_mt_touch()
1620 if (slot < 0) in wacom_mt_touch()
1634 wacom->num_contacts_left -= contacts_to_send; in wacom_mt_touch()
1635 if (wacom->num_contacts_left <= 0) { in wacom_mt_touch()
1636 wacom->num_contacts_left = 0; in wacom_mt_touch()
1637 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_mt_touch()
1644 struct input_dev *input = wacom->touch_input; in wacom_tpc_mt_touch()
1645 unsigned char *data = wacom->data; in wacom_tpc_mt_touch()
1648 for (i = 0; i < 2; i++) { in wacom_tpc_mt_touch()
1655 int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; in wacom_tpc_mt_touch()
1656 int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; in wacom_tpc_mt_touch()
1665 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_tpc_mt_touch()
1672 unsigned char *data = wacom->data; in wacom_tpc_single_touch()
1673 struct input_dev *input = wacom->touch_input; in wacom_tpc_single_touch()
1675 int x = 0, y = 0; in wacom_tpc_single_touch()
1677 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) in wacom_tpc_single_touch()
1678 return 0; in wacom_tpc_single_touch()
1681 prox = prox && (data[0] & 0x01); in wacom_tpc_single_touch()
1685 prox = prox && (data[2] & 0x01); in wacom_tpc_single_touch()
1689 prox = prox && (data[1] & 0x01); in wacom_tpc_single_touch()
1701 wacom->shared->touch_down = prox; in wacom_tpc_single_touch()
1708 unsigned char *data = wacom->data; in wacom_tpc_pen()
1709 struct input_dev *input = wacom->pen_input; in wacom_tpc_pen()
1710 bool prox = data[1] & 0x20; in wacom_tpc_pen()
1712 if (!wacom->shared->stylus_in_proximity) /* first in prox */ in wacom_tpc_pen()
1714 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_tpc_pen()
1717 wacom->shared->stylus_in_proximity = prox; in wacom_tpc_pen()
1723 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_tpc_pen()
1724 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_tpc_pen()
1727 input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); in wacom_tpc_pen()
1728 input_report_key(input, BTN_TOUCH, data[1] & 0x05); in wacom_tpc_pen()
1729 input_report_key(input, wacom->tool[0], prox); in wacom_tpc_pen()
1733 return 0; in wacom_tpc_pen()
1738 unsigned char *data = wacom->data; in wacom_tpc_irq()
1740 if (wacom->pen_input) { in wacom_tpc_irq()
1741 dev_dbg(wacom->pen_input->dev.parent, in wacom_tpc_irq()
1742 "%s: received report #%d\n", __func__, data[0]); in wacom_tpc_irq()
1745 data[0] == WACOM_REPORT_PENABLED) in wacom_tpc_irq()
1748 else if (wacom->touch_input) { in wacom_tpc_irq()
1749 dev_dbg(wacom->touch_input->dev.parent, in wacom_tpc_irq()
1750 "%s: received report #%d\n", __func__, data[0]); in wacom_tpc_irq()
1760 switch (data[0]) { in wacom_tpc_irq()
1775 return 0; in wacom_tpc_irq()
1781 struct input_absinfo *abs = &input->absinfo[usage->code]; in wacom_offset_rotation()
1782 int range = (abs->maximum - abs->minimum + 1); in wacom_offset_rotation()
1785 if (value > abs->maximum) in wacom_offset_rotation()
1786 value -= range; in wacom_offset_rotation()
1787 else if (value < abs->minimum) in wacom_offset_rotation()
1795 int subpage = (usage & 0xFF00) << 8; in wacom_equivalent_usage()
1796 int subusage = (usage & 0xFF); in wacom_equivalent_usage()
1821 int subpage = (usage & 0xFF00) << 8; in wacom_equivalent_usage()
1822 int subusage = (usage & 0xFF); in wacom_equivalent_usage()
1840 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_map_usage()
1841 struct wacom_features *features = &wacom_wac->features; in wacom_map_usage()
1842 int fmin = field->logical_minimum; in wacom_map_usage()
1843 int fmax = field->logical_maximum; in wacom_map_usage()
1844 unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_map_usage()
1852 fmin += features->offset_left; in wacom_map_usage()
1853 fmax -= features->offset_right; in wacom_map_usage()
1856 fmin += features->offset_top; in wacom_map_usage()
1857 fmax -= features->offset_bottom; in wacom_map_usage()
1860 usage->type = type; in wacom_map_usage()
1861 usage->code = code; in wacom_map_usage()
1863 set_bit(type, input->evbit); in wacom_map_usage()
1867 input_set_abs_params(input, code, fmin, fmax, fuzz, 0); in wacom_map_usage()
1887 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_usage_mapping()
1888 struct wacom_features *features = &wacom_wac->features; in wacom_wac_battery_usage_mapping()
1889 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_usage_mapping()
1895 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_wac_battery_usage_mapping()
1904 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_event()
1905 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_event()
1909 if (value == 0) { in wacom_wac_battery_event()
1910 wacom_wac->hid_data.bat_status = POWER_SUPPLY_STATUS_UNKNOWN; in wacom_wac_battery_event()
1913 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1914 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1915 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1916 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1920 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1921 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1922 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1923 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1926 wacom_wac->hid_data.bat_charging = value; in wacom_wac_battery_event()
1927 wacom_wac->hid_data.ps_connected = value; in wacom_wac_battery_event()
1928 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1929 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1944 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_report()
1945 struct wacom_features *features = &wacom_wac->features; in wacom_wac_battery_report()
1947 if (features->quirks & WACOM_QUIRK_BATTERY) { in wacom_wac_battery_report()
1948 int status = wacom_wac->hid_data.bat_status; in wacom_wac_battery_report()
1949 int capacity = wacom_wac->hid_data.battery_capacity; in wacom_wac_battery_report()
1950 bool charging = wacom_wac->hid_data.bat_charging; in wacom_wac_battery_report()
1951 bool connected = wacom_wac->hid_data.bat_connected; in wacom_wac_battery_report()
1952 bool powered = wacom_wac->hid_data.ps_connected; in wacom_wac_battery_report()
1963 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_usage_mapping()
1964 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_usage_mapping()
1965 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_usage_mapping()
1966 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_usage_mapping()
1970 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
1971 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0); in wacom_wac_pad_usage_mapping()
1972 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
1975 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
1976 wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0); in wacom_wac_pad_usage_mapping()
1977 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
1980 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
1981 wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); in wacom_wac_pad_usage_mapping()
1982 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
1991 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
1992 0); in wacom_wac_pad_usage_mapping()
1993 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
1994 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2006 wacom_wac->has_mute_touch_switch = true; in wacom_wac_pad_usage_mapping()
2007 usage->type = EV_SW; in wacom_wac_pad_usage_mapping()
2008 usage->code = SW_MUTE_DEVICE; in wacom_wac_pad_usage_mapping()
2009 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2012 wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); in wacom_wac_pad_usage_mapping()
2013 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2016 wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0); in wacom_wac_pad_usage_mapping()
2017 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2020 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); in wacom_wac_pad_usage_mapping()
2021 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2028 usage->type = EV_ABS; in wacom_wac_pad_usage_mapping()
2029 usage->code = ABS_WHEEL; in wacom_wac_pad_usage_mapping()
2030 set_bit(EV_ABS, input->evbit); in wacom_wac_pad_usage_mapping()
2031 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2034 wacom_map_usage(input, usage, field, EV_KEY, KEY_BUTTONCONFIG, 0); in wacom_wac_pad_usage_mapping()
2035 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2038 wacom_map_usage(input, usage, field, EV_KEY, KEY_ONSCREEN_KEYBOARD, 0); in wacom_wac_pad_usage_mapping()
2039 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2042 wacom_map_usage(input, usage, field, EV_KEY, KEY_CONTROLPANEL, 0); in wacom_wac_pad_usage_mapping()
2043 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2047 if (!wacom_wac->has_mode_change) { in wacom_wac_pad_usage_mapping()
2048 wacom_wac->has_mode_change = true; in wacom_wac_pad_usage_mapping()
2049 wacom_wac->is_direct_mode = true; in wacom_wac_pad_usage_mapping()
2051 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2055 switch (equivalent_usage & 0xfffffff0) { in wacom_wac_pad_usage_mapping()
2058 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
2059 0); in wacom_wac_pad_usage_mapping()
2060 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
2061 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2070 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_event()
2071 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_event()
2072 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_event()
2073 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_event()
2081 if (!usage->type && equivalent_usage != WACOM_HID_WD_MODE_CHANGE) in wacom_wac_pad_event()
2084 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { in wacom_wac_pad_event()
2085 if (usage->hid != WACOM_HID_WD_TOUCHRING) in wacom_wac_pad_event()
2086 wacom_wac->hid_data.inrange_state |= value; in wacom_wac_pad_event()
2094 * tablet's left. HID events "should" be clockwise- in wacom_wac_pad_event()
2096 * Pro and 2nd-gen Intuos Pro don't do this... in wacom_wac_pad_event()
2098 if (hdev->vendor == 0x56a && in wacom_wac_pad_event()
2099 (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ in wacom_wac_pad_event()
2100 hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2101 hdev->product == 0x392 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2102 hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */ in wacom_wac_pad_event()
2103 hdev->product == 0x3AA)) { /* MobileStudio Pro */ in wacom_wac_pad_event()
2104 value = (field->logical_maximum - value); in wacom_wac_pad_event()
2106 if (hdev->product == 0x357 || hdev->product == 0x358 || in wacom_wac_pad_event()
2107 hdev->product == 0x392) in wacom_wac_pad_event()
2109 else if (hdev->product == 0x34d || hdev->product == 0x34e || in wacom_wac_pad_event()
2110 hdev->product == 0x398 || hdev->product == 0x399 || in wacom_wac_pad_event()
2111 hdev->product == 0x3AA) in wacom_wac_pad_event()
2121 input_event(input, usage->type, usage->code, 0); in wacom_wac_pad_event()
2126 if (wacom_wac->shared->touch_input) { in wacom_wac_pad_event()
2127 bool *is_touch_on = &wacom_wac->shared->is_touch_on; in wacom_wac_pad_event()
2134 input_report_switch(wacom_wac->shared->touch_input, in wacom_wac_pad_event()
2136 input_sync(wacom_wac->shared->touch_input); in wacom_wac_pad_event()
2141 if (wacom_wac->is_direct_mode != value) { in wacom_wac_pad_event()
2142 wacom_wac->is_direct_mode = value; in wacom_wac_pad_event()
2143 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE); in wacom_wac_pad_event()
2148 for (i = 0; i < wacom->led.count; i++) in wacom_wac_pad_event()
2149 wacom_update_led(wacom, features->numbered_buttons, in wacom_wac_pad_event()
2158 input_event(input, usage->type, usage->code, value); in wacom_wac_pad_event()
2160 wacom_wac->hid_data.pad_input_event_flag = true; in wacom_wac_pad_event()
2168 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_pre_report()
2170 wacom_wac->hid_data.inrange_state = 0; in wacom_wac_pad_pre_report()
2177 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_report()
2178 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_report()
2179 bool active = wacom_wac->hid_data.inrange_state != 0; in wacom_wac_pad_report()
2182 if (wacom_wac->hid_data.pad_input_event_flag) { in wacom_wac_pad_report()
2183 input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); in wacom_wac_pad_report()
2186 wacom_wac->hid_data.pad_input_event_flag = false; in wacom_wac_pad_report()
2194 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_usage_mapping()
2195 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_usage_mapping()
2196 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_usage_mapping()
2197 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_usage_mapping()
2208 wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); in wacom_wac_pen_usage_mapping()
2211 wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); in wacom_wac_pen_usage_mapping()
2214 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); in wacom_wac_pen_usage_mapping()
2218 BTN_TOOL_RUBBER, 0); in wacom_wac_pen_usage_mapping()
2221 wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); in wacom_wac_pen_usage_mapping()
2224 wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); in wacom_wac_pen_usage_mapping()
2227 wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); in wacom_wac_pen_usage_mapping()
2231 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_pen_usage_mapping()
2234 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); in wacom_wac_pen_usage_mapping()
2237 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); in wacom_wac_pen_usage_mapping()
2240 features->quirks |= WACOM_QUIRK_TOOLSERIAL; in wacom_wac_pen_usage_mapping()
2241 wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); in wacom_wac_pen_usage_mapping()
2244 features->quirks |= WACOM_QUIRK_SENSE; in wacom_wac_pen_usage_mapping()
2245 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); in wacom_wac_pen_usage_mapping()
2248 wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); in wacom_wac_pen_usage_mapping()
2250 if (!(features->quirks & WACOM_QUIRK_AESPEN)) { in wacom_wac_pen_usage_mapping()
2251 set_bit(EV_KEY, input->evbit); in wacom_wac_pen_usage_mapping()
2257 if (!(features->device_type & WACOM_DEVICETYPE_DIRECT)) { in wacom_wac_pen_usage_mapping()
2264 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); in wacom_wac_pen_usage_mapping()
2273 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_event()
2274 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_event()
2275 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_event()
2276 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_event()
2278 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_event()
2288 value = field->logical_maximum - value; in wacom_wac_pen_event()
2291 wacom_wac->hid_data.inrange_state = value; in wacom_wac_pen_event()
2292 if (!(features->quirks & WACOM_QUIRK_SENSE)) in wacom_wac_pen_event()
2293 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2296 wacom_wac->hid_data.invert_state = value; in wacom_wac_pen_event()
2300 wacom_wac->hid_data.tipswitch |= value; in wacom_wac_pen_event()
2303 wacom_wac->hid_data.barrelswitch = value; in wacom_wac_pen_event()
2306 wacom_wac->hid_data.barrelswitch2 = value; in wacom_wac_pen_event()
2310 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); in wacom_wac_pen_event()
2311 wacom_wac->serial[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2323 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2327 __u32 raw_value = wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2329 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); in wacom_wac_pen_event()
2330 wacom_wac->serial[0] |= ((__u64)raw_value) << 32; in wacom_wac_pen_event()
2332 * Non-USI EMR devices may contain additional tool type in wacom_wac_pen_event()
2337 wacom_wac->id[0] |= raw_value & 0xFFFFF; in wacom_wac_pen_event()
2349 wacom_wac->id[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2352 if (features->offset_left && value != features->offset_left) in wacom_wac_pen_event()
2354 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2355 features->offset_left); in wacom_wac_pen_event()
2356 features->offset_left = value; in wacom_wac_pen_event()
2359 if (features->offset_right && value != features->offset_right) in wacom_wac_pen_event()
2361 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2362 features->offset_right); in wacom_wac_pen_event()
2363 features->offset_right = value; in wacom_wac_pen_event()
2366 if (features->offset_top && value != features->offset_top) in wacom_wac_pen_event()
2368 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2369 features->offset_top); in wacom_wac_pen_event()
2370 features->offset_top = value; in wacom_wac_pen_event()
2373 if (features->offset_bottom && value != features->offset_bottom) in wacom_wac_pen_event()
2375 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2376 features->offset_bottom); in wacom_wac_pen_event()
2377 features->offset_bottom = value; in wacom_wac_pen_event()
2380 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_pen_event()
2387 if (!usage->type || delay_pen_events(wacom_wac)) in wacom_wac_pen_event()
2391 if (wacom_wac->hid_data.inrange_state) in wacom_wac_pen_event()
2392 input_event(input, usage->type, usage->code, value); in wacom_wac_pen_event()
2393 else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) in wacom_wac_pen_event()
2394 input_event(input, usage->type, usage->code, 0); in wacom_wac_pen_event()
2401 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_pre_report()
2403 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_pen_pre_report()
2411 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_report()
2412 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_report()
2413 bool range = wacom_wac->hid_data.inrange_state; in wacom_wac_pen_report()
2414 bool sense = wacom_wac->hid_data.sense_state; in wacom_wac_pen_report()
2416 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_report()
2419 if (!wacom_wac->tool[0] && range) { /* first in range */ in wacom_wac_pen_report()
2421 if (wacom_wac->hid_data.invert_state) in wacom_wac_pen_report()
2422 wacom_wac->tool[0] = BTN_TOOL_RUBBER; in wacom_wac_pen_report()
2423 else if (wacom_wac->id[0]) in wacom_wac_pen_report()
2424 wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); in wacom_wac_pen_report()
2426 wacom_wac->tool[0] = BTN_TOOL_PEN; in wacom_wac_pen_report()
2430 wacom_wac->shared->stylus_in_proximity = sense; in wacom_wac_pen_report()
2432 if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { in wacom_wac_pen_report()
2433 int id = wacom_wac->id[0]; in wacom_wac_pen_report()
2434 int sw_state = wacom_wac->hid_data.barrelswitch | in wacom_wac_pen_report()
2435 (wacom_wac->hid_data.barrelswitch2 << 1); in wacom_wac_pen_report()
2442 * Non-USI EMR tools should have their IDs mangled to in wacom_wac_pen_report()
2445 if (wacom_wac->serial[0] >> 52 == 1) in wacom_wac_pen_report()
2449 * To ensure compatibility with xf86-input-wacom, we should in wacom_wac_pen_report()
2454 wacom_wac->hid_data.tipswitch); in wacom_wac_pen_report()
2455 input_report_key(input, wacom_wac->tool[0], sense); in wacom_wac_pen_report()
2456 if (wacom_wac->serial[0]) { in wacom_wac_pen_report()
2457 input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); in wacom_wac_pen_report()
2458 input_report_abs(input, ABS_MISC, sense ? id : 0); in wacom_wac_pen_report()
2461 wacom_wac->hid_data.tipswitch = false; in wacom_wac_pen_report()
2467 wacom_wac->tool[0] = 0; in wacom_wac_pen_report()
2468 wacom_wac->id[0] = 0; in wacom_wac_pen_report()
2469 wacom_wac->serial[0] = 0; in wacom_wac_pen_report()
2477 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_usage_mapping()
2478 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_usage_mapping()
2479 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_usage_mapping()
2480 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_usage_mapping()
2499 wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); in wacom_wac_finger_usage_mapping()
2500 wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); in wacom_wac_finger_usage_mapping()
2501 input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); in wacom_wac_finger_usage_mapping()
2504 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_finger_usage_mapping()
2507 wacom_wac->hid_data.cc_report = field->report->id; in wacom_wac_finger_usage_mapping()
2508 wacom_wac->hid_data.cc_index = field->index; in wacom_wac_finger_usage_mapping()
2509 wacom_wac->hid_data.cc_value_index = usage->usage_index; in wacom_wac_finger_usage_mapping()
2512 if ((field->logical_maximum - field->logical_minimum) < touch_max) { in wacom_wac_finger_usage_mapping()
2518 field->logical_maximum = 255; in wacom_wac_finger_usage_mapping()
2527 struct hid_data *hid_data = &wacom_wac->hid_data; in wacom_wac_finger_slot()
2528 bool mt = wacom_wac->features.touch_max > 1; in wacom_wac_finger_slot()
2529 bool prox = hid_data->tipswitch && in wacom_wac_finger_slot()
2532 if (wacom_wac->shared->has_mute_touch_switch && in wacom_wac_finger_slot()
2533 !wacom_wac->shared->is_touch_on) { in wacom_wac_finger_slot()
2534 if (!wacom_wac->shared->touch_down) in wacom_wac_finger_slot()
2536 prox = 0; in wacom_wac_finger_slot()
2539 wacom_wac->hid_data.num_received++; in wacom_wac_finger_slot()
2540 if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) in wacom_wac_finger_slot()
2546 slot = input_mt_get_slot_by_key(input, hid_data->id); in wacom_wac_finger_slot()
2556 hid_data->x); in wacom_wac_finger_slot()
2558 hid_data->y); in wacom_wac_finger_slot()
2560 if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { in wacom_wac_finger_slot()
2561 input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2562 input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2563 if (hid_data->width != hid_data->height) in wacom_wac_finger_slot()
2564 input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); in wacom_wac_finger_slot()
2573 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_event()
2574 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_event()
2575 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_wac_finger_event()
2577 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_finger_event()
2582 wacom_wac->hid_data.x = value; in wacom_wac_finger_event()
2585 wacom_wac->hid_data.y = value; in wacom_wac_finger_event()
2588 wacom_wac->hid_data.width = value; in wacom_wac_finger_event()
2591 wacom_wac->hid_data.height = value; in wacom_wac_finger_event()
2594 wacom_wac->hid_data.id = value; in wacom_wac_finger_event()
2597 wacom_wac->hid_data.tipswitch = value; in wacom_wac_finger_event()
2600 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_finger_event()
2603 features->touch_max = value; in wacom_wac_finger_event()
2607 if (usage->usage_index + 1 == field->report_count) { in wacom_wac_finger_event()
2608 if (equivalent_usage == wacom_wac->hid_data.last_slot_field) in wacom_wac_finger_event()
2609 wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); in wacom_wac_finger_event()
2617 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_pre_report()
2618 struct hid_data* hid_data = &wacom_wac->hid_data; in wacom_wac_finger_pre_report()
2621 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_finger_pre_report()
2623 for (i = 0; i < report->maxfield; i++) { in wacom_wac_finger_pre_report()
2624 struct hid_field *field = report->field[i]; in wacom_wac_finger_pre_report()
2627 for (j = 0; j < field->maxusage; j++) { in wacom_wac_finger_pre_report()
2628 struct hid_usage *usage = &field->usage[j]; in wacom_wac_finger_pre_report()
2630 wacom_equivalent_usage(usage->hid); in wacom_wac_finger_pre_report()
2641 hid_data->last_slot_field = equivalent_usage; in wacom_wac_finger_pre_report()
2644 hid_data->cc_report = report->id; in wacom_wac_finger_pre_report()
2645 hid_data->cc_index = i; in wacom_wac_finger_pre_report()
2646 hid_data->cc_value_index = j; in wacom_wac_finger_pre_report()
2652 if (hid_data->cc_report != 0 && in wacom_wac_finger_pre_report()
2653 hid_data->cc_index >= 0) { in wacom_wac_finger_pre_report()
2654 struct hid_field *field = report->field[hid_data->cc_index]; in wacom_wac_finger_pre_report()
2655 int value = field->value[hid_data->cc_value_index]; in wacom_wac_finger_pre_report()
2657 hid_data->num_expected = value; in wacom_wac_finger_pre_report()
2660 hid_data->num_expected = wacom_wac->features.touch_max; in wacom_wac_finger_pre_report()
2668 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_report()
2669 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_report()
2670 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_report()
2676 if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) in wacom_wac_finger_report()
2683 wacom_wac->hid_data.num_received = 0; in wacom_wac_finger_report()
2686 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); in wacom_wac_finger_report()
2693 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_usage_mapping()
2694 struct wacom_features *features = &wacom_wac->features; in wacom_wac_usage_mapping()
2697 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_wac_usage_mapping()
2715 if (wacom->wacom_wac.features.type != HID_GENERIC) in wacom_wac_event()
2718 if (value > field->logical_maximum || value < field->logical_minimum) in wacom_wac_event()
2724 else if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) in wacom_wac_event()
2726 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_event()
2728 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_event()
2738 for (r = field_index; r < report->maxfield; r++) { in wacom_report_events()
2742 field = report->field[r]; in wacom_report_events()
2743 count = field->report_count; in wacom_report_events()
2745 if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) in wacom_report_events()
2748 for (n = 0 ; n < count; n++) { in wacom_report_events()
2749 if (field->usage[n].collection_index == collection_index) in wacom_report_events()
2750 wacom_wac_event(hdev, field, &field->usage[n], in wacom_report_events()
2751 field->value[n]); in wacom_report_events()
2767 * Non-input reports may be sent prior to the device being in wacom_wac_collection()
2770 * been called to prevent potential crashes in the report- in wacom_wac_collection()
2773 if (report->type != HID_INPUT_REPORT) in wacom_wac_collection()
2774 return -1; in wacom_wac_collection()
2777 return 0; in wacom_wac_collection()
2778 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_collection()
2780 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_collection()
2783 return 0; in wacom_wac_collection()
2789 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_report()
2794 int prev_collection = -1; in wacom_wac_report()
2796 if (wacom_wac->features.type != HID_GENERIC) in wacom_wac_report()
2799 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
2800 field = report->field[r]; in wacom_wac_report()
2808 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) in wacom_wac_report()
2814 if (pad_in_hid_field && wacom->wacom_wac.pad_input) in wacom_wac_report()
2816 if (pen_in_hid_field && wacom->wacom_wac.pen_input) in wacom_wac_report()
2818 if (finger_in_hid_field && wacom->wacom_wac.touch_input) in wacom_wac_report()
2821 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
2822 field = report->field[r]; in wacom_wac_report()
2824 if (field->usage[0].collection_index != prev_collection) { in wacom_wac_report()
2826 field->usage[0].collection_index, field, r) < 0) in wacom_wac_report()
2828 prev_collection = field->usage[0].collection_index; in wacom_wac_report()
2834 if (true_pad && wacom->wacom_wac.pad_input) in wacom_wac_report()
2840 struct wacom_features *features = &wacom->features; in wacom_bpt_touch()
2841 struct input_dev *input = wacom->touch_input; in wacom_bpt_touch()
2842 struct input_dev *pad_input = wacom->pad_input; in wacom_bpt_touch()
2843 unsigned char *data = wacom->data; in wacom_bpt_touch()
2846 if (data[0] != 0x02) in wacom_bpt_touch()
2847 return 0; in wacom_bpt_touch()
2849 for (i = 0; i < 2; i++) { in wacom_bpt_touch()
2850 int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); in wacom_bpt_touch()
2852 && (data[offset + 3] & 0x80); in wacom_bpt_touch()
2857 int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; in wacom_bpt_touch()
2858 int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; in wacom_bpt_touch()
2859 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { in wacom_bpt_touch()
2870 input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); in wacom_bpt_touch()
2871 input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); in wacom_bpt_touch()
2872 input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); in wacom_bpt_touch()
2873 input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); in wacom_bpt_touch()
2874 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt_touch()
2881 struct wacom_features *features = &wacom->features; in wacom_bpt3_touch_msg()
2882 struct input_dev *input = wacom->touch_input; in wacom_bpt3_touch_msg()
2883 bool touch = data[1] & 0x80; in wacom_bpt3_touch_msg()
2884 int slot = input_mt_get_slot_by_key(input, data[0]); in wacom_bpt3_touch_msg()
2886 if (slot < 0) in wacom_bpt3_touch_msg()
2896 int y = (data[3] << 4) | (data[4] & 0x0f); in wacom_bpt3_touch_msg()
2899 if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { in wacom_bpt3_touch_msg()
2904 * "a" is a scaled-down area which we assume is in wacom_bpt3_touch_msg()
2924 struct input_dev *input = wacom->pad_input; in wacom_bpt3_button_msg()
2925 struct wacom_features *features = &wacom->features; in wacom_bpt3_button_msg()
2927 if (features->type == INTUOSHT || features->type == INTUOSHT2) { in wacom_bpt3_button_msg()
2928 input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); in wacom_bpt3_button_msg()
2929 input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); in wacom_bpt3_button_msg()
2931 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); in wacom_bpt3_button_msg()
2932 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); in wacom_bpt3_button_msg()
2934 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); in wacom_bpt3_button_msg()
2935 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); in wacom_bpt3_button_msg()
2940 unsigned char *data = wacom->data; in wacom_bpt3_touch()
2941 int count = data[1] & 0x07; in wacom_bpt3_touch()
2942 int touch_changed = 0, i; in wacom_bpt3_touch()
2944 if (data[0] != 0x02) in wacom_bpt3_touch()
2945 return 0; in wacom_bpt3_touch()
2947 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ in wacom_bpt3_touch()
2948 for (i = 0; i < count; i++) { in wacom_bpt3_touch()
2961 if (wacom->touch_input && touch_changed) { in wacom_bpt3_touch()
2962 input_mt_sync_frame(wacom->touch_input); in wacom_bpt3_touch()
2963 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt3_touch()
2971 struct wacom_features *features = &wacom->features; in wacom_bpt_pen()
2972 struct input_dev *input = wacom->pen_input; in wacom_bpt_pen()
2973 unsigned char *data = wacom->data; in wacom_bpt_pen()
2974 int x = 0, y = 0, p = 0, d = 0; in wacom_bpt_pen()
2978 if (data[0] != WACOM_REPORT_PENABLED) in wacom_bpt_pen()
2979 return 0; in wacom_bpt_pen()
2981 range = (data[1] & 0x80) == 0x80; in wacom_bpt_pen()
2982 prox = (data[1] & 0x40) == 0x40; in wacom_bpt_pen()
2983 rdy = (data[1] & 0x20) == 0x20; in wacom_bpt_pen()
2985 wacom->shared->stylus_in_proximity = range; in wacom_bpt_pen()
2987 return 0; in wacom_bpt_pen()
2991 pen = data[1] & 0x01; in wacom_bpt_pen()
2992 btn1 = data[1] & 0x02; in wacom_bpt_pen()
2993 btn2 = data[1] & 0x04; in wacom_bpt_pen()
2999 if (data[1] & 0x08) { in wacom_bpt_pen()
3000 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_bpt_pen()
3001 wacom->id[0] = ERASER_DEVICE_ID; in wacom_bpt_pen()
3003 wacom->tool[0] = BTN_TOOL_PEN; in wacom_bpt_pen()
3004 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_bpt_pen()
3006 wacom->reporting_data = true; in wacom_bpt_pen()
3015 if (data[8] <= features->distance_max) in wacom_bpt_pen()
3016 d = features->distance_max - data[8]; in wacom_bpt_pen()
3018 wacom->id[0] = 0; in wacom_bpt_pen()
3021 if (wacom->reporting_data) { in wacom_bpt_pen()
3033 input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */ in wacom_bpt_pen()
3034 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ in wacom_bpt_pen()
3038 wacom->reporting_data = false; in wacom_bpt_pen()
3046 struct wacom_features *features = &wacom->features; in wacom_bpt_irq()
3048 if ((features->type == INTUOSHT2) && in wacom_bpt_irq()
3049 (features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_bpt_irq()
3058 return 0; in wacom_bpt_irq()
3073 prefix = data[0]; in wacom_bamboo_pad_pen_event()
3074 data[0] = WACOM_REPORT_BPAD_PEN; in wacom_bamboo_pad_pen_event()
3078 * No need to check if wacom->shared->pen is valid, hid_input_report() in wacom_bamboo_pad_pen_event()
3081 hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, in wacom_bamboo_pad_pen_event()
3084 data[0] = prefix; in wacom_bamboo_pad_pen_event()
3090 struct input_dev *input = wacom->touch_input; in wacom_bamboo_pad_touch_event()
3096 prefix = data[0]; in wacom_bamboo_pad_touch_event()
3098 for (id = 0; id < wacom->features.touch_max; id++) { in wacom_bamboo_pad_touch_event()
3109 x = finger_data[0] | ((finger_data[1] & 0x0f) << 8); in wacom_bamboo_pad_touch_event()
3118 input_report_key(input, BTN_LEFT, prefix & 0x40); in wacom_bamboo_pad_touch_event()
3119 input_report_key(input, BTN_RIGHT, prefix & 0x80); in wacom_bamboo_pad_touch_event()
3122 wacom->shared->touch_down = !!prefix && report_touch_events(wacom); in wacom_bamboo_pad_touch_event()
3129 unsigned char *data = wacom->data; in wacom_bamboo_pad_irq()
3133 (data[0] != WACOM_REPORT_BPAD_TOUCH)) in wacom_bamboo_pad_irq()
3134 return 0; in wacom_bamboo_pad_irq()
3136 if (data[1] & 0x01) in wacom_bamboo_pad_irq()
3139 if (data[1] & 0x02) in wacom_bamboo_pad_irq()
3142 return 0; in wacom_bamboo_pad_irq()
3147 unsigned char *data = wacom->data; in wacom_wireless_irq()
3150 if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL) in wacom_wireless_irq()
3151 return 0; in wacom_wireless_irq()
3153 connected = data[1] & 0x01; in wacom_wireless_irq()
3157 if ((wacom->shared->type == INTUOSHT || in wacom_wireless_irq()
3158 wacom->shared->type == INTUOSHT2) && in wacom_wireless_irq()
3159 wacom->shared->touch_input && in wacom_wireless_irq()
3160 wacom->shared->touch_max) { in wacom_wireless_irq()
3161 input_report_switch(wacom->shared->touch_input, in wacom_wireless_irq()
3162 SW_MUTE_DEVICE, data[5] & 0x40); in wacom_wireless_irq()
3163 input_sync(wacom->shared->touch_input); in wacom_wireless_irq()
3167 battery = (data[5] & 0x3f) * 100 / 31; in wacom_wireless_irq()
3168 charging = !!(data[5] & 0x80); in wacom_wireless_irq()
3169 if (wacom->pid != pid) { in wacom_wireless_irq()
3170 wacom->pid = pid; in wacom_wireless_irq()
3175 battery, charging, 1, 0); in wacom_wireless_irq()
3177 } else if (wacom->pid != 0) { in wacom_wireless_irq()
3179 wacom->pid = 0; in wacom_wireless_irq()
3181 wacom_notify_battery(wacom, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); in wacom_wireless_irq()
3184 return 0; in wacom_wireless_irq()
3190 struct wacom_features *features = &wacom_wac->features; in wacom_status_irq()
3191 unsigned char *data = wacom_wac->data; in wacom_status_irq()
3193 if (data[0] != WACOM_REPORT_USB) in wacom_status_irq()
3194 return 0; in wacom_status_irq()
3196 if ((features->type == INTUOSHT || in wacom_status_irq()
3197 features->type == INTUOSHT2) && in wacom_status_irq()
3198 wacom_wac->shared->touch_input && in wacom_status_irq()
3199 features->touch_max) { in wacom_status_irq()
3200 input_report_switch(wacom_wac->shared->touch_input, in wacom_status_irq()
3201 SW_MUTE_DEVICE, data[8] & 0x40); in wacom_status_irq()
3202 input_sync(wacom_wac->shared->touch_input); in wacom_status_irq()
3205 if (data[9] & 0x02) { /* wireless module is attached */ in wacom_status_irq()
3206 int battery = (data[8] & 0x3f) * 100 / 31; in wacom_status_irq()
3207 bool charging = !!(data[8] & 0x80); in wacom_status_irq()
3212 if (!wacom->battery.battery && in wacom_status_irq()
3213 !(features->quirks & WACOM_QUIRK_BATTERY)) { in wacom_status_irq()
3214 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_status_irq()
3218 else if ((features->quirks & WACOM_QUIRK_BATTERY) && in wacom_status_irq()
3219 wacom->battery.battery) { in wacom_status_irq()
3220 features->quirks &= ~WACOM_QUIRK_BATTERY; in wacom_status_irq()
3222 wacom_notify_battery(wacom_wac, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); in wacom_status_irq()
3224 return 0; in wacom_status_irq()
3231 switch (wacom_wac->features.type) { in wacom_wac_irq()
3297 else if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3323 if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3339 if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) in wacom_wac_irq()
3351 if (wacom_wac->pen_input) in wacom_wac_irq()
3352 input_sync(wacom_wac->pen_input); in wacom_wac_irq()
3353 if (wacom_wac->touch_input) in wacom_wac_irq()
3354 input_sync(wacom_wac->touch_input); in wacom_wac_irq()
3355 if (wacom_wac->pad_input) in wacom_wac_irq()
3356 input_sync(wacom_wac->pad_input); in wacom_wac_irq()
3362 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_basic_pro_pen()
3366 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_basic_pro_pen()
3367 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_basic_pro_pen()
3368 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_basic_pro_pen()
3371 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); in wacom_setup_basic_pro_pen()
3376 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_cintiq()
3377 struct wacom_features *features = &wacom_wac->features; in wacom_setup_cintiq()
3381 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_cintiq()
3382 __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); in wacom_setup_cintiq()
3383 __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); in wacom_setup_cintiq()
3384 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); in wacom_setup_cintiq()
3386 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); in wacom_setup_cintiq()
3387 input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3389 input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3395 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_intuos()
3401 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_intuos()
3402 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_intuos()
3403 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_intuos()
3404 __set_bit(BTN_SIDE, input_dev->keybit); in wacom_setup_intuos()
3405 __set_bit(BTN_EXTRA, input_dev->keybit); in wacom_setup_intuos()
3406 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_intuos()
3407 __set_bit(BTN_TOOL_LENS, input_dev->keybit); in wacom_setup_intuos()
3409 input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); in wacom_setup_intuos()
3411 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); in wacom_setup_intuos()
3416 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_setup_device_quirks()
3417 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_setup_device_quirks()
3420 if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || in wacom_setup_device_quirks()
3421 features->type == DTUS || in wacom_setup_device_quirks()
3422 (features->type >= INTUOS3S && features->type <= WACOM_MO)) { in wacom_setup_device_quirks()
3423 if (features->device_type & WACOM_DEVICETYPE_PEN) in wacom_setup_device_quirks()
3424 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3428 if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { in wacom_setup_device_quirks()
3429 features->x_max = 1023; in wacom_setup_device_quirks()
3430 features->y_max = 1023; in wacom_setup_device_quirks()
3439 if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || in wacom_setup_device_quirks()
3440 (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { in wacom_setup_device_quirks()
3441 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_device_quirks()
3442 if (features->touch_max) in wacom_setup_device_quirks()
3443 features->device_type |= WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3444 if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) in wacom_setup_device_quirks()
3445 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3447 if (features->type == INTUOSHT2) { in wacom_setup_device_quirks()
3448 features->x_max = features->x_max / 10; in wacom_setup_device_quirks()
3449 features->y_max = features->y_max / 10; in wacom_setup_device_quirks()
3452 features->x_max = 4096; in wacom_setup_device_quirks()
3453 features->y_max = 4096; in wacom_setup_device_quirks()
3456 else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3457 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3468 if (features->type == BAMBOO_PEN && in wacom_setup_device_quirks()
3469 features->pktlen == WACOM_PKGLEN_BBTOUCH3) in wacom_setup_device_quirks()
3470 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3473 * Raw Wacom-mode pen and touch events both come from interface in wacom_setup_device_quirks()
3474 * 0, whose HID descriptor has an application usage of 0xFF0D in wacom_setup_device_quirks()
3479 if (features->type == BAMBOO_PAD) in wacom_setup_device_quirks()
3480 features->device_type = WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3482 if (features->type == REMOTE) in wacom_setup_device_quirks()
3483 features->device_type = WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3485 if (features->type == INTUOSP2_BT || in wacom_setup_device_quirks()
3486 features->type == INTUOSP2S_BT) { in wacom_setup_device_quirks()
3487 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3490 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3493 if (features->type == INTUOSHT3_BT) { in wacom_setup_device_quirks()
3494 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3496 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3499 switch (features->type) { in wacom_setup_device_quirks()
3522 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_setup_device_quirks()
3526 if (wacom->hdev->bus == BUS_BLUETOOTH) in wacom_setup_device_quirks()
3527 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3530 if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && in wacom_setup_device_quirks()
3531 features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3532 features->x_max <<= 5; in wacom_setup_device_quirks()
3533 features->y_max <<= 5; in wacom_setup_device_quirks()
3534 features->x_fuzz <<= 5; in wacom_setup_device_quirks()
3535 features->y_fuzz <<= 5; in wacom_setup_device_quirks()
3536 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; in wacom_setup_device_quirks()
3539 if (features->type == WIRELESS) { in wacom_setup_device_quirks()
3540 if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { in wacom_setup_device_quirks()
3541 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3545 if (features->type == REMOTE) in wacom_setup_device_quirks()
3546 features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; in wacom_setup_device_quirks()
3548 /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots in wacom_setup_device_quirks()
3551 if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) { in wacom_setup_device_quirks()
3552 features->quirks &= ~WACOM_QUIRK_TOOLSERIAL; in wacom_setup_device_quirks()
3553 __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3554 __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3555 __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3556 __clear_bit(ABS_Z, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3557 __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3558 __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3559 __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3560 __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3561 __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3562 __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit); in wacom_setup_device_quirks()
3563 __clear_bit(EV_MSC, wacom_wac->pen_input->evbit); in wacom_setup_device_quirks()
3570 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pen_input_capabilities()
3572 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pen_input_capabilities()
3574 if (!(features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_setup_pen_input_capabilities()
3575 return -ENODEV; in wacom_setup_pen_input_capabilities()
3577 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_pen_input_capabilities()
3578 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3580 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3582 if (features->type == HID_GENERIC) { in wacom_setup_pen_input_capabilities()
3583 /* setup has already been done; apply otherwise-undetectible quirks */ in wacom_setup_pen_input_capabilities()
3585 return 0; in wacom_setup_pen_input_capabilities()
3588 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3589 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3591 input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, in wacom_setup_pen_input_capabilities()
3592 features->x_max - features->offset_right, in wacom_setup_pen_input_capabilities()
3593 features->x_fuzz, 0); in wacom_setup_pen_input_capabilities()
3594 input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, in wacom_setup_pen_input_capabilities()
3595 features->y_max - features->offset_bottom, in wacom_setup_pen_input_capabilities()
3596 features->y_fuzz, 0); in wacom_setup_pen_input_capabilities()
3597 input_set_abs_params(input_dev, ABS_PRESSURE, 0, in wacom_setup_pen_input_capabilities()
3598 features->pressure_max, features->pressure_fuzz, 0); in wacom_setup_pen_input_capabilities()
3601 input_abs_set_res(input_dev, ABS_X, features->x_resolution); in wacom_setup_pen_input_capabilities()
3602 input_abs_set_res(input_dev, ABS_Y, features->y_resolution); in wacom_setup_pen_input_capabilities()
3604 switch (features->type) { in wacom_setup_pen_input_capabilities()
3606 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3611 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3612 features->distance_max, in wacom_setup_pen_input_capabilities()
3613 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3619 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3620 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3621 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3623 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3624 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3625 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3626 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3627 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3640 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3652 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3668 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3669 features->distance_max, in wacom_setup_pen_input_capabilities()
3670 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3672 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3686 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3693 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3694 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3695 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3696 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3700 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3704 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3705 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3706 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3714 if (features->type == INTUOSHT2 || in wacom_setup_pen_input_capabilities()
3715 features->type == INTUOSHT3_BT) { in wacom_setup_pen_input_capabilities()
3718 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3719 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3720 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3721 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3722 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3723 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3724 features->distance_max, in wacom_setup_pen_input_capabilities()
3725 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3729 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3732 return 0; in wacom_setup_pen_input_capabilities()
3738 struct wacom_features *features = &wacom_wac->features; in wacom_setup_touch_input_capabilities()
3740 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_touch_input_capabilities()
3742 if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) in wacom_setup_touch_input_capabilities()
3743 return -ENODEV; in wacom_setup_touch_input_capabilities()
3745 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_touch_input_capabilities()
3746 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3748 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3750 if (features->type == HID_GENERIC) in wacom_setup_touch_input_capabilities()
3752 return 0; in wacom_setup_touch_input_capabilities()
3754 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3756 if (features->touch_max == 1) { in wacom_setup_touch_input_capabilities()
3757 input_set_abs_params(input_dev, ABS_X, 0, in wacom_setup_touch_input_capabilities()
3758 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3759 input_set_abs_params(input_dev, ABS_Y, 0, in wacom_setup_touch_input_capabilities()
3760 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3762 features->x_resolution); in wacom_setup_touch_input_capabilities()
3764 features->y_resolution); in wacom_setup_touch_input_capabilities()
3766 else if (features->touch_max > 1) { in wacom_setup_touch_input_capabilities()
3767 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, in wacom_setup_touch_input_capabilities()
3768 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3769 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, in wacom_setup_touch_input_capabilities()
3770 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3772 features->x_resolution); in wacom_setup_touch_input_capabilities()
3774 features->y_resolution); in wacom_setup_touch_input_capabilities()
3777 switch (features->type) { in wacom_setup_touch_input_capabilities()
3780 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3781 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3783 if (wacom_wac->shared->touch->product == 0x361) { in wacom_setup_touch_input_capabilities()
3785 0, 12440, 4, 0); in wacom_setup_touch_input_capabilities()
3787 0, 8640, 4, 0); in wacom_setup_touch_input_capabilities()
3789 else if (wacom_wac->shared->touch->product == 0x360) { in wacom_setup_touch_input_capabilities()
3791 0, 8960, 4, 0); in wacom_setup_touch_input_capabilities()
3793 0, 5920, 4, 0); in wacom_setup_touch_input_capabilities()
3795 else if (wacom_wac->shared->touch->product == 0x393) { in wacom_setup_touch_input_capabilities()
3797 0, 6400, 4, 0); in wacom_setup_touch_input_capabilities()
3799 0, 4000, 4, 0); in wacom_setup_touch_input_capabilities()
3812 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3813 input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3814 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
3818 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3819 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3820 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3821 input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); in wacom_setup_touch_input_capabilities()
3825 if (wacom_wac->shared->touch->product == 0x32C || in wacom_setup_touch_input_capabilities()
3826 wacom_wac->shared->touch->product == 0xF6) { in wacom_setup_touch_input_capabilities()
3827 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3828 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3829 wacom_wac->shared->has_mute_touch_switch = true; in wacom_setup_touch_input_capabilities()
3837 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); in wacom_setup_touch_input_capabilities()
3846 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3847 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3852 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_touch_input_capabilities()
3855 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3858 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3860 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
3864 input_mt_init_slots(input_dev, features->touch_max, in wacom_setup_touch_input_capabilities()
3866 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3867 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3870 return 0; in wacom_setup_touch_input_capabilities()
3878 return BTN_A + (n-10); in wacom_numbered_button_to_key()
3880 return BTN_BASE + (n-16); in wacom_numbered_button_to_key()
3882 return 0; in wacom_numbered_button_to_key()
3890 for (i = 0; i < button_count; i++) { in wacom_setup_numbered_buttons()
3894 __set_bit(key, input_dev->keybit); in wacom_setup_numbered_buttons()
3905 * 24HD has LED group 1 to the left and LED group 0 to the right. in wacom_24hd_update_leds()
3906 * So group 0 matches the second half of the buttons and thus the mask in wacom_24hd_update_leds()
3909 if (group == 0) in wacom_24hd_update_leds()
3912 for (i = 0; i < 3; i++) { in wacom_24hd_update_leds()
3915 hid_err(wacom->hdev, "can't find LED %d in group %d\n", in wacom_24hd_update_leds()
3920 led->held = true; in wacom_24hd_update_leds()
3921 led_trigger_event(&led->trigger, LED_FULL); in wacom_24hd_update_leds()
3923 led->held = false; in wacom_24hd_update_leds()
3934 * 21UX2 has LED group 1 to the left and LED group 0 in wacom_is_led_toggled()
3938 if (wacom->wacom_wac.features.type == WACOM_21UX2) in wacom_is_led_toggled()
3939 group = 1 - group; in wacom_is_led_toggled()
3941 group_button = group * (button_count/wacom->led.count); in wacom_is_led_toggled()
3943 if (wacom->wacom_wac.features.type == INTUOSP2_BT) in wacom_is_led_toggled()
3956 if (wacom->wacom_wac.features.type == WACOM_24HD) in wacom_update_led()
3960 cur = wacom->led.groups[group].select; in wacom_update_led()
3964 hid_err(wacom->hdev, "can't find current LED %d in group %d\n", in wacom_update_led()
3970 led->held = false; in wacom_update_led()
3974 if (led->held && pressed) in wacom_update_led()
3979 hid_err(wacom->hdev, "can't find next LED in group %d\n", in wacom_update_led()
3986 next_led->held = true; in wacom_update_led()
3987 led_trigger_event(&next_led->trigger, in wacom_update_led()
3997 for (i = 0; i < wacom->led.count; i++) in wacom_report_numbered_buttons()
4000 for (i = 0; i < button_count; i++) { in wacom_report_numbered_buttons()
4011 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pad_input_capabilities()
4013 if ((features->type == HID_GENERIC) && features->numbered_buttons > 0) in wacom_setup_pad_input_capabilities()
4014 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_pad_input_capabilities()
4016 if (!(features->device_type & WACOM_DEVICETYPE_PAD)) in wacom_setup_pad_input_capabilities()
4017 return -ENODEV; in wacom_setup_pad_input_capabilities()
4019 if (features->type == REMOTE && input_dev == wacom_wac->pad_input) in wacom_setup_pad_input_capabilities()
4020 return -ENODEV; in wacom_setup_pad_input_capabilities()
4022 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pad_input_capabilities()
4024 /* kept for making legacy xf86-input-wacom working with the wheels */ in wacom_setup_pad_input_capabilities()
4025 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4027 /* kept for making legacy xf86-input-wacom accepting the pad */ in wacom_setup_pad_input_capabilities()
4028 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || in wacom_setup_pad_input_capabilities()
4029 input_dev->absinfo[ABS_X].maximum))) in wacom_setup_pad_input_capabilities()
4030 input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); in wacom_setup_pad_input_capabilities()
4031 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || in wacom_setup_pad_input_capabilities()
4032 input_dev->absinfo[ABS_Y].maximum))) in wacom_setup_pad_input_capabilities()
4033 input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); in wacom_setup_pad_input_capabilities()
4036 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4038 wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); in wacom_setup_pad_input_capabilities()
4040 switch (features->type) { in wacom_setup_pad_input_capabilities()
4050 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4051 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4052 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4053 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4054 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4058 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4059 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4064 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4065 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4066 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4068 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4069 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4071 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4072 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4074 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4075 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4079 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4080 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4081 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4083 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4084 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4086 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4087 __set_bit(KEY_CONTROLPANEL, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4088 input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4090 input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4092 input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4094 __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); in wacom_setup_pad_input_capabilities()
4098 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4099 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4100 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4102 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4103 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4109 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4110 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4114 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4119 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4123 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4134 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4143 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4149 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4156 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4158 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4159 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4160 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4161 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4167 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4176 return -ENODEV; in wacom_setup_pad_input_capabilities()
4178 return 0; in wacom_setup_pad_input_capabilities()
4182 { "Wacom Penpartner", 5040, 3780, 255, 0,
4239 { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63,
4242 { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63,
4245 { "Wacom Intuos 4x5", 12700, 10600, 1023, 31,
4248 { "Wacom Intuos 6x8", 20320, 16240, 1023, 31,
4251 { "Wacom Intuos 9x12", 30480, 24060, 1023, 31,
4254 { "Wacom Intuos 12x12", 30480, 31680, 1023, 31,
4257 { "Wacom Intuos 12x18", 45720, 31680, 1023, 31,
4260 { "Wacom PL400", 5408, 4056, 255, 0,
4263 { "Wacom PL500", 6144, 4608, 255, 0,
4266 { "Wacom PL600", 6126, 4604, 255, 0,
4269 { "Wacom PL600SX", 6260, 5016, 255, 0,
4272 { "Wacom PL550", 6144, 4608, 511, 0,
4275 { "Wacom PL800", 7220, 5780, 511, 0,
4278 { "Wacom PL700", 6758, 5406, 511, 0,
4281 { "Wacom PL510", 6282, 4762, 511, 0,
4284 { "Wacom DTU710", 34080, 27660, 511, 0,
4287 { "Wacom DTF521", 6282, 4762, 511, 0,
4290 { "Wacom DTF720", 6858, 5506, 511, 0,
4293 { "Wacom DTF720a", 6858, 5506, 511, 0,
4296 { "Wacom Cintiq Partner", 20480, 15360, 511, 0,
4299 { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31,
4302 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4305 { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31,
4308 { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31,
4311 { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31,
4314 { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63,
4317 { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63,
4320 { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63,
4323 { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63,
4326 { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63,
4329 { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63,
4332 { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63,
4389 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 };
4392 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
4396 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
4401 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
4404 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C };
4407 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 };
4409 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
4412 { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63,
4415 { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
4418 { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63,
4427 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 };
4430 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x333, .touch_max = 10,
4433 { "Wacom DTU1931", 37832, 30305, 511, 0,
4436 { "Wacom DTU2231", 47864, 27011, 511, 0,
4440 { "Wacom DTU1631", 34623, 19553, 511, 0,
4443 { "Wacom DTU1031", 22096, 13960, 511, 0,
4448 { "Wacom DTU1031X", 22672, 12928, 511, 0,
4449 DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0,
4453 { "Wacom DTU1141", 23672, 13403, 1023, 0,
4467 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D };
4470 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10,
4487 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e };
4490 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10,
4493 { "Wacom ISDv4 90", 26202, 16325, 255, 0,
4494 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4496 { "Wacom ISDv4 93", 26202, 16325, 255, 0,
4499 { "Wacom ISDv4 97", 26202, 16325, 511, 0,
4500 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4502 { "Wacom ISDv4 9A", 26202, 16325, 255, 0,
4505 { "Wacom ISDv4 9F", 26202, 16325, 255, 0,
4508 { "Wacom ISDv4 E2", 26202, 16325, 255, 0,
4511 { "Wacom ISDv4 E3", 26202, 16325, 255, 0,
4514 { "Wacom ISDv4 E5", 26202, 16325, 255, 0,
4517 { "Wacom ISDv4 E6", 27760, 15694, 255, 0,
4520 { "Wacom ISDv4 EC", 25710, 14500, 255, 0,
4521 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4523 { "Wacom ISDv4 ED", 26202, 16325, 255, 0,
4526 { "Wacom ISDv4 EF", 26202, 16325, 255, 0,
4527 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4529 { "Wacom ISDv4 100", 26202, 16325, 255, 0,
4532 { "Wacom ISDv4 101", 26202, 16325, 255, 0,
4535 { "Wacom ISDv4 10D", 26202, 16325, 255, 0,
4538 { "Wacom ISDv4 10E", 27760, 15694, 255, 0,
4541 { "Wacom ISDv4 10F", 27760, 15694, 255, 0,
4544 { "Wacom ISDv4 116", 26202, 16325, 255, 0,
4547 { "Wacom ISDv4 12C", 27848, 15752, 2047, 0,
4548 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4550 { "Wacom ISDv4 4001", 26202, 16325, 255, 0,
4553 { "Wacom ISDv4 4004", 11060, 6220, 255, 0,
4556 { "Wacom ISDv4 5000", 27848, 15752, 1023, 0,
4559 { "Wacom ISDv4 5002", 29576, 16724, 1023, 0,
4562 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4567 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31,
4570 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31,
4573 { "Wacom Bamboo Craft", 14720, 9200, 1023, 31,
4576 { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31,
4579 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31,
4582 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31,
4585 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31,
4588 { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31,
4591 { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31,
4594 { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31,
4597 { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31,
4600 { "Wacom Bamboo Connect", 14720, 9200, 1023, 31,
4603 { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31,
4606 { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31,
4609 { "Wacom Bamboo One S", 14720, 9225, 1023, 31,
4612 { "Wacom Bamboo One M", 21648, 13530, 1023, 31,
4615 { "Wacom Intuos PT S", 15200, 9500, 1023, 31,
4619 { "Wacom Intuos PT M", 21600, 13500, 1023, 31,
4623 { "Wacom Intuos S", 15200, 9500, 1023, 31,
4627 { "ISD-V4", 12800, 8000, 255, 0,
4634 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 };
4637 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10,
4644 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C };
4647 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10,
4660 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
4663 .oPid = 0x325 };
4665 { "Wacom Intuos P M", 21600, 13500, 1023, 31,
4689 { "Wacom DTK1651", 34816, 19759, 1023, 0,
4736 { USB_DEVICE_WACOM(0x00) },
4737 { USB_DEVICE_WACOM(0x03) },
4738 { USB_DEVICE_WACOM(0x10) },
4739 { USB_DEVICE_WACOM(0x11) },
4740 { USB_DEVICE_WACOM(0x12) },
4741 { USB_DEVICE_WACOM(0x13) },
4742 { USB_DEVICE_WACOM(0x14) },
4743 { USB_DEVICE_WACOM(0x15) },
4744 { USB_DEVICE_WACOM(0x16) },
4745 { USB_DEVICE_WACOM(0x17) },
4746 { USB_DEVICE_WACOM(0x18) },
4747 { USB_DEVICE_WACOM(0x19) },
4748 { USB_DEVICE_WACOM(0x20) },
4749 { USB_DEVICE_WACOM(0x21) },
4750 { USB_DEVICE_WACOM(0x22) },
4751 { USB_DEVICE_WACOM(0x23) },
4752 { USB_DEVICE_WACOM(0x24) },
4753 { USB_DEVICE_WACOM(0x26) },
4754 { USB_DEVICE_WACOM(0x27) },
4755 { USB_DEVICE_WACOM(0x28) },
4756 { USB_DEVICE_WACOM(0x29) },
4757 { USB_DEVICE_WACOM(0x2A) },
4758 { USB_DEVICE_WACOM(0x30) },
4759 { USB_DEVICE_WACOM(0x31) },
4760 { USB_DEVICE_WACOM(0x32) },
4761 { USB_DEVICE_WACOM(0x33) },
4762 { USB_DEVICE_WACOM(0x34) },
4763 { USB_DEVICE_WACOM(0x35) },
4764 { USB_DEVICE_WACOM(0x37) },
4765 { USB_DEVICE_WACOM(0x38) },
4766 { USB_DEVICE_WACOM(0x39) },
4767 { USB_DEVICE_WACOM(0x3F) },
4768 { USB_DEVICE_WACOM(0x41) },
4769 { USB_DEVICE_WACOM(0x42) },
4770 { USB_DEVICE_WACOM(0x43) },
4771 { USB_DEVICE_WACOM(0x44) },
4772 { USB_DEVICE_WACOM(0x45) },
4773 { USB_DEVICE_WACOM(0x47) },
4774 { USB_DEVICE_WACOM(0x57) },
4775 { USB_DEVICE_WACOM(0x59) },
4776 { USB_DEVICE_WACOM(0x5B) },
4777 { USB_DEVICE_WACOM(0x5D) },
4778 { USB_DEVICE_WACOM(0x5E) },
4779 { USB_DEVICE_WACOM(0x60) },
4780 { USB_DEVICE_WACOM(0x61) },
4781 { USB_DEVICE_WACOM(0x62) },
4782 { USB_DEVICE_WACOM(0x63) },
4783 { USB_DEVICE_WACOM(0x64) },
4784 { USB_DEVICE_WACOM(0x65) },
4785 { USB_DEVICE_WACOM(0x69) },
4786 { USB_DEVICE_WACOM(0x6A) },
4787 { USB_DEVICE_WACOM(0x6B) },
4788 { BT_DEVICE_WACOM(0x81) },
4789 { USB_DEVICE_WACOM(0x84) },
4790 { USB_DEVICE_WACOM(0x90) },
4791 { USB_DEVICE_WACOM(0x93) },
4792 { USB_DEVICE_WACOM(0x97) },
4793 { USB_DEVICE_WACOM(0x9A) },
4794 { USB_DEVICE_WACOM(0x9F) },
4795 { USB_DEVICE_WACOM(0xB0) },
4796 { USB_DEVICE_WACOM(0xB1) },
4797 { USB_DEVICE_WACOM(0xB2) },
4798 { USB_DEVICE_WACOM(0xB3) },
4799 { USB_DEVICE_WACOM(0xB4) },
4800 { USB_DEVICE_WACOM(0xB5) },
4801 { USB_DEVICE_WACOM(0xB7) },
4802 { USB_DEVICE_WACOM(0xB8) },
4803 { USB_DEVICE_WACOM(0xB9) },
4804 { USB_DEVICE_WACOM(0xBA) },
4805 { USB_DEVICE_WACOM(0xBB) },
4806 { USB_DEVICE_WACOM(0xBC) },
4807 { BT_DEVICE_WACOM(0xBD) },
4808 { USB_DEVICE_WACOM(0xC0) },
4809 { USB_DEVICE_WACOM(0xC2) },
4810 { USB_DEVICE_WACOM(0xC4) },
4811 { USB_DEVICE_WACOM(0xC5) },
4812 { USB_DEVICE_WACOM(0xC6) },
4813 { USB_DEVICE_WACOM(0xC7) },
4814 { USB_DEVICE_WACOM(0xCC) },
4815 { USB_DEVICE_WACOM(0xCE) },
4816 { USB_DEVICE_WACOM(0xD0) },
4817 { USB_DEVICE_WACOM(0xD1) },
4818 { USB_DEVICE_WACOM(0xD2) },
4819 { USB_DEVICE_WACOM(0xD3) },
4820 { USB_DEVICE_WACOM(0xD4) },
4821 { USB_DEVICE_WACOM(0xD5) },
4822 { USB_DEVICE_WACOM(0xD6) },
4823 { USB_DEVICE_WACOM(0xD7) },
4824 { USB_DEVICE_WACOM(0xD8) },
4825 { USB_DEVICE_WACOM(0xDA) },
4826 { USB_DEVICE_WACOM(0xDB) },
4827 { USB_DEVICE_WACOM(0xDD) },
4828 { USB_DEVICE_WACOM(0xDE) },
4829 { USB_DEVICE_WACOM(0xDF) },
4830 { USB_DEVICE_WACOM(0xE2) },
4831 { USB_DEVICE_WACOM(0xE3) },
4832 { USB_DEVICE_WACOM(0xE5) },
4833 { USB_DEVICE_WACOM(0xE6) },
4834 { USB_DEVICE_WACOM(0xEC) },
4835 { USB_DEVICE_WACOM(0xED) },
4836 { USB_DEVICE_WACOM(0xEF) },
4837 { USB_DEVICE_WACOM(0xF0) },
4838 { USB_DEVICE_WACOM(0xF4) },
4839 { USB_DEVICE_WACOM(0xF6) },
4840 { USB_DEVICE_WACOM(0xF8) },
4841 { USB_DEVICE_WACOM(0xFA) },
4842 { USB_DEVICE_WACOM(0xFB) },
4843 { USB_DEVICE_WACOM(0x100) },
4844 { USB_DEVICE_WACOM(0x101) },
4845 { USB_DEVICE_WACOM(0x10D) },
4846 { USB_DEVICE_WACOM(0x10E) },
4847 { USB_DEVICE_WACOM(0x10F) },
4848 { USB_DEVICE_WACOM(0x116) },
4849 { USB_DEVICE_WACOM(0x12C) },
4850 { USB_DEVICE_WACOM(0x300) },
4851 { USB_DEVICE_WACOM(0x301) },
4852 { USB_DEVICE_WACOM(0x302) },
4853 { USB_DEVICE_WACOM(0x303) },
4854 { USB_DEVICE_WACOM(0x304) },
4855 { USB_DEVICE_WACOM(0x307) },
4856 { USB_DEVICE_WACOM(0x309) },
4857 { USB_DEVICE_WACOM(0x30A) },
4858 { USB_DEVICE_WACOM(0x30C) },
4859 { USB_DEVICE_WACOM(0x30E) },
4860 { USB_DEVICE_WACOM(0x314) },
4861 { USB_DEVICE_WACOM(0x315) },
4862 { USB_DEVICE_WACOM(0x317) },
4863 { USB_DEVICE_WACOM(0x318) },
4864 { USB_DEVICE_WACOM(0x319) },
4865 { USB_DEVICE_WACOM(0x323) },
4866 { USB_DEVICE_WACOM(0x325) },
4867 { USB_DEVICE_WACOM(0x326) },
4868 { USB_DEVICE_WACOM(0x32A) },
4869 { USB_DEVICE_WACOM(0x32B) },
4870 { USB_DEVICE_WACOM(0x32C) },
4871 { USB_DEVICE_WACOM(0x32F) },
4872 { USB_DEVICE_WACOM(0x331) },
4873 { USB_DEVICE_WACOM(0x333) },
4874 { USB_DEVICE_WACOM(0x335) },
4875 { USB_DEVICE_WACOM(0x336) },
4876 { USB_DEVICE_WACOM(0x33B) },
4877 { USB_DEVICE_WACOM(0x33C) },
4878 { USB_DEVICE_WACOM(0x33D) },
4879 { USB_DEVICE_WACOM(0x33E) },
4880 { USB_DEVICE_WACOM(0x343) },
4881 { BT_DEVICE_WACOM(0x360) },
4882 { BT_DEVICE_WACOM(0x361) },
4883 { BT_DEVICE_WACOM(0x377) },
4884 { BT_DEVICE_WACOM(0x379) },
4885 { USB_DEVICE_WACOM(0x37A) },
4886 { USB_DEVICE_WACOM(0x37B) },
4887 { BT_DEVICE_WACOM(0x393) },
4888 { USB_DEVICE_WACOM(0x4001) },
4889 { USB_DEVICE_WACOM(0x4004) },
4890 { USB_DEVICE_WACOM(0x5000) },
4891 { USB_DEVICE_WACOM(0x5002) },
4892 { USB_DEVICE_LENOVO(0x6004) },