Lines Matching defs:wacom

7 #include "wacom.h"
38 static void wacom_update_led(struct wacom *wacom, int button_count, int mask,
66 struct wacom *wacom = from_timer(wacom, list, idleprox_timer);
67 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
73 hid_warn(wacom->hdev, "%s: tool appears to be hung in-prox. forcing it out.\n", __func__);
115 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
116 bool bat_initialized = wacom->battery.battery;
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);
885 static inline bool report_touch_events(struct wacom_wac *wacom)
887 return (touch_arbitration ? !wacom->shared->stylus_in_proximity : 1);
890 static inline bool delay_pen_events(struct wacom_wac *wacom)
892 return (wacom->shared->touch_down && touch_arbitration);
895 static int wacom_intuos_general(struct wacom_wac *wacom)
897 struct wacom_features *features = &wacom->features;
898 unsigned char *data = wacom->data;
899 struct input_dev *input = wacom->pen_input;
908 if (delay_pen_events(wacom))
912 if (!wacom->id[idx]) {
914 wacom_intuos_schedule_prox_event(wacom);
922 if ((!((wacom->id[idx] >> 16) & 0x01) &&
925 (wacom->tool[idx] == BTN_TOOL_LENS &&
1025 if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
1039 else if (wacom->tool[idx] == BTN_TOOL_LENS) {
1061 wacom_intuos_id_mangle(wacom->id[idx])); /* report tool id */
1062 input_report_key(input, wacom->tool[idx], 1);
1063 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
1064 wacom->reporting_data = true;
1068 static int wacom_intuos_irq(struct wacom_wac *wacom)
1070 unsigned char *data = wacom->data;
1071 struct input_dev *input = wacom->pen_input;
1088 result = wacom_intuos_pad(wacom);
1093 result = wacom_intuos_inout(wacom);
1098 result = wacom_intuos_general(wacom);
1109 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
1110 struct wacom_remote *remote = wacom->remote;
1117 hid_dbg(wacom->hdev, "%s: received unknown report #%d",
1183 wacom->led.groups[i].select = touch_ring_mode;
1197 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
1199 struct wacom_remote *remote = wacom->remote;
1221 hid_err(wacom->hdev, "Can't queue Remote status event.\n");
1238 static void wacom_intuos_bt_process_data(struct wacom_wac *wacom,
1241 memcpy(wacom->data, data, 10);
1242 wacom_intuos_irq(wacom);
1244 input_sync(wacom->pen_input);
1245 if (wacom->pad_input)
1246 input_sync(wacom->pad_input);
1249 static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
1255 memcpy(data, wacom->data, len);
1259 wacom_intuos_bt_process_data(wacom, data + i);
1263 wacom_intuos_bt_process_data(wacom, data + i);
1265 wacom_intuos_bt_process_data(wacom, data + i);
1271 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
1277 dev_dbg(wacom->pen_input->dev.parent,
1285 static int wacom_wac_finger_count_touches(struct wacom_wac *wacom)
1287 struct input_dev *input = wacom->touch_input;
1288 unsigned touch_max = wacom->features.touch_max;
1297 report_touch_events(wacom);
1309 static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
1313 struct input_dev *pen_input = wacom->pen_input;
1314 unsigned char *data = wacom->data;
1320 if (wacom->features.type == INTUOSP2_BT ||
1321 wacom->features.type == INTUOSP2S_BT) {
1322 wacom->serial[0] = get_unaligned_le64(&data[99]);
1323 wacom->id[0] = get_unaligned_le16(&data[107]);
1327 wacom->serial[0] = get_unaligned_le64(&data[33]);
1328 wacom->id[0] = get_unaligned_le16(&data[41]);
1333 if (wacom->serial[0] >> 52 == 1) {
1335 wacom->id[0] |= (wacom->serial[0] >> 32) & 0xFFFFF;
1348 if (wacom->hid_data.time_delayed)
1349 time_interval = ktime_get() - wacom->hid_data.time_delayed;
1351 wacom->hid_data.time_delayed = time_packet_received;
1367 wacom->shared->stylus_in_proximity = false;
1368 wacom_exit_report(wacom);
1371 wacom->tool[0] = 0;
1372 wacom->id[0] = 0;
1373 wacom->serial[0] = 0;
1374 wacom->hid_data.time_delayed = 0;
1379 if (!wacom->tool[0]) { /* first in range */
1382 wacom->tool[0] = BTN_TOOL_RUBBER;
1383 else if (wacom->id[0])
1384 wacom->tool[0] = wacom_intuos_get_tool_type(wacom->id[0]);
1386 wacom->tool[0] = BTN_TOOL_PEN;
1392 if (wacom->features.type == INTUOSP2_BT ||
1393 wacom->features.type == INTUOSP2S_BT) {
1412 if (wacom->tool[0]) {
1414 if (wacom->features.type == INTUOSP2_BT ||
1415 wacom->features.type == INTUOSP2S_BT) {
1417 range ? frame[13] : wacom->features.distance_max);
1420 range ? frame[7] : wacom->features.distance_max);
1427 input_report_key(pen_input, wacom->tool[0], prox);
1428 input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
1430 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
1433 wacom->shared->stylus_in_proximity = prox;
1442 static void wacom_intuos_pro2_bt_touch(struct wacom_wac *wacom)
1448 struct input_dev *touch_input = wacom->touch_input;
1449 unsigned char *data = wacom->data;
1466 wacom->num_contacts_left = current_num_contacts;
1468 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
1492 wacom->num_contacts_left -= contacts_to_send;
1493 if (wacom->num_contacts_left <= 0) {
1494 wacom->num_contacts_left = 0;
1495 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1500 if (wacom->num_contacts_left == 0) {
1509 static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom)
1511 struct input_dev *pad_input = wacom->pad_input;
1512 unsigned char *data = wacom->data;
1513 int nbuttons = wacom->features.numbered_buttons;
1532 input_report_key(pad_input, wacom->tool[1], prox ? 1 : 0);
1539 static void wacom_intuos_pro2_bt_battery(struct wacom_wac *wacom)
1541 unsigned char *data = wacom->data;
1546 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
1550 static void wacom_intuos_gen3_bt_pad(struct wacom_wac *wacom)
1552 struct input_dev *pad_input = wacom->pad_input;
1553 unsigned char *data = wacom->data;
1559 input_report_key(pad_input, wacom->tool[1], buttons ? 1 : 0);
1566 static void wacom_intuos_gen3_bt_battery(struct wacom_wac *wacom)
1568 unsigned char *data = wacom->data;
1573 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
1577 static int wacom_intuos_pro2_bt_irq(struct wacom_wac *wacom, size_t len)
1579 unsigned char *data = wacom->data;
1582 dev_dbg(wacom->pen_input->dev.parent,
1587 wacom_intuos_pro2_bt_pen(wacom);
1588 if (wacom->features.type == INTUOSP2_BT ||
1589 wacom->features.type == INTUOSP2S_BT) {
1590 wacom_intuos_pro2_bt_touch(wacom);
1591 wacom_intuos_pro2_bt_pad(wacom);
1592 wacom_intuos_pro2_bt_battery(wacom);
1594 wacom_intuos_gen3_bt_pad(wacom);
1595 wacom_intuos_gen3_bt_battery(wacom);
1600 static int wacom_24hdt_irq(struct wacom_wac *wacom)
1602 struct input_dev *input = wacom->touch_input;
1603 unsigned char *data = wacom->data;
1611 if (touch_is_muted(wacom) && !wacom->shared->touch_down)
1614 if (wacom->features.type == WACOM_27QHDT) {
1626 wacom->num_contacts_left = current_num_contacts;
1628 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
1632 bool touch = (data[offset] & 0x1) && report_touch_events(wacom);
1647 if (wacom->features.type != WACOM_27QHDT) {
1663 wacom->num_contacts_left -= contacts_to_send;
1664 if (wacom->num_contacts_left <= 0) {
1665 wacom->num_contacts_left = 0;
1666 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1671 static int wacom_mt_touch(struct wacom_wac *wacom)
1673 struct input_dev *input = wacom->touch_input;
1674 unsigned char *data = wacom->data;
1681 if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
1689 wacom->num_contacts_left = current_num_contacts;
1692 contacts_to_send = min(5, wacom->num_contacts_left);
1696 bool touch = (data[offset] & 0x1) && report_touch_events(wacom);
1714 wacom->num_contacts_left -= contacts_to_send;
1715 if (wacom->num_contacts_left <= 0) {
1716 wacom->num_contacts_left = 0;
1717 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1722 static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
1724 struct input_dev *input = wacom->touch_input;
1725 unsigned char *data = wacom->data;
1730 bool touch = p && report_touch_events(wacom);
1745 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
1750 static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
1752 unsigned char *data = wacom->data;
1753 struct input_dev *input = wacom->touch_input;
1754 bool prox = report_touch_events(wacom);
1757 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
1781 wacom->shared->touch_down = prox;
1786 static int wacom_tpc_pen(struct wacom_wac *wacom)
1788 unsigned char *data = wacom->data;
1789 struct input_dev *input = wacom->pen_input;
1792 if (!wacom->shared->stylus_in_proximity) /* first in prox */
1794 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
1797 wacom->shared->stylus_in_proximity = prox;
1802 if (!delay_pen_events(wacom)) {
1809 input_report_key(input, wacom->tool[0], prox);
1816 static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
1818 unsigned char *data = wacom->data;
1820 if (wacom->pen_input) {
1821 dev_dbg(wacom->pen_input->dev.parent,
1826 return wacom_tpc_pen(wacom);
1828 else if (wacom->touch_input) {
1829 dev_dbg(wacom->touch_input->dev.parent,
1834 return wacom_tpc_single_touch(wacom, len);
1837 return wacom_tpc_mt_touch(wacom);
1845 return wacom_tpc_single_touch(wacom, len);
1849 return wacom_mt_touch(wacom);
1921 struct wacom *wacom = input_get_drvdata(input);
1922 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1976 struct wacom *wacom = hid_get_drvdata(hdev);
1977 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2019 struct wacom *wacom = hid_get_drvdata(hdev);
2020 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2035 struct wacom *wacom = hid_get_drvdata(hdev);
2036 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2144 struct wacom *wacom = hid_get_drvdata(hdev);
2145 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2226 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_MODE_CHANGE);
2231 for (i = 0; i < wacom->led.count; i++)
2232 wacom_update_led(wacom, features->numbered_buttons,
2250 struct wacom *wacom = hid_get_drvdata(hdev);
2251 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2259 struct wacom *wacom = hid_get_drvdata(hdev);
2260 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2291 struct wacom *wacom = hid_get_drvdata(hdev);
2292 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2376 struct wacom *wacom = hid_get_drvdata(hdev);
2377 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2395 mod_timer(&wacom->idleprox_timer, jiffies + msecs_to_jiffies(100));
2516 struct wacom *wacom = hid_get_drvdata(hdev);
2517 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2526 struct wacom *wacom = hid_get_drvdata(hdev);
2527 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2569 * To ensure compatibility with xf86-input-wacom, we should
2578 * xf86-input-wacom does not accept a serial number
2603 struct wacom *wacom = hid_get_drvdata(hdev);
2604 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2713 struct wacom *wacom = hid_get_drvdata(hdev);
2714 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2716 struct wacom_features *features = &wacom->wacom_wac.features;
2768 struct wacom *wacom = hid_get_drvdata(hdev);
2769 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2831 struct wacom *wacom = hid_get_drvdata(hdev);
2832 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2861 struct wacom *wacom = hid_get_drvdata(hdev);
2862 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2882 struct wacom *wacom = hid_get_drvdata(hdev);
2884 if (wacom->wacom_wac.features.type != HID_GENERIC)
2895 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
2897 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
2931 struct wacom *wacom = hid_get_drvdata(hdev);
2947 else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
2949 else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
2957 struct wacom *wacom = hid_get_drvdata(hdev);
2958 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2983 if (pad_in_hid_field && wacom->wacom_wac.pad_input)
2985 if (pen_in_hid_field && wacom->wacom_wac.pen_input)
2987 if (finger_in_hid_field && wacom->wacom_wac.touch_input)
3003 if (true_pad && wacom->wacom_wac.pad_input)
3007 static int wacom_bpt_touch(struct wacom_wac *wacom)
3009 struct wacom_features *features = &wacom->features;
3010 struct input_dev *input = wacom->touch_input;
3011 struct input_dev *pad_input = wacom->pad_input;
3012 unsigned char *data = wacom->data;
3020 bool touch = report_touch_events(wacom)
3043 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
3048 static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
3050 struct wacom_features *features = &wacom->features;
3051 struct input_dev *input = wacom->touch_input;
3058 touch = touch && report_touch_events(wacom);
3091 static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
3093 struct input_dev *input = wacom->pad_input;
3094 struct wacom_features *features = &wacom->features;
3107 static int wacom_bpt3_touch(struct wacom_wac *wacom)
3109 unsigned char *data = wacom->data;
3122 wacom_bpt3_touch_msg(wacom, data + offset);
3125 wacom_bpt3_button_msg(wacom, data + offset);
3130 if (wacom->touch_input && touch_changed) {
3131 input_mt_sync_frame(wacom->touch_input);
3132 wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
3138 static int wacom_bpt_pen(struct wacom_wac *wacom)
3140 struct wacom_features *features = &wacom->features;
3141 struct input_dev *input = wacom->pen_input;
3142 unsigned char *data = wacom->data;
3154 wacom->shared->stylus_in_proximity = range;
3155 if (delay_pen_events(wacom))
3169 wacom->tool[0] = BTN_TOOL_RUBBER;
3170 wacom->id[0] = ERASER_DEVICE_ID;
3172 wacom->tool[0] = BTN_TOOL_PEN;
3173 wacom->id[0] = STYLUS_DEVICE_ID;
3175 wacom->reporting_data = true;
3187 wacom->id[0] = 0;
3190 if (wacom->reporting_data) {
3202 input_report_key(input, wacom->tool[0], range); /* PEN or RUBBER */
3203 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
3207 wacom->reporting_data = false;
3213 static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
3215 struct wacom_features *features = &wacom->features;
3219 return wacom_intuos_irq(wacom);
3221 return wacom_bpt_touch(wacom);
3223 return wacom_bpt3_touch(wacom);
3225 return wacom_bpt_pen(wacom);
3230 static void wacom_bamboo_pad_pen_event(struct wacom_wac *wacom,
3247 * No need to check if wacom->shared->pen is valid, hid_input_report()
3250 hid_input_report(wacom->shared->pen, HID_INPUT_REPORT, data,
3256 static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom,
3259 struct input_dev *input = wacom->touch_input;
3267 for (id = 0; id < wacom->features.touch_max; id++) {
3269 report_touch_events(wacom);
3291 wacom->shared->touch_down = !!prefix && report_touch_events(wacom);
3296 static int wacom_bamboo_pad_irq(struct wacom_wac *wacom, size_t len)
3298 unsigned char *data = wacom->data;
3306 wacom_bamboo_pad_pen_event(wacom, &data[1]);
3309 return wacom_bamboo_pad_touch_event(wacom, &data[9]);
3314 static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
3316 unsigned char *data = wacom->data;
3326 if ((wacom->shared->type == INTUOSHT ||
3327 wacom->shared->type == INTUOSHT2) &&
3328 wacom->shared->touch_input &&
3329 wacom->shared->touch_max) {
3330 input_report_switch(wacom->shared->touch_input,
3332 input_sync(wacom->shared->touch_input);
3338 if (wacom->pid != pid) {
3339 wacom->pid = pid;
3340 wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS);
3343 wacom_notify_battery(wacom, WACOM_POWER_SUPPLY_STATUS_AUTO,
3346 } else if (wacom->pid != 0) {
3348 wacom->pid = 0;
3349 wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS);
3350 wacom_notify_battery(wacom, POWER_SUPPLY_STATUS_UNKNOWN, 0, 0, 0, 0);
3358 struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
3383 wacom->battery.battery) {
3577 void wacom_setup_device_quirks(struct wacom *wacom)
3579 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
3580 struct wacom_features *features = &wacom->wacom_wac.features;
3689 if (wacom->hdev->bus == BUS_BLUETOOTH)
3714 if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) {
4058 static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group)
4073 led = wacom_led_find(wacom, group, i);
4075 hid_err(wacom->hdev, "can't find LED %d in group %d\n",
4088 static bool wacom_is_led_toggled(struct wacom *wacom, int button_count,
4098 if (wacom->wacom_wac.features.type == WACOM_21UX2)
4101 group_button = group * (button_count/wacom->led.count);
4103 if (wacom->wacom_wac.features.type == INTUOSP2_BT)
4109 static void wacom_update_led(struct wacom *wacom, int button_count, int mask,
4116 if (wacom->wacom_wac.features.type == WACOM_24HD)
4117 return wacom_24hd_update_leds(wacom, mask, group);
4119 pressed = wacom_is_led_toggled(wacom, button_count, mask, group);
4120 cur = wacom->led.groups[group].select;
4122 led = wacom_led_find(wacom, group, cur);
4124 hid_err(wacom->hdev, "can't find current LED %d in group %d\n",
4137 next_led = wacom_led_next(wacom, led);
4139 hid_err(wacom->hdev, "can't find next LED in group %d\n",
4154 struct wacom *wacom = input_get_drvdata(input_dev);
4157 for (i = 0; i < wacom->led.count; i++)
4158 wacom_update_led(wacom, button_count, mask, i);
4184 /* kept for making legacy xf86-input-wacom working with the wheels */
4187 /* kept for making legacy xf86-input-wacom accepting the pad */