Lines Matching defs:wacom

12 #include "wacom.h"
43 static void wacom_update_led(struct wacom *wacom, int button_count, int mask,
71 struct wacom *wacom = from_timer(wacom, list, idleprox_timer);
72 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
78 hid_warn(wacom->hdev, "%s: tool appears to be hung in-prox. forcing it out.\n", __func__);
120 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
122 __wacom_notify_battery(&wacom->battery, bat_status, bat_capacity,
126 static int wacom_penpartner_irq(struct wacom_wac *wacom)
128 unsigned char *data = wacom->data;
129 struct input_dev *input = wacom->pen_input;
134 wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
135 wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
136 input_report_key(input, wacom->tool[0], 1);
137 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
144 input_report_key(input, wacom->tool[0], 0);
170 static int wacom_pl_irq(struct wacom_wac *wacom)
172 struct wacom_features *features = &wacom->features;
173 unsigned char *data = wacom->data;
174 struct input_dev *input = wacom->pen_input;
185 if (!wacom->id[0]) {
187 wacom->tool[0] = BTN_TOOL_RUBBER;
188 wacom->id[0] = ERASER_DEVICE_ID;
191 wacom->tool[0] = BTN_TOOL_PEN;
192 wacom->id[0] = STYLUS_DEVICE_ID;
200 if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) {
204 wacom->tool[0] = BTN_TOOL_PEN;
205 wacom->id[0] = STYLUS_DEVICE_ID;
221 input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20));
225 wacom->id[0] = 0;
226 input_report_key(input, wacom->tool[0], prox);
227 input_report_abs(input, ABS_MISC, wacom->id[0]);
231 static int wacom_ptu_irq(struct wacom_wac *wacom)
233 unsigned char *data = wacom->data;
234 struct input_dev *input = wacom->pen_input;
245 wacom->id[0] = ERASER_DEVICE_ID;
249 wacom->id[0] = STYLUS_DEVICE_ID;
251 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
260 static int wacom_dtu_irq(struct wacom_wac *wacom)
262 unsigned char *data = wacom->data;
263 struct input_dev *input = wacom->pen_input;
271 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
272 if (wacom->tool[0] == BTN_TOOL_PEN)
273 wacom->id[0] = STYLUS_DEVICE_ID;
275 wacom->id[0] = ERASER_DEVICE_ID;
284 wacom->id[0] = 0;
285 input_report_key(input, wacom->tool[0], prox);
286 input_report_abs(input, ABS_MISC, wacom->id[0]);
290 static int wacom_dtus_irq(struct wacom_wac *wacom)
292 unsigned char *data = wacom->data;
293 struct input_dev *input = wacom->pen_input;
301 input = wacom->pad_input;
314 wacom->tool[0] = BTN_TOOL_RUBBER;
315 wacom->id[0] = ERASER_DEVICE_ID;
319 wacom->tool[0] = BTN_TOOL_PEN;
320 wacom->id[0] = STYLUS_DEVICE_ID;
334 wacom->id[0] = 0;
335 input_report_key(input, wacom->tool[0], prox);
336 input_report_abs(input, ABS_MISC, wacom->id[0]);
341 static int wacom_graphire_irq(struct wacom_wac *wacom)
343 struct wacom_features *features = &wacom->features;
344 unsigned char *data = wacom->data;
345 struct input_dev *input = wacom->pen_input;
346 struct input_dev *pad_input = wacom->pad_input;
366 if (prox || wacom->id[0]) {
371 wacom->tool[0] = BTN_TOOL_PEN;
372 wacom->id[0] = STYLUS_DEVICE_ID;
376 wacom->tool[0] = BTN_TOOL_RUBBER;
377 wacom->id[0] = ERASER_DEVICE_ID;
385 wacom->tool[0] = BTN_TOOL_MOUSE;
386 wacom->id[0] = CURSOR_DEVICE_ID;
392 if (wacom->tool[0] != BTN_TOOL_MOUSE) {
431 wacom->id[0] = 0;
432 input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
433 input_report_key(input, wacom->tool[0], prox);
441 if (prox || wacom->id[1]) {
442 wacom->id[1] = PAD_DEVICE_ID;
448 wacom->id[1] = 0;
449 input_report_abs(pad_input, ABS_MISC, wacom->id[1]);
456 if (prox || wacom->id[1]) {
457 wacom->id[1] = PAD_DEVICE_ID;
464 wacom->id[1] = 0;
465 input_report_abs(pad_input, ABS_MISC, wacom->id[1]);
471 if (prox || wacom->id[1]) {
472 wacom->id[1] = PAD_DEVICE_ID;
476 wacom->id[1] = 0;
477 input_report_abs(pad_input, ABS_MISC, wacom->id[1]);
488 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
498 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
503 re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]);
509 hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT);
513 static int wacom_intuos_pad(struct wacom_wac *wacom)
515 struct wacom_features *features = &wacom->features;
516 unsigned char *data = wacom->data;
517 struct input_dev *input = wacom->pad_input;
561 wacom->shared->is_touch_on =
562 !wacom->shared->is_touch_on;
576 wacom->shared->is_touch_on =
577 !wacom->shared->is_touch_on;
653 if (wacom->shared && wacom->shared->touch_input) {
654 input_report_switch(wacom->shared->touch_input,
656 !wacom->shared->is_touch_on);
657 input_sync(wacom->shared->touch_input);
666 input_report_key(input, wacom->tool[1], prox ? 1 : 0);
780 static void wacom_exit_report(struct wacom_wac *wacom)
782 struct input_dev *input = wacom->pen_input;
783 struct wacom_features *features = &wacom->features;
784 unsigned char *data = wacom->data;
796 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
813 input_report_key(input, wacom->tool[idx], 0);
815 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
816 wacom->id[idx] = 0;
819 static int wacom_intuos_inout(struct wacom_wac *wacom)
821 struct wacom_features *features = &wacom->features;
822 unsigned char *data = wacom->data;
823 struct input_dev *input = wacom->pen_input;
834 wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) +
838 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) |
841 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]);
843 wacom->shared->stylus_in_proximity = true;
850 wacom->shared->stylus_in_proximity = true;
853 if (wacom->reporting_data) {
856 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
864 wacom->shared->stylus_in_proximity = false;
865 wacom->reporting_data = false;
868 if (!wacom->id[idx])
871 wacom_exit_report(wacom);
878 static inline bool report_touch_events(struct wacom_wac *wacom)
880 return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1);
883 static inline bool delay_pen_events(struct wacom_wac *wacom)
885 return (wacom->shared->touch_down && touch_arbitration);
888 static int wacom_intuos_general(struct wacom_wac *wacom)
890 struct wacom_features *features = &wacom->features;
891 unsigned char *data = wacom->data;
892 struct input_dev *input = wacom->pen_input;
901 if (delay_pen_events(wacom))
905 if (!wacom->id[idx]) {
907 wacom_intuos_schedule_prox_event(wacom);
915 if ((!((wacom->id[idx] >> 16) & 0x01) &&
918 (wacom->tool[idx] == BTN_TOOL_LENS &&
1018 if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
1032 else if (wacom->tool[idx] == BTN_TOOL_LENS) {
1054 wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */
1055 input_report_key(input, wacom->tool[idx], 1);
1056 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
1057 wacom->reporting_data = true;
1061 static int wacom_intuos_irq(struct wacom_wac *wacom)
1063 unsigned char *data = wacom->data;
1064 struct input_dev *input = wacom->pen_input;
1081 result = wacom_intuos_pad(wacom);
1086 result = wacom_intuos_inout(wacom);
1091 result = wacom_intuos_general(wacom);
1102 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
1103 struct wacom_remote *remote = wacom->remote;
1110 hid_dbg(wacom->hdev, "%s: received unknown report #%d",
1176 wacom->led.groups[i].select = touch_ring_mode;
1190 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
1192 struct wacom_remote *remote = wacom->remote;
1216 hid_err(wacom->hdev, "Can't queue Remote status event.\n");
1233 static void wacom_intuos_bt_process_data(struct wacom_wac *wacom,
1236 memcpy(wacom->data, data, 10);
1237 wacom_intuos_irq(wacom);
1239 input_sync(wacom->pen_input);
1240 if (wacom->pad_input)
1241 input_sync(wacom->pad_input);
1244 static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
1250 memcpy(data, wacom->data, len);
1254 wacom_intuos_bt_process_data(wacom, data + i);
1258 wacom_intuos_bt_process_data(wacom, data + i);
1260 wacom_intuos_bt_process_data(wacom, data + i);
1266 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
1272 dev_dbg(wacom->pen_input->dev.parent,
1280 static int wacom_wac_finger_count_touches(struct wacom_wac *wacom)
1282 struct input_dev *input = wacom->touch_input;
1283 unsigned touch_max = wacom->features.touch_max;
1292 report_touch_events(wacom);
1304 static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
1308 struct input_dev *pen_input = wacom->pen_input;
1309 unsigned char *data = wacom->data;
1315 if (wacom->features.type == INTUOSP2_BT ||
1316 wacom->features.type == INTUOSP2S_BT) {
1317 wacom->serial[0] = get_unaligned_le64(&data[99]);
1318 wacom->id[0] = get_unaligned_le16(&data[107]);
1322 wacom->serial[0] = get_unaligned_le64(&data[33]);
1323 wacom->id[0] = get_unaligned_le16(&data[41]);
1328 if (wacom->serial[0] >> 52 == 1) {
1330 wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF;
1343 if (wacom->hid_data.time_delayed)
1344 time_interval = ktime_get() - wacom->hid_data.time_delayed;
1346 wacom->hid_data.time_delayed = time_packet_received;
1362 wacom->shared->stylus_in_proximity = false;
1363 wacom_exit_report(wacom);
1366 wacom->tool[0] = 0;
1367 wacom->id[0] = 0;
1368 wacom->serial[0] = 0;
1369 wacom->hid_data.time_delayed = 0;
1374 if (!wacom->tool[0]) { /* first in range */
1377 wacom->tool[0] = BTN_TOOL_RUBBER;
1378 else if (wacom->id[0])
1379 wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]);
1381 wacom->tool[0] = BTN_TOOL_PEN;
1387 if (wacom->features.type == INTUOSP2_BT ||
1388 wacom->features.type == INTUOSP2S_BT) {
1407 if (wacom->tool[0]) {
1409 if (wacom->features.type == INTUOSP2_BT ||
1410 wacom->features.type == INTUOSP2S_BT) {
1412 range ? frame[13] : wacom->features.distance_max);
1415 range ? frame[7] : wacom->features.distance_max);
1422 input_report_key(pen_input, wacom->tool[0], prox);
1423 input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
1425 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
1428 wacom->shared->stylus_in_proximity = prox;
1437 static void wacom_intuos_pro2_bt_touch(struct wacom_wac *wacom)
1443 struct input_dev *touch_input = wacom->touch_input;
1444 unsigned char *data = wacom->data;
1461 wacom->num_contacts_left = current_num_contacts;
1463 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
1487 wacom->num_contacts_left -= contacts_to_send;
1488 if (wacom->num_contacts_left <= 0) {
1489 wacom->num_contacts_left = 0;
1490 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1495 if (wacom->num_contacts_left == 0) {
1504 static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom)
1506 struct input_dev *pad_input = wacom->pad_input;
1507 unsigned char *data = wacom->data;
1508 int nbuttons = wacom->features.numbered_buttons;
1527 input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0);
1534 static void wacom_intuos_pro2_bt_battery(struct wacom_wac *wacom)
1536 unsigned char *data = wacom->data;
1541 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
1545 static void wacom_intuos_gen3_bt_pad(struct wacom_wac *wacom)
1547 struct input_dev *pad_input = wacom->pad_input;
1548 unsigned char *data = wacom->data;
1554 input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0);
1561 static void wacom_intuos_gen3_bt_battery(struct wacom_wac *wacom)
1563 unsigned char *data = wacom->data;
1568 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
1572 static int wacom_intuos_pro2_bt_irq(struct wacom_wac *wacom, size_t len)
1574 unsigned char *data = wacom->data;
1577 dev_dbg(wacom->pen_input->dev.parent,
1582 wacom_intuos_pro2_bt_pen(wacom);
1583 if (wacom->features.type == INTUOSP2_BT ||
1584 wacom->features.type == INTUOSP2S_BT) {
1585 wacom_intuos_pro2_bt_touch(wacom);
1586 wacom_intuos_pro2_bt_pad(wacom);
1587 wacom_intuos_pro2_bt_battery(wacom);
1589 wacom_intuos_gen3_bt_pad(wacom);
1590 wacom_intuos_gen3_bt_battery(wacom);
1595 static int wacom_24hdt_irq(struct wacom_wac *wacom)
1597 struct input_dev *input = wacom->touch_input;
1598 unsigned char *data = wacom->data;
1606 if (wacom->shared->has_mute_touch_switch &&
1607 !wacom->shared->is_touch_on) {
1608 if (!wacom->shared->touch_down)
1612 if (wacom->features.type == WACOM_27QHDT) {
1624 wacom->num_contacts_left = current_num_contacts;
1626 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
1630 bool touch = (data[offset] & 0x1) && report_touch_events(wacom);
1645 if (wacom->features.type != WACOM_27QHDT) {
1661 wacom->num_contacts_left -= contacts_to_send;
1662 if (wacom->num_contacts_left <= 0) {
1663 wacom->num_contacts_left = 0;
1664 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1669 static int wacom_mt_touch(struct wacom_wac *wacom)
1671 struct input_dev *input = wacom->touch_input;
1672 unsigned char *data = wacom->data;
1679 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
1687 wacom->num_contacts_left = current_num_contacts;
1690 contacts_to_send = min(5, wacom->num_contacts_left);
1694 bool touch = (data[offset] & 0x1) && report_touch_events(wacom);
1712 wacom->num_contacts_left -= contacts_to_send;
1713 if (wacom->num_contacts_left <= 0) {
1714 wacom->num_contacts_left = 0;
1715 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1720 static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
1722 struct input_dev *input = wacom->touch_input;
1723 unsigned char *data = wacom->data;
1728 bool touch = p && report_touch_events(wacom);
1743 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1748 static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
1750 unsigned char *data = wacom->data;
1751 struct input_dev *input = wacom->touch_input;
1752 bool prox = report_touch_events(wacom);
1755 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
1779 wacom->shared->touch_down = prox;
1784 static int wacom_tpc_pen(struct wacom_wac *wacom)
1786 unsigned char *data = wacom->data;
1787 struct input_dev *input = wacom->pen_input;
1790 if (!wacom->shared->stylus_in_proximity) /* first in prox */
1792 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
1795 wacom->shared->stylus_in_proximity = prox;
1800 if (!delay_pen_events(wacom)) {
1807 input_report_key(input, wacom->tool[0], prox);
1814 static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
1816 unsigned char *data = wacom->data;
1818 if (wacom->pen_input) {
1819 dev_dbg(wacom->pen_input->dev.parent,
1824 return wacom_tpc_pen(wacom);
1826 else if (wacom->touch_input) {
1827 dev_dbg(wacom->touch_input->dev.parent,
1832 return wacom_tpc_single_touch(wacom, len);
1835 return wacom_tpc_mt_touch(wacom);
1843 return wacom_tpc_single_touch(wacom, len);
1847 return wacom_mt_touch(wacom);
1917 struct wacom *wacom = input_get_drvdata(input);
1918 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1978 struct wacom *wacom = hid_get_drvdata(hdev);
1979 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2021 struct wacom *wacom = hid_get_drvdata(hdev);
2022 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2037 struct wacom *wacom = hid_get_drvdata(hdev);
2038 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2143 struct wacom *wacom = hid_get_drvdata(hdev);
2144 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2225 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE);
2230 for (i = 0; i < wacom->led.count; i++)
2231 wacom_update_led(wacom, features->numbered_buttons,
2249 struct wacom *wacom = hid_get_drvdata(hdev);
2250 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2258 struct wacom *wacom = hid_get_drvdata(hdev);
2259 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2275 struct wacom *wacom = hid_get_drvdata(hdev);
2276 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2354 struct wacom *wacom = hid_get_drvdata(hdev);
2355 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2373 mod_timer(&wacom->idleprox_timer, jiffies + msecs_to_jiffies(100));
2486 struct wacom *wacom = hid_get_drvdata(hdev);
2487 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2496 struct wacom *wacom = hid_get_drvdata(hdev);
2497 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2535 * To ensure compatibility with xf86-input-wacom, we should
2544 * xf86-input-wacom does not accept a serial number
2569 struct wacom *wacom = hid_get_drvdata(hdev);
2570 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2665 struct wacom *wacom = hid_get_drvdata(hdev);
2666 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2668 struct wacom_features *features = &wacom->wacom_wac.features;
2717 struct wacom *wacom = hid_get_drvdata(hdev);
2718 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2777 struct wacom *wacom = hid_get_drvdata(hdev);
2778 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2803 struct wacom *wacom = hid_get_drvdata(hdev);
2804 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2824 struct wacom *wacom = hid_get_drvdata(hdev);
2826 if (wacom->wacom_wac.features.type != HID_GENERIC)
2837 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
2839 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
2873 struct wacom *wacom = hid_get_drvdata(hdev);
2889 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
2891 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
2899 struct wacom *wacom = hid_get_drvdata(hdev);
2900 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2925 if (pad_in_hid_field && wacom->wacom_wac.pad_input)
2927 if (pen_in_hid_field && wacom->wacom_wac.pen_input)
2929 if (finger_in_hid_field && wacom->wacom_wac.touch_input)
2945 if (true_pad && wacom->wacom_wac.pad_input)
2949 static int wacom_bpt_touch(struct wacom_wac *wacom)
2951 struct wacom_features *features = &wacom->features;
2952 struct input_dev *input = wacom->touch_input;
2953 struct input_dev *pad_input = wacom->pad_input;
2954 unsigned char *data = wacom->data;
2962 bool touch = report_touch_events(wacom)
2985 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
2990 static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
2992 struct wacom_features *features = &wacom->features;
2993 struct input_dev *input = wacom->touch_input;
3000 touch = touch && report_touch_events(wacom);
3033 static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
3035 struct input_dev *input = wacom->pad_input;
3036 struct wacom_features *features = &wacom->features;
3049 static int wacom_bpt3_touch(struct wacom_wac *wacom)
3051 unsigned char *data = wacom->data;
3064 wacom_bpt3_touch_msg(wacom, data + offset);
3067 wacom_bpt3_button_msg(wacom, data + offset);
3072 if (wacom->touch_input && touch_changed) {
3073 input_mt_sync_frame(wacom->touch_input);
3074 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
3080 static int wacom_bpt_pen(struct wacom_wac *wacom)
3082 struct wacom_features *features = &wacom->features;
3083 struct input_dev *input = wacom->pen_input;
3084 unsigned char *data = wacom->data;
3096 wacom->shared->stylus_in_proximity = range;
3097 if (delay_pen_events(wacom))
3111 wacom->tool[0] = BTN_TOOL_RUBBER;
3112 wacom->id[0] = ERASER_DEVICE_ID;
3114 wacom->tool[0] = BTN_TOOL_PEN;
3115 wacom->id[0] = STYLUS_DEVICE_ID;
3117 wacom->reporting_data = true;
3129 wacom->id[0] = 0;
3132 if (wacom->reporting_data) {
3144 input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */
3145 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
3149 wacom->reporting_data = false;
3155 static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
3157 struct wacom_features *features = &wacom->features;
3161 return wacom_intuos_irq(wacom);
3163 return wacom_bpt_touch(wacom);
3165 return wacom_bpt3_touch(wacom);
3167 return wacom_bpt_pen(wacom);
3172 static void wacom_bamboo_pad_pen_event(struct wacom_wac *wacom,
3189 * No need to check if wacom->shared->pen is valid, hid_input_report()
3192 hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data,
3198 static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom,
3201 struct input_dev *input = wacom->touch_input;
3209 for (id = 0; id < wacom->features.touch_max; id++) {
3211 report_touch_events(wacom);
3233 wacom->shared->touch_down = !!prefix && report_touch_events(wacom);
3238 static int wacom_bamboo_pad_irq(struct wacom_wac *wacom, size_t len)
3240 unsigned char *data = wacom->data;
3248 wacom_bamboo_pad_pen_event(wacom, &data[1]);
3251 return wacom_bamboo_pad_touch_event(wacom, &data[9]);
3256 static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
3258 unsigned char *data = wacom->data;
3268 if ((wacom->shared->type == INTUOSHT ||
3269 wacom->shared->type == INTUOSHT2) &&
3270 wacom->shared->touch_input &&
3271 wacom->shared->touch_max) {
3272 input_report_switch(wacom->shared->touch_input,
3274 input_sync(wacom->shared->touch_input);
3280 if (wacom->pid != pid) {
3281 wacom->pid = pid;
3282 wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS);
3285 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
3288 } else if (wacom->pid != 0) {
3290 wacom->pid = 0;
3291 wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS);
3292 wacom_notify_battery(wacom, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0);
3300 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
3323 if (!wacom->battery.battery &&
3330 wacom->battery.battery) {
3525 void wacom_setup_device_quirks(struct wacom *wacom)
3527 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
3528 struct wacom_features *features = &wacom->wacom_wac.features;
3637 if (wacom->hdev->bus == BUS_BLUETOOTH)
3662 if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) {
4007 static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group)
4022 led = wacom_led_find(wacom, group, i);
4024 hid_err(wacom->hdev, "can't find LED %d in group %d\n",
4037 static bool wacom_is_led_toggled(struct wacom *wacom, int button_count,
4047 if (wacom->wacom_wac.features.type == WACOM_21UX2)
4050 group_button = group * (button_count/wacom->led.count);
4052 if (wacom->wacom_wac.features.type == INTUOSP2_BT)
4058 static void wacom_update_led(struct wacom *wacom, int button_count, int mask,
4065 if (wacom->wacom_wac.features.type == WACOM_24HD)
4066 return wacom_24hd_update_leds(wacom, mask, group);
4068 pressed = wacom_is_led_toggled(wacom, button_count, mask, group);
4069 cur = wacom->led.groups[group].select;
4071 led = wacom_led_find(wacom, group, cur);
4073 hid_err(wacom->hdev, "can't find current LED %d in group %d\n",
4086 next_led = wacom_led_next(wacom, led);
4088 hid_err(wacom->hdev, "can't find next LED in group %d\n",
4103 struct wacom *wacom = input_get_drvdata(input_dev);
4106 for (i = 0; i < wacom->led.count; i++)
4107 wacom_update_led(wacom, button_count, mask, i);
4133 /* kept for making legacy xf86-input-wacom working with the wheels */
4136 /* kept for making legacy xf86-input-wacom accepting the pad */