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()
116 bool bat_initialized = wacom->battery.battery; in wacom_notify_battery()
117 bool has_quirk = wacom_wac->features.quirks & WACOM_QUIRK_BATTERY; in wacom_notify_battery()
122 __wacom_notify_battery(&wacom->battery, bat_status, bat_capacity, in wacom_notify_battery()
128 unsigned char *data = wacom->data; in wacom_penpartner_irq()
129 struct input_dev *input = wacom->pen_input; in wacom_penpartner_irq()
131 switch (data[0]) { in wacom_penpartner_irq()
133 if (data[5] & 0x80) { in wacom_penpartner_irq()
134 wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_penpartner_irq()
135 wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; in wacom_penpartner_irq()
136 input_report_key(input, wacom->tool[0], 1); in wacom_penpartner_irq()
137 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_penpartner_irq()
141 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); in wacom_penpartner_irq()
142 input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); in wacom_penpartner_irq()
144 input_report_key(input, wacom->tool[0], 0); in wacom_penpartner_irq()
145 input_report_abs(input, ABS_MISC, 0); /* report tool id */ in wacom_penpartner_irq()
146 input_report_abs(input, ABS_PRESSURE, -1); in wacom_penpartner_irq()
147 input_report_key(input, BTN_TOUCH, 0); in wacom_penpartner_irq()
157 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); in wacom_penpartner_irq()
158 input_report_key(input, BTN_STYLUS, (data[5] & 0x40)); in wacom_penpartner_irq()
162 dev_dbg(input->dev.parent, in wacom_penpartner_irq()
163 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_penpartner_irq()
164 return 0; in wacom_penpartner_irq()
172 struct wacom_features *features = &wacom->features; in wacom_pl_irq()
173 unsigned char *data = wacom->data; in wacom_pl_irq()
174 struct input_dev *input = wacom->pen_input; in wacom_pl_irq()
177 if (data[0] != WACOM_REPORT_PENABLED) { in wacom_pl_irq()
178 dev_dbg(input->dev.parent, in wacom_pl_irq()
179 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_pl_irq()
180 return 0; in wacom_pl_irq()
183 prox = data[1] & 0x40; in wacom_pl_irq()
185 if (!wacom->id[0]) { in wacom_pl_irq()
186 if ((data[0] & 0x10) || (data[4] & 0x20)) { in wacom_pl_irq()
187 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_pl_irq()
188 wacom->id[0] = ERASER_DEVICE_ID; in wacom_pl_irq()
191 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
192 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
197 * mis-detected the type and notice that STYLUS2 isn't set in wacom_pl_irq()
200 if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { in wacom_pl_irq()
201 input_report_key(input, BTN_TOOL_RUBBER, 0); in wacom_pl_irq()
202 input_report_abs(input, ABS_MISC, 0); in wacom_pl_irq()
204 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
205 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
210 if (features->pressure_max > 255) in wacom_pl_irq()
212 pressure += (features->pressure_max + 1) / 2; in wacom_pl_irq()
214 input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); in wacom_pl_irq()
215 input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); in wacom_pl_irq()
218 input_report_key(input, BTN_TOUCH, data[4] & 0x08); in wacom_pl_irq()
219 input_report_key(input, BTN_STYLUS, data[4] & 0x10); in wacom_pl_irq()
221 input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); in wacom_pl_irq()
225 wacom->id[0] = 0; in wacom_pl_irq()
226 input_report_key(input, wacom->tool[0], prox); in wacom_pl_irq()
227 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_pl_irq()
233 unsigned char *data = wacom->data; in wacom_ptu_irq()
234 struct input_dev *input = wacom->pen_input; in wacom_ptu_irq()
236 if (data[0] != WACOM_REPORT_PENABLED) { in wacom_ptu_irq()
237 dev_dbg(input->dev.parent, in wacom_ptu_irq()
238 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_ptu_irq()
239 return 0; in wacom_ptu_irq()
242 if (data[1] & 0x04) { in wacom_ptu_irq()
243 input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20); in wacom_ptu_irq()
244 input_report_key(input, BTN_TOUCH, data[1] & 0x08); in wacom_ptu_irq()
245 wacom->id[0] = ERASER_DEVICE_ID; in wacom_ptu_irq()
247 input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20); in wacom_ptu_irq()
248 input_report_key(input, BTN_TOUCH, data[1] & 0x01); in wacom_ptu_irq()
249 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_ptu_irq()
251 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_ptu_irq()
255 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_ptu_irq()
256 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_ptu_irq()
262 unsigned char *data = wacom->data; in wacom_dtu_irq()
263 struct input_dev *input = wacom->pen_input; in wacom_dtu_irq()
264 int prox = data[1] & 0x20; in wacom_dtu_irq()
266 dev_dbg(input->dev.parent, in wacom_dtu_irq()
267 "%s: received report #%d", __func__, data[0]); in wacom_dtu_irq()
271 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_dtu_irq()
272 if (wacom->tool[0] == BTN_TOOL_PEN) in wacom_dtu_irq()
273 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtu_irq()
275 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtu_irq()
277 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_dtu_irq()
278 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_dtu_irq()
281 input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]); in wacom_dtu_irq()
282 input_report_key(input, BTN_TOUCH, data[1] & 0x05); in wacom_dtu_irq()
283 if (!prox) /* out-prox */ in wacom_dtu_irq()
284 wacom->id[0] = 0; in wacom_dtu_irq()
285 input_report_key(input, wacom->tool[0], prox); in wacom_dtu_irq()
286 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtu_irq()
292 unsigned char *data = wacom->data; in wacom_dtus_irq()
293 struct input_dev *input = wacom->pen_input; in wacom_dtus_irq()
294 unsigned short prox, pressure = 0; in wacom_dtus_irq()
296 if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { in wacom_dtus_irq()
297 dev_dbg(input->dev.parent, in wacom_dtus_irq()
298 "%s: received unknown report #%d", __func__, data[0]); in wacom_dtus_irq()
299 return 0; in wacom_dtus_irq()
300 } else if (data[0] == WACOM_REPORT_DTUSPAD) { in wacom_dtus_irq()
301 input = wacom->pad_input; in wacom_dtus_irq()
302 input_report_key(input, BTN_0, (data[1] & 0x01)); in wacom_dtus_irq()
303 input_report_key(input, BTN_1, (data[1] & 0x02)); in wacom_dtus_irq()
304 input_report_key(input, BTN_2, (data[1] & 0x04)); in wacom_dtus_irq()
305 input_report_key(input, BTN_3, (data[1] & 0x08)); in wacom_dtus_irq()
307 data[1] & 0x0f ? PAD_DEVICE_ID : 0); in wacom_dtus_irq()
310 prox = data[1] & 0x80; in wacom_dtus_irq()
314 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_dtus_irq()
315 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtus_irq()
319 wacom->tool[0] = BTN_TOOL_PEN; in wacom_dtus_irq()
320 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtus_irq()
325 input_report_key(input, BTN_STYLUS, data[1] & 0x20); in wacom_dtus_irq()
326 input_report_key(input, BTN_STYLUS2, data[1] & 0x40); in wacom_dtus_irq()
329 pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff); in wacom_dtus_irq()
333 if (!prox) /* out-prox */ in wacom_dtus_irq()
334 wacom->id[0] = 0; in wacom_dtus_irq()
335 input_report_key(input, wacom->tool[0], prox); in wacom_dtus_irq()
336 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtus_irq()
343 struct wacom_features *features = &wacom->features; in wacom_graphire_irq()
344 unsigned char *data = wacom->data; in wacom_graphire_irq()
345 struct input_dev *input = wacom->pen_input; in wacom_graphire_irq()
346 struct input_dev *pad_input = wacom->pad_input; in wacom_graphire_irq()
349 int rw = 0; in wacom_graphire_irq()
350 int retval = 0; in wacom_graphire_irq()
352 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
353 if (data[0] != WACOM_REPORT_PENABLED_BT) { in wacom_graphire_irq()
354 dev_dbg(input->dev.parent, in wacom_graphire_irq()
356 data[0]); in wacom_graphire_irq()
359 } else if (data[0] != WACOM_REPORT_PENABLED) { in wacom_graphire_irq()
360 dev_dbg(input->dev.parent, in wacom_graphire_irq()
361 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_graphire_irq()
365 prox = data[1] & 0x80; in wacom_graphire_irq()
366 if (prox || wacom->id[0]) { in wacom_graphire_irq()
370 case 0: /* Pen */ in wacom_graphire_irq()
371 wacom->tool[0] = BTN_TOOL_PEN; in wacom_graphire_irq()
372 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_graphire_irq()
376 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_graphire_irq()
377 wacom->id[0] = ERASER_DEVICE_ID; in wacom_graphire_irq()
381 input_report_key(input, BTN_MIDDLE, data[1] & 0x04); in wacom_graphire_irq()
385 wacom->tool[0] = BTN_TOOL_MOUSE; in wacom_graphire_irq()
386 wacom->id[0] = CURSOR_DEVICE_ID; in wacom_graphire_irq()
392 if (wacom->tool[0] != BTN_TOOL_MOUSE) { in wacom_graphire_irq()
393 if (features->type == GRAPHIRE_BT) in wacom_graphire_irq()
395 (((__u16) (data[1] & 0x08)) << 5)); in wacom_graphire_irq()
398 ((data[7] & 0x03) << 8)); in wacom_graphire_irq()
399 input_report_key(input, BTN_TOUCH, data[1] & 0x01); in wacom_graphire_irq()
400 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_graphire_irq()
401 input_report_key(input, BTN_STYLUS2, data[1] & 0x04); in wacom_graphire_irq()
403 input_report_key(input, BTN_LEFT, data[1] & 0x01); in wacom_graphire_irq()
404 input_report_key(input, BTN_RIGHT, data[1] & 0x02); in wacom_graphire_irq()
405 if (features->type == WACOM_G4 || in wacom_graphire_irq()
406 features->type == WACOM_MO) { in wacom_graphire_irq()
407 input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); in wacom_graphire_irq()
408 rw = (data[7] & 0x04) - (data[7] & 0x03); in wacom_graphire_irq()
409 } else if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
411 rw = 44 - (data[6] >> 2); in wacom_graphire_irq()
412 rw = clamp_val(rw, 0, 31); in wacom_graphire_irq()
417 data[1] & 0x04); in wacom_graphire_irq()
418 rw = (data[6] & 0x01) ? -1 : in wacom_graphire_irq()
419 (data[6] & 0x02) ? 1 : 0; in wacom_graphire_irq()
421 rw = 0; in wacom_graphire_irq()
424 input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); in wacom_graphire_irq()
425 rw = -(signed char)data[6]; in wacom_graphire_irq()
431 wacom->id[0] = 0; in wacom_graphire_irq()
432 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_graphire_irq()
433 input_report_key(input, wacom->tool[0], prox); in wacom_graphire_irq()
438 switch (features->type) { in wacom_graphire_irq()
440 prox = data[7] & 0xf8; in wacom_graphire_irq()
441 if (prox || wacom->id[1]) { in wacom_graphire_irq()
442 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
443 input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); in wacom_graphire_irq()
444 input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); in wacom_graphire_irq()
445 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); in wacom_graphire_irq()
448 wacom->id[1] = 0; in wacom_graphire_irq()
449 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
455 prox = (data[7] & 0xf8) || data[8]; in wacom_graphire_irq()
456 if (prox || wacom->id[1]) { in wacom_graphire_irq()
457 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
458 input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); in wacom_graphire_irq()
459 input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); in wacom_graphire_irq()
460 input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); in wacom_graphire_irq()
461 input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); in wacom_graphire_irq()
462 input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); in wacom_graphire_irq()
464 wacom->id[1] = 0; in wacom_graphire_irq()
465 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
470 prox = data[7] & 0x03; in wacom_graphire_irq()
471 if (prox || wacom->id[1]) { in wacom_graphire_irq()
472 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
473 input_report_key(pad_input, BTN_0, (data[7] & 0x02)); in wacom_graphire_irq()
474 input_report_key(pad_input, BTN_1, (data[7] & 0x01)); in wacom_graphire_irq()
476 wacom->id[1] = 0; in wacom_graphire_irq()
477 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
484 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
485 rw = (data[7] >> 2 & 0x07); in wacom_graphire_irq()
499 struct wacom_features *features = &wacom_wac->features; in wacom_intuos_schedule_prox_event()
503 re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); in wacom_intuos_schedule_prox_event()
504 if (features->type == INTUOSHT2) in wacom_intuos_schedule_prox_event()
505 r = re->report_id_hash[WACOM_REPORT_INTUOSHT2_ID]; in wacom_intuos_schedule_prox_event()
507 r = re->report_id_hash[WACOM_REPORT_INTUOS_ID1]; in wacom_intuos_schedule_prox_event()
509 hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); in wacom_intuos_schedule_prox_event()
515 struct wacom_features *features = &wacom->features; in wacom_intuos_pad()
516 unsigned char *data = wacom->data; in wacom_intuos_pad()
517 struct input_dev *input = wacom->pad_input; in wacom_intuos_pad()
519 int buttons = 0, nbuttons = features->numbered_buttons; in wacom_intuos_pad()
520 int keys = 0, nkeys = 0; in wacom_intuos_pad()
521 int ring1 = 0, ring2 = 0; in wacom_intuos_pad()
522 int strip1 = 0, strip2 = 0; in wacom_intuos_pad()
528 if (!(data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD || in wacom_intuos_pad()
529 data[0] == WACOM_REPORT_CINTIQPAD)) in wacom_intuos_pad()
530 return 0; in wacom_intuos_pad()
532 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { in wacom_intuos_pad()
533 buttons = (data[3] << 1) | (data[2] & 0x01); in wacom_intuos_pad()
535 } else if (features->type == DTK) { in wacom_intuos_pad()
537 } else if (features->type == WACOM_13HD) { in wacom_intuos_pad()
538 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
539 } else if (features->type == WACOM_24HD) { in wacom_intuos_pad()
549 * ((data[3] & 0x1f) << 8) | data[4]) in wacom_intuos_pad()
552 keys = ((data[3] & 0x1C) ? 1<<2 : 0) | in wacom_intuos_pad()
553 ((data[4] & 0xE0) ? 1<<1 : 0) | in wacom_intuos_pad()
554 ((data[4] & 0x07) ? 1<<0 : 0); in wacom_intuos_pad()
555 keyboard = !!(data[4] & 0xE0); in wacom_intuos_pad()
556 info = !!(data[3] & 0x1C); in wacom_intuos_pad()
558 if (features->oPid) { in wacom_intuos_pad()
559 mute_touch = !!(data[4] & 0x07); in wacom_intuos_pad()
561 wacom->shared->is_touch_on = in wacom_intuos_pad()
562 !wacom->shared->is_touch_on; in wacom_intuos_pad()
564 wrench = !!(data[4] & 0x07); in wacom_intuos_pad()
566 } else if (features->type == WACOM_27QHD) { in wacom_intuos_pad()
568 keys = data[2] & 0x07; in wacom_intuos_pad()
570 wrench = !!(data[2] & 0x01); in wacom_intuos_pad()
571 keyboard = !!(data[2] & 0x02); in wacom_intuos_pad()
573 if (features->oPid) { in wacom_intuos_pad()
574 mute_touch = !!(data[2] & 0x04); in wacom_intuos_pad()
576 wacom->shared->is_touch_on = in wacom_intuos_pad()
577 !wacom->shared->is_touch_on; in wacom_intuos_pad()
579 menu = !!(data[2] & 0x04); in wacom_intuos_pad()
584 } else if (features->type == CINTIQ_HYBRID) { in wacom_intuos_pad()
590 * d-pad right -> data[4] & 0x10 in wacom_intuos_pad()
591 * d-pad up -> data[4] & 0x20 in wacom_intuos_pad()
592 * d-pad left -> data[4] & 0x40 in wacom_intuos_pad()
593 * d-pad down -> data[4] & 0x80 in wacom_intuos_pad()
594 * d-pad center -> data[3] & 0x01 in wacom_intuos_pad()
596 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
597 } else if (features->type == CINTIQ_COMPANION_2) { in wacom_intuos_pad()
598 /* d-pad right -> data[2] & 0x10 in wacom_intuos_pad()
599 * d-pad up -> data[2] & 0x20 in wacom_intuos_pad()
600 * d-pad left -> data[2] & 0x40 in wacom_intuos_pad()
601 * d-pad down -> data[2] & 0x80 in wacom_intuos_pad()
602 * d-pad center -> data[1] & 0x01 in wacom_intuos_pad()
605 ((data[1] & 0x04) << 4) | in wacom_intuos_pad()
606 ((data[2] & 0x0F) << 2) | in wacom_intuos_pad()
607 (data[1] & 0x03); in wacom_intuos_pad()
608 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { in wacom_intuos_pad()
616 buttons = (data[4] << 1) | (data[3] & 0x01); in wacom_intuos_pad()
619 if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { in wacom_intuos_pad()
620 buttons = (data[8] << 10) | ((data[7] & 0x01) << 9) | in wacom_intuos_pad()
621 (data[6] << 1) | (data[5] & 0x01); in wacom_intuos_pad()
623 if (features->type == WACOM_22HD) { in wacom_intuos_pad()
625 keys = data[9] & 0x07; in wacom_intuos_pad()
627 info = !!(data[9] & 0x01); in wacom_intuos_pad()
628 wrench = !!(data[9] & 0x02); in wacom_intuos_pad()
631 buttons = ((data[6] & 0x10) << 5) | in wacom_intuos_pad()
632 ((data[5] & 0x10) << 4) | in wacom_intuos_pad()
633 ((data[6] & 0x0F) << 4) | in wacom_intuos_pad()
634 (data[5] & 0x0F); in wacom_intuos_pad()
636 strip1 = ((data[1] & 0x1f) << 8) | data[2]; in wacom_intuos_pad()
637 strip2 = ((data[3] & 0x1f) << 8) | data[4]; in wacom_intuos_pad()
640 prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) | in wacom_intuos_pad()
641 (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; in wacom_intuos_pad()
645 for (i = 0; i < nkeys; i++) in wacom_intuos_pad()
653 if (wacom->shared && wacom->shared->touch_input) { in wacom_intuos_pad()
654 input_report_switch(wacom->shared->touch_input, in wacom_intuos_pad()
656 !wacom->shared->is_touch_on); in wacom_intuos_pad()
657 input_sync(wacom->shared->touch_input); in wacom_intuos_pad()
663 input_report_abs(input, ABS_WHEEL, (ring1 & 0x80) ? (ring1 & 0x7f) : 0); in wacom_intuos_pad()
664 input_report_abs(input, ABS_THROTTLE, (ring2 & 0x80) ? (ring2 & 0x7f) : 0); in wacom_intuos_pad()
666 input_report_key(input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pad()
667 input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pad()
669 input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_pad()
676 return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); in wacom_intuos_id_mangle()
684 case 0x885: /* Intuos3 Marker Pen */ in wacom_is_art_pen()
685 case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ in wacom_is_art_pen()
686 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()
702 case 0x832: /* Stroke pen */ in wacom_intuos_get_tool_type()
703 case 0x032: in wacom_intuos_get_tool_type()
706 case 0x007: /* Mouse 4D and 2D */ in wacom_intuos_get_tool_type()
707 case 0x09c: in wacom_intuos_get_tool_type()
708 case 0x094: in wacom_intuos_get_tool_type()
709 case 0x017: /* Intuos3 2D Mouse */ in wacom_intuos_get_tool_type()
710 case 0x806: /* Intuos4 Mouse */ in wacom_intuos_get_tool_type()
713 case 0x096: /* Lens cursor */ in wacom_intuos_get_tool_type()
714 case 0x097: /* Intuos3 Lens cursor */ in wacom_intuos_get_tool_type()
715 case 0x006: /* Intuos4 Lens cursor */ in wacom_intuos_get_tool_type()
718 case 0xd12: in wacom_intuos_get_tool_type()
719 case 0x912: in wacom_intuos_get_tool_type()
720 case 0x112: in wacom_intuos_get_tool_type()
721 case 0x913: /* Intuos3 Airbrush */ in wacom_intuos_get_tool_type()
722 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ in wacom_intuos_get_tool_type()
723 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ in wacom_intuos_get_tool_type()
727 if (tool_id & 0x0008) in wacom_intuos_get_tool_type()
735 struct input_dev *input = wacom->pen_input; in wacom_exit_report()
736 struct wacom_features *features = &wacom->features; in wacom_exit_report()
737 unsigned char *data = wacom->data; in wacom_exit_report()
738 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_exit_report()
742 * when in-prox next time in wacom_exit_report()
744 input_report_abs(input, ABS_X, 0); in wacom_exit_report()
745 input_report_abs(input, ABS_Y, 0); in wacom_exit_report()
746 input_report_abs(input, ABS_DISTANCE, 0); in wacom_exit_report()
747 input_report_abs(input, ABS_TILT_X, 0); in wacom_exit_report()
748 input_report_abs(input, ABS_TILT_Y, 0); in wacom_exit_report()
749 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { in wacom_exit_report()
750 input_report_key(input, BTN_LEFT, 0); in wacom_exit_report()
751 input_report_key(input, BTN_MIDDLE, 0); in wacom_exit_report()
752 input_report_key(input, BTN_RIGHT, 0); in wacom_exit_report()
753 input_report_key(input, BTN_SIDE, 0); in wacom_exit_report()
754 input_report_key(input, BTN_EXTRA, 0); in wacom_exit_report()
755 input_report_abs(input, ABS_THROTTLE, 0); in wacom_exit_report()
756 input_report_abs(input, ABS_RZ, 0); in wacom_exit_report()
758 input_report_abs(input, ABS_PRESSURE, 0); in wacom_exit_report()
759 input_report_key(input, BTN_STYLUS, 0); in wacom_exit_report()
760 input_report_key(input, BTN_STYLUS2, 0); in wacom_exit_report()
761 input_report_key(input, BTN_TOUCH, 0); in wacom_exit_report()
762 input_report_abs(input, ABS_WHEEL, 0); in wacom_exit_report()
763 if (features->type >= INTUOS3S) in wacom_exit_report()
764 input_report_abs(input, ABS_Z, 0); in wacom_exit_report()
766 input_report_key(input, wacom->tool[idx], 0); in wacom_exit_report()
767 input_report_abs(input, ABS_MISC, 0); /* reset tool id */ in wacom_exit_report()
768 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_exit_report()
769 wacom->id[idx] = 0; in wacom_exit_report()
774 struct wacom_features *features = &wacom->features; in wacom_intuos_inout()
775 unsigned char *data = wacom->data; in wacom_intuos_inout()
776 struct input_dev *input = wacom->pen_input; in wacom_intuos_inout()
777 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_inout()
779 if (!(((data[1] & 0xfc) == 0xc0) || /* in prox */ in wacom_intuos_inout()
780 ((data[1] & 0xfe) == 0x20) || /* in range */ in wacom_intuos_inout()
781 ((data[1] & 0xfe) == 0x80))) /* out prox */ in wacom_intuos_inout()
782 return 0; in wacom_intuos_inout()
785 if ((data[1] & 0xfc) == 0xc0) { in wacom_intuos_inout()
787 wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) + in wacom_intuos_inout()
791 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | in wacom_intuos_inout()
792 ((data[7] & 0x0f) << 16) | ((data[8] & 0xf0) << 8); in wacom_intuos_inout()
794 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); in wacom_intuos_inout()
796 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
801 if ((data[1] & 0xfe) == 0x20) { in wacom_intuos_inout()
802 if (features->type != INTUOSHT2) in wacom_intuos_inout()
803 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
806 if (wacom->reporting_data) { in wacom_intuos_inout()
807 input_report_key(input, BTN_TOUCH, 0); in wacom_intuos_inout()
808 input_report_abs(input, ABS_PRESSURE, 0); in wacom_intuos_inout()
809 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); in wacom_intuos_inout()
816 if ((data[1] & 0xfe) == 0x80) { in wacom_intuos_inout()
817 wacom->shared->stylus_in_proximity = false; in wacom_intuos_inout()
818 wacom->reporting_data = false; in wacom_intuos_inout()
821 if (!wacom->id[idx]) in wacom_intuos_inout()
828 return 0; in wacom_intuos_inout()
833 return wacom_wac->probe_complete && in touch_is_muted()
834 wacom_wac->shared->has_mute_touch_switch && in touch_is_muted()
835 !wacom_wac->shared->is_touch_on; in touch_is_muted()
840 return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1); in report_touch_events()
845 return (wacom->shared->touch_down && touch_arbitration); in delay_pen_events()
850 struct wacom_features *features = &wacom->features; in wacom_intuos_general()
851 unsigned char *data = wacom->data; in wacom_intuos_general()
852 struct input_dev *input = wacom->pen_input; in wacom_intuos_general()
853 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_general()
854 unsigned char type = (data[1] >> 1) & 0x0F; in wacom_intuos_general()
857 if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_CINTIQ && in wacom_intuos_general()
858 data[0] != WACOM_REPORT_INTUOS_PEN) in wacom_intuos_general()
859 return 0; in wacom_intuos_general()
865 if (!wacom->id[idx]) { in wacom_intuos_general()
875 if ((!((wacom->id[idx] >> 16) & 0x01) && in wacom_intuos_general()
876 (features->type == WACOM_21UX2)) || in wacom_intuos_general()
878 (wacom->tool[idx] == BTN_TOOL_LENS && in wacom_intuos_general()
879 (features->type == INTUOS3 || in wacom_intuos_general()
880 features->type == INTUOS3S || in wacom_intuos_general()
881 features->type == INTUOS4 || in wacom_intuos_general()
882 features->type == INTUOS4S || in wacom_intuos_general()
883 features->type == INTUOS5 || in wacom_intuos_general()
884 features->type == INTUOS5S || in wacom_intuos_general()
885 features->type == INTUOSPM || in wacom_intuos_general()
886 features->type == INTUOSPS)) || in wacom_intuos_general()
888 (features->type == CINTIQ && !(data[1] & 0x40))) in wacom_intuos_general()
894 if (features->type < INTUOS3S) { in wacom_intuos_general()
899 if (features->type == INTUOSHT2) in wacom_intuos_general()
900 distance = features->distance_max - distance; in wacom_intuos_general()
906 case 0x00: in wacom_intuos_general()
907 case 0x01: in wacom_intuos_general()
908 case 0x02: in wacom_intuos_general()
909 case 0x03: in wacom_intuos_general()
911 t = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | (data[1] & 1); in wacom_intuos_general()
912 if (features->pressure_max < 2047) in wacom_intuos_general()
915 if (features->type != INTUOSHT2) { in wacom_intuos_general()
917 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
918 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
925 case 0x0a: in wacom_intuos_general()
930 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
931 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
934 case 0x05: in wacom_intuos_general()
936 if (features->type >= INTUOS3S) { in wacom_intuos_general()
939 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : in wacom_intuos_general()
940 ((t-1) / 2 + 450)) : (450 - t / 2) ; in wacom_intuos_general()
945 input_report_abs(input, ABS_RZ, (data[7] & 0x20) ? in wacom_intuos_general()
946 ((t - 1) / 2) : -t / 2); in wacom_intuos_general()
950 case 0x04: in wacom_intuos_general()
952 input_report_key(input, BTN_LEFT, data[8] & 0x01); in wacom_intuos_general()
953 input_report_key(input, BTN_MIDDLE, data[8] & 0x02); in wacom_intuos_general()
954 input_report_key(input, BTN_RIGHT, data[8] & 0x04); in wacom_intuos_general()
956 input_report_key(input, BTN_SIDE, data[8] & 0x20); in wacom_intuos_general()
957 input_report_key(input, BTN_EXTRA, data[8] & 0x10); in wacom_intuos_general()
959 input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); in wacom_intuos_general()
962 case 0x06: in wacom_intuos_general()
964 input_report_key(input, BTN_LEFT, data[6] & 0x01); in wacom_intuos_general()
965 input_report_key(input, BTN_MIDDLE, data[6] & 0x02); in wacom_intuos_general()
966 input_report_key(input, BTN_RIGHT, data[6] & 0x04); in wacom_intuos_general()
967 input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) in wacom_intuos_general()
968 - ((data[7] & 0x40) >> 6)); in wacom_intuos_general()
969 input_report_key(input, BTN_SIDE, data[6] & 0x08); in wacom_intuos_general()
970 input_report_key(input, BTN_EXTRA, data[6] & 0x10); in wacom_intuos_general()
973 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
974 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
977 case 0x08: in wacom_intuos_general()
978 if (wacom->tool[idx] == BTN_TOOL_MOUSE) { in wacom_intuos_general()
980 input_report_key(input, BTN_LEFT, data[8] & 0x04); in wacom_intuos_general()
981 input_report_key(input, BTN_MIDDLE, data[8] & 0x08); in wacom_intuos_general()
982 input_report_key(input, BTN_RIGHT, data[8] & 0x10); in wacom_intuos_general()
983 input_report_rel(input, REL_WHEEL, (data[8] & 0x01) in wacom_intuos_general()
984 - ((data[8] & 0x02) >> 1)); in wacom_intuos_general()
987 if (features->type >= INTUOS3S && features->type <= INTUOS3L) { in wacom_intuos_general()
988 input_report_key(input, BTN_SIDE, data[8] & 0x40); in wacom_intuos_general()
989 input_report_key(input, BTN_EXTRA, data[8] & 0x20); in wacom_intuos_general()
992 else if (wacom->tool[idx] == BTN_TOOL_LENS) { 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()
997 input_report_key(input, BTN_SIDE, data[8] & 0x10); in wacom_intuos_general()
998 input_report_key(input, BTN_EXTRA, data[8] & 0x08); in wacom_intuos_general()
1002 case 0x07: in wacom_intuos_general()
1003 case 0x09: in wacom_intuos_general()
1004 case 0x0b: in wacom_intuos_general()
1005 case 0x0c: in wacom_intuos_general()
1006 case 0x0d: in wacom_intuos_general()
1007 case 0x0e: in wacom_intuos_general()
1008 case 0x0f: in wacom_intuos_general()
1014 wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */ in wacom_intuos_general()
1015 input_report_key(input, wacom->tool[idx], 1); in wacom_intuos_general()
1016 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_intuos_general()
1017 wacom->reporting_data = true; in wacom_intuos_general()
1023 unsigned char *data = wacom->data; in wacom_intuos_irq()
1024 struct input_dev *input = wacom->pen_input; in wacom_intuos_irq()
1027 if (data[0] != WACOM_REPORT_PENABLED && in wacom_intuos_irq()
1028 data[0] != WACOM_REPORT_INTUOS_ID1 && in wacom_intuos_irq()
1029 data[0] != WACOM_REPORT_INTUOS_ID2 && in wacom_intuos_irq()
1030 data[0] != WACOM_REPORT_INTUOSPAD && in wacom_intuos_irq()
1031 data[0] != WACOM_REPORT_INTUOS_PEN && in wacom_intuos_irq()
1032 data[0] != WACOM_REPORT_CINTIQ && in wacom_intuos_irq()
1033 data[0] != WACOM_REPORT_CINTIQPAD && in wacom_intuos_irq()
1034 data[0] != WACOM_REPORT_INTUOS5PAD) { in wacom_intuos_irq()
1035 dev_dbg(input->dev.parent, in wacom_intuos_irq()
1036 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_intuos_irq()
1037 return 0; in wacom_intuos_irq()
1048 return result - 1; in wacom_intuos_irq()
1053 return result - 1; in wacom_intuos_irq()
1055 return 0; in wacom_intuos_irq()
1060 unsigned char *data = wacom_wac->data; in wacom_remote_irq()
1063 struct wacom_remote *remote = wacom->remote; in wacom_remote_irq()
1066 int i, index = -1; in wacom_remote_irq()
1069 if (data[0] != WACOM_REPORT_REMOTE) { in wacom_remote_irq()
1070 hid_dbg(wacom->hdev, "%s: received unknown report #%d", in wacom_remote_irq()
1071 __func__, data[0]); in wacom_remote_irq()
1072 return 0; in wacom_remote_irq()
1076 wacom_wac->id[0] = PAD_DEVICE_ID; in wacom_remote_irq()
1078 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_irq()
1080 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_irq()
1081 if (remote->remotes[i].serial == serial) { in wacom_remote_irq()
1087 if (index < 0 || !remote->remotes[index].registered) in wacom_remote_irq()
1090 remote->remotes[i].active_time = ktime_get(); in wacom_remote_irq()
1091 input = remote->remotes[index].input; in wacom_remote_irq()
1093 input_report_key(input, BTN_0, (data[9] & 0x01)); in wacom_remote_irq()
1094 input_report_key(input, BTN_1, (data[9] & 0x02)); in wacom_remote_irq()
1095 input_report_key(input, BTN_2, (data[9] & 0x04)); in wacom_remote_irq()
1096 input_report_key(input, BTN_3, (data[9] & 0x08)); in wacom_remote_irq()
1097 input_report_key(input, BTN_4, (data[9] & 0x10)); in wacom_remote_irq()
1098 input_report_key(input, BTN_5, (data[9] & 0x20)); in wacom_remote_irq()
1099 input_report_key(input, BTN_6, (data[9] & 0x40)); in wacom_remote_irq()
1100 input_report_key(input, BTN_7, (data[9] & 0x80)); in wacom_remote_irq()
1102 input_report_key(input, BTN_8, (data[10] & 0x01)); in wacom_remote_irq()
1103 input_report_key(input, BTN_9, (data[10] & 0x02)); in wacom_remote_irq()
1104 input_report_key(input, BTN_A, (data[10] & 0x04)); in wacom_remote_irq()
1105 input_report_key(input, BTN_B, (data[10] & 0x08)); in wacom_remote_irq()
1106 input_report_key(input, BTN_C, (data[10] & 0x10)); in wacom_remote_irq()
1107 input_report_key(input, BTN_X, (data[10] & 0x20)); in wacom_remote_irq()
1108 input_report_key(input, BTN_Y, (data[10] & 0x40)); in wacom_remote_irq()
1109 input_report_key(input, BTN_Z, (data[10] & 0x80)); in wacom_remote_irq()
1111 input_report_key(input, BTN_BASE, (data[11] & 0x01)); in wacom_remote_irq()
1112 input_report_key(input, BTN_BASE2, (data[11] & 0x02)); in wacom_remote_irq()
1114 if (data[12] & 0x80) in wacom_remote_irq()
1115 input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f) - 1); in wacom_remote_irq()
1117 input_report_abs(input, ABS_WHEEL, 0); in wacom_remote_irq()
1119 bat_percent = data[7] & 0x7f; in wacom_remote_irq()
1120 bat_charging = !!(data[7] & 0x80); in wacom_remote_irq()
1122 if (data[9] | data[10] | (data[11] & 0x03) | data[12]) in wacom_remote_irq()
1125 input_report_abs(input, ABS_MISC, 0); in wacom_remote_irq()
1132 touch_ring_mode = (data[11] & 0xC0) >> 6; in wacom_remote_irq()
1134 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_irq()
1135 if (remote->remotes[i].serial == serial) in wacom_remote_irq()
1136 wacom->led.groups[i].select = touch_ring_mode; in wacom_remote_irq()
1139 __wacom_notify_battery(&remote->remotes[index].battery, in wacom_remote_irq()
1144 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_irq()
1145 return 0; in wacom_remote_irq()
1151 unsigned char *data = wacom_wac->data; in wacom_remote_status_irq()
1152 struct wacom_remote *remote = wacom->remote; in wacom_remote_status_irq()
1157 if (data[0] != WACOM_REPORT_DEVICE_LIST) in wacom_remote_status_irq()
1160 memset(&remote_data, 0, sizeof(struct wacom_remote_work_data)); in wacom_remote_status_irq()
1162 for (i = 0; i < WACOM_MAX_REMOTES; i++) { in wacom_remote_status_irq()
1169 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_status_irq()
1171 ret = kfifo_in(&remote->remote_fifo, &remote_data, sizeof(remote_data)); in wacom_remote_status_irq()
1173 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1174 hid_err(wacom->hdev, "Can't queue Remote status event.\n"); in wacom_remote_status_irq()
1178 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1185 int x = x2 - x1; in int_dist()
1186 int y = y2 - y1; in int_dist()
1194 memcpy(wacom->data, data, 10); in wacom_intuos_bt_process_data()
1197 input_sync(wacom->pen_input); in wacom_intuos_bt_process_data()
1198 if (wacom->pad_input) in wacom_intuos_bt_process_data()
1199 input_sync(wacom->pad_input); in wacom_intuos_bt_process_data()
1208 memcpy(data, wacom->data, len); in wacom_intuos_bt_irq()
1210 switch (data[0]) { in wacom_intuos_bt_irq()
1211 case 0x04: in wacom_intuos_bt_irq()
1215 case 0x03: in wacom_intuos_bt_irq()
1221 bat_charging = (power_raw & 0x08) ? 1 : 0; in wacom_intuos_bt_irq()
1222 ps_connected = (power_raw & 0x10) ? 1 : 0; in wacom_intuos_bt_irq()
1223 battery_capacity = batcap_i4[power_raw & 0x07]; in wacom_intuos_bt_irq()
1230 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_bt_irq()
1232 data[0], data[1], len); in wacom_intuos_bt_irq()
1233 return 0; in wacom_intuos_bt_irq()
1235 return 0; in wacom_intuos_bt_irq()
1240 struct input_dev *input = wacom->touch_input; in wacom_wac_finger_count_touches()
1241 unsigned touch_max = wacom->features.touch_max; in wacom_wac_finger_count_touches()
1242 int count = 0; in wacom_wac_finger_count_touches()
1246 return 0; in wacom_wac_finger_count_touches()
1249 return test_bit(BTN_TOUCH, input->key) && in wacom_wac_finger_count_touches()
1252 for (i = 0; i < input->mt->num_slots; i++) { in wacom_wac_finger_count_touches()
1253 struct input_mt_slot *ps = &input->mt->slots[i]; in wacom_wac_finger_count_touches()
1255 if (id >= 0) in wacom_wac_finger_count_touches()
1266 struct input_dev *pen_input = wacom->pen_input; in wacom_intuos_pro2_bt_pen()
1267 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pen()
1268 int number_of_valid_frames = 0; in wacom_intuos_pro2_bt_pen()
1273 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1274 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1275 wacom->serial[0] = get_unaligned_le64(&data[99]); in wacom_intuos_pro2_bt_pen()
1276 wacom->id[0] = get_unaligned_le16(&data[107]); in wacom_intuos_pro2_bt_pen()
1280 wacom->serial[0] = get_unaligned_le64(&data[33]); in wacom_intuos_pro2_bt_pen()
1281 wacom->id[0] = get_unaligned_le16(&data[41]); in wacom_intuos_pro2_bt_pen()
1286 if (wacom->serial[0] >> 52 == 1) { in wacom_intuos_pro2_bt_pen()
1287 /* Add back in missing bits of ID for non-USI pens */ in wacom_intuos_pro2_bt_pen()
1288 wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF; in wacom_intuos_pro2_bt_pen()
1292 for (i = 0; i < pen_frames; i++) { in wacom_intuos_pro2_bt_pen()
1294 bool valid = frame[0] & 0x80; in wacom_intuos_pro2_bt_pen()
1301 if (wacom->hid_data.time_delayed) in wacom_intuos_pro2_bt_pen()
1302 time_interval = ktime_get() - wacom->hid_data.time_delayed; in wacom_intuos_pro2_bt_pen()
1304 wacom->hid_data.time_delayed = time_packet_received; in wacom_intuos_pro2_bt_pen()
1307 for (i = 0; i < number_of_valid_frames; i++) { in wacom_intuos_pro2_bt_pen()
1309 bool valid = frame[0] & 0x80; in wacom_intuos_pro2_bt_pen()
1310 bool prox = frame[0] & 0x40; in wacom_intuos_pro2_bt_pen()
1311 bool range = frame[0] & 0x20; in wacom_intuos_pro2_bt_pen()
1312 bool invert = frame[0] & 0x10; in wacom_intuos_pro2_bt_pen()
1313 int frames_number_reversed = number_of_valid_frames - i - 1; in wacom_intuos_pro2_bt_pen()
1314 ktime_t event_timestamp = time_packet_received - frames_number_reversed * time_interval; in wacom_intuos_pro2_bt_pen()
1320 wacom->shared->stylus_in_proximity = false; in wacom_intuos_pro2_bt_pen()
1324 wacom->tool[0] = 0; in wacom_intuos_pro2_bt_pen()
1325 wacom->id[0] = 0; in wacom_intuos_pro2_bt_pen()
1326 wacom->serial[0] = 0; in wacom_intuos_pro2_bt_pen()
1327 wacom->hid_data.time_delayed = 0; in wacom_intuos_pro2_bt_pen()
1332 if (!wacom->tool[0]) { /* first in range */ in wacom_intuos_pro2_bt_pen()
1335 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_intuos_pro2_bt_pen()
1336 else if (wacom->id[0]) in wacom_intuos_pro2_bt_pen()
1337 wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]); in wacom_intuos_pro2_bt_pen()
1339 wacom->tool[0] = BTN_TOOL_PEN; in wacom_intuos_pro2_bt_pen()
1345 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1346 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1353 rotation -= 1800; in wacom_intuos_pro2_bt_pen()
1365 if (wacom->tool[0]) { in wacom_intuos_pro2_bt_pen()
1367 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1368 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1370 range ? frame[13] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1373 range ? frame[7] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1376 input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x09); in wacom_intuos_pro2_bt_pen()
1377 input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02); in wacom_intuos_pro2_bt_pen()
1378 input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04); in wacom_intuos_pro2_bt_pen()
1380 input_report_key(pen_input, wacom->tool[0], prox); in wacom_intuos_pro2_bt_pen()
1381 input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]); in wacom_intuos_pro2_bt_pen()
1383 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */ in wacom_intuos_pro2_bt_pen()
1386 wacom->shared->stylus_in_proximity = prox; in wacom_intuos_pro2_bt_pen()
1401 struct input_dev *touch_input = wacom->touch_input; in wacom_intuos_pro2_bt_touch()
1402 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_touch()
1406 for (i = 0; i < finger_frames; i++) { in wacom_intuos_pro2_bt_touch()
1408 int current_num_contacts = frame[0] & 0x7F; in wacom_intuos_pro2_bt_touch()
1411 if (!(frame[0] & 0x80)) in wacom_intuos_pro2_bt_touch()
1416 * packet in series will have non-zero current_num_contacts. in wacom_intuos_pro2_bt_touch()
1419 wacom->num_contacts_left = current_num_contacts; in wacom_intuos_pro2_bt_touch()
1421 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_intuos_pro2_bt_touch()
1423 for (j = 0; j < contacts_to_send; j++) { in wacom_intuos_pro2_bt_touch()
1425 int slot = input_mt_get_slot_by_key(touch_input, touch[0]); in wacom_intuos_pro2_bt_touch()
1431 if (slot < 0) in wacom_intuos_pro2_bt_touch()
1435 input_mt_report_slot_state(touch_input, MT_TOOL_FINGER, touch[1] & 0x01); in wacom_intuos_pro2_bt_touch()
1445 wacom->num_contacts_left -= contacts_to_send; in wacom_intuos_pro2_bt_touch()
1446 if (wacom->num_contacts_left <= 0) { in wacom_intuos_pro2_bt_touch()
1447 wacom->num_contacts_left = 0; in wacom_intuos_pro2_bt_touch()
1448 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_intuos_pro2_bt_touch()
1453 if (wacom->num_contacts_left == 0) { in wacom_intuos_pro2_bt_touch()
1464 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_pro2_bt_pad()
1465 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pad()
1466 int nbuttons = wacom->features.numbered_buttons; in wacom_intuos_pro2_bt_pad()
1469 int center = (data[281] & 0x40) >> 6; in wacom_intuos_pro2_bt_pad()
1470 int ring = data[285] & 0x7F; in wacom_intuos_pro2_bt_pad()
1471 bool ringstatus = data[285] & 0x80; in wacom_intuos_pro2_bt_pad()
1474 /* Fix touchring data: userspace expects 0 at left and increasing clockwise */ in wacom_intuos_pro2_bt_pad()
1475 ring = 71 - ring; in wacom_intuos_pro2_bt_pad()
1478 ring -= 72; in wacom_intuos_pro2_bt_pad()
1481 expresskeys | (center << (nbuttons - 1))); in wacom_intuos_pro2_bt_pad()
1483 input_report_abs(pad_input, ABS_WHEEL, ringstatus ? ring : 0); in wacom_intuos_pro2_bt_pad()
1485 input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pro2_bt_pad()
1486 input_report_abs(pad_input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pro2_bt_pad()
1487 input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_pro2_bt_pad()
1494 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_battery()
1496 bool chg = data[284] & 0x80; in wacom_intuos_pro2_bt_battery()
1497 int battery_status = data[284] & 0x7F; in wacom_intuos_pro2_bt_battery()
1505 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_gen3_bt_pad()
1506 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_pad()
1512 input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0); in wacom_intuos_gen3_bt_pad()
1513 input_report_abs(pad_input, ABS_MISC, buttons ? PAD_DEVICE_ID : 0); in wacom_intuos_gen3_bt_pad()
1514 input_event(pad_input, EV_MSC, MSC_SERIAL, 0xffffffff); in wacom_intuos_gen3_bt_pad()
1521 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_battery()
1523 bool chg = data[45] & 0x80; in wacom_intuos_gen3_bt_battery()
1524 int battery_status = data[45] & 0x7F; in wacom_intuos_gen3_bt_battery()
1532 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_irq()
1534 if (data[0] != 0x80 && data[0] != 0x81) { in wacom_intuos_pro2_bt_irq()
1535 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_pro2_bt_irq()
1536 "%s: received unknown report #%d\n", __func__, data[0]); in wacom_intuos_pro2_bt_irq()
1537 return 0; in wacom_intuos_pro2_bt_irq()
1541 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_irq()
1542 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_irq()
1550 return 0; in wacom_intuos_pro2_bt_irq()
1555 struct input_dev *input = wacom->touch_input; in wacom_24hdt_irq()
1556 unsigned char *data = wacom->data; in wacom_24hdt_irq()
1559 int contacts_to_send = 0; in wacom_24hdt_irq()
1564 if (touch_is_muted(wacom) && !wacom->shared->touch_down) in wacom_24hdt_irq()
1565 return 0; in wacom_24hdt_irq()
1567 if (wacom->features.type == WACOM_27QHDT) { in wacom_24hdt_irq()
1571 y_offset = 0; in wacom_24hdt_irq()
1576 * packet in series will have non-zero current_num_contacts. in wacom_24hdt_irq()
1579 wacom->num_contacts_left = current_num_contacts; in wacom_24hdt_irq()
1581 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_24hdt_irq()
1583 for (i = 0; i < contacts_to_send; i++) { in wacom_24hdt_irq()
1585 bool touch = (data[offset] & 0x1) && report_touch_events(wacom); in wacom_24hdt_irq()
1588 if (slot < 0) in wacom_24hdt_irq()
1600 if (wacom->features.type != WACOM_27QHDT) { in wacom_24hdt_irq()
1616 wacom->num_contacts_left -= contacts_to_send; in wacom_24hdt_irq()
1617 if (wacom->num_contacts_left <= 0) { in wacom_24hdt_irq()
1618 wacom->num_contacts_left = 0; in wacom_24hdt_irq()
1619 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_24hdt_irq()
1626 struct input_dev *input = wacom->touch_input; in wacom_mt_touch()
1627 unsigned char *data = wacom->data; in wacom_mt_touch()
1630 int contacts_to_send = 0; in wacom_mt_touch()
1631 int x_offset = 0; in wacom_mt_touch()
1634 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) in wacom_mt_touch()
1635 x_offset = -4; in wacom_mt_touch()
1639 * packet in series will have non-zero current_num_contacts. in wacom_mt_touch()
1642 wacom->num_contacts_left = current_num_contacts; in wacom_mt_touch()
1645 contacts_to_send = min(5, wacom->num_contacts_left); in wacom_mt_touch()
1647 for (i = 0; i < contacts_to_send; i++) { in wacom_mt_touch()
1649 bool touch = (data[offset] & 0x1) && report_touch_events(wacom); in wacom_mt_touch()
1653 if (slot < 0) in wacom_mt_touch()
1667 wacom->num_contacts_left -= contacts_to_send; in wacom_mt_touch()
1668 if (wacom->num_contacts_left <= 0) { in wacom_mt_touch()
1669 wacom->num_contacts_left = 0; in wacom_mt_touch()
1670 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_mt_touch()
1677 struct input_dev *input = wacom->touch_input; in wacom_tpc_mt_touch()
1678 unsigned char *data = wacom->data; in wacom_tpc_mt_touch()
1681 for (i = 0; i < 2; i++) { in wacom_tpc_mt_touch()
1688 int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff; in wacom_tpc_mt_touch()
1689 int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff; in wacom_tpc_mt_touch()
1698 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_tpc_mt_touch()
1705 unsigned char *data = wacom->data; in wacom_tpc_single_touch()
1706 struct input_dev *input = wacom->touch_input; in wacom_tpc_single_touch()
1708 int x = 0, y = 0; in wacom_tpc_single_touch()
1710 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) in wacom_tpc_single_touch()
1711 return 0; in wacom_tpc_single_touch()
1714 prox = prox && (data[0] & 0x01); in wacom_tpc_single_touch()
1718 prox = prox && (data[2] & 0x01); in wacom_tpc_single_touch()
1722 prox = prox && (data[1] & 0x01); in wacom_tpc_single_touch()
1734 wacom->shared->touch_down = prox; in wacom_tpc_single_touch()
1741 unsigned char *data = wacom->data; in wacom_tpc_pen()
1742 struct input_dev *input = wacom->pen_input; in wacom_tpc_pen()
1743 bool prox = data[1] & 0x20; in wacom_tpc_pen()
1745 if (!wacom->shared->stylus_in_proximity) /* first in prox */ in wacom_tpc_pen()
1747 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_tpc_pen()
1750 wacom->shared->stylus_in_proximity = prox; in wacom_tpc_pen()
1756 input_report_key(input, BTN_STYLUS, data[1] & 0x02); in wacom_tpc_pen()
1757 input_report_key(input, BTN_STYLUS2, data[1] & 0x10); in wacom_tpc_pen()
1760 input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); in wacom_tpc_pen()
1761 input_report_key(input, BTN_TOUCH, data[1] & 0x05); in wacom_tpc_pen()
1762 input_report_key(input, wacom->tool[0], prox); in wacom_tpc_pen()
1766 return 0; in wacom_tpc_pen()
1771 unsigned char *data = wacom->data; in wacom_tpc_irq()
1773 if (wacom->pen_input) { in wacom_tpc_irq()
1774 dev_dbg(wacom->pen_input->dev.parent, in wacom_tpc_irq()
1775 "%s: received report #%d\n", __func__, data[0]); in wacom_tpc_irq()
1778 data[0] == WACOM_REPORT_PENABLED) in wacom_tpc_irq()
1781 else if (wacom->touch_input) { in wacom_tpc_irq()
1782 dev_dbg(wacom->touch_input->dev.parent, in wacom_tpc_irq()
1783 "%s: received report #%d\n", __func__, data[0]); in wacom_tpc_irq()
1793 switch (data[0]) { in wacom_tpc_irq()
1808 return 0; in wacom_tpc_irq()
1814 struct input_absinfo *abs = &input->absinfo[usage->code]; in wacom_offset_rotation()
1815 int range = (abs->maximum - abs->minimum + 1); in wacom_offset_rotation()
1818 if (value > abs->maximum) in wacom_offset_rotation()
1819 value -= range; in wacom_offset_rotation()
1820 else if (value < abs->minimum) in wacom_offset_rotation()
1828 int subpage = (usage & 0xFF00) << 8; in wacom_equivalent_usage()
1829 int subusage = (usage & 0xFF); in wacom_equivalent_usage()
1856 int subpage = (usage & 0xFF00) << 8; in wacom_equivalent_usage()
1857 int subusage = (usage & 0xFF); in wacom_equivalent_usage()
1875 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_map_usage()
1876 struct wacom_features *features = &wacom_wac->features; in wacom_map_usage()
1877 int fmin = field->logical_minimum; in wacom_map_usage()
1878 int fmax = field->logical_maximum; in wacom_map_usage()
1879 unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_map_usage()
1890 fmin += features->offset_left; in wacom_map_usage()
1891 fmax -= features->offset_right; in wacom_map_usage()
1894 fmin += features->offset_top; in wacom_map_usage()
1895 fmax -= features->offset_bottom; in wacom_map_usage()
1898 usage->type = type; in wacom_map_usage()
1899 usage->code = code; in wacom_map_usage()
1903 input_set_abs_params(input, code, fmin, fmax, fuzz, 0); in wacom_map_usage()
1909 "Using default resolution for axis type 0x%x code 0x%x\n", in wacom_map_usage()
1933 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_event()
1934 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_event()
1938 if (value == 0) { in wacom_wac_battery_event()
1939 wacom_wac->hid_data.bat_status = POWER_SUPPLY_STATUS_UNKNOWN; in wacom_wac_battery_event()
1942 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1943 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1944 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1945 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1947 wacom_wac->features.quirks |= WACOM_QUIRK_BATTERY; in wacom_wac_battery_event()
1950 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1951 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1952 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1953 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1954 wacom_wac->features.quirks |= WACOM_QUIRK_BATTERY; in wacom_wac_battery_event()
1957 wacom_wac->hid_data.bat_charging = value; in wacom_wac_battery_event()
1958 wacom_wac->hid_data.ps_connected = value; in wacom_wac_battery_event()
1959 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1960 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1961 wacom_wac->features.quirks |= WACOM_QUIRK_BATTERY; in wacom_wac_battery_event()
1976 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_report()
1978 int status = wacom_wac->hid_data.bat_status; in wacom_wac_battery_report()
1979 int capacity = wacom_wac->hid_data.battery_capacity; in wacom_wac_battery_report()
1980 bool charging = wacom_wac->hid_data.bat_charging; in wacom_wac_battery_report()
1981 bool connected = wacom_wac->hid_data.bat_connected; in wacom_wac_battery_report()
1982 bool powered = wacom_wac->hid_data.ps_connected; in wacom_wac_battery_report()
1992 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_usage_mapping()
1993 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_usage_mapping()
1994 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_usage_mapping()
1995 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_usage_mapping()
1999 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
2000 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 0); in wacom_wac_pad_usage_mapping()
2001 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2004 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
2005 wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 0); in wacom_wac_pad_usage_mapping()
2006 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2009 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
2010 wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); in wacom_wac_pad_usage_mapping()
2011 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2020 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
2021 0); in wacom_wac_pad_usage_mapping()
2022 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
2023 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2027 wacom_wac->is_soft_touch_switch = true; in wacom_wac_pad_usage_mapping()
2038 wacom_wac->has_mute_touch_switch = true; in wacom_wac_pad_usage_mapping()
2039 usage->type = EV_SW; in wacom_wac_pad_usage_mapping()
2040 usage->code = SW_MUTE_DEVICE; in wacom_wac_pad_usage_mapping()
2043 wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); in wacom_wac_pad_usage_mapping()
2044 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2047 wacom_map_usage(input, usage, field, EV_ABS, ABS_RY, 0); in wacom_wac_pad_usage_mapping()
2048 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2051 if (field->flags & HID_MAIN_ITEM_RELATIVE) { in wacom_wac_pad_usage_mapping()
2052 wacom_wac->relring_count++; in wacom_wac_pad_usage_mapping()
2053 if (wacom_wac->relring_count == 1) { in wacom_wac_pad_usage_mapping()
2054 wacom_map_usage(input, usage, field, EV_REL, REL_WHEEL_HI_RES, 0); in wacom_wac_pad_usage_mapping()
2055 set_bit(REL_WHEEL, input->relbit); in wacom_wac_pad_usage_mapping()
2057 else if (wacom_wac->relring_count == 2) { in wacom_wac_pad_usage_mapping()
2058 wacom_map_usage(input, usage, field, EV_REL, REL_HWHEEL_HI_RES, 0); in wacom_wac_pad_usage_mapping()
2059 set_bit(REL_HWHEEL, input->relbit); in wacom_wac_pad_usage_mapping()
2062 wacom_wac->absring_count++; in wacom_wac_pad_usage_mapping()
2063 if (wacom_wac->absring_count == 1) in wacom_wac_pad_usage_mapping()
2064 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); in wacom_wac_pad_usage_mapping()
2065 else if (wacom_wac->absring_count == 2) in wacom_wac_pad_usage_mapping()
2066 wacom_map_usage(input, usage, field, EV_ABS, ABS_THROTTLE, 0); in wacom_wac_pad_usage_mapping()
2068 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2075 usage->type = EV_ABS; in wacom_wac_pad_usage_mapping()
2076 usage->code = ABS_WHEEL; in wacom_wac_pad_usage_mapping()
2077 set_bit(EV_ABS, input->evbit); in wacom_wac_pad_usage_mapping()
2078 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2081 wacom_map_usage(input, usage, field, EV_KEY, KEY_BUTTONCONFIG, 0); in wacom_wac_pad_usage_mapping()
2082 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2085 wacom_map_usage(input, usage, field, EV_KEY, KEY_ONSCREEN_KEYBOARD, 0); in wacom_wac_pad_usage_mapping()
2086 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2089 wacom_map_usage(input, usage, field, EV_KEY, KEY_CONTROLPANEL, 0); in wacom_wac_pad_usage_mapping()
2090 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2094 if (!wacom_wac->has_mode_change) { in wacom_wac_pad_usage_mapping()
2095 wacom_wac->has_mode_change = true; in wacom_wac_pad_usage_mapping()
2096 wacom_wac->is_direct_mode = true; in wacom_wac_pad_usage_mapping()
2098 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2102 switch (equivalent_usage & 0xfffffff0) { in wacom_wac_pad_usage_mapping()
2105 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
2106 0); in wacom_wac_pad_usage_mapping()
2107 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
2108 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2117 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_event()
2118 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_event()
2119 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_event()
2120 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_event()
2128 if (!usage->type && equivalent_usage != WACOM_HID_WD_MODE_CHANGE) in wacom_wac_pad_event()
2131 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { in wacom_wac_pad_event()
2132 bool is_abs_touchring = usage->hid == WACOM_HID_WD_TOUCHRING && in wacom_wac_pad_event()
2133 !(field->flags & HID_MAIN_ITEM_RELATIVE); in wacom_wac_pad_event()
2136 wacom_wac->hid_data.inrange_state |= value; in wacom_wac_pad_event()
2145 if (wacom_wac->shared->touch_input) { in wacom_wac_pad_event()
2146 bool *is_touch_on = &wacom_wac->shared->is_touch_on; in wacom_wac_pad_event()
2153 input_report_switch(wacom_wac->shared->touch_input, in wacom_wac_pad_event()
2155 input_sync(wacom_wac->shared->touch_input); in wacom_wac_pad_event()
2168 * tablet's left. HID events "should" be clockwise- in wacom_wac_pad_event()
2170 * Pro and 2nd-gen Intuos Pro don't do this... in wacom_wac_pad_event()
2172 if (hdev->vendor == 0x56a && in wacom_wac_pad_event()
2173 (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ in wacom_wac_pad_event()
2174 hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2175 hdev->product == 0x392 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2176 hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */ in wacom_wac_pad_event()
2177 hdev->product == 0x3AA)) { /* MobileStudio Pro */ in wacom_wac_pad_event()
2178 value = (field->logical_maximum - value); in wacom_wac_pad_event()
2180 if (hdev->product == 0x357 || hdev->product == 0x358 || in wacom_wac_pad_event()
2181 hdev->product == 0x392) in wacom_wac_pad_event()
2183 else if (hdev->product == 0x34d || hdev->product == 0x34e || in wacom_wac_pad_event()
2184 hdev->product == 0x398 || hdev->product == 0x399 || in wacom_wac_pad_event()
2185 hdev->product == 0x3AA) in wacom_wac_pad_event()
2188 else if (field->flags & HID_MAIN_ITEM_RELATIVE) { in wacom_wac_pad_event()
2189 int hires_value = value * 120 / usage->resolution_multiplier; in wacom_wac_pad_event()
2193 if (usage->code == REL_WHEEL_HI_RES) { in wacom_wac_pad_event()
2200 hires_value = -hires_value; in wacom_wac_pad_event()
2201 ring_value = &wacom_wac->hid_data.ring_value; in wacom_wac_pad_event()
2204 else if (usage->code == REL_HWHEEL_HI_RES) { in wacom_wac_pad_event()
2212 ring_value = &wacom_wac->hid_data.ring2_value; in wacom_wac_pad_event()
2216 hid_err(wacom->hdev, "unrecognized relative wheel with code %d\n", in wacom_wac_pad_event()
2217 usage->code); in wacom_wac_pad_event()
2225 * units of hi-res travel. in wacom_wac_pad_event()
2227 if (*ring_value >= 120 || *ring_value <= -120) { in wacom_wac_pad_event()
2230 input_event(input, usage->type, lowres_code, clicks); in wacom_wac_pad_event()
2231 *ring_value -= clicks * 120; in wacom_wac_pad_event()
2241 input_event(input, usage->type, usage->code, 0); in wacom_wac_pad_event()
2245 if (wacom_wac->is_direct_mode != value) { in wacom_wac_pad_event()
2246 wacom_wac->is_direct_mode = value; in wacom_wac_pad_event()
2247 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE); in wacom_wac_pad_event()
2252 for (i = 0; i < wacom->led.count; i++) in wacom_wac_pad_event()
2253 wacom_update_led(wacom, features->numbered_buttons, in wacom_wac_pad_event()
2262 input_event(input, usage->type, usage->code, value); in wacom_wac_pad_event()
2264 wacom_wac->hid_data.pad_input_event_flag = true; in wacom_wac_pad_event()
2272 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_pre_report()
2274 wacom_wac->hid_data.inrange_state = 0; in wacom_wac_pad_pre_report()
2281 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_report()
2282 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_report()
2283 bool active = wacom_wac->hid_data.inrange_state != 0; in wacom_wac_pad_report()
2286 if (wacom_wac->hid_data.pad_input_event_flag) { in wacom_wac_pad_report()
2287 input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); in wacom_wac_pad_report()
2290 wacom_wac->hid_data.pad_input_event_flag = false; in wacom_wac_pad_report()
2296 struct input_dev *input = wacom_wac->pen_input; in wacom_set_barrel_switch3_usage()
2297 struct wacom_features *features = &wacom_wac->features; in wacom_set_barrel_switch3_usage()
2299 if (!(features->quirks & WACOM_QUIRK_AESPEN) && in wacom_set_barrel_switch3_usage()
2300 wacom_wac->hid_data.barrelswitch && in wacom_set_barrel_switch3_usage()
2301 wacom_wac->hid_data.barrelswitch2 && in wacom_set_barrel_switch3_usage()
2302 wacom_wac->hid_data.serialhi && in wacom_set_barrel_switch3_usage()
2303 !wacom_wac->hid_data.barrelswitch3) { in wacom_set_barrel_switch3_usage()
2305 features->quirks |= WACOM_QUIRK_PEN_BUTTON3; in wacom_set_barrel_switch3_usage()
2313 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_usage_mapping()
2314 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_usage_mapping()
2315 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_usage_mapping()
2316 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_usage_mapping()
2327 wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); in wacom_wac_pen_usage_mapping()
2330 wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); in wacom_wac_pen_usage_mapping()
2333 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); in wacom_wac_pen_usage_mapping()
2337 BTN_TOOL_RUBBER, 0); in wacom_wac_pen_usage_mapping()
2340 wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); in wacom_wac_pen_usage_mapping()
2343 wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); in wacom_wac_pen_usage_mapping()
2346 wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); in wacom_wac_pen_usage_mapping()
2350 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_pen_usage_mapping()
2354 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_pen_usage_mapping()
2357 wacom_wac->hid_data.barrelswitch = true; in wacom_wac_pen_usage_mapping()
2359 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); in wacom_wac_pen_usage_mapping()
2362 wacom_wac->hid_data.barrelswitch2 = true; in wacom_wac_pen_usage_mapping()
2364 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); in wacom_wac_pen_usage_mapping()
2367 features->quirks |= WACOM_QUIRK_TOOLSERIAL; in wacom_wac_pen_usage_mapping()
2368 wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); in wacom_wac_pen_usage_mapping()
2371 wacom_map_usage(input, usage, field, EV_MSC, MSC_TIMESTAMP, 0); in wacom_wac_pen_usage_mapping()
2374 features->quirks |= WACOM_QUIRK_SENSE; in wacom_wac_pen_usage_mapping()
2375 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); in wacom_wac_pen_usage_mapping()
2378 wacom_wac->hid_data.serialhi = true; in wacom_wac_pen_usage_mapping()
2380 wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); in wacom_wac_pen_usage_mapping()
2384 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); in wacom_wac_pen_usage_mapping()
2387 wacom_wac->hid_data.barrelswitch3 = true; in wacom_wac_pen_usage_mapping()
2388 wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS3, 0); in wacom_wac_pen_usage_mapping()
2389 features->quirks &= ~WACOM_QUIRK_PEN_BUTTON3; in wacom_wac_pen_usage_mapping()
2392 wacom_wac->hid_data.sequence_number = -1; in wacom_wac_pen_usage_mapping()
2401 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_event()
2402 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_event()
2403 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_event()
2404 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_event()
2406 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_event()
2416 value = field->logical_maximum - value; in wacom_wac_pen_event()
2419 mod_timer(&wacom->idleprox_timer, jiffies + msecs_to_jiffies(100)); in wacom_wac_pen_event()
2420 wacom_wac->hid_data.inrange_state = value; in wacom_wac_pen_event()
2421 if (!(features->quirks & WACOM_QUIRK_SENSE)) in wacom_wac_pen_event()
2422 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2425 wacom_wac->hid_data.invert_state = value; in wacom_wac_pen_event()
2429 wacom_wac->hid_data.tipswitch |= value; in wacom_wac_pen_event()
2432 wacom_wac->hid_data.barrelswitch = value; in wacom_wac_pen_event()
2435 wacom_wac->hid_data.barrelswitch2 = value; in wacom_wac_pen_event()
2439 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); in wacom_wac_pen_event()
2440 wacom_wac->serial[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2445 if (!wacom_is_art_pen(wacom_wac->id[0])) return; in wacom_wac_pen_event()
2455 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2459 __u32 raw_value = wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2461 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); in wacom_wac_pen_event()
2462 wacom_wac->serial[0] |= ((__u64)raw_value) << 32; in wacom_wac_pen_event()
2464 * Non-USI EMR devices may contain additional tool type in wacom_wac_pen_event()
2469 wacom_wac->id[0] |= raw_value & 0xFFFFF; in wacom_wac_pen_event()
2481 wacom_wac->id[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2484 if (features->offset_left && value != features->offset_left) in wacom_wac_pen_event()
2486 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2487 features->offset_left); in wacom_wac_pen_event()
2488 features->offset_left = value; in wacom_wac_pen_event()
2491 if (features->offset_right && value != features->offset_right) in wacom_wac_pen_event()
2493 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2494 features->offset_right); in wacom_wac_pen_event()
2495 features->offset_right = value; in wacom_wac_pen_event()
2498 if (features->offset_top && value != features->offset_top) in wacom_wac_pen_event()
2500 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2501 features->offset_top); in wacom_wac_pen_event()
2502 features->offset_top = value; in wacom_wac_pen_event()
2505 if (features->offset_bottom && value != features->offset_bottom) in wacom_wac_pen_event()
2507 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2508 features->offset_bottom); in wacom_wac_pen_event()
2509 features->offset_bottom = value; in wacom_wac_pen_event()
2512 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_pen_event()
2515 wacom_wac->hid_data.barrelswitch3 = value; in wacom_wac_pen_event()
2518 if (wacom_wac->hid_data.sequence_number != value && in wacom_wac_pen_event()
2519 wacom_wac->hid_data.sequence_number >= 0) { in wacom_wac_pen_event()
2520 int sequence_size = field->logical_maximum - field->logical_minimum + 1; in wacom_wac_pen_event()
2521 int drop_count = (value - wacom_wac->hid_data.sequence_number) % sequence_size; in wacom_wac_pen_event()
2524 wacom_wac->hid_data.sequence_number = value + 1; in wacom_wac_pen_event()
2525 if (wacom_wac->hid_data.sequence_number > field->logical_maximum) in wacom_wac_pen_event()
2526 wacom_wac->hid_data.sequence_number = field->logical_minimum; in wacom_wac_pen_event()
2533 if (!usage->type || delay_pen_events(wacom_wac)) in wacom_wac_pen_event()
2537 if (wacom_wac->hid_data.inrange_state) in wacom_wac_pen_event()
2538 input_event(input, usage->type, usage->code, value); in wacom_wac_pen_event()
2539 else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) in wacom_wac_pen_event()
2540 input_event(input, usage->type, usage->code, 0); in wacom_wac_pen_event()
2547 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_pre_report()
2549 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_pen_pre_report()
2557 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_report()
2558 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_report()
2559 bool range = wacom_wac->hid_data.inrange_state; in wacom_wac_pen_report()
2560 bool sense = wacom_wac->hid_data.sense_state; in wacom_wac_pen_report()
2561 bool entering_range = !wacom_wac->tool[0] && range; in wacom_wac_pen_report()
2563 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_report()
2568 if (wacom_wac->hid_data.invert_state) in wacom_wac_pen_report()
2569 wacom_wac->tool[0] = BTN_TOOL_RUBBER; in wacom_wac_pen_report()
2570 else if (wacom_wac->features.quirks & WACOM_QUIRK_AESPEN) in wacom_wac_pen_report()
2571 wacom_wac->tool[0] = BTN_TOOL_PEN; in wacom_wac_pen_report()
2572 else if (wacom_wac->id[0]) in wacom_wac_pen_report()
2573 wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); in wacom_wac_pen_report()
2575 wacom_wac->tool[0] = BTN_TOOL_PEN; in wacom_wac_pen_report()
2579 wacom_wac->shared->stylus_in_proximity = sense; in wacom_wac_pen_report()
2581 if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { in wacom_wac_pen_report()
2582 int id = wacom_wac->id[0]; in wacom_wac_pen_report()
2583 if (wacom_wac->features.quirks & WACOM_QUIRK_PEN_BUTTON3) { in wacom_wac_pen_report()
2584 int sw_state = wacom_wac->hid_data.barrelswitch | in wacom_wac_pen_report()
2585 (wacom_wac->hid_data.barrelswitch2 << 1); in wacom_wac_pen_report()
2586 wacom_wac->hid_data.barrelswitch = sw_state == 1; in wacom_wac_pen_report()
2587 wacom_wac->hid_data.barrelswitch2 = sw_state == 2; in wacom_wac_pen_report()
2588 wacom_wac->hid_data.barrelswitch3 = sw_state == 3; in wacom_wac_pen_report()
2590 input_report_key(input, BTN_STYLUS, wacom_wac->hid_data.barrelswitch); in wacom_wac_pen_report()
2591 input_report_key(input, BTN_STYLUS2, wacom_wac->hid_data.barrelswitch2); in wacom_wac_pen_report()
2592 input_report_key(input, BTN_STYLUS3, wacom_wac->hid_data.barrelswitch3); in wacom_wac_pen_report()
2595 * Non-USI EMR tools should have their IDs mangled to in wacom_wac_pen_report()
2598 if (wacom_wac->serial[0] >> 52 == 1) in wacom_wac_pen_report()
2602 * To ensure compatibility with xf86-input-wacom, we should in wacom_wac_pen_report()
2607 wacom_wac->hid_data.tipswitch); in wacom_wac_pen_report()
2608 input_report_key(input, wacom_wac->tool[0], sense); in wacom_wac_pen_report()
2609 if (wacom_wac->serial[0]) { in wacom_wac_pen_report()
2611 * xf86-input-wacom does not accept a serial number in wacom_wac_pen_report()
2612 * of '0'. Report the low 32 bits if possible, but in wacom_wac_pen_report()
2615 __u32 serial_lo = wacom_wac->serial[0] & 0xFFFFFFFFu; in wacom_wac_pen_report()
2616 __u32 serial_hi = wacom_wac->serial[0] >> 32; in wacom_wac_pen_report()
2618 input_report_abs(input, ABS_MISC, sense ? id : 0); in wacom_wac_pen_report()
2621 wacom_wac->hid_data.tipswitch = false; in wacom_wac_pen_report()
2627 if (wacom_wac->features.quirks & WACOM_QUIRK_AESPEN) { in wacom_wac_pen_report()
2629 cancel_delayed_work(&wacom->aes_battery_work); in wacom_wac_pen_report()
2631 schedule_delayed_work(&wacom->aes_battery_work, in wacom_wac_pen_report()
2636 wacom_wac->tool[0] = 0; in wacom_wac_pen_report()
2637 wacom_wac->id[0] = 0; in wacom_wac_pen_report()
2638 wacom_wac->serial[0] = 0; in wacom_wac_pen_report()
2646 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_usage_mapping()
2647 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_usage_mapping()
2648 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_usage_mapping()
2649 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_usage_mapping()
2668 wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); in wacom_wac_finger_usage_mapping()
2669 wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); in wacom_wac_finger_usage_mapping()
2670 input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); in wacom_wac_finger_usage_mapping()
2673 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); in wacom_wac_finger_usage_mapping()
2676 wacom_wac->hid_data.cc_report = field->report->id; in wacom_wac_finger_usage_mapping()
2677 wacom_wac->hid_data.cc_index = field->index; in wacom_wac_finger_usage_mapping()
2678 wacom_wac->hid_data.cc_value_index = usage->usage_index; in wacom_wac_finger_usage_mapping()
2681 if ((field->logical_maximum - field->logical_minimum) < touch_max) { in wacom_wac_finger_usage_mapping()
2687 field->logical_maximum = 255; in wacom_wac_finger_usage_mapping()
2691 wacom_map_usage(input, usage, field, EV_MSC, MSC_TIMESTAMP, 0); in wacom_wac_finger_usage_mapping()
2699 struct hid_data *hid_data = &wacom_wac->hid_data; in wacom_wac_finger_slot()
2700 bool mt = wacom_wac->features.touch_max > 1; in wacom_wac_finger_slot()
2701 bool touch_down = hid_data->tipswitch && hid_data->confidence; in wacom_wac_finger_slot()
2705 if (!wacom_wac->shared->touch_down) in wacom_wac_finger_slot()
2710 wacom_wac->hid_data.num_received++; in wacom_wac_finger_slot()
2711 if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) in wacom_wac_finger_slot()
2717 slot = input_mt_get_slot_by_key(input, hid_data->id); in wacom_wac_finger_slot()
2718 if (slot < 0) { in wacom_wac_finger_slot()
2721 struct input_mt_slot *ps = &input->mt->slots[slot]; in wacom_wac_finger_slot()
2724 if (!prox && mt_id < 0) { in wacom_wac_finger_slot()
2725 // No data to send for this slot; short-circuit in wacom_wac_finger_slot()
2739 hid_data->x); in wacom_wac_finger_slot()
2741 hid_data->y); in wacom_wac_finger_slot()
2743 if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { in wacom_wac_finger_slot()
2744 input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2745 input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2746 if (hid_data->width != hid_data->height) in wacom_wac_finger_slot()
2747 input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); in wacom_wac_finger_slot()
2756 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_event()
2757 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_event()
2758 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_wac_finger_event()
2760 if (touch_is_muted(wacom_wac) && !wacom_wac->shared->touch_down) in wacom_wac_finger_event()
2763 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_finger_event()
2768 wacom_wac->hid_data.confidence = value; in wacom_wac_finger_event()
2771 wacom_wac->hid_data.x = value; in wacom_wac_finger_event()
2774 wacom_wac->hid_data.y = value; in wacom_wac_finger_event()
2777 wacom_wac->hid_data.width = value; in wacom_wac_finger_event()
2780 wacom_wac->hid_data.height = value; in wacom_wac_finger_event()
2783 wacom_wac->hid_data.id = value; in wacom_wac_finger_event()
2786 wacom_wac->hid_data.tipswitch = value; in wacom_wac_finger_event()
2789 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_finger_event()
2792 if (!features->touch_max) { in wacom_wac_finger_event()
2793 features->touch_max = value; in wacom_wac_finger_event()
2795 hid_warn(hdev, "%s: ignoring attempt to overwrite non-zero touch_max " in wacom_wac_finger_event()
2796 "%d -> %d\n", __func__, features->touch_max, value); in wacom_wac_finger_event()
2801 if (usage->usage_index + 1 == field->report_count) { in wacom_wac_finger_event()
2802 if (equivalent_usage == wacom_wac->hid_data.last_slot_field) in wacom_wac_finger_event()
2803 wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); in wacom_wac_finger_event()
2811 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_pre_report()
2812 struct hid_data* hid_data = &wacom_wac->hid_data; in wacom_wac_finger_pre_report()
2815 if (touch_is_muted(wacom_wac) && !wacom_wac->shared->touch_down) in wacom_wac_finger_pre_report()
2818 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_finger_pre_report()
2820 hid_data->confidence = true; in wacom_wac_finger_pre_report()
2822 hid_data->cc_report = 0; in wacom_wac_finger_pre_report()
2823 hid_data->cc_index = -1; in wacom_wac_finger_pre_report()
2824 hid_data->cc_value_index = -1; in wacom_wac_finger_pre_report()
2826 for (i = 0; i < report->maxfield; i++) { in wacom_wac_finger_pre_report()
2827 struct hid_field *field = report->field[i]; in wacom_wac_finger_pre_report()
2830 for (j = 0; j < field->maxusage; j++) { in wacom_wac_finger_pre_report()
2831 struct hid_usage *usage = &field->usage[j]; in wacom_wac_finger_pre_report()
2833 wacom_equivalent_usage(usage->hid); in wacom_wac_finger_pre_report()
2844 hid_data->last_slot_field = equivalent_usage; in wacom_wac_finger_pre_report()
2847 hid_data->cc_report = report->id; in wacom_wac_finger_pre_report()
2848 hid_data->cc_index = i; in wacom_wac_finger_pre_report()
2849 hid_data->cc_value_index = j; in wacom_wac_finger_pre_report()
2855 if (hid_data->cc_report != 0 && in wacom_wac_finger_pre_report()
2856 hid_data->cc_index >= 0) { in wacom_wac_finger_pre_report()
2857 struct hid_field *field = report->field[hid_data->cc_index]; in wacom_wac_finger_pre_report()
2858 int value = field->value[hid_data->cc_value_index]; in wacom_wac_finger_pre_report()
2860 hid_data->num_expected = value; in wacom_wac_finger_pre_report()
2861 hid_data->num_received = 0; in wacom_wac_finger_pre_report()
2865 hid_data->num_expected = wacom_wac->features.touch_max; in wacom_wac_finger_pre_report()
2866 hid_data->num_received = 0; in wacom_wac_finger_pre_report()
2874 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_report()
2875 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_report()
2876 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_report()
2879 if (wacom_wac->hid_data.num_expected == 0) in wacom_wac_finger_report()
2886 if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) in wacom_wac_finger_report()
2893 wacom_wac->hid_data.num_received = 0; in wacom_wac_finger_report()
2894 wacom_wac->hid_data.num_expected = 0; in wacom_wac_finger_report()
2897 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); in wacom_wac_finger_report()
2904 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_usage_mapping()
2905 struct wacom_features *features = &wacom_wac->features; in wacom_wac_usage_mapping()
2908 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_wac_usage_mapping()
2926 if (wacom->wacom_wac.features.type != HID_GENERIC) in wacom_wac_event()
2929 if (value > field->logical_maximum || value < field->logical_minimum) in wacom_wac_event()
2937 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_event()
2939 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_event()
2949 for (r = field_index; r < report->maxfield; r++) { in wacom_report_events()
2953 field = report->field[r]; in wacom_report_events()
2954 count = field->report_count; in wacom_report_events()
2956 if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) in wacom_report_events()
2959 for (n = 0 ; n < count; n++) { in wacom_report_events()
2960 if (field->usage[n].collection_index == collection_index) in wacom_report_events()
2961 wacom_wac_event(hdev, field, &field->usage[n], in wacom_report_events()
2962 field->value[n]); in wacom_report_events()
2978 * Non-input reports may be sent prior to the device being in wacom_wac_collection()
2981 * been called to prevent potential crashes in the report- in wacom_wac_collection()
2984 if (report->type != HID_INPUT_REPORT) in wacom_wac_collection()
2985 return -1; in wacom_wac_collection()
2988 return 0; in wacom_wac_collection()
2989 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_collection()
2991 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_collection()
2994 return 0; in wacom_wac_collection()
3000 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_report()
3005 int prev_collection = -1; in wacom_wac_report()
3007 if (wacom_wac->features.type != HID_GENERIC) in wacom_wac_report()
3010 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
3011 field = report->field[r]; in wacom_wac_report()
3019 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) in wacom_wac_report()
3025 if (pad_in_hid_field && wacom_wac->pad_input) in wacom_wac_report()
3027 if (pen_in_hid_field && wacom_wac->pen_input) in wacom_wac_report()
3029 if (finger_in_hid_field && wacom_wac->touch_input) in wacom_wac_report()
3032 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
3033 field = report->field[r]; in wacom_wac_report()
3035 if (field->usage[0].collection_index != prev_collection) { in wacom_wac_report()
3037 field->usage[0].collection_index, field, r) < 0) in wacom_wac_report()
3039 prev_collection = field->usage[0].collection_index; in wacom_wac_report()
3045 if (true_pad && wacom_wac->pad_input) in wacom_wac_report()
3051 struct wacom_features *features = &wacom->features; in wacom_bpt_touch()
3052 struct input_dev *input = wacom->touch_input; in wacom_bpt_touch()
3053 struct input_dev *pad_input = wacom->pad_input; in wacom_bpt_touch()
3054 unsigned char *data = wacom->data; in wacom_bpt_touch()
3057 if (data[0] != 0x02) in wacom_bpt_touch()
3058 return 0; in wacom_bpt_touch()
3060 for (i = 0; i < 2; i++) { in wacom_bpt_touch()
3061 int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); in wacom_bpt_touch()
3063 && (data[offset + 3] & 0x80); in wacom_bpt_touch()
3068 int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff; in wacom_bpt_touch()
3069 int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff; in wacom_bpt_touch()
3070 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { in wacom_bpt_touch()
3081 input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); in wacom_bpt_touch()
3082 input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); in wacom_bpt_touch()
3083 input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); in wacom_bpt_touch()
3084 input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); in wacom_bpt_touch()
3085 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt_touch()
3092 struct wacom_features *features = &wacom->features; in wacom_bpt3_touch_msg()
3093 struct input_dev *input = wacom->touch_input; in wacom_bpt3_touch_msg()
3094 bool touch = data[1] & 0x80; in wacom_bpt3_touch_msg()
3095 int slot = input_mt_get_slot_by_key(input, data[0]); in wacom_bpt3_touch_msg()
3097 if (slot < 0) in wacom_bpt3_touch_msg()
3107 int y = (data[3] << 4) | (data[4] & 0x0f); in wacom_bpt3_touch_msg()
3110 if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { in wacom_bpt3_touch_msg()
3115 * "a" is a scaled-down area which we assume is in wacom_bpt3_touch_msg()
3135 struct input_dev *input = wacom->pad_input; in wacom_bpt3_button_msg()
3136 struct wacom_features *features = &wacom->features; in wacom_bpt3_button_msg()
3138 if (features->type == INTUOSHT || features->type == INTUOSHT2) { in wacom_bpt3_button_msg()
3139 input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); in wacom_bpt3_button_msg()
3140 input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); in wacom_bpt3_button_msg()
3142 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); in wacom_bpt3_button_msg()
3143 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); in wacom_bpt3_button_msg()
3145 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); in wacom_bpt3_button_msg()
3146 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); in wacom_bpt3_button_msg()
3151 unsigned char *data = wacom->data; in wacom_bpt3_touch()
3152 int count = data[1] & 0x07; in wacom_bpt3_touch()
3153 int touch_changed = 0, i; in wacom_bpt3_touch()
3155 if (data[0] != 0x02) in wacom_bpt3_touch()
3156 return 0; in wacom_bpt3_touch()
3158 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ in wacom_bpt3_touch()
3159 for (i = 0; i < count; i++) { in wacom_bpt3_touch()
3172 if (wacom->touch_input && touch_changed) { in wacom_bpt3_touch()
3173 input_mt_sync_frame(wacom->touch_input); in wacom_bpt3_touch()
3174 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt3_touch()
3182 struct wacom_features *features = &wacom->features; in wacom_bpt_pen()
3183 struct input_dev *input = wacom->pen_input; in wacom_bpt_pen()
3184 unsigned char *data = wacom->data; in wacom_bpt_pen()
3185 int x = 0, y = 0, p = 0, d = 0; in wacom_bpt_pen()
3189 if (data[0] != WACOM_REPORT_PENABLED) in wacom_bpt_pen()
3190 return 0; in wacom_bpt_pen()
3192 range = (data[1] & 0x80) == 0x80; in wacom_bpt_pen()
3193 prox = (data[1] & 0x40) == 0x40; in wacom_bpt_pen()
3194 rdy = (data[1] & 0x20) == 0x20; in wacom_bpt_pen()
3196 wacom->shared->stylus_in_proximity = range; in wacom_bpt_pen()
3198 return 0; in wacom_bpt_pen()
3202 pen = data[1] & 0x01; in wacom_bpt_pen()
3203 btn1 = data[1] & 0x02; in wacom_bpt_pen()
3204 btn2 = data[1] & 0x04; in wacom_bpt_pen()
3210 if (data[1] & 0x08) { in wacom_bpt_pen()
3211 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_bpt_pen()
3212 wacom->id[0] = ERASER_DEVICE_ID; in wacom_bpt_pen()
3214 wacom->tool[0] = BTN_TOOL_PEN; in wacom_bpt_pen()
3215 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_bpt_pen()
3217 wacom->reporting_data = true; in wacom_bpt_pen()
3226 if (data[8] <= features->distance_max) in wacom_bpt_pen()
3227 d = features->distance_max - data[8]; in wacom_bpt_pen()
3229 wacom->id[0] = 0; in wacom_bpt_pen()
3232 if (wacom->reporting_data) { in wacom_bpt_pen()
3244 input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */ in wacom_bpt_pen()
3245 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ in wacom_bpt_pen()
3249 wacom->reporting_data = false; in wacom_bpt_pen()
3257 struct wacom_features *features = &wacom->features; in wacom_bpt_irq()
3259 if ((features->type == INTUOSHT2) && in wacom_bpt_irq()
3260 (features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_bpt_irq()
3269 return 0; in wacom_bpt_irq()
3284 prefix = data[0]; in wacom_bamboo_pad_pen_event()
3285 data[0] = WACOM_REPORT_BPAD_PEN; in wacom_bamboo_pad_pen_event()
3289 * No need to check if wacom->shared->pen is valid, hid_input_report() in wacom_bamboo_pad_pen_event()
3292 hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, in wacom_bamboo_pad_pen_event()
3295 data[0] = prefix; in wacom_bamboo_pad_pen_event()
3301 struct input_dev *input = wacom->touch_input; in wacom_bamboo_pad_touch_event()
3307 prefix = data[0]; in wacom_bamboo_pad_touch_event()
3309 for (id = 0; id < wacom->features.touch_max; id++) { in wacom_bamboo_pad_touch_event()
3320 x = finger_data[0] | ((finger_data[1] & 0x0f) << 8); in wacom_bamboo_pad_touch_event()
3329 input_report_key(input, BTN_LEFT, prefix & 0x40); in wacom_bamboo_pad_touch_event()
3330 input_report_key(input, BTN_RIGHT, prefix & 0x80); in wacom_bamboo_pad_touch_event()
3333 wacom->shared->touch_down = !!prefix && report_touch_events(wacom); in wacom_bamboo_pad_touch_event()
3340 unsigned char *data = wacom->data; in wacom_bamboo_pad_irq()
3344 (data[0] != WACOM_REPORT_BPAD_TOUCH)) in wacom_bamboo_pad_irq()
3345 return 0; in wacom_bamboo_pad_irq()
3347 if (data[1] & 0x01) in wacom_bamboo_pad_irq()
3350 if (data[1] & 0x02) in wacom_bamboo_pad_irq()
3353 return 0; in wacom_bamboo_pad_irq()
3358 unsigned char *data = wacom->data; in wacom_wireless_irq()
3361 if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL) in wacom_wireless_irq()
3362 return 0; in wacom_wireless_irq()
3364 connected = data[1] & 0x01; in wacom_wireless_irq()
3368 if ((wacom->shared->type == INTUOSHT || in wacom_wireless_irq()
3369 wacom->shared->type == INTUOSHT2) && in wacom_wireless_irq()
3370 wacom->shared->touch_input && in wacom_wireless_irq()
3371 wacom->shared->touch_max) { in wacom_wireless_irq()
3372 input_report_switch(wacom->shared->touch_input, in wacom_wireless_irq()
3373 SW_MUTE_DEVICE, data[5] & 0x40); in wacom_wireless_irq()
3374 input_sync(wacom->shared->touch_input); in wacom_wireless_irq()
3378 battery = (data[5] & 0x3f) * 100 / 31; in wacom_wireless_irq()
3379 charging = !!(data[5] & 0x80); in wacom_wireless_irq()
3380 if (wacom->pid != pid) { in wacom_wireless_irq()
3381 wacom->pid = pid; in wacom_wireless_irq()
3386 battery, charging, 1, 0); in wacom_wireless_irq()
3388 } else if (wacom->pid != 0) { in wacom_wireless_irq()
3390 wacom->pid = 0; in wacom_wireless_irq()
3392 wacom_notify_battery(wacom, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); in wacom_wireless_irq()
3395 return 0; in wacom_wireless_irq()
3401 struct wacom_features *features = &wacom_wac->features; in wacom_status_irq()
3402 unsigned char *data = wacom_wac->data; in wacom_status_irq()
3404 if (data[0] != WACOM_REPORT_USB) in wacom_status_irq()
3405 return 0; in wacom_status_irq()
3407 if ((features->type == INTUOSHT || in wacom_status_irq()
3408 features->type == INTUOSHT2) && in wacom_status_irq()
3409 wacom_wac->shared->touch_input && in wacom_status_irq()
3410 features->touch_max) { in wacom_status_irq()
3411 input_report_switch(wacom_wac->shared->touch_input, in wacom_status_irq()
3412 SW_MUTE_DEVICE, data[8] & 0x40); in wacom_status_irq()
3413 input_sync(wacom_wac->shared->touch_input); in wacom_status_irq()
3416 if (data[9] & 0x02) { /* wireless module is attached */ in wacom_status_irq()
3417 int battery = (data[8] & 0x3f) * 100 / 31; in wacom_status_irq()
3418 bool charging = !!(data[8] & 0x80); in wacom_status_irq()
3420 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_status_irq()
3424 else if ((features->quirks & WACOM_QUIRK_BATTERY) && in wacom_status_irq()
3425 wacom->battery.battery) { in wacom_status_irq()
3426 features->quirks &= ~WACOM_QUIRK_BATTERY; in wacom_status_irq()
3427 wacom_notify_battery(wacom_wac, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0); in wacom_status_irq()
3429 return 0; in wacom_status_irq()
3436 switch (wacom_wac->features.type) { in wacom_wac_irq()
3502 else if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3528 if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3544 if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) in wacom_wac_irq()
3556 if (wacom_wac->pen_input) in wacom_wac_irq()
3557 input_sync(wacom_wac->pen_input); in wacom_wac_irq()
3558 if (wacom_wac->touch_input) in wacom_wac_irq()
3559 input_sync(wacom_wac->touch_input); in wacom_wac_irq()
3560 if (wacom_wac->pad_input) in wacom_wac_irq()
3561 input_sync(wacom_wac->pad_input); in wacom_wac_irq()
3567 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_basic_pro_pen()
3571 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_basic_pro_pen()
3572 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_basic_pro_pen()
3573 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_basic_pro_pen()
3576 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); in wacom_setup_basic_pro_pen()
3581 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_cintiq()
3582 struct wacom_features *features = &wacom_wac->features; in wacom_setup_cintiq()
3586 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_cintiq()
3587 __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); in wacom_setup_cintiq()
3588 __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); in wacom_setup_cintiq()
3589 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); in wacom_setup_cintiq()
3591 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); in wacom_setup_cintiq()
3592 input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3594 input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3600 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_intuos()
3606 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_intuos()
3607 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_intuos()
3608 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_intuos()
3609 __set_bit(BTN_SIDE, input_dev->keybit); in wacom_setup_intuos()
3610 __set_bit(BTN_EXTRA, input_dev->keybit); in wacom_setup_intuos()
3611 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_intuos()
3612 __set_bit(BTN_TOOL_LENS, input_dev->keybit); in wacom_setup_intuos()
3614 input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); in wacom_setup_intuos()
3616 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); in wacom_setup_intuos()
3621 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_setup_device_quirks()
3622 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_setup_device_quirks()
3625 if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || in wacom_setup_device_quirks()
3626 features->type == DTUS || in wacom_setup_device_quirks()
3627 (features->type >= INTUOS3S && features->type <= WACOM_MO)) { in wacom_setup_device_quirks()
3628 if (features->device_type & WACOM_DEVICETYPE_PEN) in wacom_setup_device_quirks()
3629 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3633 if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { in wacom_setup_device_quirks()
3634 features->x_max = 1023; in wacom_setup_device_quirks()
3635 features->y_max = 1023; in wacom_setup_device_quirks()
3644 if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || in wacom_setup_device_quirks()
3645 (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { in wacom_setup_device_quirks()
3646 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_device_quirks()
3647 if (features->touch_max) in wacom_setup_device_quirks()
3648 features->device_type |= WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3649 if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) in wacom_setup_device_quirks()
3650 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3652 if (features->type == INTUOSHT2) { in wacom_setup_device_quirks()
3653 features->x_max = features->x_max / 10; in wacom_setup_device_quirks()
3654 features->y_max = features->y_max / 10; in wacom_setup_device_quirks()
3657 features->x_max = 4096; in wacom_setup_device_quirks()
3658 features->y_max = 4096; in wacom_setup_device_quirks()
3661 else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3662 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3673 if (features->type == BAMBOO_PEN && in wacom_setup_device_quirks()
3674 features->pktlen == WACOM_PKGLEN_BBTOUCH3) in wacom_setup_device_quirks()
3675 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3678 * Raw Wacom-mode pen and touch events both come from interface in wacom_setup_device_quirks()
3679 * 0, whose HID descriptor has an application usage of 0xFF0D in wacom_setup_device_quirks()
3684 if (features->type == BAMBOO_PAD) in wacom_setup_device_quirks()
3685 features->device_type = WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3687 if (features->type == REMOTE) in wacom_setup_device_quirks()
3688 features->device_type = WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3690 if (features->type == INTUOSP2_BT || in wacom_setup_device_quirks()
3691 features->type == INTUOSP2S_BT) { in wacom_setup_device_quirks()
3692 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3695 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3698 if (features->type == INTUOSHT3_BT) { in wacom_setup_device_quirks()
3699 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3701 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3704 switch (features->type) { in wacom_setup_device_quirks()
3727 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_setup_device_quirks()
3731 if (wacom->hdev->bus == BUS_BLUETOOTH) in wacom_setup_device_quirks()
3732 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3735 if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && in wacom_setup_device_quirks()
3736 features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3737 features->x_max <<= 5; in wacom_setup_device_quirks()
3738 features->y_max <<= 5; in wacom_setup_device_quirks()
3739 features->x_fuzz <<= 5; in wacom_setup_device_quirks()
3740 features->y_fuzz <<= 5; in wacom_setup_device_quirks()
3741 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; in wacom_setup_device_quirks()
3744 if (features->type == WIRELESS) { in wacom_setup_device_quirks()
3745 if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { in wacom_setup_device_quirks()
3746 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3750 if (features->type == REMOTE) in wacom_setup_device_quirks()
3751 features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; in wacom_setup_device_quirks()
3753 /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots in wacom_setup_device_quirks()
3756 if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) { in wacom_setup_device_quirks()
3757 features->quirks &= ~WACOM_QUIRK_TOOLSERIAL; in wacom_setup_device_quirks()
3758 __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3759 __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3760 __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3761 __clear_bit(ABS_Z, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3762 __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3763 __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3764 __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3765 __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3766 __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3767 __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit); in wacom_setup_device_quirks()
3768 __clear_bit(EV_MSC, wacom_wac->pen_input->evbit); in wacom_setup_device_quirks()
3775 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pen_input_capabilities()
3777 if (!(features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_setup_pen_input_capabilities()
3778 return -ENODEV; in wacom_setup_pen_input_capabilities()
3780 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_pen_input_capabilities()
3781 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3783 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3785 if (features->type == HID_GENERIC) in wacom_setup_pen_input_capabilities()
3787 return 0; in wacom_setup_pen_input_capabilities()
3789 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pen_input_capabilities()
3790 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3791 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3793 input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, in wacom_setup_pen_input_capabilities()
3794 features->x_max - features->offset_right, in wacom_setup_pen_input_capabilities()
3795 features->x_fuzz, 0); in wacom_setup_pen_input_capabilities()
3796 input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, in wacom_setup_pen_input_capabilities()
3797 features->y_max - features->offset_bottom, in wacom_setup_pen_input_capabilities()
3798 features->y_fuzz, 0); in wacom_setup_pen_input_capabilities()
3799 input_set_abs_params(input_dev, ABS_PRESSURE, 0, in wacom_setup_pen_input_capabilities()
3800 features->pressure_max, features->pressure_fuzz, 0); in wacom_setup_pen_input_capabilities()
3803 input_abs_set_res(input_dev, ABS_X, features->x_resolution); in wacom_setup_pen_input_capabilities()
3804 input_abs_set_res(input_dev, ABS_Y, features->y_resolution); in wacom_setup_pen_input_capabilities()
3806 switch (features->type) { in wacom_setup_pen_input_capabilities()
3808 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3813 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3814 features->distance_max, in wacom_setup_pen_input_capabilities()
3815 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3821 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3822 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3823 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3825 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3826 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3827 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3828 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3829 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3842 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3854 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3870 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3871 features->distance_max, in wacom_setup_pen_input_capabilities()
3872 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3874 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3888 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3895 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3896 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3897 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3898 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3902 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3906 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3907 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3908 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3916 if (features->type == INTUOSHT2 || in wacom_setup_pen_input_capabilities()
3917 features->type == INTUOSHT3_BT) { in wacom_setup_pen_input_capabilities()
3920 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3921 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3922 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3923 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3924 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3925 input_set_abs_params(input_dev, ABS_DISTANCE, 0, in wacom_setup_pen_input_capabilities()
3926 features->distance_max, in wacom_setup_pen_input_capabilities()
3927 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3931 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3934 return 0; in wacom_setup_pen_input_capabilities()
3940 struct wacom_features *features = &wacom_wac->features; in wacom_setup_touch_input_capabilities()
3942 if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) in wacom_setup_touch_input_capabilities()
3943 return -ENODEV; in wacom_setup_touch_input_capabilities()
3945 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_touch_input_capabilities()
3946 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3948 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3950 if (features->type == HID_GENERIC) in wacom_setup_touch_input_capabilities()
3952 return 0; in wacom_setup_touch_input_capabilities()
3954 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_touch_input_capabilities()
3955 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3957 if (features->touch_max == 1) { in wacom_setup_touch_input_capabilities()
3958 input_set_abs_params(input_dev, ABS_X, 0, in wacom_setup_touch_input_capabilities()
3959 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3960 input_set_abs_params(input_dev, ABS_Y, 0, in wacom_setup_touch_input_capabilities()
3961 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3963 features->x_resolution); in wacom_setup_touch_input_capabilities()
3965 features->y_resolution); in wacom_setup_touch_input_capabilities()
3967 else if (features->touch_max > 1) { in wacom_setup_touch_input_capabilities()
3968 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, in wacom_setup_touch_input_capabilities()
3969 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3970 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, in wacom_setup_touch_input_capabilities()
3971 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3973 features->x_resolution); in wacom_setup_touch_input_capabilities()
3975 features->y_resolution); in wacom_setup_touch_input_capabilities()
3978 switch (features->type) { in wacom_setup_touch_input_capabilities()
3981 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3982 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3984 if (wacom_wac->shared->touch->product == 0x361) { in wacom_setup_touch_input_capabilities()
3986 0, 12440, 4, 0); in wacom_setup_touch_input_capabilities()
3988 0, 8640, 4, 0); in wacom_setup_touch_input_capabilities()
3990 else if (wacom_wac->shared->touch->product == 0x360) { in wacom_setup_touch_input_capabilities()
3992 0, 8960, 4, 0); in wacom_setup_touch_input_capabilities()
3994 0, 5920, 4, 0); in wacom_setup_touch_input_capabilities()
3996 else if (wacom_wac->shared->touch->product == 0x393) { in wacom_setup_touch_input_capabilities()
3998 0, 6400, 4, 0); in wacom_setup_touch_input_capabilities()
4000 0, 4000, 4, 0); in wacom_setup_touch_input_capabilities()
4013 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
4014 input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
4015 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
4019 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
4020 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
4021 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
4022 input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); in wacom_setup_touch_input_capabilities()
4026 if (wacom_wac->shared->touch->product == 0x32C || in wacom_setup_touch_input_capabilities()
4027 wacom_wac->shared->touch->product == 0xF6) { in wacom_setup_touch_input_capabilities()
4028 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
4029 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
4030 wacom_wac->has_mute_touch_switch = true; in wacom_setup_touch_input_capabilities()
4031 wacom_wac->is_soft_touch_switch = true; in wacom_setup_touch_input_capabilities()
4039 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); in wacom_setup_touch_input_capabilities()
4048 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
4049 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
4054 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_touch_input_capabilities()
4057 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
4060 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
4062 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
4066 input_mt_init_slots(input_dev, features->touch_max, in wacom_setup_touch_input_capabilities()
4068 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
4069 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
4072 return 0; in wacom_setup_touch_input_capabilities()
4080 return BTN_A + (n-10); in wacom_numbered_button_to_key()
4082 return BTN_BASE + (n-16); in wacom_numbered_button_to_key()
4084 return 0; in wacom_numbered_button_to_key()
4092 for (i = 0; i < button_count; i++) { in wacom_setup_numbered_buttons()
4096 __set_bit(key, input_dev->keybit); in wacom_setup_numbered_buttons()
4107 * 24HD has LED group 1 to the left and LED group 0 to the right. in wacom_24hd_update_leds()
4108 * So group 0 matches the second half of the buttons and thus the mask in wacom_24hd_update_leds()
4111 if (group == 0) in wacom_24hd_update_leds()
4114 for (i = 0; i < 3; i++) { in wacom_24hd_update_leds()
4117 hid_err(wacom->hdev, "can't find LED %d in group %d\n", in wacom_24hd_update_leds()
4122 led->held = true; in wacom_24hd_update_leds()
4123 led_trigger_event(&led->trigger, LED_FULL); in wacom_24hd_update_leds()
4125 led->held = false; in wacom_24hd_update_leds()
4136 * 21UX2 has LED group 1 to the left and LED group 0 in wacom_is_led_toggled()
4140 if (wacom->wacom_wac.features.type == WACOM_21UX2) in wacom_is_led_toggled()
4141 group = 1 - group; in wacom_is_led_toggled()
4143 group_button = group * (button_count/wacom->led.count); in wacom_is_led_toggled()
4145 if (wacom->wacom_wac.features.type == INTUOSP2_BT) in wacom_is_led_toggled()
4158 if (wacom->wacom_wac.features.type == WACOM_24HD) in wacom_update_led()
4162 cur = wacom->led.groups[group].select; in wacom_update_led()
4166 hid_err(wacom->hdev, "can't find current LED %d in group %d\n", in wacom_update_led()
4172 led->held = false; in wacom_update_led()
4176 if (led->held && pressed) in wacom_update_led()
4181 hid_err(wacom->hdev, "can't find next LED in group %d\n", in wacom_update_led()
4188 next_led->held = true; in wacom_update_led()
4189 led_trigger_event(&next_led->trigger, in wacom_update_led()
4199 for (i = 0; i < wacom->led.count; i++) in wacom_report_numbered_buttons()
4202 for (i = 0; i < button_count; i++) { in wacom_report_numbered_buttons()
4213 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pad_input_capabilities()
4215 if ((features->type == HID_GENERIC) && features->numbered_buttons > 0) in wacom_setup_pad_input_capabilities()
4216 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_pad_input_capabilities()
4218 if (!(features->device_type & WACOM_DEVICETYPE_PAD)) in wacom_setup_pad_input_capabilities()
4219 return -ENODEV; in wacom_setup_pad_input_capabilities()
4221 if (features->type == REMOTE && input_dev == wacom_wac->pad_input) in wacom_setup_pad_input_capabilities()
4222 return -ENODEV; in wacom_setup_pad_input_capabilities()
4224 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pad_input_capabilities()
4226 /* kept for making legacy xf86-input-wacom working with the wheels */ in wacom_setup_pad_input_capabilities()
4227 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4229 /* kept for making legacy xf86-input-wacom accepting the pad */ in wacom_setup_pad_input_capabilities()
4230 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || in wacom_setup_pad_input_capabilities()
4231 input_dev->absinfo[ABS_X].maximum))) in wacom_setup_pad_input_capabilities()
4232 input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); in wacom_setup_pad_input_capabilities()
4233 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || in wacom_setup_pad_input_capabilities()
4234 input_dev->absinfo[ABS_Y].maximum))) in wacom_setup_pad_input_capabilities()
4235 input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); in wacom_setup_pad_input_capabilities()
4238 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4240 wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); in wacom_setup_pad_input_capabilities()
4242 switch (features->type) { in wacom_setup_pad_input_capabilities()
4252 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4253 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4254 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4255 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4256 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4260 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4261 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4266 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4267 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4268 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4270 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4271 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4273 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4274 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4276 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4277 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4281 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4282 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4283 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4285 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4286 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4288 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4289 __set_bit(KEY_CONTROLPANEL, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4290 input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4292 input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4294 input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4296 __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); in wacom_setup_pad_input_capabilities()
4300 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4301 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4302 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4304 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4305 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4311 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4312 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4316 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4321 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4325 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); in wacom_setup_pad_input_capabilities()
4336 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4345 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4351 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4358 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4360 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4361 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4362 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4363 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4369 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); in wacom_setup_pad_input_capabilities()
4378 return -ENODEV; in wacom_setup_pad_input_capabilities()
4380 return 0; in wacom_setup_pad_input_capabilities()
4384 { "Wacom Penpartner", 5040, 3780, 255, 0,
4441 { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63,
4444 { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63,
4447 { "Wacom Intuos 4x5", 12700, 10600, 1023, 31,
4450 { "Wacom Intuos 6x8", 20320, 16240, 1023, 31,
4453 { "Wacom Intuos 9x12", 30480, 24060, 1023, 31,
4456 { "Wacom Intuos 12x12", 30480, 31680, 1023, 31,
4459 { "Wacom Intuos 12x18", 45720, 31680, 1023, 31,
4462 { "Wacom PL400", 5408, 4056, 255, 0,
4465 { "Wacom PL500", 6144, 4608, 255, 0,
4468 { "Wacom PL600", 6126, 4604, 255, 0,
4471 { "Wacom PL600SX", 6260, 5016, 255, 0,
4474 { "Wacom PL550", 6144, 4608, 511, 0,
4477 { "Wacom PL800", 7220, 5780, 511, 0,
4480 { "Wacom PL700", 6758, 5406, 511, 0,
4483 { "Wacom PL510", 6282, 4762, 511, 0,
4486 { "Wacom DTU710", 34080, 27660, 511, 0,
4489 { "Wacom DTF521", 6282, 4762, 511, 0,
4492 { "Wacom DTF720", 6858, 5506, 511, 0,
4495 { "Wacom DTF720a", 6858, 5506, 511, 0,
4498 { "Wacom Cintiq Partner", 20480, 15360, 511, 0,
4501 { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31,
4504 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4507 { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31,
4510 { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31,
4513 { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31,
4516 { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63,
4519 { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63,
4522 { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63,
4525 { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63,
4528 { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63,
4531 { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63,
4534 { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63,
4591 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 };
4594 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
4598 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
4603 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
4606 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C };
4609 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 };
4611 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63,
4614 { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63,
4617 { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
4620 { "Wacom Cintiq 13HD", 59552, 33848, 1023, 63,
4629 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 };
4632 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x333, .touch_max = 10,
4635 { "Wacom DTU1931", 37832, 30305, 511, 0,
4638 { "Wacom DTU2231", 47864, 27011, 511, 0,
4642 { "Wacom DTU1631", 34623, 19553, 511, 0,
4645 { "Wacom DTU1031", 22096, 13960, 511, 0,
4650 { "Wacom DTU1031X", 22672, 12928, 511, 0,
4651 DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0,
4655 { "Wacom DTU1141", 23672, 13403, 1023, 0,
4669 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D };
4672 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10,
4689 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e };
4692 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10,
4695 { "Wacom ISDv4 90", 26202, 16325, 255, 0,
4696 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4698 { "Wacom ISDv4 93", 26202, 16325, 255, 0,
4701 { "Wacom ISDv4 97", 26202, 16325, 511, 0,
4702 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4704 { "Wacom ISDv4 9A", 26202, 16325, 255, 0,
4707 { "Wacom ISDv4 9F", 26202, 16325, 255, 0,
4710 { "Wacom ISDv4 E2", 26202, 16325, 255, 0,
4713 { "Wacom ISDv4 E3", 26202, 16325, 255, 0,
4716 { "Wacom ISDv4 E5", 26202, 16325, 255, 0,
4719 { "Wacom ISDv4 E6", 27760, 15694, 255, 0,
4722 { "Wacom ISDv4 EC", 25710, 14500, 255, 0,
4723 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4725 { "Wacom ISDv4 ED", 26202, 16325, 255, 0,
4728 { "Wacom ISDv4 EF", 26202, 16325, 255, 0,
4729 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4731 { "Wacom ISDv4 100", 26202, 16325, 255, 0,
4734 { "Wacom ISDv4 101", 26202, 16325, 255, 0,
4737 { "Wacom ISDv4 10D", 26202, 16325, 255, 0,
4740 { "Wacom ISDv4 10E", 27760, 15694, 255, 0,
4743 { "Wacom ISDv4 10F", 27760, 15694, 255, 0,
4746 { "Wacom ISDv4 116", 26202, 16325, 255, 0,
4749 { "Wacom ISDv4 12C", 27848, 15752, 2047, 0,
4750 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4752 { "Wacom ISDv4 4001", 26202, 16325, 255, 0,
4755 { "Wacom ISDv4 4004", 11060, 6220, 255, 0,
4758 { "Wacom ISDv4 5000", 27848, 15752, 1023, 0,
4761 { "Wacom ISDv4 5002", 29576, 16724, 1023, 0,
4764 { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31,
4769 { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31,
4772 { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31,
4775 { "Wacom Bamboo Craft", 14720, 9200, 1023, 31,
4778 { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31,
4781 { "Wacom Bamboo Pen", 14720, 9200, 1023, 31,
4784 { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31,
4787 { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31,
4790 { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31,
4793 { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31,
4796 { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31,
4799 { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31,
4802 { "Wacom Bamboo Connect", 14720, 9200, 1023, 31,
4805 { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31,
4808 { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31,
4811 { "Wacom Bamboo One S", 14720, 9225, 1023, 31,
4814 { "Wacom Bamboo One M", 21648, 13530, 1023, 31,
4817 { "Wacom Intuos PT S", 15200, 9500, 1023, 31,
4821 { "Wacom Intuos PT M", 21600, 13500, 1023, 31,
4825 { "Wacom Intuos S", 15200, 9500, 1023, 31,
4829 { "ISD-V4", 12800, 8000, 255, 0,
4836 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 };
4839 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10,
4846 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C };
4849 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10,
4862 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
4865 .oPid = 0x325 };
4867 { "Wacom Intuos P M", 21600, 13500, 1023, 31,
4891 { "Wacom DTK1651", 34816, 19759, 1023, 0,
4951 { USB_DEVICE_WACOM(0x00) },
4952 { USB_DEVICE_WACOM(0x03) },
4953 { USB_DEVICE_WACOM(0x10) },
4954 { USB_DEVICE_WACOM(0x11) },
4955 { USB_DEVICE_WACOM(0x12) },
4956 { USB_DEVICE_WACOM(0x13) },
4957 { USB_DEVICE_WACOM(0x14) },
4958 { USB_DEVICE_WACOM(0x15) },
4959 { USB_DEVICE_WACOM(0x16) },
4960 { USB_DEVICE_WACOM(0x17) },
4961 { USB_DEVICE_WACOM(0x18) },
4962 { USB_DEVICE_WACOM(0x19) },
4963 { USB_DEVICE_WACOM(0x20) },
4964 { USB_DEVICE_WACOM(0x21) },
4965 { USB_DEVICE_WACOM(0x22) },
4966 { USB_DEVICE_WACOM(0x23) },
4967 { USB_DEVICE_WACOM(0x24) },
4968 { USB_DEVICE_WACOM(0x26) },
4969 { USB_DEVICE_WACOM(0x27) },
4970 { USB_DEVICE_WACOM(0x28) },
4971 { USB_DEVICE_WACOM(0x29) },
4972 { USB_DEVICE_WACOM(0x2A) },
4973 { USB_DEVICE_WACOM(0x30) },
4974 { USB_DEVICE_WACOM(0x31) },
4975 { USB_DEVICE_WACOM(0x32) },
4976 { USB_DEVICE_WACOM(0x33) },
4977 { USB_DEVICE_WACOM(0x34) },
4978 { USB_DEVICE_WACOM(0x35) },
4979 { USB_DEVICE_WACOM(0x37) },
4980 { USB_DEVICE_WACOM(0x38) },
4981 { USB_DEVICE_WACOM(0x39) },
4982 { USB_DEVICE_WACOM(0x3F) },
4983 { USB_DEVICE_WACOM(0x41) },
4984 { USB_DEVICE_WACOM(0x42) },
4985 { USB_DEVICE_WACOM(0x43) },
4986 { USB_DEVICE_WACOM(0x44) },
4987 { USB_DEVICE_WACOM(0x45) },
4988 { USB_DEVICE_WACOM(0x47) },
4989 { USB_DEVICE_WACOM(0x57) },
4990 { USB_DEVICE_WACOM(0x59) },
4991 { USB_DEVICE_WACOM(0x5B) },
4992 { USB_DEVICE_WACOM(0x5D) },
4993 { USB_DEVICE_WACOM(0x5E) },
4994 { USB_DEVICE_WACOM(0x60) },
4995 { USB_DEVICE_WACOM(0x61) },
4996 { USB_DEVICE_WACOM(0x62) },
4997 { USB_DEVICE_WACOM(0x63) },
4998 { USB_DEVICE_WACOM(0x64) },
4999 { USB_DEVICE_WACOM(0x65) },
5000 { USB_DEVICE_WACOM(0x69) },
5001 { USB_DEVICE_WACOM(0x6A) },
5002 { USB_DEVICE_WACOM(0x6B) },
5003 { BT_DEVICE_WACOM(0x81) },
5004 { USB_DEVICE_WACOM(0x84) },
5005 { USB_DEVICE_WACOM(0x90) },
5006 { USB_DEVICE_WACOM(0x93) },
5007 { USB_DEVICE_WACOM(0x94) },
5008 { USB_DEVICE_WACOM(0x97) },
5009 { USB_DEVICE_WACOM(0x9A) },
5010 { USB_DEVICE_WACOM(0x9F) },
5011 { USB_DEVICE_WACOM(0xB0) },
5012 { USB_DEVICE_WACOM(0xB1) },
5013 { USB_DEVICE_WACOM(0xB2) },
5014 { USB_DEVICE_WACOM(0xB3) },
5015 { USB_DEVICE_WACOM(0xB4) },
5016 { USB_DEVICE_WACOM(0xB5) },
5017 { USB_DEVICE_WACOM(0xB7) },
5018 { USB_DEVICE_WACOM(0xB8) },
5019 { USB_DEVICE_WACOM(0xB9) },
5020 { USB_DEVICE_WACOM(0xBA) },
5021 { USB_DEVICE_WACOM(0xBB) },
5022 { USB_DEVICE_WACOM(0xBC) },
5023 { BT_DEVICE_WACOM(0xBD) },
5024 { USB_DEVICE_WACOM(0xC0) },
5025 { USB_DEVICE_WACOM(0xC2) },
5026 { USB_DEVICE_WACOM(0xC4) },
5027 { USB_DEVICE_WACOM(0xC5) },
5028 { USB_DEVICE_WACOM(0xC6) },
5029 { USB_DEVICE_WACOM(0xC7) },
5030 { USB_DEVICE_WACOM(0xCC) },
5031 { USB_DEVICE_WACOM(0xCE) },
5032 { USB_DEVICE_WACOM(0xD0) },
5033 { USB_DEVICE_WACOM(0xD1) },
5034 { USB_DEVICE_WACOM(0xD2) },
5035 { USB_DEVICE_WACOM(0xD3) },
5036 { USB_DEVICE_WACOM(0xD4) },
5037 { USB_DEVICE_WACOM(0xD5) },
5038 { USB_DEVICE_WACOM(0xD6) },
5039 { USB_DEVICE_WACOM(0xD7) },
5040 { USB_DEVICE_WACOM(0xD8) },
5041 { USB_DEVICE_WACOM(0xDA) },
5042 { USB_DEVICE_WACOM(0xDB) },
5043 { USB_DEVICE_WACOM(0xDD) },
5044 { USB_DEVICE_WACOM(0xDE) },
5045 { USB_DEVICE_WACOM(0xDF) },
5046 { USB_DEVICE_WACOM(0xE2) },
5047 { USB_DEVICE_WACOM(0xE3) },
5048 { USB_DEVICE_WACOM(0xE5) },
5049 { USB_DEVICE_WACOM(0xE6) },
5050 { USB_DEVICE_WACOM(0xEC) },
5051 { USB_DEVICE_WACOM(0xED) },
5052 { USB_DEVICE_WACOM(0xEF) },
5053 { USB_DEVICE_WACOM(0xF0) },
5054 { USB_DEVICE_WACOM(0xF4) },
5055 { USB_DEVICE_WACOM(0xF6) },
5056 { USB_DEVICE_WACOM(0xF8) },
5057 { USB_DEVICE_WACOM(0xFA) },
5058 { USB_DEVICE_WACOM(0xFB) },
5059 { USB_DEVICE_WACOM(0x100) },
5060 { USB_DEVICE_WACOM(0x101) },
5061 { USB_DEVICE_WACOM(0x10D) },
5062 { USB_DEVICE_WACOM(0x10E) },
5063 { USB_DEVICE_WACOM(0x10F) },
5064 { USB_DEVICE_WACOM(0x116) },
5065 { USB_DEVICE_WACOM(0x12C) },
5066 { USB_DEVICE_WACOM(0x300) },
5067 { USB_DEVICE_WACOM(0x301) },
5068 { USB_DEVICE_WACOM(0x302) },
5069 { USB_DEVICE_WACOM(0x303) },
5070 { USB_DEVICE_WACOM(0x304) },
5071 { USB_DEVICE_WACOM(0x307) },
5072 { USB_DEVICE_WACOM(0x309) },
5073 { USB_DEVICE_WACOM(0x30A) },
5074 { USB_DEVICE_WACOM(0x30C) },
5075 { USB_DEVICE_WACOM(0x30E) },
5076 { USB_DEVICE_WACOM(0x314) },
5077 { USB_DEVICE_WACOM(0x315) },
5078 { USB_DEVICE_WACOM(0x317) },
5079 { USB_DEVICE_WACOM(0x318) },
5080 { USB_DEVICE_WACOM(0x319) },
5081 { USB_DEVICE_WACOM(0x323) },
5082 { USB_DEVICE_WACOM(0x325) },
5083 { USB_DEVICE_WACOM(0x326) },
5084 { USB_DEVICE_WACOM(0x32A) },
5085 { USB_DEVICE_WACOM(0x32B) },
5086 { USB_DEVICE_WACOM(0x32C) },
5087 { USB_DEVICE_WACOM(0x32F) },
5088 { USB_DEVICE_WACOM(0x331) },
5089 { USB_DEVICE_WACOM(0x333) },
5090 { USB_DEVICE_WACOM(0x335) },
5091 { USB_DEVICE_WACOM(0x336) },
5092 { USB_DEVICE_WACOM(0x33B) },
5093 { USB_DEVICE_WACOM(0x33C) },
5094 { USB_DEVICE_WACOM(0x33D) },
5095 { USB_DEVICE_WACOM(0x33E) },
5096 { USB_DEVICE_WACOM(0x343) },
5097 { BT_DEVICE_WACOM(0x360) },
5098 { BT_DEVICE_WACOM(0x361) },
5099 { BT_DEVICE_WACOM(0x377) },
5100 { BT_DEVICE_WACOM(0x379) },
5101 { USB_DEVICE_WACOM(0x37A) },
5102 { USB_DEVICE_WACOM(0x37B) },
5103 { BT_DEVICE_WACOM(0x393) },
5104 { BT_DEVICE_WACOM(0x3c6) },
5105 { BT_DEVICE_WACOM(0x3c8) },
5106 { BT_DEVICE_WACOM(0x3dd) },
5107 { USB_DEVICE_WACOM(0x4001) },
5108 { USB_DEVICE_WACOM(0x4004) },
5109 { USB_DEVICE_WACOM(0x5000) },
5110 { USB_DEVICE_WACOM(0x5002) },
5111 { USB_DEVICE_LENOVO(0x6004) },