Lines Matching +full:event +full:- +full:prox
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * USB Wacom tablet support - Wacom specific code
29 * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo
60 bool changed = battery->bat_status != bat_status || in __wacom_notify_battery()
61 battery->battery_capacity != bat_capacity || in __wacom_notify_battery()
62 battery->bat_charging != bat_charging || in __wacom_notify_battery()
63 battery->bat_connected != bat_connected || in __wacom_notify_battery()
64 battery->ps_connected != ps_connected; in __wacom_notify_battery()
67 battery->bat_status = bat_status; in __wacom_notify_battery()
68 battery->battery_capacity = bat_capacity; in __wacom_notify_battery()
69 battery->bat_charging = bat_charging; in __wacom_notify_battery()
70 battery->bat_connected = bat_connected; in __wacom_notify_battery()
71 battery->ps_connected = ps_connected; in __wacom_notify_battery()
73 if (battery->battery) in __wacom_notify_battery()
74 power_supply_changed(battery->battery); in __wacom_notify_battery()
84 __wacom_notify_battery(&wacom->battery, bat_status, bat_capacity, in wacom_notify_battery()
90 unsigned char *data = wacom->data; in wacom_penpartner_irq()
91 struct input_dev *input = wacom->pen_input; in wacom_penpartner_irq()
96 wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_penpartner_irq()
97 wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID; in wacom_penpartner_irq()
98 input_report_key(input, wacom->tool[0], 1); in wacom_penpartner_irq()
99 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_penpartner_irq()
103 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127)); in wacom_penpartner_irq()
106 input_report_key(input, wacom->tool[0], 0); in wacom_penpartner_irq()
108 input_report_abs(input, ABS_PRESSURE, -1); in wacom_penpartner_irq()
119 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); in wacom_penpartner_irq()
124 dev_dbg(input->dev.parent, in wacom_penpartner_irq()
134 struct wacom_features *features = &wacom->features; in wacom_pl_irq()
135 unsigned char *data = wacom->data; in wacom_pl_irq()
136 struct input_dev *input = wacom->pen_input; in wacom_pl_irq()
137 int prox, pressure; in wacom_pl_irq() local
140 dev_dbg(input->dev.parent, in wacom_pl_irq()
145 prox = data[1] & 0x40; in wacom_pl_irq()
147 if (!wacom->id[0]) { in wacom_pl_irq()
149 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_pl_irq()
150 wacom->id[0] = ERASER_DEVICE_ID; in wacom_pl_irq()
153 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
154 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
158 /* If the eraser is in prox, STYLUS2 is always set. If we in wacom_pl_irq()
159 * mis-detected the type and notice that STYLUS2 isn't set in wacom_pl_irq()
160 * then force the eraser out of prox and let the pen in. in wacom_pl_irq()
162 if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { in wacom_pl_irq()
166 wacom->tool[0] = BTN_TOOL_PEN; in wacom_pl_irq()
167 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_pl_irq()
170 if (prox) { in wacom_pl_irq()
172 if (features->pressure_max > 255) in wacom_pl_irq()
174 pressure += (features->pressure_max + 1) / 2; in wacom_pl_irq()
183 input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); in wacom_pl_irq()
186 if (!prox) in wacom_pl_irq()
187 wacom->id[0] = 0; in wacom_pl_irq()
188 input_report_key(input, wacom->tool[0], prox); in wacom_pl_irq()
189 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_pl_irq()
195 unsigned char *data = wacom->data; in wacom_ptu_irq()
196 struct input_dev *input = wacom->pen_input; in wacom_ptu_irq()
199 dev_dbg(input->dev.parent, in wacom_ptu_irq()
207 wacom->id[0] = ERASER_DEVICE_ID; in wacom_ptu_irq()
211 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_ptu_irq()
213 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_ptu_irq()
224 unsigned char *data = wacom->data; in wacom_dtu_irq()
225 struct input_dev *input = wacom->pen_input; in wacom_dtu_irq()
226 int prox = data[1] & 0x20; in wacom_dtu_irq() local
228 dev_dbg(input->dev.parent, in wacom_dtu_irq()
231 if (prox) { in wacom_dtu_irq()
233 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_dtu_irq()
234 if (wacom->tool[0] == BTN_TOOL_PEN) in wacom_dtu_irq()
235 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtu_irq()
237 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtu_irq()
245 if (!prox) /* out-prox */ in wacom_dtu_irq()
246 wacom->id[0] = 0; in wacom_dtu_irq()
247 input_report_key(input, wacom->tool[0], prox); in wacom_dtu_irq()
248 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtu_irq()
254 unsigned char *data = wacom->data; in wacom_dtus_irq()
255 struct input_dev *input = wacom->pen_input; in wacom_dtus_irq()
256 unsigned short prox, pressure = 0; in wacom_dtus_irq() local
259 dev_dbg(input->dev.parent, in wacom_dtus_irq()
263 input = wacom->pad_input; in wacom_dtus_irq()
272 prox = data[1] & 0x80; in wacom_dtus_irq()
273 if (prox) { in wacom_dtus_irq()
276 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_dtus_irq()
277 wacom->id[0] = ERASER_DEVICE_ID; in wacom_dtus_irq()
281 wacom->tool[0] = BTN_TOOL_PEN; in wacom_dtus_irq()
282 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_dtus_irq()
295 if (!prox) /* out-prox */ in wacom_dtus_irq()
296 wacom->id[0] = 0; in wacom_dtus_irq()
297 input_report_key(input, wacom->tool[0], prox); in wacom_dtus_irq()
298 input_report_abs(input, ABS_MISC, wacom->id[0]); in wacom_dtus_irq()
305 struct wacom_features *features = &wacom->features; in wacom_graphire_irq()
306 unsigned char *data = wacom->data; in wacom_graphire_irq()
307 struct input_dev *input = wacom->pen_input; in wacom_graphire_irq()
308 struct input_dev *pad_input = wacom->pad_input; in wacom_graphire_irq()
310 int prox; in wacom_graphire_irq() local
314 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
316 dev_dbg(input->dev.parent, in wacom_graphire_irq()
322 dev_dbg(input->dev.parent, in wacom_graphire_irq()
327 prox = data[1] & 0x80; in wacom_graphire_irq()
328 if (prox || wacom->id[0]) { in wacom_graphire_irq()
329 if (prox) { in wacom_graphire_irq()
333 wacom->tool[0] = BTN_TOOL_PEN; in wacom_graphire_irq()
334 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_graphire_irq()
338 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_graphire_irq()
339 wacom->id[0] = ERASER_DEVICE_ID; in wacom_graphire_irq()
347 wacom->tool[0] = BTN_TOOL_MOUSE; in wacom_graphire_irq()
348 wacom->id[0] = CURSOR_DEVICE_ID; in wacom_graphire_irq()
354 if (wacom->tool[0] != BTN_TOOL_MOUSE) { in wacom_graphire_irq()
355 if (features->type == GRAPHIRE_BT) in wacom_graphire_irq()
367 if (features->type == WACOM_G4 || in wacom_graphire_irq()
368 features->type == WACOM_MO) { in wacom_graphire_irq()
370 rw = (data[7] & 0x04) - (data[7] & 0x03); in wacom_graphire_irq()
371 } else if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
373 rw = 44 - (data[6] >> 2); in wacom_graphire_irq()
380 rw = (data[6] & 0x01) ? -1 : in wacom_graphire_irq()
387 rw = -(signed char)data[6]; in wacom_graphire_irq()
392 if (!prox) in wacom_graphire_irq()
393 wacom->id[0] = 0; in wacom_graphire_irq()
394 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ in wacom_graphire_irq()
395 input_report_key(input, wacom->tool[0], prox); in wacom_graphire_irq()
396 input_sync(input); /* sync last event */ in wacom_graphire_irq()
400 switch (features->type) { in wacom_graphire_irq()
402 prox = data[7] & 0xf8; in wacom_graphire_irq()
403 if (prox || wacom->id[1]) { in wacom_graphire_irq()
404 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
407 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); in wacom_graphire_irq()
409 if (!prox) in wacom_graphire_irq()
410 wacom->id[1] = 0; in wacom_graphire_irq()
411 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
417 prox = (data[7] & 0xf8) || data[8]; in wacom_graphire_irq()
418 if (prox || wacom->id[1]) { in wacom_graphire_irq()
419 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
425 if (!prox) in wacom_graphire_irq()
426 wacom->id[1] = 0; in wacom_graphire_irq()
427 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
432 prox = data[7] & 0x03; in wacom_graphire_irq()
433 if (prox || wacom->id[1]) { in wacom_graphire_irq()
434 wacom->id[1] = PAD_DEVICE_ID; in wacom_graphire_irq()
437 if (!prox) in wacom_graphire_irq()
438 wacom->id[1] = 0; in wacom_graphire_irq()
439 input_report_abs(pad_input, ABS_MISC, wacom->id[1]); in wacom_graphire_irq()
446 if (features->type == GRAPHIRE_BT) { in wacom_graphire_irq()
461 struct wacom_features *features = &wacom_wac->features; in wacom_intuos_schedule_prox_event()
465 re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); in wacom_intuos_schedule_prox_event()
466 if (features->type == INTUOSHT2) in wacom_intuos_schedule_prox_event()
467 r = re->report_id_hash[WACOM_REPORT_INTUOSHT2_ID]; in wacom_intuos_schedule_prox_event()
469 r = re->report_id_hash[WACOM_REPORT_INTUOS_ID1]; in wacom_intuos_schedule_prox_event()
471 hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); in wacom_intuos_schedule_prox_event()
477 struct wacom_features *features = &wacom->features; in wacom_intuos_pad()
478 unsigned char *data = wacom->data; in wacom_intuos_pad()
479 struct input_dev *input = wacom->pad_input; in wacom_intuos_pad()
481 int buttons = 0, nbuttons = features->numbered_buttons; in wacom_intuos_pad()
485 bool prox = false; in wacom_intuos_pad() local
489 /* pad packets. Works as a second tool and is always in prox */ in wacom_intuos_pad()
494 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { in wacom_intuos_pad()
497 } else if (features->type == DTK) { in wacom_intuos_pad()
499 } else if (features->type == WACOM_13HD) { in wacom_intuos_pad()
501 } else if (features->type == WACOM_24HD) { in wacom_intuos_pad()
520 if (features->oPid) { in wacom_intuos_pad()
523 wacom->shared->is_touch_on = in wacom_intuos_pad()
524 !wacom->shared->is_touch_on; in wacom_intuos_pad()
528 } else if (features->type == WACOM_27QHD) { in wacom_intuos_pad()
535 if (features->oPid) { in wacom_intuos_pad()
538 wacom->shared->is_touch_on = in wacom_intuos_pad()
539 !wacom->shared->is_touch_on; in wacom_intuos_pad()
546 } else if (features->type == CINTIQ_HYBRID) { in wacom_intuos_pad()
552 * d-pad right -> data[4] & 0x10 in wacom_intuos_pad()
553 * d-pad up -> data[4] & 0x20 in wacom_intuos_pad()
554 * d-pad left -> data[4] & 0x40 in wacom_intuos_pad()
555 * d-pad down -> data[4] & 0x80 in wacom_intuos_pad()
556 * d-pad center -> data[3] & 0x01 in wacom_intuos_pad()
559 } else if (features->type == CINTIQ_COMPANION_2) { in wacom_intuos_pad()
560 /* d-pad right -> data[2] & 0x10 in wacom_intuos_pad()
561 * d-pad up -> data[2] & 0x20 in wacom_intuos_pad()
562 * d-pad left -> data[2] & 0x40 in wacom_intuos_pad()
563 * d-pad down -> data[2] & 0x80 in wacom_intuos_pad()
564 * d-pad center -> data[1] & 0x01 in wacom_intuos_pad()
570 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { in wacom_intuos_pad()
581 if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) { in wacom_intuos_pad()
585 if (features->type == WACOM_22HD) { in wacom_intuos_pad()
602 prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) | in wacom_intuos_pad()
615 if (wacom->shared && wacom->shared->touch_input) { in wacom_intuos_pad()
616 input_report_switch(wacom->shared->touch_input, in wacom_intuos_pad()
618 !wacom->shared->is_touch_on); in wacom_intuos_pad()
619 input_sync(wacom->shared->touch_input); in wacom_intuos_pad()
628 input_report_key(input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pad()
629 input_report_abs(input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pad()
731 struct input_dev *input = wacom->pen_input; in wacom_exit_report()
732 struct wacom_features *features = &wacom->features; in wacom_exit_report()
733 unsigned char *data = wacom->data; in wacom_exit_report()
734 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_exit_report()
738 * when in-prox next time in wacom_exit_report()
745 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { in wacom_exit_report()
759 if (features->type >= INTUOS3S) in wacom_exit_report()
762 input_report_key(input, wacom->tool[idx], 0); in wacom_exit_report()
764 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_exit_report()
765 wacom->id[idx] = 0; in wacom_exit_report()
770 struct wacom_features *features = &wacom->features; in wacom_intuos_inout()
771 unsigned char *data = wacom->data; in wacom_intuos_inout()
772 struct input_dev *input = wacom->pen_input; in wacom_intuos_inout()
773 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_inout()
775 if (!(((data[1] & 0xfc) == 0xc0) || /* in prox */ in wacom_intuos_inout()
777 ((data[1] & 0xfe) == 0x80))) /* out prox */ in wacom_intuos_inout()
783 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + in wacom_intuos_inout()
787 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | in wacom_intuos_inout()
790 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]); in wacom_intuos_inout()
792 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
798 if (features->type != INTUOSHT2) in wacom_intuos_inout()
799 wacom->shared->stylus_in_proximity = true; in wacom_intuos_inout()
802 if (wacom->reporting_data) { in wacom_intuos_inout()
805 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); in wacom_intuos_inout()
813 wacom->shared->stylus_in_proximity = false; in wacom_intuos_inout()
814 wacom->reporting_data = false; in wacom_intuos_inout()
817 if (!wacom->id[idx]) in wacom_intuos_inout()
829 return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1); in report_touch_events()
834 return (wacom->shared->touch_down && touch_arbitration); in delay_pen_events()
839 struct wacom_features *features = &wacom->features; in wacom_intuos_general()
840 unsigned char *data = wacom->data; in wacom_intuos_general()
841 struct input_dev *input = wacom->pen_input; in wacom_intuos_general()
842 int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; in wacom_intuos_general()
854 if (!wacom->id[idx]) { in wacom_intuos_general()
864 if ((!((wacom->id[idx] >> 16) & 0x01) && in wacom_intuos_general()
865 (features->type == WACOM_21UX2)) || in wacom_intuos_general()
867 (wacom->tool[idx] == BTN_TOOL_LENS && in wacom_intuos_general()
868 (features->type == INTUOS3 || in wacom_intuos_general()
869 features->type == INTUOS3S || in wacom_intuos_general()
870 features->type == INTUOS4 || in wacom_intuos_general()
871 features->type == INTUOS4S || in wacom_intuos_general()
872 features->type == INTUOS5 || in wacom_intuos_general()
873 features->type == INTUOS5S || in wacom_intuos_general()
874 features->type == INTUOSPM || in wacom_intuos_general()
875 features->type == INTUOSPS)) || in wacom_intuos_general()
877 (features->type == CINTIQ && !(data[1] & 0x40))) in wacom_intuos_general()
883 if (features->type < INTUOS3S) { in wacom_intuos_general()
888 if (features->type == INTUOSHT2) in wacom_intuos_general()
889 distance = features->distance_max - distance; in wacom_intuos_general()
901 if (features->pressure_max < 2047) in wacom_intuos_general()
904 if (features->type != INTUOSHT2) { in wacom_intuos_general()
906 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
907 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
919 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
920 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
925 if (features->type >= INTUOS3S) { in wacom_intuos_general()
928 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : in wacom_intuos_general()
929 ((t-1) / 2 + 450)) : (450 - t / 2) ; in wacom_intuos_general()
935 ((t - 1) / 2) : -t / 2); in wacom_intuos_general()
948 input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); in wacom_intuos_general()
957 - ((data[7] & 0x40) >> 6)); in wacom_intuos_general()
962 (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); in wacom_intuos_general()
963 input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); in wacom_intuos_general()
967 if (wacom->tool[idx] == BTN_TOOL_MOUSE) { in wacom_intuos_general()
973 - ((data[8] & 0x02) >> 1)); in wacom_intuos_general()
976 if (features->type >= INTUOS3S && features->type <= INTUOS3L) { in wacom_intuos_general()
981 else if (wacom->tool[idx] == BTN_TOOL_LENS) { in wacom_intuos_general()
1003 wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */ in wacom_intuos_general()
1004 input_report_key(input, wacom->tool[idx], 1); in wacom_intuos_general()
1005 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); in wacom_intuos_general()
1006 wacom->reporting_data = true; in wacom_intuos_general()
1012 unsigned char *data = wacom->data; in wacom_intuos_irq()
1013 struct input_dev *input = wacom->pen_input; in wacom_intuos_irq()
1024 dev_dbg(input->dev.parent, in wacom_intuos_irq()
1034 /* process in/out prox events */ in wacom_intuos_irq()
1037 return result - 1; in wacom_intuos_irq()
1042 return result - 1; in wacom_intuos_irq()
1049 unsigned char *data = wacom_wac->data; in wacom_remote_irq()
1052 struct wacom_remote *remote = wacom->remote; in wacom_remote_irq()
1055 int i, index = -1; in wacom_remote_irq()
1059 hid_dbg(wacom->hdev, "%s: received unknown report #%d", in wacom_remote_irq()
1065 wacom_wac->id[0] = PAD_DEVICE_ID; in wacom_remote_irq()
1067 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_irq()
1070 if (remote->remotes[i].serial == serial) { in wacom_remote_irq()
1076 if (index < 0 || !remote->remotes[index].registered) in wacom_remote_irq()
1079 input = remote->remotes[index].input; in wacom_remote_irq()
1103 input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f) - 1); in wacom_remote_irq()
1123 if (remote->remotes[i].serial == serial) in wacom_remote_irq()
1124 wacom->led.groups[i].select = touch_ring_mode; in wacom_remote_irq()
1127 __wacom_notify_battery(&remote->remotes[index].battery, in wacom_remote_irq()
1132 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_irq()
1139 unsigned char *data = wacom_wac->data; in wacom_remote_status_irq()
1140 struct wacom_remote *remote = wacom->remote; in wacom_remote_status_irq()
1159 spin_lock_irqsave(&remote->remote_lock, flags); in wacom_remote_status_irq()
1161 ret = kfifo_in(&remote->remote_fifo, &remote_data, sizeof(remote_data)); in wacom_remote_status_irq()
1163 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1164 hid_err(wacom->hdev, "Can't queue Remote status event.\n"); in wacom_remote_status_irq()
1168 spin_unlock_irqrestore(&remote->remote_lock, flags); in wacom_remote_status_irq()
1175 int x = x2 - x1; in int_dist()
1176 int y = y2 - y1; in int_dist()
1184 memcpy(wacom->data, data, 10); in wacom_intuos_bt_process_data()
1187 input_sync(wacom->pen_input); in wacom_intuos_bt_process_data()
1188 if (wacom->pad_input) in wacom_intuos_bt_process_data()
1189 input_sync(wacom->pad_input); in wacom_intuos_bt_process_data()
1198 memcpy(data, wacom->data, len); in wacom_intuos_bt_irq()
1220 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_bt_irq()
1230 struct input_dev *input = wacom->touch_input; in wacom_wac_finger_count_touches()
1231 unsigned touch_max = wacom->features.touch_max; in wacom_wac_finger_count_touches()
1239 return test_bit(BTN_TOUCH, input->key) && in wacom_wac_finger_count_touches()
1242 for (i = 0; i < input->mt->num_slots; i++) { in wacom_wac_finger_count_touches()
1243 struct input_mt_slot *ps = &input->mt->slots[i]; in wacom_wac_finger_count_touches()
1256 struct input_dev *pen_input = wacom->pen_input; in wacom_intuos_pro2_bt_pen()
1257 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pen()
1260 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1261 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1262 wacom->serial[0] = get_unaligned_le64(&data[99]); in wacom_intuos_pro2_bt_pen()
1263 wacom->id[0] = get_unaligned_le16(&data[107]); in wacom_intuos_pro2_bt_pen()
1267 wacom->serial[0] = get_unaligned_le64(&data[33]); in wacom_intuos_pro2_bt_pen()
1268 wacom->id[0] = get_unaligned_le16(&data[41]); in wacom_intuos_pro2_bt_pen()
1273 if (wacom->serial[0] >> 52 == 1) { in wacom_intuos_pro2_bt_pen()
1274 /* Add back in missing bits of ID for non-USI pens */ in wacom_intuos_pro2_bt_pen()
1275 wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF; in wacom_intuos_pro2_bt_pen()
1281 bool prox = frame[0] & 0x40; in wacom_intuos_pro2_bt_pen() local
1288 if (!prox) { in wacom_intuos_pro2_bt_pen()
1289 wacom->shared->stylus_in_proximity = false; in wacom_intuos_pro2_bt_pen()
1293 wacom->tool[0] = 0; in wacom_intuos_pro2_bt_pen()
1294 wacom->id[0] = 0; in wacom_intuos_pro2_bt_pen()
1295 wacom->serial[0] = 0; in wacom_intuos_pro2_bt_pen()
1300 if (!wacom->tool[0]) { /* first in range */ in wacom_intuos_pro2_bt_pen()
1303 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_intuos_pro2_bt_pen()
1304 else if (wacom->id[0]) in wacom_intuos_pro2_bt_pen()
1305 wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]); in wacom_intuos_pro2_bt_pen()
1307 wacom->tool[0] = BTN_TOOL_PEN; in wacom_intuos_pro2_bt_pen()
1313 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1314 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1321 rotation -= 1800; in wacom_intuos_pro2_bt_pen()
1332 if (wacom->tool[0]) { in wacom_intuos_pro2_bt_pen()
1334 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_pen()
1335 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_pen()
1337 range ? frame[13] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1340 range ? frame[7] : wacom->features.distance_max); in wacom_intuos_pro2_bt_pen()
1347 input_report_key(pen_input, wacom->tool[0], prox); in wacom_intuos_pro2_bt_pen()
1348 input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]); in wacom_intuos_pro2_bt_pen()
1350 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */ in wacom_intuos_pro2_bt_pen()
1353 wacom->shared->stylus_in_proximity = prox; in wacom_intuos_pro2_bt_pen()
1365 struct input_dev *touch_input = wacom->touch_input; in wacom_intuos_pro2_bt_touch()
1366 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_touch()
1380 * packet in series will have non-zero current_num_contacts. in wacom_intuos_pro2_bt_touch()
1383 wacom->num_contacts_left = current_num_contacts; in wacom_intuos_pro2_bt_touch()
1385 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_intuos_pro2_bt_touch()
1409 wacom->num_contacts_left -= contacts_to_send; in wacom_intuos_pro2_bt_touch()
1410 if (wacom->num_contacts_left <= 0) { in wacom_intuos_pro2_bt_touch()
1411 wacom->num_contacts_left = 0; in wacom_intuos_pro2_bt_touch()
1412 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_intuos_pro2_bt_touch()
1417 if (wacom->num_contacts_left == 0) { in wacom_intuos_pro2_bt_touch()
1428 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_pro2_bt_pad()
1429 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_pad()
1430 int nbuttons = wacom->features.numbered_buttons; in wacom_intuos_pro2_bt_pad()
1436 bool prox = expresskeys || center || ringstatus; in wacom_intuos_pro2_bt_pad() local
1439 ring = 71 - ring; in wacom_intuos_pro2_bt_pad()
1442 ring -= 72; in wacom_intuos_pro2_bt_pad()
1445 expresskeys | (center << (nbuttons - 1))); in wacom_intuos_pro2_bt_pad()
1449 input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0); in wacom_intuos_pro2_bt_pad()
1450 input_report_abs(pad_input, ABS_MISC, prox ? PAD_DEVICE_ID : 0); in wacom_intuos_pro2_bt_pad()
1458 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_battery()
1469 struct input_dev *pad_input = wacom->pad_input; in wacom_intuos_gen3_bt_pad()
1470 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_pad()
1476 input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0); in wacom_intuos_gen3_bt_pad()
1485 unsigned char *data = wacom->data; in wacom_intuos_gen3_bt_battery()
1496 unsigned char *data = wacom->data; in wacom_intuos_pro2_bt_irq()
1499 dev_dbg(wacom->pen_input->dev.parent, in wacom_intuos_pro2_bt_irq()
1505 if (wacom->features.type == INTUOSP2_BT || in wacom_intuos_pro2_bt_irq()
1506 wacom->features.type == INTUOSP2S_BT) { in wacom_intuos_pro2_bt_irq()
1519 struct input_dev *input = wacom->touch_input; in wacom_24hdt_irq()
1520 unsigned char *data = wacom->data; in wacom_24hdt_irq()
1528 if (wacom->shared->has_mute_touch_switch && in wacom_24hdt_irq()
1529 !wacom->shared->is_touch_on) { in wacom_24hdt_irq()
1530 if (!wacom->shared->touch_down) in wacom_24hdt_irq()
1534 if (wacom->features.type == WACOM_27QHDT) { in wacom_24hdt_irq()
1543 * packet in series will have non-zero current_num_contacts. in wacom_24hdt_irq()
1546 wacom->num_contacts_left = current_num_contacts; in wacom_24hdt_irq()
1548 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); in wacom_24hdt_irq()
1567 if (wacom->features.type != WACOM_27QHDT) { in wacom_24hdt_irq()
1583 wacom->num_contacts_left -= contacts_to_send; in wacom_24hdt_irq()
1584 if (wacom->num_contacts_left <= 0) { in wacom_24hdt_irq()
1585 wacom->num_contacts_left = 0; in wacom_24hdt_irq()
1586 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_24hdt_irq()
1593 struct input_dev *input = wacom->touch_input; in wacom_mt_touch()
1594 unsigned char *data = wacom->data; in wacom_mt_touch()
1601 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) in wacom_mt_touch()
1602 x_offset = -4; in wacom_mt_touch()
1606 * packet in series will have non-zero current_num_contacts. in wacom_mt_touch()
1609 wacom->num_contacts_left = current_num_contacts; in wacom_mt_touch()
1612 contacts_to_send = min(5, wacom->num_contacts_left); in wacom_mt_touch()
1634 wacom->num_contacts_left -= contacts_to_send; in wacom_mt_touch()
1635 if (wacom->num_contacts_left <= 0) { in wacom_mt_touch()
1636 wacom->num_contacts_left = 0; in wacom_mt_touch()
1637 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_mt_touch()
1644 struct input_dev *input = wacom->touch_input; in wacom_tpc_mt_touch()
1645 unsigned char *data = wacom->data; in wacom_tpc_mt_touch()
1664 /* keep touch state for pen event */ in wacom_tpc_mt_touch()
1665 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_tpc_mt_touch()
1672 unsigned char *data = wacom->data; in wacom_tpc_single_touch()
1673 struct input_dev *input = wacom->touch_input; in wacom_tpc_single_touch()
1674 bool prox = report_touch_events(wacom); in wacom_tpc_single_touch() local
1677 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) in wacom_tpc_single_touch()
1681 prox = prox && (data[0] & 0x01); in wacom_tpc_single_touch()
1685 prox = prox && (data[2] & 0x01); in wacom_tpc_single_touch()
1689 prox = prox && (data[1] & 0x01); in wacom_tpc_single_touch()
1694 if (prox) { in wacom_tpc_single_touch()
1698 input_report_key(input, BTN_TOUCH, prox); in wacom_tpc_single_touch()
1701 wacom->shared->touch_down = prox; in wacom_tpc_single_touch()
1708 unsigned char *data = wacom->data; in wacom_tpc_pen()
1709 struct input_dev *input = wacom->pen_input; in wacom_tpc_pen()
1710 bool prox = data[1] & 0x20; in wacom_tpc_pen() local
1712 if (!wacom->shared->stylus_in_proximity) /* first in prox */ in wacom_tpc_pen()
1714 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; in wacom_tpc_pen()
1717 wacom->shared->stylus_in_proximity = prox; in wacom_tpc_pen()
1729 input_report_key(input, wacom->tool[0], prox); in wacom_tpc_pen()
1738 unsigned char *data = wacom->data; in wacom_tpc_irq()
1740 if (wacom->pen_input) { in wacom_tpc_irq()
1741 dev_dbg(wacom->pen_input->dev.parent, in wacom_tpc_irq()
1748 else if (wacom->touch_input) { in wacom_tpc_irq()
1749 dev_dbg(wacom->touch_input->dev.parent, in wacom_tpc_irq()
1781 struct input_absinfo *abs = &input->absinfo[usage->code]; in wacom_offset_rotation()
1782 int range = (abs->maximum - abs->minimum + 1); in wacom_offset_rotation()
1785 if (value > abs->maximum) in wacom_offset_rotation()
1786 value -= range; in wacom_offset_rotation()
1787 else if (value < abs->minimum) in wacom_offset_rotation()
1840 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_map_usage()
1841 struct wacom_features *features = &wacom_wac->features; in wacom_map_usage()
1842 int fmin = field->logical_minimum; in wacom_map_usage()
1843 int fmax = field->logical_maximum; in wacom_map_usage()
1844 unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_map_usage()
1852 fmin += features->offset_left; in wacom_map_usage()
1853 fmax -= features->offset_right; in wacom_map_usage()
1856 fmin += features->offset_top; in wacom_map_usage()
1857 fmax -= features->offset_bottom; in wacom_map_usage()
1860 usage->type = type; in wacom_map_usage()
1861 usage->code = code; in wacom_map_usage()
1863 set_bit(type, input->evbit); in wacom_map_usage()
1887 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_usage_mapping()
1888 struct wacom_features *features = &wacom_wac->features; in wacom_wac_battery_usage_mapping()
1889 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_usage_mapping()
1895 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_wac_battery_usage_mapping()
1904 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_event()
1905 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_battery_event()
1910 wacom_wac->hid_data.bat_status = POWER_SUPPLY_STATUS_UNKNOWN; in wacom_wac_battery_event()
1913 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1914 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1915 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1916 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1920 value = value * 100 / (field->logical_maximum - field->logical_minimum); in wacom_wac_battery_event()
1921 wacom_wac->hid_data.battery_capacity = value; in wacom_wac_battery_event()
1922 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1923 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1926 wacom_wac->hid_data.bat_charging = value; in wacom_wac_battery_event()
1927 wacom_wac->hid_data.ps_connected = value; in wacom_wac_battery_event()
1928 wacom_wac->hid_data.bat_connected = 1; in wacom_wac_battery_event()
1929 wacom_wac->hid_data.bat_status = WACOM_POWER_SUPPLY_STATUS_AUTO; in wacom_wac_battery_event()
1944 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_battery_report()
1945 struct wacom_features *features = &wacom_wac->features; in wacom_wac_battery_report()
1947 if (features->quirks & WACOM_QUIRK_BATTERY) { in wacom_wac_battery_report()
1948 int status = wacom_wac->hid_data.bat_status; in wacom_wac_battery_report()
1949 int capacity = wacom_wac->hid_data.battery_capacity; in wacom_wac_battery_report()
1950 bool charging = wacom_wac->hid_data.bat_charging; in wacom_wac_battery_report()
1951 bool connected = wacom_wac->hid_data.bat_connected; in wacom_wac_battery_report()
1952 bool powered = wacom_wac->hid_data.ps_connected; in wacom_wac_battery_report()
1963 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_usage_mapping()
1964 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_usage_mapping()
1965 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_usage_mapping()
1966 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_usage_mapping()
1970 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
1972 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
1975 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
1977 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
1980 __set_bit(INPUT_PROP_ACCELEROMETER, input->propbit); in wacom_wac_pad_usage_mapping()
1982 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
1991 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
1993 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
1994 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2006 wacom_wac->has_mute_touch_switch = true; in wacom_wac_pad_usage_mapping()
2007 usage->type = EV_SW; in wacom_wac_pad_usage_mapping()
2008 usage->code = SW_MUTE_DEVICE; in wacom_wac_pad_usage_mapping()
2009 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2013 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2017 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2021 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2028 usage->type = EV_ABS; in wacom_wac_pad_usage_mapping()
2029 usage->code = ABS_WHEEL; in wacom_wac_pad_usage_mapping()
2030 set_bit(EV_ABS, input->evbit); in wacom_wac_pad_usage_mapping()
2031 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2035 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2039 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2043 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2047 if (!wacom_wac->has_mode_change) { in wacom_wac_pad_usage_mapping()
2048 wacom_wac->has_mode_change = true; in wacom_wac_pad_usage_mapping()
2049 wacom_wac->is_direct_mode = true; in wacom_wac_pad_usage_mapping()
2051 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2058 wacom_numbered_button_to_key(features->numbered_buttons), in wacom_wac_pad_usage_mapping()
2060 features->numbered_buttons++; in wacom_wac_pad_usage_mapping()
2061 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_wac_pad_usage_mapping()
2070 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_event()
2071 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_event()
2072 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pad_event()
2073 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pad_event()
2078 * Avoid reporting this event and setting inrange_state if this usage in wacom_wac_pad_event()
2081 if (!usage->type && equivalent_usage != WACOM_HID_WD_MODE_CHANGE) in wacom_wac_pad_event()
2084 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { in wacom_wac_pad_event()
2085 if (usage->hid != WACOM_HID_WD_TOUCHRING) in wacom_wac_pad_event()
2086 wacom_wac->hid_data.inrange_state |= value; in wacom_wac_pad_event()
2094 * tablet's left. HID events "should" be clockwise- in wacom_wac_pad_event()
2096 * Pro and 2nd-gen Intuos Pro don't do this... in wacom_wac_pad_event()
2098 if (hdev->vendor == 0x56a && in wacom_wac_pad_event()
2099 (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ in wacom_wac_pad_event()
2100 hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2101 hdev->product == 0x392 || /* Intuos Pro 2 */ in wacom_wac_pad_event()
2102 hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */ in wacom_wac_pad_event()
2103 hdev->product == 0x3AA)) { /* MobileStudio Pro */ in wacom_wac_pad_event()
2104 value = (field->logical_maximum - value); in wacom_wac_pad_event()
2106 if (hdev->product == 0x357 || hdev->product == 0x358 || in wacom_wac_pad_event()
2107 hdev->product == 0x392) in wacom_wac_pad_event()
2109 else if (hdev->product == 0x34d || hdev->product == 0x34e || in wacom_wac_pad_event()
2110 hdev->product == 0x398 || hdev->product == 0x399 || in wacom_wac_pad_event()
2111 hdev->product == 0x3AA) in wacom_wac_pad_event()
2121 input_event(input, usage->type, usage->code, 0); in wacom_wac_pad_event()
2126 if (wacom_wac->shared->touch_input) { in wacom_wac_pad_event()
2127 bool *is_touch_on = &wacom_wac->shared->is_touch_on; in wacom_wac_pad_event()
2134 input_report_switch(wacom_wac->shared->touch_input, in wacom_wac_pad_event()
2136 input_sync(wacom_wac->shared->touch_input); in wacom_wac_pad_event()
2141 if (wacom_wac->is_direct_mode != value) { in wacom_wac_pad_event()
2142 wacom_wac->is_direct_mode = value; in wacom_wac_pad_event()
2143 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE); in wacom_wac_pad_event()
2148 for (i = 0; i < wacom->led.count; i++) in wacom_wac_pad_event()
2149 wacom_update_led(wacom, features->numbered_buttons, in wacom_wac_pad_event()
2158 input_event(input, usage->type, usage->code, value); in wacom_wac_pad_event()
2160 wacom_wac->hid_data.pad_input_event_flag = true; in wacom_wac_pad_event()
2168 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_pre_report()
2170 wacom_wac->hid_data.inrange_state = 0; in wacom_wac_pad_pre_report()
2177 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pad_report()
2178 struct input_dev *input = wacom_wac->pad_input; in wacom_wac_pad_report()
2179 bool active = wacom_wac->hid_data.inrange_state != 0; in wacom_wac_pad_report()
2181 /* report prox for expresskey events */ in wacom_wac_pad_report()
2182 if (wacom_wac->hid_data.pad_input_event_flag) { in wacom_wac_pad_report()
2186 wacom_wac->hid_data.pad_input_event_flag = false; in wacom_wac_pad_report()
2194 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_usage_mapping()
2195 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_usage_mapping()
2196 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_usage_mapping()
2197 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_usage_mapping()
2240 features->quirks |= WACOM_QUIRK_TOOLSERIAL; in wacom_wac_pen_usage_mapping()
2244 features->quirks |= WACOM_QUIRK_SENSE; in wacom_wac_pen_usage_mapping()
2250 if (!(features->quirks & WACOM_QUIRK_AESPEN)) { in wacom_wac_pen_usage_mapping()
2251 set_bit(EV_KEY, input->evbit); in wacom_wac_pen_usage_mapping()
2257 if (!(features->device_type & WACOM_DEVICETYPE_DIRECT)) { in wacom_wac_pen_usage_mapping()
2273 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_event()
2274 struct wacom_features *features = &wacom_wac->features; in wacom_wac_pen_event()
2275 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_event()
2276 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_pen_event()
2278 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_event()
2288 value = field->logical_maximum - value; in wacom_wac_pen_event()
2291 wacom_wac->hid_data.inrange_state = value; in wacom_wac_pen_event()
2292 if (!(features->quirks & WACOM_QUIRK_SENSE)) in wacom_wac_pen_event()
2293 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2296 wacom_wac->hid_data.invert_state = value; in wacom_wac_pen_event()
2300 wacom_wac->hid_data.tipswitch |= value; in wacom_wac_pen_event()
2303 wacom_wac->hid_data.barrelswitch = value; in wacom_wac_pen_event()
2306 wacom_wac->hid_data.barrelswitch2 = value; in wacom_wac_pen_event()
2310 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); in wacom_wac_pen_event()
2311 wacom_wac->serial[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2323 wacom_wac->hid_data.sense_state = value; in wacom_wac_pen_event()
2327 __u32 raw_value = wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2329 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF); in wacom_wac_pen_event()
2330 wacom_wac->serial[0] |= ((__u64)raw_value) << 32; in wacom_wac_pen_event()
2332 * Non-USI EMR devices may contain additional tool type in wacom_wac_pen_event()
2337 wacom_wac->id[0] |= raw_value & 0xFFFFF; in wacom_wac_pen_event()
2349 wacom_wac->id[0] |= wacom_s32tou(value, field->report_size); in wacom_wac_pen_event()
2352 if (features->offset_left && value != features->offset_left) in wacom_wac_pen_event()
2354 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2355 features->offset_left); in wacom_wac_pen_event()
2356 features->offset_left = value; in wacom_wac_pen_event()
2359 if (features->offset_right && value != features->offset_right) in wacom_wac_pen_event()
2361 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2362 features->offset_right); in wacom_wac_pen_event()
2363 features->offset_right = value; in wacom_wac_pen_event()
2366 if (features->offset_top && value != features->offset_top) in wacom_wac_pen_event()
2368 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2369 features->offset_top); in wacom_wac_pen_event()
2370 features->offset_top = value; in wacom_wac_pen_event()
2373 if (features->offset_bottom && value != features->offset_bottom) in wacom_wac_pen_event()
2375 "%d -> %d\n", __func__, value, in wacom_wac_pen_event()
2376 features->offset_bottom); in wacom_wac_pen_event()
2377 features->offset_bottom = value; in wacom_wac_pen_event()
2380 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_pen_event()
2387 if (!usage->type || delay_pen_events(wacom_wac)) in wacom_wac_pen_event()
2391 if (wacom_wac->hid_data.inrange_state) in wacom_wac_pen_event()
2392 input_event(input, usage->type, usage->code, value); in wacom_wac_pen_event()
2393 else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) in wacom_wac_pen_event()
2394 input_event(input, usage->type, usage->code, 0); in wacom_wac_pen_event()
2401 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_pre_report()
2403 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_pen_pre_report()
2411 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_report()
2412 struct input_dev *input = wacom_wac->pen_input; in wacom_wac_pen_report()
2413 bool range = wacom_wac->hid_data.inrange_state; in wacom_wac_pen_report()
2414 bool sense = wacom_wac->hid_data.sense_state; in wacom_wac_pen_report()
2416 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_pen_report()
2419 if (!wacom_wac->tool[0] && range) { /* first in range */ in wacom_wac_pen_report()
2421 if (wacom_wac->hid_data.invert_state) in wacom_wac_pen_report()
2422 wacom_wac->tool[0] = BTN_TOOL_RUBBER; in wacom_wac_pen_report()
2423 else if (wacom_wac->id[0]) in wacom_wac_pen_report()
2424 wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]); in wacom_wac_pen_report()
2426 wacom_wac->tool[0] = BTN_TOOL_PEN; in wacom_wac_pen_report()
2430 wacom_wac->shared->stylus_in_proximity = sense; in wacom_wac_pen_report()
2432 if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { in wacom_wac_pen_report()
2433 int id = wacom_wac->id[0]; in wacom_wac_pen_report()
2434 int sw_state = wacom_wac->hid_data.barrelswitch | in wacom_wac_pen_report()
2435 (wacom_wac->hid_data.barrelswitch2 << 1); in wacom_wac_pen_report()
2442 * Non-USI EMR tools should have their IDs mangled to in wacom_wac_pen_report()
2445 if (wacom_wac->serial[0] >> 52 == 1) in wacom_wac_pen_report()
2449 * To ensure compatibility with xf86-input-wacom, we should in wacom_wac_pen_report()
2450 * report the BTN_TOOL_* event prior to the ABS_MISC or in wacom_wac_pen_report()
2454 wacom_wac->hid_data.tipswitch); in wacom_wac_pen_report()
2455 input_report_key(input, wacom_wac->tool[0], sense); in wacom_wac_pen_report()
2456 if (wacom_wac->serial[0]) { in wacom_wac_pen_report()
2457 input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); in wacom_wac_pen_report()
2461 wacom_wac->hid_data.tipswitch = false; in wacom_wac_pen_report()
2467 wacom_wac->tool[0] = 0; in wacom_wac_pen_report()
2468 wacom_wac->id[0] = 0; in wacom_wac_pen_report()
2469 wacom_wac->serial[0] = 0; in wacom_wac_pen_report()
2477 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_usage_mapping()
2478 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_usage_mapping()
2479 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_usage_mapping()
2480 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_usage_mapping()
2507 wacom_wac->hid_data.cc_report = field->report->id; in wacom_wac_finger_usage_mapping()
2508 wacom_wac->hid_data.cc_index = field->index; in wacom_wac_finger_usage_mapping()
2509 wacom_wac->hid_data.cc_value_index = usage->usage_index; in wacom_wac_finger_usage_mapping()
2512 if ((field->logical_maximum - field->logical_minimum) < touch_max) { in wacom_wac_finger_usage_mapping()
2518 field->logical_maximum = 255; in wacom_wac_finger_usage_mapping()
2527 struct hid_data *hid_data = &wacom_wac->hid_data; in wacom_wac_finger_slot()
2528 bool mt = wacom_wac->features.touch_max > 1; in wacom_wac_finger_slot()
2529 bool prox = hid_data->tipswitch && in wacom_wac_finger_slot() local
2532 if (wacom_wac->shared->has_mute_touch_switch && in wacom_wac_finger_slot()
2533 !wacom_wac->shared->is_touch_on) { in wacom_wac_finger_slot()
2534 if (!wacom_wac->shared->touch_down) in wacom_wac_finger_slot()
2536 prox = 0; in wacom_wac_finger_slot()
2539 wacom_wac->hid_data.num_received++; in wacom_wac_finger_slot()
2540 if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) in wacom_wac_finger_slot()
2546 slot = input_mt_get_slot_by_key(input, hid_data->id); in wacom_wac_finger_slot()
2548 input_mt_report_slot_state(input, MT_TOOL_FINGER, prox); in wacom_wac_finger_slot()
2551 input_report_key(input, BTN_TOUCH, prox); in wacom_wac_finger_slot()
2554 if (prox) { in wacom_wac_finger_slot()
2556 hid_data->x); in wacom_wac_finger_slot()
2558 hid_data->y); in wacom_wac_finger_slot()
2560 if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { in wacom_wac_finger_slot()
2561 input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2562 input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); in wacom_wac_finger_slot()
2563 if (hid_data->width != hid_data->height) in wacom_wac_finger_slot()
2564 input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); in wacom_wac_finger_slot()
2573 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_event()
2574 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); in wacom_wac_finger_event()
2575 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_wac_finger_event()
2577 if (wacom_wac->is_invalid_bt_frame) in wacom_wac_finger_event()
2582 wacom_wac->hid_data.x = value; in wacom_wac_finger_event()
2585 wacom_wac->hid_data.y = value; in wacom_wac_finger_event()
2588 wacom_wac->hid_data.width = value; in wacom_wac_finger_event()
2591 wacom_wac->hid_data.height = value; in wacom_wac_finger_event()
2594 wacom_wac->hid_data.id = value; in wacom_wac_finger_event()
2597 wacom_wac->hid_data.tipswitch = value; in wacom_wac_finger_event()
2600 wacom_wac->is_invalid_bt_frame = !value; in wacom_wac_finger_event()
2603 features->touch_max = value; in wacom_wac_finger_event()
2607 if (usage->usage_index + 1 == field->report_count) { in wacom_wac_finger_event()
2608 if (equivalent_usage == wacom_wac->hid_data.last_slot_field) in wacom_wac_finger_event()
2609 wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); in wacom_wac_finger_event()
2617 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_pre_report()
2618 struct hid_data* hid_data = &wacom_wac->hid_data; in wacom_wac_finger_pre_report()
2621 wacom_wac->is_invalid_bt_frame = false; in wacom_wac_finger_pre_report()
2623 for (i = 0; i < report->maxfield; i++) { in wacom_wac_finger_pre_report()
2624 struct hid_field *field = report->field[i]; in wacom_wac_finger_pre_report()
2627 for (j = 0; j < field->maxusage; j++) { in wacom_wac_finger_pre_report()
2628 struct hid_usage *usage = &field->usage[j]; in wacom_wac_finger_pre_report()
2630 wacom_equivalent_usage(usage->hid); in wacom_wac_finger_pre_report()
2641 hid_data->last_slot_field = equivalent_usage; in wacom_wac_finger_pre_report()
2644 hid_data->cc_report = report->id; in wacom_wac_finger_pre_report()
2645 hid_data->cc_index = i; in wacom_wac_finger_pre_report()
2646 hid_data->cc_value_index = j; in wacom_wac_finger_pre_report()
2652 if (hid_data->cc_report != 0 && in wacom_wac_finger_pre_report()
2653 hid_data->cc_index >= 0) { in wacom_wac_finger_pre_report()
2654 struct hid_field *field = report->field[hid_data->cc_index]; in wacom_wac_finger_pre_report()
2655 int value = field->value[hid_data->cc_value_index]; in wacom_wac_finger_pre_report()
2657 hid_data->num_expected = value; in wacom_wac_finger_pre_report()
2660 hid_data->num_expected = wacom_wac->features.touch_max; in wacom_wac_finger_pre_report()
2668 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_finger_report()
2669 struct input_dev *input = wacom_wac->touch_input; in wacom_wac_finger_report()
2670 unsigned touch_max = wacom_wac->features.touch_max; in wacom_wac_finger_report()
2676 if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) in wacom_wac_finger_report()
2683 wacom_wac->hid_data.num_received = 0; in wacom_wac_finger_report()
2685 /* keep touch state for pen event */ in wacom_wac_finger_report()
2686 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); in wacom_wac_finger_report()
2693 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_usage_mapping()
2694 struct wacom_features *features = &wacom_wac->features; in wacom_wac_usage_mapping()
2697 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_wac_usage_mapping()
2715 if (wacom->wacom_wac.features.type != HID_GENERIC) in wacom_wac_event()
2718 if (value > field->logical_maximum || value < field->logical_minimum) in wacom_wac_event()
2724 else if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) in wacom_wac_event()
2726 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_event()
2728 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_event()
2738 for (r = field_index; r < report->maxfield; r++) { in wacom_report_events()
2742 field = report->field[r]; in wacom_report_events()
2743 count = field->report_count; in wacom_report_events()
2745 if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) in wacom_report_events()
2749 if (field->usage[n].collection_index == collection_index) in wacom_report_events()
2750 wacom_wac_event(hdev, field, &field->usage[n], in wacom_report_events()
2751 field->value[n]); in wacom_report_events()
2767 * Non-input reports may be sent prior to the device being in wacom_wac_collection()
2770 * been called to prevent potential crashes in the report- in wacom_wac_collection()
2773 if (report->type != HID_INPUT_REPORT) in wacom_wac_collection()
2774 return -1; in wacom_wac_collection()
2778 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) in wacom_wac_collection()
2780 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) in wacom_wac_collection()
2789 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_report()
2794 int prev_collection = -1; in wacom_wac_report()
2796 if (wacom_wac->features.type != HID_GENERIC) in wacom_wac_report()
2799 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
2800 field = report->field[r]; in wacom_wac_report()
2808 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) in wacom_wac_report()
2814 if (pad_in_hid_field && wacom->wacom_wac.pad_input) in wacom_wac_report()
2816 if (pen_in_hid_field && wacom->wacom_wac.pen_input) in wacom_wac_report()
2818 if (finger_in_hid_field && wacom->wacom_wac.touch_input) in wacom_wac_report()
2821 for (r = 0; r < report->maxfield; r++) { in wacom_wac_report()
2822 field = report->field[r]; in wacom_wac_report()
2824 if (field->usage[0].collection_index != prev_collection) { in wacom_wac_report()
2826 field->usage[0].collection_index, field, r) < 0) in wacom_wac_report()
2828 prev_collection = field->usage[0].collection_index; in wacom_wac_report()
2834 if (true_pad && wacom->wacom_wac.pad_input) in wacom_wac_report()
2840 struct wacom_features *features = &wacom->features; in wacom_bpt_touch()
2841 struct input_dev *input = wacom->touch_input; in wacom_bpt_touch()
2842 struct input_dev *pad_input = wacom->pad_input; in wacom_bpt_touch()
2843 unsigned char *data = wacom->data; in wacom_bpt_touch()
2859 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { in wacom_bpt_touch()
2874 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt_touch()
2881 struct wacom_features *features = &wacom->features; in wacom_bpt3_touch_msg()
2882 struct input_dev *input = wacom->touch_input; in wacom_bpt3_touch_msg()
2899 if (features->type >= INTUOSPS && features->type <= INTUOSHT2) { in wacom_bpt3_touch_msg()
2904 * "a" is a scaled-down area which we assume is in wacom_bpt3_touch_msg()
2924 struct input_dev *input = wacom->pad_input; in wacom_bpt3_button_msg()
2925 struct wacom_features *features = &wacom->features; in wacom_bpt3_button_msg()
2927 if (features->type == INTUOSHT || features->type == INTUOSHT2) { in wacom_bpt3_button_msg()
2940 unsigned char *data = wacom->data; in wacom_bpt3_touch()
2947 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ in wacom_bpt3_touch()
2961 if (wacom->touch_input && touch_changed) { in wacom_bpt3_touch()
2962 input_mt_sync_frame(wacom->touch_input); in wacom_bpt3_touch()
2963 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); in wacom_bpt3_touch()
2971 struct wacom_features *features = &wacom->features; in wacom_bpt_pen()
2972 struct input_dev *input = wacom->pen_input; in wacom_bpt_pen()
2973 unsigned char *data = wacom->data; in wacom_bpt_pen()
2976 bool range, prox, rdy; in wacom_bpt_pen() local
2982 prox = (data[1] & 0x40) == 0x40; in wacom_bpt_pen()
2985 wacom->shared->stylus_in_proximity = range; in wacom_bpt_pen()
2995 if (prox) { in wacom_bpt_pen()
3000 wacom->tool[0] = BTN_TOOL_RUBBER; in wacom_bpt_pen()
3001 wacom->id[0] = ERASER_DEVICE_ID; in wacom_bpt_pen()
3003 wacom->tool[0] = BTN_TOOL_PEN; in wacom_bpt_pen()
3004 wacom->id[0] = STYLUS_DEVICE_ID; in wacom_bpt_pen()
3006 wacom->reporting_data = true; in wacom_bpt_pen()
3010 * Convert distance from out prox to distance from tablet. in wacom_bpt_pen()
3015 if (data[8] <= features->distance_max) in wacom_bpt_pen()
3016 d = features->distance_max - data[8]; in wacom_bpt_pen()
3018 wacom->id[0] = 0; in wacom_bpt_pen()
3021 if (wacom->reporting_data) { in wacom_bpt_pen()
3026 if (prox || !range) { in wacom_bpt_pen()
3033 input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */ in wacom_bpt_pen()
3034 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ in wacom_bpt_pen()
3038 wacom->reporting_data = false; in wacom_bpt_pen()
3046 struct wacom_features *features = &wacom->features; in wacom_bpt_irq()
3048 if ((features->type == INTUOSHT2) && in wacom_bpt_irq()
3049 (features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_bpt_irq()
3067 * We need to reroute the event from the debug interface to the in wacom_bamboo_pad_pen_event()
3077 * actually reroute the event. in wacom_bamboo_pad_pen_event()
3078 * No need to check if wacom->shared->pen is valid, hid_input_report() in wacom_bamboo_pad_pen_event()
3081 hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data, in wacom_bamboo_pad_pen_event()
3090 struct input_dev *input = wacom->touch_input; in wacom_bamboo_pad_touch_event()
3098 for (id = 0; id < wacom->features.touch_max; id++) { in wacom_bamboo_pad_touch_event()
3121 /* keep touch state for pen event */ in wacom_bamboo_pad_touch_event()
3122 wacom->shared->touch_down = !!prefix && report_touch_events(wacom); in wacom_bamboo_pad_touch_event()
3129 unsigned char *data = wacom->data; in wacom_bamboo_pad_irq()
3147 unsigned char *data = wacom->data; in wacom_wireless_irq()
3157 if ((wacom->shared->type == INTUOSHT || in wacom_wireless_irq()
3158 wacom->shared->type == INTUOSHT2) && in wacom_wireless_irq()
3159 wacom->shared->touch_input && in wacom_wireless_irq()
3160 wacom->shared->touch_max) { in wacom_wireless_irq()
3161 input_report_switch(wacom->shared->touch_input, in wacom_wireless_irq()
3163 input_sync(wacom->shared->touch_input); in wacom_wireless_irq()
3169 if (wacom->pid != pid) { in wacom_wireless_irq()
3170 wacom->pid = pid; in wacom_wireless_irq()
3177 } else if (wacom->pid != 0) { in wacom_wireless_irq()
3179 wacom->pid = 0; in wacom_wireless_irq()
3190 struct wacom_features *features = &wacom_wac->features; in wacom_status_irq()
3191 unsigned char *data = wacom_wac->data; in wacom_status_irq()
3196 if ((features->type == INTUOSHT || in wacom_status_irq()
3197 features->type == INTUOSHT2) && in wacom_status_irq()
3198 wacom_wac->shared->touch_input && in wacom_status_irq()
3199 features->touch_max) { in wacom_status_irq()
3200 input_report_switch(wacom_wac->shared->touch_input, in wacom_status_irq()
3202 input_sync(wacom_wac->shared->touch_input); in wacom_status_irq()
3212 if (!wacom->battery.battery && in wacom_status_irq()
3213 !(features->quirks & WACOM_QUIRK_BATTERY)) { in wacom_status_irq()
3214 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_status_irq()
3218 else if ((features->quirks & WACOM_QUIRK_BATTERY) && in wacom_status_irq()
3219 wacom->battery.battery) { in wacom_status_irq()
3220 features->quirks &= ~WACOM_QUIRK_BATTERY; in wacom_status_irq()
3231 switch (wacom_wac->features.type) { in wacom_wac_irq()
3297 else if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3323 if (wacom_wac->data[0] == WACOM_REPORT_USB) in wacom_wac_irq()
3339 if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) in wacom_wac_irq()
3351 if (wacom_wac->pen_input) in wacom_wac_irq()
3352 input_sync(wacom_wac->pen_input); in wacom_wac_irq()
3353 if (wacom_wac->touch_input) in wacom_wac_irq()
3354 input_sync(wacom_wac->touch_input); in wacom_wac_irq()
3355 if (wacom_wac->pad_input) in wacom_wac_irq()
3356 input_sync(wacom_wac->pad_input); in wacom_wac_irq()
3362 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_basic_pro_pen()
3366 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_basic_pro_pen()
3367 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_basic_pro_pen()
3368 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_basic_pro_pen()
3371 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); in wacom_setup_basic_pro_pen()
3376 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_cintiq()
3377 struct wacom_features *features = &wacom_wac->features; in wacom_setup_cintiq()
3381 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_cintiq()
3382 __set_bit(BTN_TOOL_BRUSH, input_dev->keybit); in wacom_setup_cintiq()
3383 __set_bit(BTN_TOOL_PENCIL, input_dev->keybit); in wacom_setup_cintiq()
3384 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); in wacom_setup_cintiq()
3387 input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3389 input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); in wacom_setup_cintiq()
3395 struct input_dev *input_dev = wacom_wac->pen_input; in wacom_setup_intuos()
3401 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_intuos()
3402 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_intuos()
3403 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_intuos()
3404 __set_bit(BTN_SIDE, input_dev->keybit); in wacom_setup_intuos()
3405 __set_bit(BTN_EXTRA, input_dev->keybit); in wacom_setup_intuos()
3406 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_intuos()
3407 __set_bit(BTN_TOOL_LENS, input_dev->keybit); in wacom_setup_intuos()
3409 input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); in wacom_setup_intuos()
3411 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); in wacom_setup_intuos()
3416 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_setup_device_quirks()
3417 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_setup_device_quirks()
3420 if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 || in wacom_setup_device_quirks()
3421 features->type == DTUS || in wacom_setup_device_quirks()
3422 (features->type >= INTUOS3S && features->type <= WACOM_MO)) { in wacom_setup_device_quirks()
3423 if (features->device_type & WACOM_DEVICETYPE_PEN) in wacom_setup_device_quirks()
3424 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3428 if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) { in wacom_setup_device_quirks()
3429 features->x_max = 1023; in wacom_setup_device_quirks()
3430 features->y_max = 1023; in wacom_setup_device_quirks()
3439 if ((features->type >= INTUOS5S && features->type <= INTUOSPL) || in wacom_setup_device_quirks()
3440 (features->type >= INTUOSHT && features->type <= BAMBOO_PT)) { in wacom_setup_device_quirks()
3441 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_device_quirks()
3442 if (features->touch_max) in wacom_setup_device_quirks()
3443 features->device_type |= WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3444 if (features->type >= INTUOSHT && features->type <= BAMBOO_PT) in wacom_setup_device_quirks()
3445 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3447 if (features->type == INTUOSHT2) { in wacom_setup_device_quirks()
3448 features->x_max = features->x_max / 10; in wacom_setup_device_quirks()
3449 features->y_max = features->y_max / 10; in wacom_setup_device_quirks()
3452 features->x_max = 4096; in wacom_setup_device_quirks()
3453 features->y_max = 4096; in wacom_setup_device_quirks()
3456 else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3457 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3468 if (features->type == BAMBOO_PEN && in wacom_setup_device_quirks()
3469 features->pktlen == WACOM_PKGLEN_BBTOUCH3) in wacom_setup_device_quirks()
3470 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3473 * Raw Wacom-mode pen and touch events both come from interface in wacom_setup_device_quirks()
3479 if (features->type == BAMBOO_PAD) in wacom_setup_device_quirks()
3480 features->device_type = WACOM_DEVICETYPE_TOUCH; in wacom_setup_device_quirks()
3482 if (features->type == REMOTE) in wacom_setup_device_quirks()
3483 features->device_type = WACOM_DEVICETYPE_PAD; in wacom_setup_device_quirks()
3485 if (features->type == INTUOSP2_BT || in wacom_setup_device_quirks()
3486 features->type == INTUOSP2S_BT) { in wacom_setup_device_quirks()
3487 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3490 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3493 if (features->type == INTUOSHT3_BT) { in wacom_setup_device_quirks()
3494 features->device_type |= WACOM_DEVICETYPE_PEN | in wacom_setup_device_quirks()
3496 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3499 switch (features->type) { in wacom_setup_device_quirks()
3522 features->device_type |= WACOM_DEVICETYPE_DIRECT; in wacom_setup_device_quirks()
3526 if (wacom->hdev->bus == BUS_BLUETOOTH) in wacom_setup_device_quirks()
3527 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3530 if ((features->type == BAMBOO_PT || features->type == BAMBOO_TOUCH) && in wacom_setup_device_quirks()
3531 features->pktlen == WACOM_PKGLEN_BBTOUCH) { in wacom_setup_device_quirks()
3532 features->x_max <<= 5; in wacom_setup_device_quirks()
3533 features->y_max <<= 5; in wacom_setup_device_quirks()
3534 features->x_fuzz <<= 5; in wacom_setup_device_quirks()
3535 features->y_fuzz <<= 5; in wacom_setup_device_quirks()
3536 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; in wacom_setup_device_quirks()
3539 if (features->type == WIRELESS) { in wacom_setup_device_quirks()
3540 if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { in wacom_setup_device_quirks()
3541 features->quirks |= WACOM_QUIRK_BATTERY; in wacom_setup_device_quirks()
3545 if (features->type == REMOTE) in wacom_setup_device_quirks()
3546 features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; in wacom_setup_device_quirks()
3548 /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots in wacom_setup_device_quirks()
3551 if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) { in wacom_setup_device_quirks()
3552 features->quirks &= ~WACOM_QUIRK_TOOLSERIAL; in wacom_setup_device_quirks()
3553 __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3554 __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3555 __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit); in wacom_setup_device_quirks()
3556 __clear_bit(ABS_Z, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3557 __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3558 __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3559 __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3560 __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3561 __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit); in wacom_setup_device_quirks()
3562 __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit); in wacom_setup_device_quirks()
3563 __clear_bit(EV_MSC, wacom_wac->pen_input->evbit); in wacom_setup_device_quirks()
3570 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pen_input_capabilities()
3572 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pen_input_capabilities()
3574 if (!(features->device_type & WACOM_DEVICETYPE_PEN)) in wacom_setup_pen_input_capabilities()
3575 return -ENODEV; in wacom_setup_pen_input_capabilities()
3577 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_pen_input_capabilities()
3578 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3580 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_pen_input_capabilities()
3582 if (features->type == HID_GENERIC) { in wacom_setup_pen_input_capabilities()
3583 /* setup has already been done; apply otherwise-undetectible quirks */ in wacom_setup_pen_input_capabilities()
3588 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3589 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3591 input_set_abs_params(input_dev, ABS_X, 0 + features->offset_left, in wacom_setup_pen_input_capabilities()
3592 features->x_max - features->offset_right, in wacom_setup_pen_input_capabilities()
3593 features->x_fuzz, 0); in wacom_setup_pen_input_capabilities()
3594 input_set_abs_params(input_dev, ABS_Y, 0 + features->offset_top, in wacom_setup_pen_input_capabilities()
3595 features->y_max - features->offset_bottom, in wacom_setup_pen_input_capabilities()
3596 features->y_fuzz, 0); in wacom_setup_pen_input_capabilities()
3598 features->pressure_max, features->pressure_fuzz, 0); in wacom_setup_pen_input_capabilities()
3601 input_abs_set_res(input_dev, ABS_X, features->x_resolution); in wacom_setup_pen_input_capabilities()
3602 input_abs_set_res(input_dev, ABS_Y, features->y_resolution); in wacom_setup_pen_input_capabilities()
3604 switch (features->type) { in wacom_setup_pen_input_capabilities()
3606 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3612 features->distance_max, in wacom_setup_pen_input_capabilities()
3613 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3619 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3620 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3621 __set_bit(BTN_MIDDLE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3623 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3624 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3625 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3626 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3627 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3640 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3652 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3669 features->distance_max, in wacom_setup_pen_input_capabilities()
3670 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3672 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); in wacom_setup_pen_input_capabilities()
3686 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3693 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3694 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3695 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3696 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3700 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3704 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3705 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3706 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3714 if (features->type == INTUOSHT2 || in wacom_setup_pen_input_capabilities()
3715 features->type == INTUOSHT3_BT) { in wacom_setup_pen_input_capabilities()
3718 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3719 __set_bit(BTN_TOOL_PEN, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3720 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3721 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3722 __set_bit(BTN_STYLUS2, input_dev->keybit); in wacom_setup_pen_input_capabilities()
3724 features->distance_max, in wacom_setup_pen_input_capabilities()
3725 features->distance_fuzz, 0); in wacom_setup_pen_input_capabilities()
3729 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pen_input_capabilities()
3738 struct wacom_features *features = &wacom_wac->features; in wacom_setup_touch_input_capabilities()
3740 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_touch_input_capabilities()
3742 if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) in wacom_setup_touch_input_capabilities()
3743 return -ENODEV; in wacom_setup_touch_input_capabilities()
3745 if (features->device_type & WACOM_DEVICETYPE_DIRECT) in wacom_setup_touch_input_capabilities()
3746 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3748 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in wacom_setup_touch_input_capabilities()
3750 if (features->type == HID_GENERIC) in wacom_setup_touch_input_capabilities()
3754 __set_bit(BTN_TOUCH, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3756 if (features->touch_max == 1) { in wacom_setup_touch_input_capabilities()
3758 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3760 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3762 features->x_resolution); in wacom_setup_touch_input_capabilities()
3764 features->y_resolution); in wacom_setup_touch_input_capabilities()
3766 else if (features->touch_max > 1) { in wacom_setup_touch_input_capabilities()
3768 features->x_max, features->x_fuzz, 0); in wacom_setup_touch_input_capabilities()
3770 features->y_max, features->y_fuzz, 0); in wacom_setup_touch_input_capabilities()
3772 features->x_resolution); in wacom_setup_touch_input_capabilities()
3774 features->y_resolution); in wacom_setup_touch_input_capabilities()
3777 switch (features->type) { in wacom_setup_touch_input_capabilities()
3780 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3781 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3783 if (wacom_wac->shared->touch->product == 0x361) { in wacom_setup_touch_input_capabilities()
3789 else if (wacom_wac->shared->touch->product == 0x360) { in wacom_setup_touch_input_capabilities()
3795 else if (wacom_wac->shared->touch->product == 0x393) { in wacom_setup_touch_input_capabilities()
3812 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3813 input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3814 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
3818 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3819 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3820 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3825 if (wacom_wac->shared->touch->product == 0x32C || in wacom_setup_touch_input_capabilities()
3826 wacom_wac->shared->touch->product == 0xF6) { in wacom_setup_touch_input_capabilities()
3827 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3828 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3829 wacom_wac->shared->has_mute_touch_switch = true; in wacom_setup_touch_input_capabilities()
3837 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); in wacom_setup_touch_input_capabilities()
3846 input_dev->evbit[0] |= BIT_MASK(EV_SW); in wacom_setup_touch_input_capabilities()
3847 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); in wacom_setup_touch_input_capabilities()
3852 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { in wacom_setup_touch_input_capabilities()
3855 0, features->x_max, 0, 0); in wacom_setup_touch_input_capabilities()
3858 0, features->y_max, 0, 0); in wacom_setup_touch_input_capabilities()
3860 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); in wacom_setup_touch_input_capabilities()
3864 input_mt_init_slots(input_dev, features->touch_max, in wacom_setup_touch_input_capabilities()
3866 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3867 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_touch_input_capabilities()
3878 return BTN_A + (n-10); in wacom_numbered_button_to_key()
3880 return BTN_BASE + (n-16); in wacom_numbered_button_to_key()
3894 __set_bit(key, input_dev->keybit); in wacom_setup_numbered_buttons()
3915 hid_err(wacom->hdev, "can't find LED %d in group %d\n", in wacom_24hd_update_leds()
3920 led->held = true; in wacom_24hd_update_leds()
3921 led_trigger_event(&led->trigger, LED_FULL); in wacom_24hd_update_leds()
3923 led->held = false; in wacom_24hd_update_leds()
3938 if (wacom->wacom_wac.features.type == WACOM_21UX2) in wacom_is_led_toggled()
3939 group = 1 - group; in wacom_is_led_toggled()
3941 group_button = group * (button_count/wacom->led.count); in wacom_is_led_toggled()
3943 if (wacom->wacom_wac.features.type == INTUOSP2_BT) in wacom_is_led_toggled()
3956 if (wacom->wacom_wac.features.type == WACOM_24HD) in wacom_update_led()
3960 cur = wacom->led.groups[group].select; in wacom_update_led()
3964 hid_err(wacom->hdev, "can't find current LED %d in group %d\n", in wacom_update_led()
3970 led->held = false; in wacom_update_led()
3974 if (led->held && pressed) in wacom_update_led()
3979 hid_err(wacom->hdev, "can't find next LED in group %d\n", in wacom_update_led()
3986 next_led->held = true; in wacom_update_led()
3987 led_trigger_event(&next_led->trigger, in wacom_update_led()
3997 for (i = 0; i < wacom->led.count; i++) in wacom_report_numbered_buttons()
4011 struct wacom_features *features = &wacom_wac->features; in wacom_setup_pad_input_capabilities()
4013 if ((features->type == HID_GENERIC) && features->numbered_buttons > 0) in wacom_setup_pad_input_capabilities()
4014 features->device_type |= WACOM_DEVICETYPE_PAD; in wacom_setup_pad_input_capabilities()
4016 if (!(features->device_type & WACOM_DEVICETYPE_PAD)) in wacom_setup_pad_input_capabilities()
4017 return -ENODEV; in wacom_setup_pad_input_capabilities()
4019 if (features->type == REMOTE && input_dev == wacom_wac->pad_input) in wacom_setup_pad_input_capabilities()
4020 return -ENODEV; in wacom_setup_pad_input_capabilities()
4022 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in wacom_setup_pad_input_capabilities()
4024 /* kept for making legacy xf86-input-wacom working with the wheels */ in wacom_setup_pad_input_capabilities()
4025 __set_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4027 /* kept for making legacy xf86-input-wacom accepting the pad */ in wacom_setup_pad_input_capabilities()
4028 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_X].minimum || in wacom_setup_pad_input_capabilities()
4029 input_dev->absinfo[ABS_X].maximum))) in wacom_setup_pad_input_capabilities()
4031 if (!(input_dev->absinfo && (input_dev->absinfo[ABS_Y].minimum || in wacom_setup_pad_input_capabilities()
4032 input_dev->absinfo[ABS_Y].maximum))) in wacom_setup_pad_input_capabilities()
4036 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4038 wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); in wacom_setup_pad_input_capabilities()
4040 switch (features->type) { in wacom_setup_pad_input_capabilities()
4050 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4051 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4052 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4053 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4058 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4059 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4064 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4065 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4066 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4068 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4069 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4071 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4072 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4079 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4080 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4081 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4083 __set_bit(KEY_ONSCREEN_KEYBOARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4084 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4086 if (!features->oPid) in wacom_setup_pad_input_capabilities()
4087 __set_bit(KEY_CONTROLPANEL, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4088 input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4090 input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4092 input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); in wacom_setup_pad_input_capabilities()
4094 __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); in wacom_setup_pad_input_capabilities()
4098 __set_bit(KEY_PROG1, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4099 __set_bit(KEY_PROG2, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4100 __set_bit(KEY_PROG3, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4102 __set_bit(KEY_BUTTONCONFIG, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4103 __set_bit(KEY_INFO, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4143 __set_bit(BTN_STYLUS, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4156 __clear_bit(ABS_MISC, input_dev->absbit); in wacom_setup_pad_input_capabilities()
4158 __set_bit(BTN_LEFT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4159 __set_bit(BTN_FORWARD, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4160 __set_bit(BTN_BACK, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4161 __set_bit(BTN_RIGHT, input_dev->keybit); in wacom_setup_pad_input_capabilities()
4176 return -ENODEV; in wacom_setup_pad_input_capabilities()
4494 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4500 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4521 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4527 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4548 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */
4627 { "ISD-V4", 12800, 8000, 255, 0,