Lines Matching +full:0 +full:- +full:1023

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * USB Wacom tablet support - Wacom specific code
25 * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo
43 struct input_dev *input = wacom_wac->pen_input; in wacom_force_proxout()
45 wacom_wac->shared->stylus_in_proximity = 0; in wacom_force_proxout()
47 input_report_key(input, BTN_TOUCH, 0); in wacom_force_proxout()
48 input_report_key(input, BTN_STYLUS, 0); in wacom_force_proxout()
49 input_report_key(input, BTN_STYLUS2, 0); in wacom_force_proxout()
50 input_report_key(input, BTN_STYLUS3, 0); in wacom_force_proxout()
51 input_report_key(input, wacom_wac->tool[0], 0); in wacom_force_proxout()
52 if (wacom_wac->serial[0]) { in wacom_force_proxout()
53 input_report_abs(input, ABS_MISC, 0); in wacom_force_proxout()
55 input_report_abs(input, ABS_PRESSURE, 0); in wacom_force_proxout()
57 wacom_wac->tool[0] = 0; in wacom_force_proxout()
58 wacom_wac->id[0] = 0; in wacom_force_proxout()
59 wacom_wac->serial[0] = 0; in wacom_force_proxout()
67 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_idleprox_timeout()
69 if (!wacom_wac->hid_data.sense_state) { in wacom_idleprox_timeout()
73 hid_warn(wacom->hdev, "%s: tool appears to be hung in-prox. forcing it out.\n", __func__); in wacom_idleprox_timeout()
93 bool changed = battery->bat_status != bat_status || in __wacom_notify_battery()
94 battery->battery_capacity != bat_capacity || in __wacom_notify_battery()
95 battery->bat_charging != bat_charging || in __wacom_notify_battery()
96 battery->bat_connected != bat_connected || in __wacom_notify_battery()
97 battery->ps_connected != ps_connected; in __wacom_notify_battery()
100 battery->bat_status = bat_status; in __wacom_notify_battery()
101 battery->battery_capacity = bat_capacity; in __wacom_notify_battery()
102 battery->bat_charging = bat_charging; in __wacom_notify_battery()
103 battery->bat_connected = bat_connected; in __wacom_notify_battery()
104 battery->ps_connected = ps_connected; in __wacom_notify_battery()
106 if (battery->battery) in __wacom_notify_battery()
107 power_supply_changed(battery->battery); in __wacom_notify_battery()
117 __wacom_notify_battery(&wacom->battery, bat_status, bat_capacity, in wacom_notify_battery()
123 unsigned char *data = wacom->data; in wacom_penpartner_irq()
124 struct input_dev *input = wacom->pen_input; in wacom_penpartner_irq()
126 switch (data[0]) { in wacom_penpartner_irq()
128 if (data[5] & 0x80) { in wacom_penpartner_irq()
129 wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_penpartner_irq()
130 wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; in wacom_penpartner_irq()
131 input_report_key(input, wacom->tool[0], 1); in wacom_penpartner_irq()
132 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_penpartner_irq()
136 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); in wacom_penpartner_irq()
137 input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); in wacom_penpartner_irq()
139 input_report_key(input, wacom->tool[0], 0); in wacom_penpartner_irq()
140 input_report_abs(input, ABS_MISC, 0); /* report tool id */ in wacom_penpartner_irq()
141 input_report_abs(input, ABS_PRESSURE, -1); in wacom_penpartner_irq()
142 input_report_key(input, BTN_TOUCH, 0); in wacom_penpartner_irq()
152 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); in wacom_penpartner_irq()
153 input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); in wacom_penpartner_irq()
157 dev_dbg(input->dev.parent, in wacom_penpartner_irq()
158 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_penpartner_irq()
159 return 0; in wacom_penpartner_irq()
167 struct wacom_features *features = &wacom->features; in wacom_pl_irq()
168 unsigned char *data = wacom->data; in wacom_pl_irq()
169 struct input_dev *input = wacom->pen_input; in wacom_pl_irq()
172 if (data[0] != WACOM_REPORT_PENABLED) { in wacom_pl_irq()
173 dev_dbg(input->dev.parent, in wacom_pl_irq()
174 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_pl_irq()
175 return 0; in wacom_pl_irq()
178 prox = data[1] & 0x40; in wacom_pl_irq()
180 if (!wacom->id[0]) { in wacom_pl_irq()
181 if ((data[0] & 0x10) || (data[4] & 0x20)) { in wacom_pl_irq()
182 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_pl_irq()
183 wacom->id[0] = ERASER_DEVICE_ID; in wacom_pl_irq()
186 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
187 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
192 * mis-detected the type and notice that STYLUS2 isn't set in wacom_pl_irq()
195 if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { in wacom_pl_irq()
196 input_report_key(input, BTN_TOOL_RUBBER, 0); in wacom_pl_irq()
197 input_report_abs(input, ABS_MISC, 0); in wacom_pl_irq()
199 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
200 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
205 if (features->pressure_max > 255) in wacom_pl_irq()
207 pressure += (features->pressure_max + 1) / 2; in wacom_pl_irq()
209 input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); in wacom_pl_irq()
210 input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); in wacom_pl_irq()
213 input_report_key(input, BTN_TOUCH, data[4] & 0x08); in wacom_pl_irq()
214 input_report_key(input, BTN_STYLUS, data[4] & 0x10); in wacom_pl_irq()
216 input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); in wacom_pl_irq()
220 wacom->id[0] = 0; in wacom_pl_irq()
221 input_report_key(input, wacom->tool[0], prox); in wacom_pl_irq()
222 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_pl_irq()
228 unsigned char *data = wacom->data; in wacom_ptu_irq()
229 struct input_dev *input = wacom->pen_input; in wacom_ptu_irq()
231 if (data[0] != WACOM_REPORT_PENABLED) { in wacom_ptu_irq()
232 dev_dbg(input->dev.parent, in wacom_ptu_irq()
233 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_ptu_irq()
234 return 0; in wacom_ptu_irq()
237 if (data[1] & 0x04) { in wacom_ptu_irq()
238 input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20); in wacom_ptu_irq()
239 input_report_key(input, BTN_TOUCH, data[1] & 0x08); in wacom_ptu_irq()
240 wacom->id[0] = ERASER_DEVICE_ID; in wacom_ptu_irq()
242 input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20); in wacom_ptu_irq()
243 input_report_key(input, BTN_TOUCH, data[1] & 0x01); in wacom_ptu_irq()
244 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_ptu_irq()
246 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_ptu_irq()
250 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_ptu_irq()
251 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_ptu_irq()
257 unsigned char *data = wacom->data; in wacom_dtu_irq()
258 struct input_dev *input = wacom->pen_input; in wacom_dtu_irq()
259 int prox = data[1] & 0x20; in wacom_dtu_irq()
261 dev_dbg(input->dev.parent, in wacom_dtu_irq()
262 "%s: received report #%d", __func__, data[0]); in wacom_dtu_irq()
266 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_dtu_irq()
267 if (wacom->tool[0] == BTN_TOOL_PEN) in wacom_dtu_irq()
268 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtu_irq()
270 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtu_irq()
272 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_dtu_irq()
273 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_dtu_irq()
276 input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]); in wacom_dtu_irq()
277 input_report_key(input, BTN_TOUCH, data[1] & 0x05); in wacom_dtu_irq()
278 if (!prox) /* out-prox */ in wacom_dtu_irq()
279 wacom->id[0] = 0; in wacom_dtu_irq()
280 input_report_key(input, wacom->tool[0], prox); in wacom_dtu_irq()
281 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtu_irq()
287 unsigned char *data = wacom->data; in wacom_dtus_irq()
288 struct input_dev *input = wacom->pen_input; in wacom_dtus_irq()
289 unsigned short prox, pressure = 0; in wacom_dtus_irq()
291 if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { in wacom_dtus_irq()
292 dev_dbg(input->dev.parent, in wacom_dtus_irq()
293 "%s: received unknown report #%d", __func__, data[0]); in wacom_dtus_irq()
294 return 0; in wacom_dtus_irq()
295 } else if (data[0] == WACOM_REPORT_DTUSPAD) { in wacom_dtus_irq()
296 input = wacom->pad_input; in wacom_dtus_irq()
297 input_report_key(input, BTN_0, (data[1] & 0x01)); in wacom_dtus_irq()
298 input_report_key(input, BTN_1, (data[1] & 0x02)); in wacom_dtus_irq()
299 input_report_key(input, BTN_2, (data[1] & 0x04)); in wacom_dtus_irq()
300 input_report_key(input, BTN_3, (data[1] & 0x08)); in wacom_dtus_irq()
302 data[1] & 0x0f ? PAD_DEVICE_ID : 0); in wacom_dtus_irq()
305 prox = data[1] & 0x80; in wacom_dtus_irq()
309 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_dtus_irq()
310 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtus_irq()
314 wacom->tool[0] = BTN_TOOL_PEN; in wacom_dtus_irq()
315 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtus_irq()
320 input_report_key(input, BTN_STYLUS, data[1] & 0x20); in wacom_dtus_irq()
321 input_report_key(input, BTN_STYLUS2, data[1] & 0x40); in wacom_dtus_irq()
324 pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff); in wacom_dtus_irq()
328 if (!prox) /* out-prox */ in wacom_dtus_irq()
329 wacom->id[0] = 0; in wacom_dtus_irq()
330 input_report_key(input, wacom->tool[0], prox); in wacom_dtus_irq()
331 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtus_irq()
338 struct wacom_features *features = &wacom->features; in wacom_graphire_irq()
339 unsigned char *data = wacom->data; in wacom_graphire_irq()
340 struct input_dev *input = wacom->pen_input; in wacom_graphire_irq()
341 struct input_dev *pad_input = wacom->pad_input; in wacom_graphire_irq()
344 int rw = 0; in wacom_graphire_irq()
345 int retval = 0; in wacom_graphire_irq()
347 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
348 if (data[0] != WACOM_REPORT_PENABLED_BT) { in wacom_graphire_irq()
349 dev_dbg(input->dev.parent, in wacom_graphire_irq()
351 data[0]); in wacom_graphire_irq()
354 } else if (data[0] != WACOM_REPORT_PENABLED) { in wacom_graphire_irq()
355 dev_dbg(input->dev.parent, in wacom_graphire_irq()
356 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_graphire_irq()
360 prox = data[1] & 0x80; in wacom_graphire_irq()
361 if (prox || wacom->id[0]) { in wacom_graphire_irq()
365 case 0: /* Pen */ in wacom_graphire_irq()
366 wacom->tool[0] = BTN_TOOL_PEN; in wacom_graphire_irq()
367 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_graphire_irq()
371 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_graphire_irq()
372 wacom->id[0] = ERASER_DEVICE_ID; in wacom_graphire_irq()
376 input_report_key(input, BTN_MIDDLE, data[1] & 0x04); in wacom_graphire_irq()
380 wacom->tool[0] = BTN_TOOL_MOUSE; in wacom_graphire_irq()
381 wacom->id[0] = CURSOR_DEVICE_ID; in wacom_graphire_irq()
387 if (wacom->tool[0] != BTN_TOOL_MOUSE) { in wacom_graphire_irq()
388 if (features->type == GRAPHIRE_BT) in wacom_graphire_irq()
390 (((__u16) (data[1] & 0x08)) << 5)); in wacom_graphire_irq()
393 ((data[7] & 0x03) << 8)); in wacom_graphire_irq()
394 input_report_key(input, BTN_TOUCH, data[1] & 0x01); in wacom_graphire_irq()
395 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_graphire_irq()
396 input_report_key(input, BTN_STYLUS2, data[1] & 0x04); in wacom_graphire_irq()
398 input_report_key(input, BTN_LEFT, data[1] & 0x01); in wacom_graphire_irq()
399 input_report_key(input, BTN_RIGHT, data[1] & 0x02); in wacom_graphire_irq()
400 if (features->type == WACOM_G4 || in wacom_graphire_irq()
401 features->type == WACOM_MO) { in wacom_graphire_irq()
402 input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); in wacom_graphire_irq()
403 rw = (data[7] & 0x04) - (data[7] & 0x03); in wacom_graphire_irq()
404 } else if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
406 rw = 44 - (data[6] >> 2); in wacom_graphire_irq()
407 rw = clamp_val(rw, 0, 31); in wacom_graphire_irq()
412 data[1] & 0x04); in wacom_graphire_irq()
413 rw = (data[6] & 0x01) ? -1 : in wacom_graphire_irq()
414 (data[6] & 0x02) ? 1 : 0; in wacom_graphire_irq()
416 rw = 0; in wacom_graphire_irq()
419 input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); in wacom_graphire_irq()
420 rw = -(signed char)data[6]; in wacom_graphire_irq()
426 wacom->id[0] = 0; in wacom_graphire_irq()
427 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_graphire_irq()
428 input_report_key(input, wacom->tool[0], prox); in wacom_graphire_irq()
433 switch (features->type) { in wacom_graphire_irq()
435 prox = data[7] & 0xf8; in wacom_graphire_irq()
436 if (prox || wacom->id[1]) { in wacom_graphire_irq()
437 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
438 input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); in wacom_graphire_irq()
439 input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); in wacom_graphire_irq()
440 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); in wacom_graphire_irq()
443 wacom->id[1] = 0; in wacom_graphire_irq()
444 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
450 prox = (data[7] & 0xf8) || data[8]; in wacom_graphire_irq()
451 if (prox || wacom->id[1]) { in wacom_graphire_irq()
452 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
453 input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); in wacom_graphire_irq()
454 input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); in wacom_graphire_irq()
455 input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); in wacom_graphire_irq()
456 input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); in wacom_graphire_irq()
457 input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); in wacom_graphire_irq()
459 wacom->id[1] = 0; in wacom_graphire_irq()
460 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
465 prox = data[7] & 0x03; in wacom_graphire_irq()
466 if (prox || wacom->id[1]) { in wacom_graphire_irq()
467 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
468 input_report_key(pad_input, BTN_0, (data[7] & 0x02)); in wacom_graphire_irq()
469 input_report_key(pad_input, BTN_1, (data[7] & 0x01)); in wacom_graphire_irq()
471 wacom->id[1] = 0; in wacom_graphire_irq()
472 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
479 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
480 rw = (data[7] >> 2 & 0x07); in wacom_graphire_irq()
494 struct wacom_features *features = &wacom_wac->features; in wacom_intuos_schedule_prox_event()
498 re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); in wacom_intuos_schedule_prox_event()
499 if (features->type == INTUOSHT2) in wacom_intuos_schedule_prox_event()
500 r = re->report_id_hash[WACOM_REPORT_INTUOSHT2_ID]; in wacom_intuos_schedule_prox_event()
502 r = re->report_id_hash[WACOM_REPORT_INTUOS_ID1]; in wacom_intuos_schedule_prox_event()
504 hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); in wacom_intuos_schedule_prox_event()
510 struct wacom_features *features = &wacom->features; in wacom_intuos_pad()
511 unsigned char *data = wacom->data; in wacom_intuos_pad()
512 struct input_dev *input = wacom->pad_input; in wacom_intuos_pad()
514 int buttons = 0, nbuttons = features->numbered_buttons; in wacom_intuos_pad()
515 int keys = 0, nkeys = 0; in wacom_intuos_pad()
516 int ring1 = 0, ring2 = 0; in wacom_intuos_pad()
517 int strip1 = 0, strip2 = 0; in wacom_intuos_pad()
523 if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD || in wacom_intuos_pad()
524 data[0] == WACOM_REPORT_CINTIQPAD)) in wacom_intuos_pad()
525 return 0; in wacom_intuos_pad()
527 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { in wacom_intuos_pad()
528 buttons = (data[3] << 1) | (data[2] & 0x01); in wacom_intuos_pad()
530 } else if (features->type == DTK) { in wacom_intuos_pad()
532 } else if (features->type == WACOM_13HD) { in wacom_intuos_pad()
533 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
534 } else if (features->type == WACOM_24HD) { in wacom_intuos_pad()
544 * ((data[3] & 0x1f) << 8) | data[4]) in wacom_intuos_pad()
547 keys = ((data[3] & 0x1C) ? 1<<2 : 0) | in wacom_intuos_pad()
548 ((data[4] & 0xE0) ? 1<<1 : 0) | in wacom_intuos_pad()
549 ((data[4] & 0x07) ? 1<<0 : 0); in wacom_intuos_pad()
550 keyboard = !!(data[4] & 0xE0); in wacom_intuos_pad()
551 info = !!(data[3] & 0x1C); in wacom_intuos_pad()
553 if (features->oPid) { in wacom_intuos_pad()
554 mute_touch = !!(data[4] & 0x07); in wacom_intuos_pad()
556 wacom->shared->is_touch_on = in wacom_intuos_pad()
557 !wacom->shared->is_touch_on; in wacom_intuos_pad()
559 wrench = !!(data[4] & 0x07); in wacom_intuos_pad()
561 } else if (features->type == WACOM_27QHD) { in wacom_intuos_pad()
563 keys = data[2] & 0x07; in wacom_intuos_pad()
565 wrench = !!(data[2] & 0x01); in wacom_intuos_pad()
566 keyboard = !!(data[2] & 0x02); in wacom_intuos_pad()
568 if (features->oPid) { in wacom_intuos_pad()
569 mute_touch = !!(data[2] & 0x04); in wacom_intuos_pad()
571 wacom->shared->is_touch_on = in wacom_intuos_pad()
572 !wacom->shared->is_touch_on; in wacom_intuos_pad()
574 menu = !!(data[2] & 0x04); in wacom_intuos_pad()
579 } else if (features->type == CINTIQ_HYBRID) { in wacom_intuos_pad()
585 * d-pad right -> data[4] & 0x10 in wacom_intuos_pad()
586 * d-pad up -> data[4] & 0x20 in wacom_intuos_pad()
587 * d-pad left -> data[4] & 0x40 in wacom_intuos_pad()
588 * d-pad down -> data[4] & 0x80 in wacom_intuos_pad()
589 * d-pad center -> data[3] & 0x01 in wacom_intuos_pad()
591 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
592 } else if (features->type == CINTIQ_COMPANION_2) { in wacom_intuos_pad()
593 /* d-pad right -> data[2] & 0x10 in wacom_intuos_pad()
594 * d-pad up -> data[2] & 0x20 in wacom_intuos_pad()
595 * d-pad left -> data[2] & 0x40 in wacom_intuos_pad()
596 * d-pad down -> data[2] & 0x80 in wacom_intuos_pad()
597 * d-pad center -> data[1] & 0x01 in wacom_intuos_pad()
600 ((data[1] & 0x04) << 4) | in wacom_intuos_pad()
601 ((data[2] & 0x0F) << 2) | in wacom_intuos_pad()
602 (data[1] & 0x03); in wacom_intuos_pad()
603 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { in wacom_intuos_pad()
611 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
614 if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { in wacom_intuos_pad()
615 buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) | in wacom_intuos_pad()
616 (data[6] << 1) | (data[5] & 0x01); in wacom_intuos_pad()
618 if (features->type == WACOM_22HD) { in wacom_intuos_pad()
620 keys = data[9] & 0x07; in wacom_intuos_pad()
622 info = !!(data[9] & 0x01); in wacom_intuos_pad()
623 wrench = !!(data[9] & 0x02); in wacom_intuos_pad()
626 buttons = ((data[6] & 0x10) << 5) | in wacom_intuos_pad()
627 ((data[5] & 0x10) << 4) | in wacom_intuos_pad()
628 ((data[6] & 0x0F) << 4) | in wacom_intuos_pad()
629 (data[5] & 0x0F); in wacom_intuos_pad()
631 strip1 = ((data[1] & 0x1f) << 8) | data[2]; in wacom_intuos_pad()
632 strip2 = ((data[3] & 0x1f) << 8) | data[4]; in wacom_intuos_pad()
635 prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) | in wacom_intuos_pad()
636 (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; in wacom_intuos_pad()
640 for (i = 0; i < nkeys; i++) in wacom_intuos_pad()
648 if (wacom->shared && wacom->shared->touch_input) { in wacom_intuos_pad()
649 input_report_switch(wacom->shared->touch_input, in wacom_intuos_pad()
651 !wacom->shared->is_touch_on); in wacom_intuos_pad()
652 input_sync(wacom->shared->touch_input); in wacom_intuos_pad()
658 input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0); in wacom_intuos_pad()
659 input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0); in wacom_intuos_pad()
661 input_report_key(input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pad()
662 input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pad()
664 input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_pad()
671 return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); in wacom_intuos_id_mangle()
679 case 0x885: /* Intuos3 Marker Pen */ in wacom_is_art_pen()
680 case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ in wacom_is_art_pen()
681 case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ in wacom_is_art_pen()
696 case 0x812: /* Inking pen */ in wacom_intuos_get_tool_type()
697 case 0x801: /* Intuos3 Inking pen */ in wacom_intuos_get_tool_type()
698 case 0x12802: /* Intuos4/5 Inking Pen */ in wacom_intuos_get_tool_type()
699 case 0x012: in wacom_intuos_get_tool_type()
703 case 0x822: /* Pen */ in wacom_intuos_get_tool_type()
704 case 0x842: in wacom_intuos_get_tool_type()
705 case 0x852: in wacom_intuos_get_tool_type()
706 case 0x823: /* Intuos3 Grip Pen */ in wacom_intuos_get_tool_type()
707 case 0x813: /* Intuos3 Classic Pen */ in wacom_intuos_get_tool_type()
708 case 0x802: /* Intuos4/5 13HD/24HD General Pen */ in wacom_intuos_get_tool_type()
709 case 0x8e2: /* IntuosHT2 pen */ in wacom_intuos_get_tool_type()
710 case 0x022: in wacom_intuos_get_tool_type()
711 case 0x200: /* Pro Pen 3 */ in wacom_intuos_get_tool_type()
712 case 0x04200: /* Pro Pen 3 */ in wacom_intuos_get_tool_type()
713 case 0x10842: /* MobileStudio Pro Pro Pen slim */ in wacom_intuos_get_tool_type()
714 case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ in wacom_intuos_get_tool_type()
715 case 0x16802: /* Cintiq 13HD Pro Pen */ in wacom_intuos_get_tool_type()
716 case 0x18802: /* DTH2242 Pen */ in wacom_intuos_get_tool_type()
717 case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ in wacom_intuos_get_tool_type()
718 case 0x80842: /* Intuos Pro and Cintiq Pro 3D Pen */ in wacom_intuos_get_tool_type()
722 case 0x832: /* Stroke pen */ in wacom_intuos_get_tool_type()
723 case 0x032: in wacom_intuos_get_tool_type()
727 case 0x007: /* Mouse 4D and 2D */ in wacom_intuos_get_tool_type()
728 case 0x09c: in wacom_intuos_get_tool_type()
729 case 0x094: in wacom_intuos_get_tool_type()
730 case 0x017: /* Intuos3 2D Mouse */ in wacom_intuos_get_tool_type()
731 case 0x806: /* Intuos4 Mouse */ in wacom_intuos_get_tool_type()
735 case 0x096: /* Lens cursor */ in wacom_intuos_get_tool_type()
736 case 0x097: /* Intuos3 Lens cursor */ in wacom_intuos_get_tool_type()
737 case 0x006: /* Intuos4 Lens cursor */ in wacom_intuos_get_tool_type()
741 case 0x82a: /* Eraser */ in wacom_intuos_get_tool_type()
742 case 0x84a: in wacom_intuos_get_tool_type()
743 case 0x85a: in wacom_intuos_get_tool_type()
744 case 0x91a: in wacom_intuos_get_tool_type()
745 case 0xd1a: in wacom_intuos_get_tool_type()
746 case 0x0fa: in wacom_intuos_get_tool_type()
747 case 0x82b: /* Intuos3 Grip Pen Eraser */ in wacom_intuos_get_tool_type()
748 case 0x81b: /* Intuos3 Classic Pen Eraser */ in wacom_intuos_get_tool_type()
749 case 0x91b: /* Intuos3 Airbrush Eraser */ in wacom_intuos_get_tool_type()
750 case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */ in wacom_intuos_get_tool_type()
751 case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */ in wacom_intuos_get_tool_type()
752 case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ in wacom_intuos_get_tool_type()
753 case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */ in wacom_intuos_get_tool_type()
754 case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ in wacom_intuos_get_tool_type()
755 case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */ in wacom_intuos_get_tool_type()
756 case 0x1084a: /* MobileStudio Pro Pro Pen slim Eraser */ in wacom_intuos_get_tool_type()
757 case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */ in wacom_intuos_get_tool_type()
758 case 0x1880a: /* DTH2242 Eraser */ in wacom_intuos_get_tool_type()
759 case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */ in wacom_intuos_get_tool_type()
763 case 0xd12: in wacom_intuos_get_tool_type()
764 case 0x912: in wacom_intuos_get_tool_type()
765 case 0x112: in wacom_intuos_get_tool_type()
766 case 0x913: /* Intuos3 Airbrush */ in wacom_intuos_get_tool_type()
767 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ in wacom_intuos_get_tool_type()
768 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ in wacom_intuos_get_tool_type()
777 struct input_dev *input = wacom->pen_input; in wacom_exit_report()
778 struct wacom_features *features = &wacom->features; in wacom_exit_report()
779 unsigned char *data = wacom->data; in wacom_exit_report()
780 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_exit_report()
784 * when in-prox next time in wacom_exit_report()
786 input_report_abs(input, ABS_X, 0); in wacom_exit_report()
787 input_report_abs(input, ABS_Y, 0); in wacom_exit_report()
788 input_report_abs(input, ABS_DISTANCE, 0); in wacom_exit_report()
789 input_report_abs(input, ABS_TILT_X, 0); in wacom_exit_report()
790 input_report_abs(input, ABS_TILT_Y, 0); in wacom_exit_report()
791 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { in wacom_exit_report()
792 input_report_key(input, BTN_LEFT, 0); in wacom_exit_report()
793 input_report_key(input, BTN_MIDDLE, 0); in wacom_exit_report()
794 input_report_key(input, BTN_RIGHT, 0); in wacom_exit_report()
795 input_report_key(input, BTN_SIDE, 0); in wacom_exit_report()
796 input_report_key(input, BTN_EXTRA, 0); in wacom_exit_report()
797 input_report_abs(input, ABS_THROTTLE, 0); in wacom_exit_report()
798 input_report_abs(input, ABS_RZ, 0); in wacom_exit_report()
800 input_report_abs(input, ABS_PRESSURE, 0); in wacom_exit_report()
801 input_report_key(input, BTN_STYLUS, 0); in wacom_exit_report()
802 input_report_key(input, BTN_STYLUS2, 0); in wacom_exit_report()
803 input_report_key(input, BTN_TOUCH, 0); in wacom_exit_report()
804 input_report_abs(input, ABS_WHEEL, 0); in wacom_exit_report()
805 if (features->type >= INTUOS3S) in wacom_exit_report()
806 input_report_abs(input, ABS_Z, 0); in wacom_exit_report()
808 input_report_key(input, wacom->tool[idx], 0); in wacom_exit_report()
809 input_report_abs(input, ABS_MISC, 0); /* reset tool id */ in wacom_exit_report()
810 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_exit_report()
811 wacom->id[idx] = 0; in wacom_exit_report()
816 struct wacom_features *features = &wacom->features; in wacom_intuos_inout()
817 unsigned char *data = wacom->data; in wacom_intuos_inout()
818 struct input_dev *input = wacom->pen_input; in wacom_intuos_inout()
819 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_inout()
821 if (!(((data[1] & 0xfc) == 0xc0) || /* in prox */ in wacom_intuos_inout()
822 ((data[1] & 0xfe) == 0x20) || /* in range */ in wacom_intuos_inout()
823 ((data[1] & 0xfe) == 0x80))) /* out prox */ in wacom_intuos_inout()
824 return 0; in wacom_intuos_inout()
827 if ((data[1] & 0xfc) == 0xc0) { in wacom_intuos_inout()
829 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + in wacom_intuos_inout()
833 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | in wacom_intuos_inout()
834 ((data[7] & 0x0f) << 16) | ((data[8] & 0xf0) << 8); in wacom_intuos_inout()
836 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); in wacom_intuos_inout()
838 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
843 if ((data[1] & 0xfe) == 0x20) { in wacom_intuos_inout()
844 if (features->type != INTUOSHT2) in wacom_intuos_inout()
845 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
848 if (wacom->reporting_data) { in wacom_intuos_inout()
849 input_report_key(input, BTN_TOUCH, 0); in wacom_intuos_inout()
850 input_report_abs(input, ABS_PRESSURE, 0); in wacom_intuos_inout()
851 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); in wacom_intuos_inout()
858 if ((data[1] & 0xfe) == 0x80) { in wacom_intuos_inout()
859 wacom->shared->stylus_in_proximity = false; in wacom_intuos_inout()
860 wacom->reporting_data = false; in wacom_intuos_inout()
863 if (!wacom->id[idx]) in wacom_intuos_inout()
870 return 0; in wacom_intuos_inout()
875 return wacom_wac->probe_complete && in touch_is_muted()
876 wacom_wac->shared->has_mute_touch_switch && in touch_is_muted()
877 !wacom_wac->shared->is_touch_on; in touch_is_muted()
882 return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1); in report_touch_events()
887 return (wacom->shared->touch_down && touch_arbitration); in delay_pen_events()
892 struct wacom_features *features = &wacom->features; in wacom_intuos_general()
893 unsigned char *data = wacom->data; in wacom_intuos_general()
894 struct input_dev *input = wacom->pen_input; in wacom_intuos_general()
895 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_general()
896 unsigned char type = (data[1] >> 1) & 0x0F; in wacom_intuos_general()
899 if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_CINTIQ && in wacom_intuos_general()
900 data[0] != WACOM_REPORT_INTUOS_PEN) in wacom_intuos_general()
901 return 0; in wacom_intuos_general()
907 if (!wacom->id[idx]) { in wacom_intuos_general()
917 if ((!((wacom->id[idx] >> 16) & 0x01) && in wacom_intuos_general()
918 (features->type == WACOM_21UX2)) || in wacom_intuos_general()
920 (wacom->tool[idx] == BTN_TOOL_LENS && in wacom_intuos_general()
921 (features->type == INTUOS3 || in wacom_intuos_general()
922 features->type == INTUOS3S || in wacom_intuos_general()
923 features->type == INTUOS4 || in wacom_intuos_general()
924 features->type == INTUOS4S || in wacom_intuos_general()
925 features->type == INTUOS5 || in wacom_intuos_general()
926 features->type == INTUOS5S || in wacom_intuos_general()
927 features->type == INTUOSPM || in wacom_intuos_general()
928 features->type == INTUOSPS)) || in wacom_intuos_general()
930 (features->type == CINTIQ && !(data[1] & 0x40))) in wacom_intuos_general()
936 if (features->type < INTUOS3S) { in wacom_intuos_general()
941 if (features->type == INTUOSHT2) in wacom_intuos_general()
942 distance = features->distance_max - distance; in wacom_intuos_general()
948 case 0x00: in wacom_intuos_general()
949 case 0x01: in wacom_intuos_general()
950 case 0x02: in wacom_intuos_general()
951 case 0x03: in wacom_intuos_general()
953 t = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | (data[1] & 1); in wacom_intuos_general()
954 if (features->pressure_max < 2047) in wacom_intuos_general()
957 if (features->type != INTUOSHT2) { in wacom_intuos_general()
959 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
960 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
967 case 0x0a: in wacom_intuos_general()
972 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
973 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
976 case 0x05: in wacom_intuos_general()
978 if (features->type >= INTUOS3S) { in wacom_intuos_general()
981 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : in wacom_intuos_general()
982 ((t-1) / 2 + 450)) : (450 - t / 2) ; in wacom_intuos_general()
987 input_report_abs(input, ABS_RZ, (data[7] & 0x20) ? in wacom_intuos_general()
988 ((t - 1) / 2) : -t / 2); in wacom_intuos_general()
992 case 0x04: in wacom_intuos_general()
994 input_report_key(input, BTN_LEFT, data[8] & 0x01); in wacom_intuos_general()
995 input_report_key(input, BTN_MIDDLE, data[8] & 0x02); in wacom_intuos_general()
996 input_report_key(input, BTN_RIGHT, data[8] & 0x04); in wacom_intuos_general()
998 input_report_key(input, BTN_SIDE, data[8] & 0x20); in wacom_intuos_general()
999 input_report_key(input, BTN_EXTRA, data[8] & 0x10); in wacom_intuos_general()
1001 input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); in wacom_intuos_general()
1004 case 0x06: in wacom_intuos_general()
1006 input_report_key(input, BTN_LEFT, data[6] & 0x01); in wacom_intuos_general()
1007 input_report_key(input, BTN_MIDDLE, data[6] & 0x02); in wacom_intuos_general()
1008 input_report_key(input, BTN_RIGHT, data[6] & 0x04); in wacom_intuos_general()
1009 input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) in wacom_intuos_general()
1010 - ((data[7] & 0x40) >> 6)); in wacom_intuos_general()
1011 input_report_key(input, BTN_SIDE, data[6] & 0x08); in wacom_intuos_general()
1012 input_report_key(input, BTN_EXTRA, data[6] & 0x10); in wacom_intuos_general()
1015 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
1016 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
1019 case 0x08: in wacom_intuos_general()
1020 if (wacom->tool[idx] == BTN_TOOL_MOUSE) { in wacom_intuos_general()
1022 input_report_key(input, BTN_LEFT, data[8] & 0x04); in wacom_intuos_general()
1023 input_report_key(input, BTN_MIDDLE, data[8] & 0x08); in wacom_intuos_general()
1024 input_report_key(input, BTN_RIGHT, data[8] & 0x10); in wacom_intuos_general()
1025 input_report_rel(input, REL_WHEEL, (data[8] & 0x01) in wacom_intuos_general()
1026 - ((data[8] & 0x02) >> 1)); in wacom_intuos_general()
1029 if (features->type >= INTUOS3S && features->type <= INTUOS3L) { in wacom_intuos_general()
1030 input_report_key(input, BTN_SIDE, data[8] & 0x40); in wacom_intuos_general()
1031 input_report_key(input, BTN_EXTRA, data[8] & 0x20); in wacom_intuos_general()
1034 else if (wacom->tool[idx] == BTN_TOOL_LENS) { in wacom_intuos_general()
1036 input_report_key(input, BTN_LEFT, data[8] & 0x01); in wacom_intuos_general()
1037 input_report_key(input, BTN_MIDDLE, data[8] & 0x02); in wacom_intuos_general()
1038 input_report_key(input, BTN_RIGHT, data[8] & 0x04); in wacom_intuos_general()
1039 input_report_key(input, BTN_SIDE, data[8] & 0x10); in wacom_intuos_general()
1040 input_report_key(input, BTN_EXTRA, data[8] & 0x08); in wacom_intuos_general()
1044 case 0x07: in wacom_intuos_general()
1045 case 0x09: in wacom_intuos_general()
1046 case 0x0b: in wacom_intuos_general()
1047 case 0x0c: in wacom_intuos_general()
1048 case 0x0d: in wacom_intuos_general()
1049 case 0x0e: in wacom_intuos_general()
1050 case 0x0f: in wacom_intuos_general()
1056 wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */ in wacom_intuos_general()
1057 input_report_key(input, wacom->tool[idx], 1); in wacom_intuos_general()
1058 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_intuos_general()
1059 wacom->reporting_data = true; in wacom_intuos_general()
1065 unsigned char *data = wacom->data; in wacom_intuos_irq()
1066 struct input_dev *input = wacom->pen_input; in wacom_intuos_irq()
1069 if (data[0] != WACOM_REPORT_PENABLED && in wacom_intuos_irq()
1070 data[0] != WACOM_REPORT_INTUOS_ID1 && in wacom_intuos_irq()
1071 data[0] != WACOM_REPORT_INTUOS_ID2 && in wacom_intuos_irq()
1072 data[0] != WACOM_REPORT_INTUOSPAD && in wacom_intuos_irq()
1073 data[0] != WACOM_REPORT_INTUOS_PEN && in wacom_intuos_irq()
1074 data[0] != WACOM_REPORT_CINTIQ && in wacom_intuos_irq()
1075 data[0] != WACOM_REPORT_CINTIQPAD && in wacom_intuos_irq()
1076 data[0] != WACOM_REPORT_INTUOS5PAD) { in wacom_intuos_irq()
1077 dev_dbg(input->dev.parent, in wacom_intuos_irq()
1078 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_intuos_irq()
1079 return 0; in wacom_intuos_irq()
1090 return result - 1; in wacom_intuos_irq()
1095 return result - 1; in wacom_intuos_irq()
1097 return 0; in wacom_intuos_irq()
1102 unsigned char *data = wacom_wac->data; in wacom_remote_irq()
1105 struct wacom_remote *remote = wacom->remote; in wacom_remote_irq()
1108 int i, index = -1; in wacom_remote_irq()
1111 if (data[0] != WACOM_REPORT_REMOTE) { in wacom_remote_irq()
1112 hid_dbg(wacom->hdev, "%s: received unknown report #%d", in wacom_remote_irq()
1113 __func__, data[0]); in wacom_remote_irq()
1114 return 0; in wacom_remote_irq()
1118 wacom_wac->id[0] = PAD_DEVICE_ID; in wacom_remote_irq()
1120 spin_lock_irqsave(&remote->remote_lock, flags); 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()
1129 if (index < 0 || !remote->remotes[index].registered) in wacom_remote_irq()
1132 input = remote->remotes[index].input; in wacom_remote_irq()
1134 input_report_key(input, BTN_0, (data[9] & 0x01)); in wacom_remote_irq()
1135 input_report_key(input, BTN_1, (data[9] & 0x02)); in wacom_remote_irq()
1136 input_report_key(input, BTN_2, (data[9] & 0x04)); in wacom_remote_irq()
1137 input_report_key(input, BTN_3, (data[9] & 0x08)); in wacom_remote_irq()
1138 input_report_key(input, BTN_4, (data[9] & 0x10)); in wacom_remote_irq()
1139 input_report_key(input, BTN_5, (data[9] & 0x20)); in wacom_remote_irq()
1140 input_report_key(input, BTN_6, (data[9] & 0x40)); in wacom_remote_irq()
1141 input_report_key(input, BTN_7, (data[9] & 0x80)); in wacom_remote_irq()
1143 input_report_key(input, BTN_8, (data[10] & 0x01)); in wacom_remote_irq()
1144 input_report_key(input, BTN_9, (data[10] & 0x02)); in wacom_remote_irq()
1145 input_report_key(input, BTN_A, (data[10] & 0x04)); in wacom_remote_irq()
1146 input_report_key(input, BTN_B, (data[10] & 0x08)); in wacom_remote_irq()
1147 input_report_key(input, BTN_C, (data[10] & 0x10)); in wacom_remote_irq()
1148 input_report_key(input, BTN_X, (data[10] & 0x20)); in wacom_remote_irq()
1149 input_report_key(input, BTN_Y, (data[10] & 0x40)); in wacom_remote_irq()
1150 input_report_key(input, BTN_Z, (data[10] & 0x80)); in wacom_remote_irq()
1152 input_report_key(input, BTN_BASE, (data[11] & 0x01)); in wacom_remote_irq()
1153 input_report_key(input, BTN_BASE2, (data[11] & 0x02)); in wacom_remote_irq()
1155 if (data[12] & 0x80) in wacom_remote_irq()
1156 input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f) - 1); in wacom_remote_irq()
1158 input_report_abs(input, ABS_WHEEL, 0); in wacom_remote_irq()
1160 bat_percent = data[7] & 0x7f; in wacom_remote_irq()
1161 bat_charging = !!(data[7] & 0x80); in wacom_remote_irq()
1163 if (data[9] | data[10] | (data[11] & 0x03) | data[12]) in wacom_remote_irq()
1166 input_report_abs(input, ABS_MISC, 0); in wacom_remote_irq()
1173 touch_ring_mode = (data[11] & 0xC0) >> 6; in wacom_remote_irq()
1175 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_irq()
1176 if (remote->remotes[i].serial == serial) in wacom_remote_irq()
1177 wacom->led.groups[i].select = touch_ring_mode; in wacom_remote_irq()
1180 __wacom_notify_battery(&remote->remotes[index].battery, in wacom_remote_irq()
1185 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_irq()
1186 return 0; in wacom_remote_irq()
1192 unsigned char *data = wacom_wac->data; in wacom_remote_status_irq()
1193 struct wacom_remote *remote = wacom->remote; in wacom_remote_status_irq()
1198 if (data[0] != WACOM_REPORT_DEVICE_LIST) in wacom_remote_status_irq()
1201 memset(&remote_data, 0, sizeof(struct wacom_remote_data)); in wacom_remote_status_irq()
1203 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_status_irq()
1212 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_status_irq()
1214 ret = kfifo_in(&remote->remote_fifo, &remote_data, sizeof(remote_data)); in wacom_remote_status_irq()
1216 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1217 hid_err(wacom->hdev, "Can't queue Remote status event.\n"); in wacom_remote_status_irq()
1221 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1228 int x = x2 - x1; in int_dist()
1229 int y = y2 - y1; in int_dist()
1237 memcpy(wacom->data, data, 10); in wacom_intuos_bt_process_data()
1240 input_sync(wacom->pen_input); in wacom_intuos_bt_process_data()
1241 if (wacom->pad_input) in wacom_intuos_bt_process_data()
1242 input_sync(wacom->pad_input); in wacom_intuos_bt_process_data()
1251 memcpy(data, wacom->data, len); in wacom_intuos_bt_irq()
1253 switch (data[0]) { in wacom_intuos_bt_irq()
1254 case 0x04: in wacom_intuos_bt_irq()
1258 case 0x03: in wacom_intuos_bt_irq()
1264 bat_charging = (power_raw & 0x08) ? 1 : 0; in wacom_intuos_bt_irq()
1265 ps_connected = (power_raw & 0x10) ? 1 : 0; in wacom_intuos_bt_irq()
1266 battery_capacity = batcap_i4[power_raw & 0x07]; in wacom_intuos_bt_irq()
1273 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_bt_irq()
1275 data[0], data[1], len); in wacom_intuos_bt_irq()
1276 return 0; in wacom_intuos_bt_irq()
1278 return 0; in wacom_intuos_bt_irq()
1283 struct input_dev *input = wacom->touch_input; in wacom_wac_finger_count_touches()
1284 unsigned touch_max = wacom->features.touch_max; in wacom_wac_finger_count_touches()
1285 int count = 0; in wacom_wac_finger_count_touches()
1289 return 0; in wacom_wac_finger_count_touches()
1292 return test_bit(BTN_TOUCH, input->key) && in wacom_wac_finger_count_touches()
1295 for (i = 0; i < input->mt->num_slots; i++) { in wacom_wac_finger_count_touches()
1296 struct input_mt_slot *ps = &input->mt->slots[i]; in wacom_wac_finger_count_touches()
1298 if (id >= 0) in wacom_wac_finger_count_touches()
1309 struct input_dev *pen_input = wacom->pen_input; in wacom_intuos_pro2_bt_pen()
1310 unsigned char *data = wacom->data; 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()
1315 wacom->serial[0] = get_unaligned_le64(&data[99]); in wacom_intuos_pro2_bt_pen()
1316 wacom->id[0] = get_unaligned_le16(&data[107]); in wacom_intuos_pro2_bt_pen()
1320 wacom->serial[0] = get_unaligned_le64(&data[33]); in wacom_intuos_pro2_bt_pen()
1321 wacom->id[0] = get_unaligned_le16(&data[41]); in wacom_intuos_pro2_bt_pen()
1326 if (wacom->serial[0] >> 52 == 1) { in wacom_intuos_pro2_bt_pen()
1327 /* Add back in missing bits of ID for non-USI pens */ in wacom_intuos_pro2_bt_pen()
1328 wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF; in wacom_intuos_pro2_bt_pen()
1331 for (i = 0; i < pen_frames; i++) { in wacom_intuos_pro2_bt_pen()
1333 bool valid = frame[0] & 0x80; in wacom_intuos_pro2_bt_pen()
1334 bool prox = frame[0] & 0x40; in wacom_intuos_pro2_bt_pen()
1335 bool range = frame[0] & 0x20; in wacom_intuos_pro2_bt_pen()
1336 bool invert = frame[0] & 0x10; in wacom_intuos_pro2_bt_pen()
1342 wacom->shared->stylus_in_proximity = false; in wacom_intuos_pro2_bt_pen()
1346 wacom->tool[0] = 0; in wacom_intuos_pro2_bt_pen()
1347 wacom->id[0] = 0; in wacom_intuos_pro2_bt_pen()
1348 wacom->serial[0] = 0; in wacom_intuos_pro2_bt_pen()
1353 if (!wacom->tool[0]) { /* first in range */ in wacom_intuos_pro2_bt_pen()
1356 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_intuos_pro2_bt_pen()
1357 else if (wacom->id[0]) in wacom_intuos_pro2_bt_pen()
1358 wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]); in wacom_intuos_pro2_bt_pen()
1360 wacom->tool[0] = BTN_TOOL_PEN; in wacom_intuos_pro2_bt_pen()
1366 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1367 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1374 rotation -= 1800; in wacom_intuos_pro2_bt_pen()
1385 if (wacom->tool[0]) { in wacom_intuos_pro2_bt_pen()
1387 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1388 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1390 range ? frame[13] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1393 range ? frame[7] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1396 input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x09); in wacom_intuos_pro2_bt_pen()
1397 input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02); in wacom_intuos_pro2_bt_pen()
1398 input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04); in wacom_intuos_pro2_bt_pen()
1400 input_report_key(pen_input, wacom->tool[0], prox); in wacom_intuos_pro2_bt_pen()
1401 input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]); in wacom_intuos_pro2_bt_pen()
1403 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */ in wacom_intuos_pro2_bt_pen()
1406 wacom->shared->stylus_in_proximity = prox; in wacom_intuos_pro2_bt_pen()
1418 struct input_dev *touch_input = wacom->touch_input; in wacom_intuos_pro2_bt_touch()
1419 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_touch()
1423 for (i = 0; i < finger_frames; i++) { in wacom_intuos_pro2_bt_touch()
1425 int current_num_contacts = frame[0] & 0x7F; in wacom_intuos_pro2_bt_touch()
1428 if (!(frame[0] & 0x80)) in wacom_intuos_pro2_bt_touch()
1433 * packet in series will have non-zero current_num_contacts. in wacom_intuos_pro2_bt_touch()
1436 wacom->num_contacts_left = current_num_contacts; in wacom_intuos_pro2_bt_touch()
1438 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_intuos_pro2_bt_touch()
1440 for (j = 0; j < contacts_to_send; j++) { in wacom_intuos_pro2_bt_touch()
1442 int slot = input_mt_get_slot_by_key(touch_input, touch[0]); in wacom_intuos_pro2_bt_touch()
1448 if (slot < 0) in wacom_intuos_pro2_bt_touch()
1452 input_mt_report_slot_state(touch_input, MT_TOOL_FINGER, touch[1] & 0x01); in wacom_intuos_pro2_bt_touch()
1462 wacom->num_contacts_left -= contacts_to_send; in wacom_intuos_pro2_bt_touch()
1463 if (wacom->num_contacts_left <= 0) { in wacom_intuos_pro2_bt_touch()
1464 wacom->num_contacts_left = 0; in wacom_intuos_pro2_bt_touch()
1465 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_intuos_pro2_bt_touch()
1470 if (wacom->num_contacts_left == 0) { in wacom_intuos_pro2_bt_touch()
1481 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_pro2_bt_pad()
1482 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pad()
1483 int nbuttons = wacom->features.numbered_buttons; in wacom_intuos_pro2_bt_pad()
1486 int center = (data[281] & 0x40) >> 6; in wacom_intuos_pro2_bt_pad()
1487 int ring = data[285] & 0x7F; in wacom_intuos_pro2_bt_pad()
1488 bool ringstatus = data[285] & 0x80; in wacom_intuos_pro2_bt_pad()
1491 /* Fix touchring data: userspace expects 0 at left and increasing clockwise */ in wacom_intuos_pro2_bt_pad()
1492 ring = 71 - ring; in wacom_intuos_pro2_bt_pad()
1495 ring -= 72; in wacom_intuos_pro2_bt_pad()
1498 expresskeys | (center << (nbuttons - 1))); in wacom_intuos_pro2_bt_pad()
1500 input_report_abs(pad_input, ABS_WHEEL, ringstatus ? ring : 0); in wacom_intuos_pro2_bt_pad()
1502 input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pro2_bt_pad()
1503 input_report_abs(pad_input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pro2_bt_pad()
1504 input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_pro2_bt_pad()
1511 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_battery()
1513 bool chg = data[284] & 0x80; in wacom_intuos_pro2_bt_battery()
1514 int battery_status = data[284] & 0x7F; in wacom_intuos_pro2_bt_battery()
1522 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_gen3_bt_pad()
1523 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_pad()
1529 input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0); in wacom_intuos_gen3_bt_pad()
1530 input_report_abs(pad_input, ABS_MISC, buttons ? PAD_DEVICE_ID : 0); in wacom_intuos_gen3_bt_pad()
1531 input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_gen3_bt_pad()
1538 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_battery()
1540 bool chg = data[45] & 0x80; in wacom_intuos_gen3_bt_battery()
1541 int battery_status = data[45] & 0x7F; in wacom_intuos_gen3_bt_battery()
1549 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_irq()
1551 if (data[0] != 0x80 && data[0] != 0x81) { in wacom_intuos_pro2_bt_irq()
1552 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_pro2_bt_irq()
1553 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_intuos_pro2_bt_irq()
1554 return 0; in wacom_intuos_pro2_bt_irq()
1558 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_irq()
1559 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_irq()
1567 return 0; in wacom_intuos_pro2_bt_irq()
1572 struct input_dev *input = wacom->touch_input; in wacom_24hdt_irq()
1573 unsigned char *data = wacom->data; in wacom_24hdt_irq()
1576 int contacts_to_send = 0; in wacom_24hdt_irq()
1581 if (touch_is_muted(wacom) && !wacom->shared->touch_down) in wacom_24hdt_irq()
1582 return 0; in wacom_24hdt_irq()
1584 if (wacom->features.type == WACOM_27QHDT) { in wacom_24hdt_irq()
1588 y_offset = 0; in wacom_24hdt_irq()
1593 * packet in series will have non-zero current_num_contacts. in wacom_24hdt_irq()
1596 wacom->num_contacts_left = current_num_contacts; in wacom_24hdt_irq()
1598 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_24hdt_irq()
1600 for (i = 0; i < contacts_to_send; i++) { in wacom_24hdt_irq()
1602 bool touch = (data[offset] & 0x1) && report_touch_events(wacom); in wacom_24hdt_irq()
1605 if (slot < 0) in wacom_24hdt_irq()
1617 if (wacom->features.type != WACOM_27QHDT) { in wacom_24hdt_irq()
1633 wacom->num_contacts_left -= contacts_to_send; in wacom_24hdt_irq()
1634 if (wacom->num_contacts_left <= 0) { in wacom_24hdt_irq()
1635 wacom->num_contacts_left = 0; in wacom_24hdt_irq()
1636 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_24hdt_irq()
1643 struct input_dev *input = wacom->touch_input; in wacom_mt_touch()
1644 unsigned char *data = wacom->data; in wacom_mt_touch()
1647 int contacts_to_send = 0; in wacom_mt_touch()
1648 int x_offset = 0; in wacom_mt_touch()
1651 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) in wacom_mt_touch()
1652 x_offset = -4; in wacom_mt_touch()
1656 * packet in series will have non-zero current_num_contacts. in wacom_mt_touch()
1659 wacom->num_contacts_left = current_num_contacts; in wacom_mt_touch()
1662 contacts_to_send = min(5, wacom->num_contacts_left); in wacom_mt_touch()
1664 for (i = 0; i < contacts_to_send; i++) { in wacom_mt_touch()
1666 bool touch = (data[offset] & 0x1) && report_touch_events(wacom); in wacom_mt_touch()
1670 if (slot < 0) in wacom_mt_touch()
1684 wacom->num_contacts_left -= contacts_to_send; in wacom_mt_touch()
1685 if (wacom->num_contacts_left <= 0) { in wacom_mt_touch()
1686 wacom->num_contacts_left = 0; in wacom_mt_touch()
1687 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_mt_touch()
1694 struct input_dev *input = wacom->touch_input; in wacom_tpc_mt_touch()
1695 unsigned char *data = wacom->data; in wacom_tpc_mt_touch()
1698 for (i = 0; i < 2; i++) { in wacom_tpc_mt_touch()
1705 int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; in wacom_tpc_mt_touch()
1706 int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; in wacom_tpc_mt_touch()
1715 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_tpc_mt_touch()
1722 unsigned char *data = wacom->data; in wacom_tpc_single_touch()
1723 struct input_dev *input = wacom->touch_input; in wacom_tpc_single_touch()
1725 int x = 0, y = 0; in wacom_tpc_single_touch()
1727 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) in wacom_tpc_single_touch()
1728 return 0; in wacom_tpc_single_touch()
1731 prox = prox && (data[0] & 0x01); in wacom_tpc_single_touch()
1735 prox = prox && (data[2] & 0x01); in wacom_tpc_single_touch()
1739 prox = prox && (data[1] & 0x01); in wacom_tpc_single_touch()
1751 wacom->shared->touch_down = prox; in wacom_tpc_single_touch()
1758 unsigned char *data = wacom->data; in wacom_tpc_pen()
1759 struct input_dev *input = wacom->pen_input; in wacom_tpc_pen()
1760 bool prox = data[1] & 0x20; in wacom_tpc_pen()
1762 if (!wacom->shared->stylus_in_proximity) /* first in prox */ in wacom_tpc_pen()
1764 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_tpc_pen()
1767 wacom->shared->stylus_in_proximity = prox; in wacom_tpc_pen()
1773 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_tpc_pen()
1774 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_tpc_pen()
1777 input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); in wacom_tpc_pen()
1778 input_report_key(input, BTN_TOUCH, data[1] & 0x05); in wacom_tpc_pen()
1779 input_report_key(input, wacom->tool[0], prox); in wacom_tpc_pen()
1783 return 0; in wacom_tpc_pen()
1788 unsigned char *data = wacom->data; in wacom_tpc_irq()
1790 if (wacom->pen_input) { in wacom_tpc_irq()
1791 dev_dbg(wacom->pen_input->dev.parent, in wacom_tpc_irq()
1792 "%s: received report #%d\n", __func__, data[0]); in wacom_tpc_irq()
1795 data[0] == WACOM_REPORT_PENABLED) in wacom_tpc_irq()
1798 else if (wacom->touch_input) { in wacom_tpc_irq()
1799 dev_dbg(wacom->touch_input->dev.parent, in wacom_tpc_irq()
1800 "%s: received report #%d\n", __func__, data[0]); in wacom_tpc_irq()
1810 switch (data[0]) { in wacom_tpc_irq()
1825 return 0; in wacom_tpc_irq()
1831 struct input_absinfo *abs = &input->absinfo[usage->code]; in wacom_offset_rotation()
1832 int range = (abs->maximum - abs->minimum + 1); in wacom_offset_rotation()
1835 if (value > abs->maximum) in wacom_offset_rotation()
1836 value -= range; in wacom_offset_rotation()
1837 else if (value < abs->minimum) in wacom_offset_rotation()
1845 int subpage = (usage & 0xFF00) << 8; in wacom_equivalent_usage()
1846 int subusage = (usage & 0xFF); in wacom_equivalent_usage()
1873 int subpage = (usage & 0xFF00) << 8; in wacom_equivalent_usage()
1874 int subusage = (usage & 0xFF); in wacom_equivalent_usage()
1892 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_map_usage()
1893 struct wacom_features *features = &wacom_wac->features; in wacom_map_usage()
1894 int fmin = field->logical_minimum; in wacom_map_usage()
1895 int fmax = field->logical_maximum; in wacom_map_usage()
1896 unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_map_usage()
1904 fmin += features->offset_left; in wacom_map_usage()
1905 fmax -= features->offset_right; in wacom_map_usage()
1908 fmin += features->offset_top; in wacom_map_usage()
1909 fmax -= features->offset_bottom; in wacom_map_usage()
1912 usage->type = type; in wacom_map_usage()
1913 usage->code = code; in wacom_map_usage()
1917 input_set_abs_params(input, code, fmin, fmax, fuzz, 0); in wacom_map_usage()
1933 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_usage_mapping()
1934 struct wacom_features *features = &wacom_wac->features; in wacom_wac_battery_usage_mapping()
1935 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_usage_mapping()
1941 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_wac_battery_usage_mapping()
1950 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_event()
1951 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_event()
1955 if (value == 0) { in wacom_wac_battery_event()
1956 wacom_wac->hid_data.bat_status = POWER_SUPPLY_STATUS_UNKNOWN; in wacom_wac_battery_event()
1959 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1960 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1961 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1962 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1966 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1967 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1968 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1969 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1972 wacom_wac->hid_data.bat_charging = value; in wacom_wac_battery_event()
1973 wacom_wac->hid_data.ps_connected = value; in wacom_wac_battery_event()
1974 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1975 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1990 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_report()
1991 struct wacom_features *features = &wacom_wac->features; in wacom_wac_battery_report()
1993 if (features->quirks & WACOM_QUIRK_BATTERY) { in wacom_wac_battery_report()
1994 int status = wacom_wac->hid_data.bat_status; in wacom_wac_battery_report()
1995 int capacity = wacom_wac->hid_data.battery_capacity; in wacom_wac_battery_report()
1996 bool charging = wacom_wac->hid_data.bat_charging; in wacom_wac_battery_report()
1997 bool connected = wacom_wac->hid_data.bat_connected; in wacom_wac_battery_report()
1998 bool powered = wacom_wac->hid_data.ps_connected; in wacom_wac_battery_report()
2009 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_usage_mapping()
2010 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_usage_mapping()
2011 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_usage_mapping()
2012 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_usage_mapping()
2016 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
2017 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0); in wacom_wac_pad_usage_mapping()
2018 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2021 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
2022 wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0); in wacom_wac_pad_usage_mapping()
2023 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2026 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
2027 wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); in wacom_wac_pad_usage_mapping()
2028 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2037 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
2038 0); in wacom_wac_pad_usage_mapping()
2039 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
2040 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2044 wacom_wac->is_soft_touch_switch = true; in wacom_wac_pad_usage_mapping()
2055 wacom_wac->has_mute_touch_switch = true; in wacom_wac_pad_usage_mapping()
2056 usage->type = EV_SW; in wacom_wac_pad_usage_mapping()
2057 usage->code = SW_MUTE_DEVICE; in wacom_wac_pad_usage_mapping()
2060 wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); in wacom_wac_pad_usage_mapping()
2061 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2064 wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0); in wacom_wac_pad_usage_mapping()
2065 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2068 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); in wacom_wac_pad_usage_mapping()
2069 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2076 usage->type = EV_ABS; in wacom_wac_pad_usage_mapping()
2077 usage->code = ABS_WHEEL; in wacom_wac_pad_usage_mapping()
2078 set_bit(EV_ABS, input->evbit); in wacom_wac_pad_usage_mapping()
2079 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2082 wacom_map_usage(input, usage, field, EV_KEY, KEY_BUTTONCONFIG, 0); in wacom_wac_pad_usage_mapping()
2083 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2086 wacom_map_usage(input, usage, field, EV_KEY, KEY_ONSCREEN_KEYBOARD, 0); in wacom_wac_pad_usage_mapping()
2087 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2090 wacom_map_usage(input, usage, field, EV_KEY, KEY_CONTROLPANEL, 0); in wacom_wac_pad_usage_mapping()
2091 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2095 if (!wacom_wac->has_mode_change) { in wacom_wac_pad_usage_mapping()
2096 wacom_wac->has_mode_change = true; in wacom_wac_pad_usage_mapping()
2097 wacom_wac->is_direct_mode = true; in wacom_wac_pad_usage_mapping()
2099 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2103 switch (equivalent_usage & 0xfffffff0) { in wacom_wac_pad_usage_mapping()
2106 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
2107 0); in wacom_wac_pad_usage_mapping()
2108 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
2109 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2118 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_event()
2119 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_event()
2120 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_event()
2121 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_event()
2129 if (!usage->type && equivalent_usage != WACOM_HID_WD_MODE_CHANGE) in wacom_wac_pad_event()
2132 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { in wacom_wac_pad_event()
2133 if (usage->hid != WACOM_HID_WD_TOUCHRING) in wacom_wac_pad_event()
2134 wacom_wac->hid_data.inrange_state |= value; in wacom_wac_pad_event()
2143 if (wacom_wac->shared->touch_input) { in wacom_wac_pad_event()
2144 bool *is_touch_on = &wacom_wac->shared->is_touch_on; in wacom_wac_pad_event()
2151 input_report_switch(wacom_wac->shared->touch_input, in wacom_wac_pad_event()
2153 input_sync(wacom_wac->shared->touch_input); in wacom_wac_pad_event()
2166 * tablet's left. HID events "should" be clockwise- in wacom_wac_pad_event()
2168 * Pro and 2nd-gen Intuos Pro don't do this... in wacom_wac_pad_event()
2170 if (hdev->vendor == 0x56a && in wacom_wac_pad_event()
2171 (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ in wacom_wac_pad_event()
2172 hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2173 hdev->product == 0x392 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2174 hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */ in wacom_wac_pad_event()
2175 hdev->product == 0x3AA)) { /* MobileStudio Pro */ in wacom_wac_pad_event()
2176 value = (field->logical_maximum - value); in wacom_wac_pad_event()
2178 if (hdev->product == 0x357 || hdev->product == 0x358 || in wacom_wac_pad_event()
2179 hdev->product == 0x392) in wacom_wac_pad_event()
2181 else if (hdev->product == 0x34d || hdev->product == 0x34e || in wacom_wac_pad_event()
2182 hdev->product == 0x398 || hdev->product == 0x399 || in wacom_wac_pad_event()
2183 hdev->product == 0x3AA) in wacom_wac_pad_event()
2193 input_event(input, usage->type, usage->code, 0); in wacom_wac_pad_event()
2197 if (wacom_wac->is_direct_mode != value) { in wacom_wac_pad_event()
2198 wacom_wac->is_direct_mode = value; in wacom_wac_pad_event()
2199 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE); in wacom_wac_pad_event()
2204 for (i = 0; i < wacom->led.count; i++) in wacom_wac_pad_event()
2205 wacom_update_led(wacom, features->numbered_buttons, in wacom_wac_pad_event()
2214 input_event(input, usage->type, usage->code, value); in wacom_wac_pad_event()
2216 wacom_wac->hid_data.pad_input_event_flag = true; in wacom_wac_pad_event()
2224 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_pre_report()
2226 wacom_wac->hid_data.inrange_state = 0; in wacom_wac_pad_pre_report()
2233 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_report()
2234 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_report()
2235 bool active = wacom_wac->hid_data.inrange_state != 0; in wacom_wac_pad_report()
2238 if (wacom_wac->hid_data.pad_input_event_flag) { in wacom_wac_pad_report()
2239 input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); in wacom_wac_pad_report()
2242 wacom_wac->hid_data.pad_input_event_flag = false; in wacom_wac_pad_report()
2248 struct input_dev *input = wacom_wac->pen_input; in wacom_set_barrel_switch3_usage()
2249 struct wacom_features *features = &wacom_wac->features; in wacom_set_barrel_switch3_usage()
2251 if (!(features->quirks & WACOM_QUIRK_AESPEN) && in wacom_set_barrel_switch3_usage()
2252 wacom_wac->hid_data.barrelswitch && in wacom_set_barrel_switch3_usage()
2253 wacom_wac->hid_data.barrelswitch2 && in wacom_set_barrel_switch3_usage()
2254 wacom_wac->hid_data.serialhi && in wacom_set_barrel_switch3_usage()
2255 !wacom_wac->hid_data.barrelswitch3) { in wacom_set_barrel_switch3_usage()
2257 features->quirks |= WACOM_QUIRK_PEN_BUTTON3; in wacom_set_barrel_switch3_usage()
2265 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_usage_mapping()
2266 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_usage_mapping()
2267 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_usage_mapping()
2268 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_usage_mapping()
2279 wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); in wacom_wac_pen_usage_mapping()
2282 wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); in wacom_wac_pen_usage_mapping()
2285 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); in wacom_wac_pen_usage_mapping()
2289 BTN_TOOL_RUBBER, 0); in wacom_wac_pen_usage_mapping()
2292 wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); in wacom_wac_pen_usage_mapping()
2295 wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); in wacom_wac_pen_usage_mapping()
2298 wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); in wacom_wac_pen_usage_mapping()
2302 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_pen_usage_mapping()
2306 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_pen_usage_mapping()
2309 wacom_wac->hid_data.barrelswitch = true; in wacom_wac_pen_usage_mapping()
2311 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); in wacom_wac_pen_usage_mapping()
2314 wacom_wac->hid_data.barrelswitch2 = true; in wacom_wac_pen_usage_mapping()
2316 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); in wacom_wac_pen_usage_mapping()
2319 features->quirks |= WACOM_QUIRK_TOOLSERIAL; in wacom_wac_pen_usage_mapping()
2320 wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); in wacom_wac_pen_usage_mapping()
2323 wacom_map_usage(input, usage, field, EV_MSC, MSC_TIMESTAMP, 0); in wacom_wac_pen_usage_mapping()
2326 features->quirks |= WACOM_QUIRK_SENSE; in wacom_wac_pen_usage_mapping()
2327 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); in wacom_wac_pen_usage_mapping()
2330 wacom_wac->hid_data.serialhi = true; in wacom_wac_pen_usage_mapping()
2332 wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); in wacom_wac_pen_usage_mapping()
2336 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); in wacom_wac_pen_usage_mapping()
2339 wacom_wac->hid_data.barrelswitch3 = true; in wacom_wac_pen_usage_mapping()
2340 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS3, 0); in wacom_wac_pen_usage_mapping()
2341 features->quirks &= ~WACOM_QUIRK_PEN_BUTTON3; in wacom_wac_pen_usage_mapping()
2350 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_event()
2351 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_event()
2352 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_event()
2353 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_event()
2355 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_event()
2365 value = field->logical_maximum - value; in wacom_wac_pen_event()
2368 mod_timer(&wacom->idleprox_timer, jiffies + msecs_to_jiffies(100)); in wacom_wac_pen_event()
2369 wacom_wac->hid_data.inrange_state = value; in wacom_wac_pen_event()
2370 if (!(features->quirks & WACOM_QUIRK_SENSE)) in wacom_wac_pen_event()
2371 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2374 wacom_wac->hid_data.invert_state = value; in wacom_wac_pen_event()
2378 wacom_wac->hid_data.tipswitch |= value; in wacom_wac_pen_event()
2381 wacom_wac->hid_data.barrelswitch = value; in wacom_wac_pen_event()
2384 wacom_wac->hid_data.barrelswitch2 = value; in wacom_wac_pen_event()
2388 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); in wacom_wac_pen_event()
2389 wacom_wac->serial[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2394 if (!wacom_is_art_pen(wacom_wac->id[0])) return; in wacom_wac_pen_event()
2404 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2408 __u32 raw_value = wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2410 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); in wacom_wac_pen_event()
2411 wacom_wac->serial[0] |= ((__u64)raw_value) << 32; in wacom_wac_pen_event()
2413 * Non-USI EMR devices may contain additional tool type in wacom_wac_pen_event()
2418 wacom_wac->id[0] |= raw_value & 0xFFFFF; in wacom_wac_pen_event()
2430 wacom_wac->id[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2433 if (features->offset_left && value != features->offset_left) in wacom_wac_pen_event()
2435 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2436 features->offset_left); in wacom_wac_pen_event()
2437 features->offset_left = value; in wacom_wac_pen_event()
2440 if (features->offset_right && value != features->offset_right) in wacom_wac_pen_event()
2442 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2443 features->offset_right); in wacom_wac_pen_event()
2444 features->offset_right = value; in wacom_wac_pen_event()
2447 if (features->offset_top && value != features->offset_top) in wacom_wac_pen_event()
2449 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2450 features->offset_top); in wacom_wac_pen_event()
2451 features->offset_top = value; in wacom_wac_pen_event()
2454 if (features->offset_bottom && value != features->offset_bottom) in wacom_wac_pen_event()
2456 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2457 features->offset_bottom); in wacom_wac_pen_event()
2458 features->offset_bottom = value; in wacom_wac_pen_event()
2461 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_pen_event()
2464 wacom_wac->hid_data.barrelswitch3 = value; in wacom_wac_pen_event()
2467 if (wacom_wac->hid_data.sequence_number != value) in wacom_wac_pen_event()
2468 …hid_warn(hdev, "Dropped %hu packets", (unsigned short)(value - wacom_wac->hid_data.sequence_number… in wacom_wac_pen_event()
2469 wacom_wac->hid_data.sequence_number = value + 1; in wacom_wac_pen_event()
2476 if (!usage->type || delay_pen_events(wacom_wac)) in wacom_wac_pen_event()
2480 if (wacom_wac->hid_data.inrange_state) in wacom_wac_pen_event()
2481 input_event(input, usage->type, usage->code, value); in wacom_wac_pen_event()
2482 else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) in wacom_wac_pen_event()
2483 input_event(input, usage->type, usage->code, 0); in wacom_wac_pen_event()
2490 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_pre_report()
2492 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_pen_pre_report()
2500 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_report()
2501 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_report()
2502 bool range = wacom_wac->hid_data.inrange_state; in wacom_wac_pen_report()
2503 bool sense = wacom_wac->hid_data.sense_state; in wacom_wac_pen_report()
2505 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_report()
2508 if (!wacom_wac->tool[0] && range) { /* first in range */ in wacom_wac_pen_report()
2510 if (wacom_wac->hid_data.invert_state) in wacom_wac_pen_report()
2511 wacom_wac->tool[0] = BTN_TOOL_RUBBER; in wacom_wac_pen_report()
2512 else if (wacom_wac->id[0]) in wacom_wac_pen_report()
2513 wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); in wacom_wac_pen_report()
2515 wacom_wac->tool[0] = BTN_TOOL_PEN; in wacom_wac_pen_report()
2519 wacom_wac->shared->stylus_in_proximity = sense; in wacom_wac_pen_report()
2521 if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { in wacom_wac_pen_report()
2522 int id = wacom_wac->id[0]; in wacom_wac_pen_report()
2523 if (wacom_wac->features.quirks & WACOM_QUIRK_PEN_BUTTON3) { in wacom_wac_pen_report()
2524 int sw_state = wacom_wac->hid_data.barrelswitch | in wacom_wac_pen_report()
2525 (wacom_wac->hid_data.barrelswitch2 << 1); in wacom_wac_pen_report()
2526 wacom_wac->hid_data.barrelswitch = sw_state == 1; in wacom_wac_pen_report()
2527 wacom_wac->hid_data.barrelswitch2 = sw_state == 2; in wacom_wac_pen_report()
2528 wacom_wac->hid_data.barrelswitch3 = sw_state == 3; in wacom_wac_pen_report()
2530 input_report_key(input, BTN_STYLUS, wacom_wac->hid_data.barrelswitch); in wacom_wac_pen_report()
2531 input_report_key(input, BTN_STYLUS2, wacom_wac->hid_data.barrelswitch2); in wacom_wac_pen_report()
2532 input_report_key(input, BTN_STYLUS3, wacom_wac->hid_data.barrelswitch3); in wacom_wac_pen_report()
2535 * Non-USI EMR tools should have their IDs mangled to in wacom_wac_pen_report()
2538 if (wacom_wac->serial[0] >> 52 == 1) in wacom_wac_pen_report()
2542 * To ensure compatibility with xf86-input-wacom, we should in wacom_wac_pen_report()
2547 wacom_wac->hid_data.tipswitch); in wacom_wac_pen_report()
2548 input_report_key(input, wacom_wac->tool[0], sense); in wacom_wac_pen_report()
2549 if (wacom_wac->serial[0]) { in wacom_wac_pen_report()
2550 input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); in wacom_wac_pen_report()
2551 input_report_abs(input, ABS_MISC, sense ? id : 0); in wacom_wac_pen_report()
2554 wacom_wac->hid_data.tipswitch = false; in wacom_wac_pen_report()
2560 wacom_wac->tool[0] = 0; in wacom_wac_pen_report()
2561 wacom_wac->id[0] = 0; in wacom_wac_pen_report()
2562 wacom_wac->serial[0] = 0; in wacom_wac_pen_report()
2570 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_usage_mapping()
2571 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_usage_mapping()
2572 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_usage_mapping()
2573 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_usage_mapping()
2592 wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); in wacom_wac_finger_usage_mapping()
2593 wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); in wacom_wac_finger_usage_mapping()
2594 input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); in wacom_wac_finger_usage_mapping()
2597 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_finger_usage_mapping()
2600 wacom_wac->hid_data.cc_report = field->report->id; in wacom_wac_finger_usage_mapping()
2601 wacom_wac->hid_data.cc_index = field->index; in wacom_wac_finger_usage_mapping()
2602 wacom_wac->hid_data.cc_value_index = usage->usage_index; in wacom_wac_finger_usage_mapping()
2605 if ((field->logical_maximum - field->logical_minimum) < touch_max) { in wacom_wac_finger_usage_mapping()
2611 field->logical_maximum = 255; in wacom_wac_finger_usage_mapping()
2615 wacom_map_usage(input, usage, field, EV_MSC, MSC_TIMESTAMP, 0); in wacom_wac_finger_usage_mapping()
2623 struct hid_data *hid_data = &wacom_wac->hid_data; in wacom_wac_finger_slot()
2624 bool mt = wacom_wac->features.touch_max > 1; in wacom_wac_finger_slot()
2625 bool prox = hid_data->tipswitch && in wacom_wac_finger_slot()
2629 if (!wacom_wac->shared->touch_down) in wacom_wac_finger_slot()
2634 wacom_wac->hid_data.num_received++; in wacom_wac_finger_slot()
2635 if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) in wacom_wac_finger_slot()
2641 slot = input_mt_get_slot_by_key(input, hid_data->id); in wacom_wac_finger_slot()
2642 if (slot < 0) { in wacom_wac_finger_slot()
2645 struct input_mt_slot *ps = &input->mt->slots[slot]; in wacom_wac_finger_slot()
2648 if (!prox && mt_id < 0) { in wacom_wac_finger_slot()
2649 // No data to send for this slot; short-circuit in wacom_wac_finger_slot()
2663 hid_data->x); in wacom_wac_finger_slot()
2665 hid_data->y); in wacom_wac_finger_slot()
2667 if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { in wacom_wac_finger_slot()
2668 input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2669 input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2670 if (hid_data->width != hid_data->height) in wacom_wac_finger_slot()
2671 input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); in wacom_wac_finger_slot()
2678 struct input_mt *mt = dev->mt; in wacom_wac_slot_is_active()
2684 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in wacom_wac_slot_is_active()
2685 if (s->key == key && in wacom_wac_slot_is_active()
2686 input_mt_get_value(s, ABS_MT_TRACKING_ID) >= 0) { in wacom_wac_slot_is_active()
2698 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_event()
2699 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_event()
2700 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_wac_finger_event()
2702 if (touch_is_muted(wacom_wac) && !wacom_wac->shared->touch_down) in wacom_wac_finger_event()
2705 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_finger_event()
2710 wacom_wac->hid_data.confidence = value; in wacom_wac_finger_event()
2713 wacom_wac->hid_data.x = value; in wacom_wac_finger_event()
2716 wacom_wac->hid_data.y = value; in wacom_wac_finger_event()
2719 wacom_wac->hid_data.width = value; in wacom_wac_finger_event()
2722 wacom_wac->hid_data.height = value; in wacom_wac_finger_event()
2725 wacom_wac->hid_data.id = value; in wacom_wac_finger_event()
2728 wacom_wac->hid_data.tipswitch = value; in wacom_wac_finger_event()
2731 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_finger_event()
2734 if (!features->touch_max) { in wacom_wac_finger_event()
2735 features->touch_max = value; in wacom_wac_finger_event()
2737 hid_warn(hdev, "%s: ignoring attempt to overwrite non-zero touch_max " in wacom_wac_finger_event()
2738 "%d -> %d\n", __func__, features->touch_max, value); in wacom_wac_finger_event()
2743 if (usage->usage_index + 1 == field->report_count) { in wacom_wac_finger_event()
2744 if (equivalent_usage == wacom_wac->hid_data.last_slot_field) { in wacom_wac_finger_event()
2745 bool touch_removed = wacom_wac_slot_is_active(wacom_wac->touch_input, in wacom_wac_finger_event()
2746 wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; in wacom_wac_finger_event()
2748 if (wacom_wac->hid_data.confidence || touch_removed) { in wacom_wac_finger_event()
2749 wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); in wacom_wac_finger_event()
2759 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_pre_report()
2760 struct hid_data* hid_data = &wacom_wac->hid_data; in wacom_wac_finger_pre_report()
2763 if (touch_is_muted(wacom_wac) && !wacom_wac->shared->touch_down) in wacom_wac_finger_pre_report()
2766 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_finger_pre_report()
2768 hid_data->confidence = true; in wacom_wac_finger_pre_report()
2770 hid_data->cc_report = 0; in wacom_wac_finger_pre_report()
2771 hid_data->cc_index = -1; in wacom_wac_finger_pre_report()
2772 hid_data->cc_value_index = -1; in wacom_wac_finger_pre_report()
2774 for (i = 0; i < report->maxfield; i++) { in wacom_wac_finger_pre_report()
2775 struct hid_field *field = report->field[i]; in wacom_wac_finger_pre_report()
2778 for (j = 0; j < field->maxusage; j++) { in wacom_wac_finger_pre_report()
2779 struct hid_usage *usage = &field->usage[j]; in wacom_wac_finger_pre_report()
2781 wacom_equivalent_usage(usage->hid); in wacom_wac_finger_pre_report()
2792 hid_data->last_slot_field = equivalent_usage; in wacom_wac_finger_pre_report()
2795 hid_data->cc_report = report->id; in wacom_wac_finger_pre_report()
2796 hid_data->cc_index = i; in wacom_wac_finger_pre_report()
2797 hid_data->cc_value_index = j; in wacom_wac_finger_pre_report()
2803 if (hid_data->cc_report != 0 && in wacom_wac_finger_pre_report()
2804 hid_data->cc_index >= 0) { in wacom_wac_finger_pre_report()
2805 struct hid_field *field = report->field[hid_data->cc_index]; in wacom_wac_finger_pre_report()
2806 int value = field->value[hid_data->cc_value_index]; in wacom_wac_finger_pre_report()
2808 hid_data->num_expected = value; in wacom_wac_finger_pre_report()
2809 hid_data->num_received = 0; in wacom_wac_finger_pre_report()
2813 hid_data->num_expected = wacom_wac->features.touch_max; in wacom_wac_finger_pre_report()
2814 hid_data->num_received = 0; in wacom_wac_finger_pre_report()
2822 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_report()
2823 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_report()
2824 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_report()
2827 if (wacom_wac->hid_data.num_expected == 0) in wacom_wac_finger_report()
2834 if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) in wacom_wac_finger_report()
2841 wacom_wac->hid_data.num_received = 0; in wacom_wac_finger_report()
2842 wacom_wac->hid_data.num_expected = 0; in wacom_wac_finger_report()
2845 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); in wacom_wac_finger_report()
2852 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_usage_mapping()
2853 struct wacom_features *features = &wacom_wac->features; in wacom_wac_usage_mapping()
2856 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_wac_usage_mapping()
2874 if (wacom->wacom_wac.features.type != HID_GENERIC) in wacom_wac_event()
2877 if (value > field->logical_maximum || value < field->logical_minimum) in wacom_wac_event()
2885 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_event()
2887 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_event()
2897 for (r = field_index; r < report->maxfield; r++) { in wacom_report_events()
2901 field = report->field[r]; in wacom_report_events()
2902 count = field->report_count; in wacom_report_events()
2904 if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) in wacom_report_events()
2907 for (n = 0 ; n < count; n++) { in wacom_report_events()
2908 if (field->usage[n].collection_index == collection_index) in wacom_report_events()
2909 wacom_wac_event(hdev, field, &field->usage[n], in wacom_report_events()
2910 field->value[n]); in wacom_report_events()
2926 * Non-input reports may be sent prior to the device being in wacom_wac_collection()
2929 * been called to prevent potential crashes in the report- in wacom_wac_collection()
2932 if (report->type != HID_INPUT_REPORT) in wacom_wac_collection()
2933 return -1; in wacom_wac_collection()
2936 return 0; in wacom_wac_collection()
2937 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_collection()
2939 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_collection()
2942 return 0; in wacom_wac_collection()
2948 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_report()
2953 int prev_collection = -1; in wacom_wac_report()
2955 if (wacom_wac->features.type != HID_GENERIC) in wacom_wac_report()
2958 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
2959 field = report->field[r]; in wacom_wac_report()
2967 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) in wacom_wac_report()
2973 if (pad_in_hid_field && wacom->wacom_wac.pad_input) in wacom_wac_report()
2975 if (pen_in_hid_field && wacom->wacom_wac.pen_input) in wacom_wac_report()
2977 if (finger_in_hid_field && wacom->wacom_wac.touch_input) in wacom_wac_report()
2980 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
2981 field = report->field[r]; in wacom_wac_report()
2983 if (field->usage[0].collection_index != prev_collection) { in wacom_wac_report()
2985 field->usage[0].collection_index, field, r) < 0) in wacom_wac_report()
2987 prev_collection = field->usage[0].collection_index; in wacom_wac_report()
2993 if (true_pad && wacom->wacom_wac.pad_input) in wacom_wac_report()
2999 struct wacom_features *features = &wacom->features; in wacom_bpt_touch()
3000 struct input_dev *input = wacom->touch_input; in wacom_bpt_touch()
3001 struct input_dev *pad_input = wacom->pad_input; in wacom_bpt_touch()
3002 unsigned char *data = wacom->data; in wacom_bpt_touch()
3005 if (data[0] != 0x02) in wacom_bpt_touch()
3006 return 0; in wacom_bpt_touch()
3008 for (i = 0; i < 2; i++) { in wacom_bpt_touch()
3009 int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); in wacom_bpt_touch()
3011 && (data[offset + 3] & 0x80); in wacom_bpt_touch()
3016 int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; in wacom_bpt_touch()
3017 int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; in wacom_bpt_touch()
3018 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { in wacom_bpt_touch()
3029 input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); in wacom_bpt_touch()
3030 input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); in wacom_bpt_touch()
3031 input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); in wacom_bpt_touch()
3032 input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); in wacom_bpt_touch()
3033 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt_touch()
3040 struct wacom_features *features = &wacom->features; in wacom_bpt3_touch_msg()
3041 struct input_dev *input = wacom->touch_input; in wacom_bpt3_touch_msg()
3042 bool touch = data[1] & 0x80; in wacom_bpt3_touch_msg()
3043 int slot = input_mt_get_slot_by_key(input, data[0]); in wacom_bpt3_touch_msg()
3045 if (slot < 0) in wacom_bpt3_touch_msg()
3055 int y = (data[3] << 4) | (data[4] & 0x0f); in wacom_bpt3_touch_msg()
3058 if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { in wacom_bpt3_touch_msg()
3063 * "a" is a scaled-down area which we assume is in wacom_bpt3_touch_msg()
3083 struct input_dev *input = wacom->pad_input; in wacom_bpt3_button_msg()
3084 struct wacom_features *features = &wacom->features; in wacom_bpt3_button_msg()
3086 if (features->type == INTUOSHT || features->type == INTUOSHT2) { in wacom_bpt3_button_msg()
3087 input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); in wacom_bpt3_button_msg()
3088 input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); in wacom_bpt3_button_msg()
3090 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); in wacom_bpt3_button_msg()
3091 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); in wacom_bpt3_button_msg()
3093 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); in wacom_bpt3_button_msg()
3094 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); in wacom_bpt3_button_msg()
3099 unsigned char *data = wacom->data; in wacom_bpt3_touch()
3100 int count = data[1] & 0x07; in wacom_bpt3_touch()
3101 int touch_changed = 0, i; in wacom_bpt3_touch()
3103 if (data[0] != 0x02) in wacom_bpt3_touch()
3104 return 0; in wacom_bpt3_touch()
3106 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ in wacom_bpt3_touch()
3107 for (i = 0; i < count; i++) { in wacom_bpt3_touch()
3120 if (wacom->touch_input && touch_changed) { in wacom_bpt3_touch()
3121 input_mt_sync_frame(wacom->touch_input); in wacom_bpt3_touch()
3122 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt3_touch()
3130 struct wacom_features *features = &wacom->features; in wacom_bpt_pen()
3131 struct input_dev *input = wacom->pen_input; in wacom_bpt_pen()
3132 unsigned char *data = wacom->data; in wacom_bpt_pen()
3133 int x = 0, y = 0, p = 0, d = 0; in wacom_bpt_pen()
3137 if (data[0] != WACOM_REPORT_PENABLED) in wacom_bpt_pen()
3138 return 0; in wacom_bpt_pen()
3140 range = (data[1] & 0x80) == 0x80; in wacom_bpt_pen()
3141 prox = (data[1] & 0x40) == 0x40; in wacom_bpt_pen()
3142 rdy = (data[1] & 0x20) == 0x20; in wacom_bpt_pen()
3144 wacom->shared->stylus_in_proximity = range; in wacom_bpt_pen()
3146 return 0; in wacom_bpt_pen()
3150 pen = data[1] & 0x01; in wacom_bpt_pen()
3151 btn1 = data[1] & 0x02; in wacom_bpt_pen()
3152 btn2 = data[1] & 0x04; in wacom_bpt_pen()
3158 if (data[1] & 0x08) { in wacom_bpt_pen()
3159 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_bpt_pen()
3160 wacom->id[0] = ERASER_DEVICE_ID; in wacom_bpt_pen()
3162 wacom->tool[0] = BTN_TOOL_PEN; in wacom_bpt_pen()
3163 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_bpt_pen()
3165 wacom->reporting_data = true; in wacom_bpt_pen()
3174 if (data[8] <= features->distance_max) in wacom_bpt_pen()
3175 d = features->distance_max - data[8]; in wacom_bpt_pen()
3177 wacom->id[0] = 0; in wacom_bpt_pen()
3180 if (wacom->reporting_data) { in wacom_bpt_pen()
3192 input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */ in wacom_bpt_pen()
3193 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ in wacom_bpt_pen()
3197 wacom->reporting_data = false; in wacom_bpt_pen()
3205 struct wacom_features *features = &wacom->features; in wacom_bpt_irq()
3207 if ((features->type == INTUOSHT2) && in wacom_bpt_irq()
3208 (features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_bpt_irq()
3217 return 0; in wacom_bpt_irq()
3232 prefix = data[0]; in wacom_bamboo_pad_pen_event()
3233 data[0] = WACOM_REPORT_BPAD_PEN; in wacom_bamboo_pad_pen_event()
3237 * No need to check if wacom->shared->pen is valid, hid_input_report() in wacom_bamboo_pad_pen_event()
3240 hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, in wacom_bamboo_pad_pen_event()
3243 data[0] = prefix; in wacom_bamboo_pad_pen_event()
3249 struct input_dev *input = wacom->touch_input; in wacom_bamboo_pad_touch_event()
3255 prefix = data[0]; in wacom_bamboo_pad_touch_event()
3257 for (id = 0; id < wacom->features.touch_max; id++) { in wacom_bamboo_pad_touch_event()
3268 x = finger_data[0] | ((finger_data[1] & 0x0f) << 8); in wacom_bamboo_pad_touch_event()
3277 input_report_key(input, BTN_LEFT, prefix & 0x40); in wacom_bamboo_pad_touch_event()
3278 input_report_key(input, BTN_RIGHT, prefix & 0x80); in wacom_bamboo_pad_touch_event()
3281 wacom->shared->touch_down = !!prefix && report_touch_events(wacom); in wacom_bamboo_pad_touch_event()
3288 unsigned char *data = wacom->data; in wacom_bamboo_pad_irq()
3292 (data[0] != WACOM_REPORT_BPAD_TOUCH)) in wacom_bamboo_pad_irq()
3293 return 0; in wacom_bamboo_pad_irq()
3295 if (data[1] & 0x01) in wacom_bamboo_pad_irq()
3298 if (data[1] & 0x02) in wacom_bamboo_pad_irq()
3301 return 0; in wacom_bamboo_pad_irq()
3306 unsigned char *data = wacom->data; in wacom_wireless_irq()
3309 if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL) in wacom_wireless_irq()
3310 return 0; in wacom_wireless_irq()
3312 connected = data[1] & 0x01; in wacom_wireless_irq()
3316 if ((wacom->shared->type == INTUOSHT || in wacom_wireless_irq()
3317 wacom->shared->type == INTUOSHT2) && in wacom_wireless_irq()
3318 wacom->shared->touch_input && in wacom_wireless_irq()
3319 wacom->shared->touch_max) { in wacom_wireless_irq()
3320 input_report_switch(wacom->shared->touch_input, in wacom_wireless_irq()
3321 SW_MUTE_DEVICE, data[5] & 0x40); in wacom_wireless_irq()
3322 input_sync(wacom->shared->touch_input); in wacom_wireless_irq()
3326 battery = (data[5] & 0x3f) * 100 / 31; in wacom_wireless_irq()
3327 charging = !!(data[5] & 0x80); in wacom_wireless_irq()
3328 if (wacom->pid != pid) { in wacom_wireless_irq()
3329 wacom->pid = pid; in wacom_wireless_irq()
3334 battery, charging, 1, 0); in wacom_wireless_irq()
3336 } else if (wacom->pid != 0) { in wacom_wireless_irq()
3338 wacom->pid = 0; in wacom_wireless_irq()
3340 wacom_notify_battery(wacom, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); in wacom_wireless_irq()
3343 return 0; in wacom_wireless_irq()
3349 struct wacom_features *features = &wacom_wac->features; in wacom_status_irq()
3350 unsigned char *data = wacom_wac->data; in wacom_status_irq()
3352 if (data[0] != WACOM_REPORT_USB) in wacom_status_irq()
3353 return 0; in wacom_status_irq()
3355 if ((features->type == INTUOSHT || in wacom_status_irq()
3356 features->type == INTUOSHT2) && in wacom_status_irq()
3357 wacom_wac->shared->touch_input && in wacom_status_irq()
3358 features->touch_max) { in wacom_status_irq()
3359 input_report_switch(wacom_wac->shared->touch_input, in wacom_status_irq()
3360 SW_MUTE_DEVICE, data[8] & 0x40); in wacom_status_irq()
3361 input_sync(wacom_wac->shared->touch_input); in wacom_status_irq()
3364 if (data[9] & 0x02) { /* wireless module is attached */ in wacom_status_irq()
3365 int battery = (data[8] & 0x3f) * 100 / 31; in wacom_status_irq()
3366 bool charging = !!(data[8] & 0x80); in wacom_status_irq()
3371 if (!wacom->battery.battery && in wacom_status_irq()
3372 !(features->quirks & WACOM_QUIRK_BATTERY)) { in wacom_status_irq()
3373 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_status_irq()
3377 else if ((features->quirks & WACOM_QUIRK_BATTERY) && in wacom_status_irq()
3378 wacom->battery.battery) { in wacom_status_irq()
3379 features->quirks &= ~WACOM_QUIRK_BATTERY; in wacom_status_irq()
3381 wacom_notify_battery(wacom_wac, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); in wacom_status_irq()
3383 return 0; in wacom_status_irq()
3390 switch (wacom_wac->features.type) { in wacom_wac_irq()
3456 else if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3482 if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3498 if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) in wacom_wac_irq()
3510 if (wacom_wac->pen_input) in wacom_wac_irq()
3511 input_sync(wacom_wac->pen_input); in wacom_wac_irq()
3512 if (wacom_wac->touch_input) in wacom_wac_irq()
3513 input_sync(wacom_wac->touch_input); in wacom_wac_irq()
3514 if (wacom_wac->pad_input) in wacom_wac_irq()
3515 input_sync(wacom_wac->pad_input); in wacom_wac_irq()
3521 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_basic_pro_pen()
3525 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_basic_pro_pen()
3526 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_basic_pro_pen()
3527 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_basic_pro_pen()
3530 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); in wacom_setup_basic_pro_pen()
3535 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_cintiq()
3536 struct wacom_features *features = &wacom_wac->features; in wacom_setup_cintiq()
3540 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_cintiq()
3541 __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); in wacom_setup_cintiq()
3542 __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); in wacom_setup_cintiq()
3543 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); in wacom_setup_cintiq()
3545 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); in wacom_setup_cintiq()
3546 input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3548 input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3554 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_intuos()
3560 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_intuos()
3561 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_intuos()
3562 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_intuos()
3563 __set_bit(BTN_SIDE, input_dev->keybit); in wacom_setup_intuos()
3564 __set_bit(BTN_EXTRA, input_dev->keybit); in wacom_setup_intuos()
3565 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_intuos()
3566 __set_bit(BTN_TOOL_LENS, input_dev->keybit); in wacom_setup_intuos()
3568 input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); in wacom_setup_intuos()
3570 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); in wacom_setup_intuos()
3575 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_setup_device_quirks()
3576 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_setup_device_quirks()
3579 if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || in wacom_setup_device_quirks()
3580 features->type == DTUS || in wacom_setup_device_quirks()
3581 (features->type >= INTUOS3S && features->type <= WACOM_MO)) { in wacom_setup_device_quirks()
3582 if (features->device_type & WACOM_DEVICETYPE_PEN) in wacom_setup_device_quirks()
3583 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3587 if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { in wacom_setup_device_quirks()
3588 features->x_max = 1023; in wacom_setup_device_quirks()
3589 features->y_max = 1023; in wacom_setup_device_quirks()
3598 if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || in wacom_setup_device_quirks()
3599 (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { in wacom_setup_device_quirks()
3600 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_device_quirks()
3601 if (features->touch_max) in wacom_setup_device_quirks()
3602 features->device_type |= WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3603 if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) in wacom_setup_device_quirks()
3604 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3606 if (features->type == INTUOSHT2) { in wacom_setup_device_quirks()
3607 features->x_max = features->x_max / 10; in wacom_setup_device_quirks()
3608 features->y_max = features->y_max / 10; in wacom_setup_device_quirks()
3611 features->x_max = 4096; in wacom_setup_device_quirks()
3612 features->y_max = 4096; in wacom_setup_device_quirks()
3615 else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3616 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3627 if (features->type == BAMBOO_PEN && in wacom_setup_device_quirks()
3628 features->pktlen == WACOM_PKGLEN_BBTOUCH3) in wacom_setup_device_quirks()
3629 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3632 * Raw Wacom-mode pen and touch events both come from interface in wacom_setup_device_quirks()
3633 * 0, whose HID descriptor has an application usage of 0xFF0D in wacom_setup_device_quirks()
3638 if (features->type == BAMBOO_PAD) in wacom_setup_device_quirks()
3639 features->device_type = WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3641 if (features->type == REMOTE) in wacom_setup_device_quirks()
3642 features->device_type = WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3644 if (features->type == INTUOSP2_BT || in wacom_setup_device_quirks()
3645 features->type == INTUOSP2S_BT) { in wacom_setup_device_quirks()
3646 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3649 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3652 if (features->type == INTUOSHT3_BT) { in wacom_setup_device_quirks()
3653 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3655 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3658 switch (features->type) { in wacom_setup_device_quirks()
3681 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_setup_device_quirks()
3685 if (wacom->hdev->bus == BUS_BLUETOOTH) in wacom_setup_device_quirks()
3686 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3689 if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && in wacom_setup_device_quirks()
3690 features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3691 features->x_max <<= 5; in wacom_setup_device_quirks()
3692 features->y_max <<= 5; in wacom_setup_device_quirks()
3693 features->x_fuzz <<= 5; in wacom_setup_device_quirks()
3694 features->y_fuzz <<= 5; in wacom_setup_device_quirks()
3695 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; in wacom_setup_device_quirks()
3698 if (features->type == WIRELESS) { in wacom_setup_device_quirks()
3699 if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { in wacom_setup_device_quirks()
3700 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3704 if (features->type == REMOTE) in wacom_setup_device_quirks()
3705 features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; in wacom_setup_device_quirks()
3707 /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots in wacom_setup_device_quirks()
3710 if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) { in wacom_setup_device_quirks()
3711 features->quirks &= ~WACOM_QUIRK_TOOLSERIAL; in wacom_setup_device_quirks()
3712 __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3713 __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3714 __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3715 __clear_bit(ABS_Z, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3716 __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3717 __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3718 __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3719 __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3720 __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3721 __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit); in wacom_setup_device_quirks()
3722 __clear_bit(EV_MSC, wacom_wac->pen_input->evbit); in wacom_setup_device_quirks()
3729 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pen_input_capabilities()
3731 if (!(features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_setup_pen_input_capabilities()
3732 return -ENODEV; in wacom_setup_pen_input_capabilities()
3734 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_pen_input_capabilities()
3735 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3737 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3739 if (features->type == HID_GENERIC) in wacom_setup_pen_input_capabilities()
3741 return 0; in wacom_setup_pen_input_capabilities()
3743 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pen_input_capabilities()
3744 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3745 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3747 input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, in wacom_setup_pen_input_capabilities()
3748 features->x_max - features->offset_right, in wacom_setup_pen_input_capabilities()
3749 features->x_fuzz, 0); in wacom_setup_pen_input_capabilities()
3750 input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, in wacom_setup_pen_input_capabilities()
3751 features->y_max - features->offset_bottom, in wacom_setup_pen_input_capabilities()
3752 features->y_fuzz, 0); in wacom_setup_pen_input_capabilities()
3753 input_set_abs_params(input_dev, ABS_PRESSURE, 0, in wacom_setup_pen_input_capabilities()
3754 features->pressure_max, features->pressure_fuzz, 0); in wacom_setup_pen_input_capabilities()
3757 input_abs_set_res(input_dev, ABS_X, features->x_resolution); in wacom_setup_pen_input_capabilities()
3758 input_abs_set_res(input_dev, ABS_Y, features->y_resolution); in wacom_setup_pen_input_capabilities()
3760 switch (features->type) { in wacom_setup_pen_input_capabilities()
3762 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3767 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3768 features->distance_max, in wacom_setup_pen_input_capabilities()
3769 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3775 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3776 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3777 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3779 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3780 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3781 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3782 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3783 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3796 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3808 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3824 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3825 features->distance_max, in wacom_setup_pen_input_capabilities()
3826 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3828 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3842 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3849 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3850 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3851 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3852 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3856 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3860 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3861 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3862 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3870 if (features->type == INTUOSHT2 || in wacom_setup_pen_input_capabilities()
3871 features->type == INTUOSHT3_BT) { in wacom_setup_pen_input_capabilities()
3874 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3875 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3876 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3877 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3878 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3879 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3880 features->distance_max, in wacom_setup_pen_input_capabilities()
3881 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3885 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3888 return 0; in wacom_setup_pen_input_capabilities()
3894 struct wacom_features *features = &wacom_wac->features; in wacom_setup_touch_input_capabilities()
3896 if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) in wacom_setup_touch_input_capabilities()
3897 return -ENODEV; in wacom_setup_touch_input_capabilities()
3899 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_touch_input_capabilities()
3900 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3902 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3904 if (features->type == HID_GENERIC) in wacom_setup_touch_input_capabilities()
3906 return 0; in wacom_setup_touch_input_capabilities()
3908 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_touch_input_capabilities()
3909 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3911 if (features->touch_max == 1) { in wacom_setup_touch_input_capabilities()
3912 input_set_abs_params(input_dev, ABS_X, 0, in wacom_setup_touch_input_capabilities()
3913 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3914 input_set_abs_params(input_dev, ABS_Y, 0, in wacom_setup_touch_input_capabilities()
3915 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3917 features->x_resolution); in wacom_setup_touch_input_capabilities()
3919 features->y_resolution); in wacom_setup_touch_input_capabilities()
3921 else if (features->touch_max > 1) { in wacom_setup_touch_input_capabilities()
3922 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, in wacom_setup_touch_input_capabilities()
3923 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3924 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, in wacom_setup_touch_input_capabilities()
3925 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3927 features->x_resolution); in wacom_setup_touch_input_capabilities()
3929 features->y_resolution); in wacom_setup_touch_input_capabilities()
3932 switch (features->type) { in wacom_setup_touch_input_capabilities()
3935 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3936 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3938 if (wacom_wac->shared->touch->product == 0x361) { in wacom_setup_touch_input_capabilities()
3940 0, 12440, 4, 0); in wacom_setup_touch_input_capabilities()
3942 0, 8640, 4, 0); in wacom_setup_touch_input_capabilities()
3944 else if (wacom_wac->shared->touch->product == 0x360) { in wacom_setup_touch_input_capabilities()
3946 0, 8960, 4, 0); in wacom_setup_touch_input_capabilities()
3948 0, 5920, 4, 0); in wacom_setup_touch_input_capabilities()
3950 else if (wacom_wac->shared->touch->product == 0x393) { in wacom_setup_touch_input_capabilities()
3952 0, 6400, 4, 0); in wacom_setup_touch_input_capabilities()
3954 0, 4000, 4, 0); in wacom_setup_touch_input_capabilities()
3967 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3968 input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3969 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
3973 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3974 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3975 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3976 input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); in wacom_setup_touch_input_capabilities()
3980 if (wacom_wac->shared->touch->product == 0x32C || in wacom_setup_touch_input_capabilities()
3981 wacom_wac->shared->touch->product == 0xF6) { in wacom_setup_touch_input_capabilities()
3982 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3983 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3984 wacom_wac->has_mute_touch_switch = true; in wacom_setup_touch_input_capabilities()
3985 wacom_wac->is_soft_touch_switch = true; in wacom_setup_touch_input_capabilities()
3993 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); in wacom_setup_touch_input_capabilities()
4002 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
4003 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
4008 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_touch_input_capabilities()
4011 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
4014 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
4016 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
4020 input_mt_init_slots(input_dev, features->touch_max, in wacom_setup_touch_input_capabilities()
4022 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
4023 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
4026 return 0; in wacom_setup_touch_input_capabilities()
4034 return BTN_A + (n-10); in wacom_numbered_button_to_key()
4036 return BTN_BASE + (n-16); in wacom_numbered_button_to_key()
4038 return 0; in wacom_numbered_button_to_key()
4046 for (i = 0; i < button_count; i++) { in wacom_setup_numbered_buttons()
4050 __set_bit(key, input_dev->keybit); in wacom_setup_numbered_buttons()
4061 * 24HD has LED group 1 to the left and LED group 0 to the right. in wacom_24hd_update_leds()
4062 * So group 0 matches the second half of the buttons and thus the mask in wacom_24hd_update_leds()
4065 if (group == 0) in wacom_24hd_update_leds()
4068 for (i = 0; i < 3; i++) { in wacom_24hd_update_leds()
4071 hid_err(wacom->hdev, "can't find LED %d in group %d\n", in wacom_24hd_update_leds()
4076 led->held = true; in wacom_24hd_update_leds()
4077 led_trigger_event(&led->trigger, LED_FULL); in wacom_24hd_update_leds()
4079 led->held = false; in wacom_24hd_update_leds()
4090 * 21UX2 has LED group 1 to the left and LED group 0 in wacom_is_led_toggled()
4094 if (wacom->wacom_wac.features.type == WACOM_21UX2) in wacom_is_led_toggled()
4095 group = 1 - group; in wacom_is_led_toggled()
4097 group_button = group * (button_count/wacom->led.count); in wacom_is_led_toggled()
4099 if (wacom->wacom_wac.features.type == INTUOSP2_BT) in wacom_is_led_toggled()
4112 if (wacom->wacom_wac.features.type == WACOM_24HD) in wacom_update_led()
4116 cur = wacom->led.groups[group].select; in wacom_update_led()
4120 hid_err(wacom->hdev, "can't find current LED %d in group %d\n", in wacom_update_led()
4126 led->held = false; in wacom_update_led()
4130 if (led->held && pressed) in wacom_update_led()
4135 hid_err(wacom->hdev, "can't find next LED in group %d\n", in wacom_update_led()
4142 next_led->held = true; in wacom_update_led()
4143 led_trigger_event(&next_led->trigger, in wacom_update_led()
4153 for (i = 0; i < wacom->led.count; i++) in wacom_report_numbered_buttons()
4156 for (i = 0; i < button_count; i++) { in wacom_report_numbered_buttons()
4167 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pad_input_capabilities()
4169 if ((features->type == HID_GENERIC) && features->numbered_buttons > 0) in wacom_setup_pad_input_capabilities()
4170 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_pad_input_capabilities()
4172 if (!(features->device_type & WACOM_DEVICETYPE_PAD)) in wacom_setup_pad_input_capabilities()
4173 return -ENODEV; in wacom_setup_pad_input_capabilities()
4175 if (features->type == REMOTE && input_dev == wacom_wac->pad_input) in wacom_setup_pad_input_capabilities()
4176 return -ENODEV; in wacom_setup_pad_input_capabilities()
4178 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pad_input_capabilities()
4180 /* kept for making legacy xf86-input-wacom working with the wheels */ in wacom_setup_pad_input_capabilities()
4181 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4183 /* kept for making legacy xf86-input-wacom accepting the pad */ in wacom_setup_pad_input_capabilities()
4184 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || in wacom_setup_pad_input_capabilities()
4185 input_dev->absinfo[ABS_X].maximum))) in wacom_setup_pad_input_capabilities()
4186 input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); in wacom_setup_pad_input_capabilities()
4187 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || in wacom_setup_pad_input_capabilities()
4188 input_dev->absinfo[ABS_Y].maximum))) in wacom_setup_pad_input_capabilities()
4189 input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); in wacom_setup_pad_input_capabilities()
4192 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4194 wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); in wacom_setup_pad_input_capabilities()
4196 switch (features->type) { in wacom_setup_pad_input_capabilities()
4206 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4207 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4208 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4209 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4210 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4214 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4215 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4220 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4221 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4222 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4224 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4225 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4227 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4228 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4230 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4231 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4235 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4236 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4237 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4239 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4240 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4242 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4243 __set_bit(KEY_CONTROLPANEL, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4244 input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4246 input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4248 input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4250 __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); in wacom_setup_pad_input_capabilities()
4254 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4255 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4256 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4258 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4259 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4265 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4266 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4270 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4275 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4279 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4290 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4299 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4305 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4312 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4314 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4315 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4316 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4317 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4323 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4332 return -ENODEV; in wacom_setup_pad_input_capabilities()
4334 return 0; in wacom_setup_pad_input_capabilities()
4338 { "Wacom Penpartner", 5040, 3780, 255, 0,
4395 { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63,
4398 { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63,
4401 { "Wacom Intuos 4x5", 12700, 10600, 1023, 31,
4404 { "Wacom Intuos 6x8", 20320, 16240, 1023, 31,
4407 { "Wacom Intuos 9x12", 30480, 24060, 1023, 31,
4410 { "Wacom Intuos 12x12", 30480, 31680, 1023, 31,
4413 { "Wacom Intuos 12x18", 45720, 31680, 1023, 31,
4416 { "Wacom PL400", 5408, 4056, 255, 0,
4419 { "Wacom PL500", 6144, 4608, 255, 0,
4422 { "Wacom PL600", 6126, 4604, 255, 0,
4425 { "Wacom PL600SX", 6260, 5016, 255, 0,
4428 { "Wacom PL550", 6144, 4608, 511, 0,
4431 { "Wacom PL800", 7220, 5780, 511, 0,
4434 { "Wacom PL700", 6758, 5406, 511, 0,
4437 { "Wacom PL510", 6282, 4762, 511, 0,
4440 { "Wacom DTU710", 34080, 27660, 511, 0,
4443 { "Wacom DTF521", 6282, 4762, 511, 0,
4446 { "Wacom DTF720", 6858, 5506, 511, 0,
4449 { "Wacom DTF720a", 6858, 5506, 511, 0,
4452 { "Wacom Cintiq Partner", 20480, 15360, 511, 0,
4455 { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31,
4458 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4461 { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31,
4464 { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31,
4467 { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31,
4470 { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63,
4473 { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63,
4476 { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63,
4479 { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63,
4482 { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63,
4485 { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63,
4488 { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63,
4545 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 };
4548 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
4552 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
4557 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
4560 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C };
4563 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 };
4565 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
4568 { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63,
4571 { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
4574 { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63,
4583 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 };
4586 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x333, .touch_max = 10,
4589 { "Wacom DTU1931", 37832, 30305, 511, 0,
4592 { "Wacom DTU2231", 47864, 27011, 511, 0,
4596 { "Wacom DTU1631", 34623, 19553, 511, 0,
4599 { "Wacom DTU1031", 22096, 13960, 511, 0,
4604 { "Wacom DTU1031X", 22672, 12928, 511, 0,
4605 DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0,
4609 { "Wacom DTU1141", 23672, 13403, 1023, 0,
4623 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D };
4626 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10,
4643 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e };
4646 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10,
4649 { "Wacom ISDv4 90", 26202, 16325, 255, 0,
4650 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4652 { "Wacom ISDv4 93", 26202, 16325, 255, 0,
4655 { "Wacom ISDv4 97", 26202, 16325, 511, 0,
4656 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4658 { "Wacom ISDv4 9A", 26202, 16325, 255, 0,
4661 { "Wacom ISDv4 9F", 26202, 16325, 255, 0,
4664 { "Wacom ISDv4 E2", 26202, 16325, 255, 0,
4667 { "Wacom ISDv4 E3", 26202, 16325, 255, 0,
4670 { "Wacom ISDv4 E5", 26202, 16325, 255, 0,
4673 { "Wacom ISDv4 E6", 27760, 15694, 255, 0,
4676 { "Wacom ISDv4 EC", 25710, 14500, 255, 0,
4677 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4679 { "Wacom ISDv4 ED", 26202, 16325, 255, 0,
4682 { "Wacom ISDv4 EF", 26202, 16325, 255, 0,
4683 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4685 { "Wacom ISDv4 100", 26202, 16325, 255, 0,
4688 { "Wacom ISDv4 101", 26202, 16325, 255, 0,
4691 { "Wacom ISDv4 10D", 26202, 16325, 255, 0,
4694 { "Wacom ISDv4 10E", 27760, 15694, 255, 0,
4697 { "Wacom ISDv4 10F", 27760, 15694, 255, 0,
4700 { "Wacom ISDv4 116", 26202, 16325, 255, 0,
4703 { "Wacom ISDv4 12C", 27848, 15752, 2047, 0,
4704 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4706 { "Wacom ISDv4 4001", 26202, 16325, 255, 0,
4709 { "Wacom ISDv4 4004", 11060, 6220, 255, 0,
4712 { "Wacom ISDv4 5000", 27848, 15752, 1023, 0,
4715 { "Wacom ISDv4 5002", 29576, 16724, 1023, 0,
4718 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4723 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31,
4726 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31,
4729 { "Wacom Bamboo Craft", 14720, 9200, 1023, 31,
4732 { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31,
4735 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31,
4738 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31,
4741 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31,
4744 { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31,
4747 { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31,
4750 { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31,
4753 { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31,
4756 { "Wacom Bamboo Connect", 14720, 9200, 1023, 31,
4759 { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31,
4762 { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31,
4765 { "Wacom Bamboo One S", 14720, 9225, 1023, 31,
4768 { "Wacom Bamboo One M", 21648, 13530, 1023, 31,
4771 { "Wacom Intuos PT S", 15200, 9500, 1023, 31,
4775 { "Wacom Intuos PT M", 21600, 13500, 1023, 31,
4779 { "Wacom Intuos S", 15200, 9500, 1023, 31,
4783 { "ISD-V4", 12800, 8000, 255, 0,
4790 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 };
4793 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10,
4800 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C };
4803 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10,
4816 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
4819 .oPid = 0x325 };
4821 { "Wacom Intuos P M", 21600, 13500, 1023, 31,
4845 { "Wacom DTK1651", 34816, 19759, 1023, 0,
4902 { USB_DEVICE_WACOM(0x00) },
4903 { USB_DEVICE_WACOM(0x03) },
4904 { USB_DEVICE_WACOM(0x10) },
4905 { USB_DEVICE_WACOM(0x11) },
4906 { USB_DEVICE_WACOM(0x12) },
4907 { USB_DEVICE_WACOM(0x13) },
4908 { USB_DEVICE_WACOM(0x14) },
4909 { USB_DEVICE_WACOM(0x15) },
4910 { USB_DEVICE_WACOM(0x16) },
4911 { USB_DEVICE_WACOM(0x17) },
4912 { USB_DEVICE_WACOM(0x18) },
4913 { USB_DEVICE_WACOM(0x19) },
4914 { USB_DEVICE_WACOM(0x20) },
4915 { USB_DEVICE_WACOM(0x21) },
4916 { USB_DEVICE_WACOM(0x22) },
4917 { USB_DEVICE_WACOM(0x23) },
4918 { USB_DEVICE_WACOM(0x24) },
4919 { USB_DEVICE_WACOM(0x26) },
4920 { USB_DEVICE_WACOM(0x27) },
4921 { USB_DEVICE_WACOM(0x28) },
4922 { USB_DEVICE_WACOM(0x29) },
4923 { USB_DEVICE_WACOM(0x2A) },
4924 { USB_DEVICE_WACOM(0x30) },
4925 { USB_DEVICE_WACOM(0x31) },
4926 { USB_DEVICE_WACOM(0x32) },
4927 { USB_DEVICE_WACOM(0x33) },
4928 { USB_DEVICE_WACOM(0x34) },
4929 { USB_DEVICE_WACOM(0x35) },
4930 { USB_DEVICE_WACOM(0x37) },
4931 { USB_DEVICE_WACOM(0x38) },
4932 { USB_DEVICE_WACOM(0x39) },
4933 { USB_DEVICE_WACOM(0x3F) },
4934 { USB_DEVICE_WACOM(0x41) },
4935 { USB_DEVICE_WACOM(0x42) },
4936 { USB_DEVICE_WACOM(0x43) },
4937 { USB_DEVICE_WACOM(0x44) },
4938 { USB_DEVICE_WACOM(0x45) },
4939 { USB_DEVICE_WACOM(0x47) },
4940 { USB_DEVICE_WACOM(0x57) },
4941 { USB_DEVICE_WACOM(0x59) },
4942 { USB_DEVICE_WACOM(0x5B) },
4943 { USB_DEVICE_WACOM(0x5D) },
4944 { USB_DEVICE_WACOM(0x5E) },
4945 { USB_DEVICE_WACOM(0x60) },
4946 { USB_DEVICE_WACOM(0x61) },
4947 { USB_DEVICE_WACOM(0x62) },
4948 { USB_DEVICE_WACOM(0x63) },
4949 { USB_DEVICE_WACOM(0x64) },
4950 { USB_DEVICE_WACOM(0x65) },
4951 { USB_DEVICE_WACOM(0x69) },
4952 { USB_DEVICE_WACOM(0x6A) },
4953 { USB_DEVICE_WACOM(0x6B) },
4954 { BT_DEVICE_WACOM(0x81) },
4955 { USB_DEVICE_WACOM(0x84) },
4956 { USB_DEVICE_WACOM(0x90) },
4957 { USB_DEVICE_WACOM(0x93) },
4958 { USB_DEVICE_WACOM(0x97) },
4959 { USB_DEVICE_WACOM(0x9A) },
4960 { USB_DEVICE_WACOM(0x9F) },
4961 { USB_DEVICE_WACOM(0xB0) },
4962 { USB_DEVICE_WACOM(0xB1) },
4963 { USB_DEVICE_WACOM(0xB2) },
4964 { USB_DEVICE_WACOM(0xB3) },
4965 { USB_DEVICE_WACOM(0xB4) },
4966 { USB_DEVICE_WACOM(0xB5) },
4967 { USB_DEVICE_WACOM(0xB7) },
4968 { USB_DEVICE_WACOM(0xB8) },
4969 { USB_DEVICE_WACOM(0xB9) },
4970 { USB_DEVICE_WACOM(0xBA) },
4971 { USB_DEVICE_WACOM(0xBB) },
4972 { USB_DEVICE_WACOM(0xBC) },
4973 { BT_DEVICE_WACOM(0xBD) },
4974 { USB_DEVICE_WACOM(0xC0) },
4975 { USB_DEVICE_WACOM(0xC2) },
4976 { USB_DEVICE_WACOM(0xC4) },
4977 { USB_DEVICE_WACOM(0xC5) },
4978 { USB_DEVICE_WACOM(0xC6) },
4979 { USB_DEVICE_WACOM(0xC7) },
4980 { USB_DEVICE_WACOM(0xCC) },
4981 { USB_DEVICE_WACOM(0xCE) },
4982 { USB_DEVICE_WACOM(0xD0) },
4983 { USB_DEVICE_WACOM(0xD1) },
4984 { USB_DEVICE_WACOM(0xD2) },
4985 { USB_DEVICE_WACOM(0xD3) },
4986 { USB_DEVICE_WACOM(0xD4) },
4987 { USB_DEVICE_WACOM(0xD5) },
4988 { USB_DEVICE_WACOM(0xD6) },
4989 { USB_DEVICE_WACOM(0xD7) },
4990 { USB_DEVICE_WACOM(0xD8) },
4991 { USB_DEVICE_WACOM(0xDA) },
4992 { USB_DEVICE_WACOM(0xDB) },
4993 { USB_DEVICE_WACOM(0xDD) },
4994 { USB_DEVICE_WACOM(0xDE) },
4995 { USB_DEVICE_WACOM(0xDF) },
4996 { USB_DEVICE_WACOM(0xE2) },
4997 { USB_DEVICE_WACOM(0xE3) },
4998 { USB_DEVICE_WACOM(0xE5) },
4999 { USB_DEVICE_WACOM(0xE6) },
5000 { USB_DEVICE_WACOM(0xEC) },
5001 { USB_DEVICE_WACOM(0xED) },
5002 { USB_DEVICE_WACOM(0xEF) },
5003 { USB_DEVICE_WACOM(0xF0) },
5004 { USB_DEVICE_WACOM(0xF4) },
5005 { USB_DEVICE_WACOM(0xF6) },
5006 { USB_DEVICE_WACOM(0xF8) },
5007 { USB_DEVICE_WACOM(0xFA) },
5008 { USB_DEVICE_WACOM(0xFB) },
5009 { USB_DEVICE_WACOM(0x100) },
5010 { USB_DEVICE_WACOM(0x101) },
5011 { USB_DEVICE_WACOM(0x10D) },
5012 { USB_DEVICE_WACOM(0x10E) },
5013 { USB_DEVICE_WACOM(0x10F) },
5014 { USB_DEVICE_WACOM(0x116) },
5015 { USB_DEVICE_WACOM(0x12C) },
5016 { USB_DEVICE_WACOM(0x300) },
5017 { USB_DEVICE_WACOM(0x301) },
5018 { USB_DEVICE_WACOM(0x302) },
5019 { USB_DEVICE_WACOM(0x303) },
5020 { USB_DEVICE_WACOM(0x304) },
5021 { USB_DEVICE_WACOM(0x307) },
5022 { USB_DEVICE_WACOM(0x309) },
5023 { USB_DEVICE_WACOM(0x30A) },
5024 { USB_DEVICE_WACOM(0x30C) },
5025 { USB_DEVICE_WACOM(0x30E) },
5026 { USB_DEVICE_WACOM(0x314) },
5027 { USB_DEVICE_WACOM(0x315) },
5028 { USB_DEVICE_WACOM(0x317) },
5029 { USB_DEVICE_WACOM(0x318) },
5030 { USB_DEVICE_WACOM(0x319) },
5031 { USB_DEVICE_WACOM(0x323) },
5032 { USB_DEVICE_WACOM(0x325) },
5033 { USB_DEVICE_WACOM(0x326) },
5034 { USB_DEVICE_WACOM(0x32A) },
5035 { USB_DEVICE_WACOM(0x32B) },
5036 { USB_DEVICE_WACOM(0x32C) },
5037 { USB_DEVICE_WACOM(0x32F) },
5038 { USB_DEVICE_WACOM(0x331) },
5039 { USB_DEVICE_WACOM(0x333) },
5040 { USB_DEVICE_WACOM(0x335) },
5041 { USB_DEVICE_WACOM(0x336) },
5042 { USB_DEVICE_WACOM(0x33B) },
5043 { USB_DEVICE_WACOM(0x33C) },
5044 { USB_DEVICE_WACOM(0x33D) },
5045 { USB_DEVICE_WACOM(0x33E) },
5046 { USB_DEVICE_WACOM(0x343) },
5047 { BT_DEVICE_WACOM(0x360) },
5048 { BT_DEVICE_WACOM(0x361) },
5049 { BT_DEVICE_WACOM(0x377) },
5050 { BT_DEVICE_WACOM(0x379) },
5051 { USB_DEVICE_WACOM(0x37A) },
5052 { USB_DEVICE_WACOM(0x37B) },
5053 { BT_DEVICE_WACOM(0x393) },
5054 { BT_DEVICE_WACOM(0x3c6) },
5055 { BT_DEVICE_WACOM(0x3c8) },
5056 { BT_DEVICE_WACOM(0x3dd) },
5057 { USB_DEVICE_WACOM(0x4001) },
5058 { USB_DEVICE_WACOM(0x4004) },
5059 { USB_DEVICE_WACOM(0x5000) },
5060 { USB_DEVICE_WACOM(0x5002) },
5061 { USB_DEVICE_LENOVO(0x6004) },