wacom_wac.c (fcf887e7caaa813eea821d11bf2b7619a37df37a) wacom_wac.c (073b50bccbbf99a3b79a1913604c656d0e1a56c9)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * drivers/input/tablet/wacom_wac.c
4 *
5 * USB Wacom tablet support - Wacom specific code
6 */
7
8/*

--- 237 unchanged lines hidden (view full) ---

246 wacom->id[0] = 0;
247 input_report_key(input, wacom->tool[0], prox);
248 input_report_abs(input, ABS_MISC, wacom->id[0]);
249 return 1;
250}
251
252static int wacom_dtus_irq(struct wacom_wac *wacom)
253{
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * drivers/input/tablet/wacom_wac.c
4 *
5 * USB Wacom tablet support - Wacom specific code
6 */
7
8/*

--- 237 unchanged lines hidden (view full) ---

246 wacom->id[0] = 0;
247 input_report_key(input, wacom->tool[0], prox);
248 input_report_abs(input, ABS_MISC, wacom->id[0]);
249 return 1;
250}
251
252static int wacom_dtus_irq(struct wacom_wac *wacom)
253{
254 char *data = wacom->data;
254 unsigned char *data = wacom->data;
255 struct input_dev *input = wacom->pen_input;
256 unsigned short prox, pressure = 0;
257
258 if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) {
259 dev_dbg(input->dev.parent,
260 "%s: received unknown report #%d", __func__, data[0]);
261 return 0;
262 } else if (data[0] == WACOM_REPORT_DTUSPAD) {

--- 304 unchanged lines hidden (view full) ---

567 ((data[5] & 0x10) << 4) |
568 ((data[6] & 0x0F) << 4) |
569 (data[5] & 0x0F);
570 }
571 strip1 = ((data[1] & 0x1f) << 8) | data[2];
572 strip2 = ((data[3] & 0x1f) << 8) | data[4];
573 }
574
255 struct input_dev *input = wacom->pen_input;
256 unsigned short prox, pressure = 0;
257
258 if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) {
259 dev_dbg(input->dev.parent,
260 "%s: received unknown report #%d", __func__, data[0]);
261 return 0;
262 } else if (data[0] == WACOM_REPORT_DTUSPAD) {

--- 304 unchanged lines hidden (view full) ---

567 ((data[5] & 0x10) << 4) |
568 ((data[6] & 0x0F) << 4) |
569 (data[5] & 0x0F);
570 }
571 strip1 = ((data[1] & 0x1f) << 8) | data[2];
572 strip2 = ((data[3] & 0x1f) << 8) | data[4];
573 }
574
575 prox = (buttons & ~(~0 << nbuttons)) | (keys & ~(~0 << nkeys)) |
575 prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) |
576 (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2;
577
578 wacom_report_numbered_buttons(input, nbuttons, buttons);
579
580 for (i = 0; i < nkeys; i++)
581 input_report_key(input, KEY_PROG1 + i, keys & (1 << i));
582
583 input_report_abs(input, ABS_RX, strip1);

--- 257 unchanged lines hidden (view full) ---

841 x = (be16_to_cpup((__be16 *)&data[2]) << 1) | ((data[9] >> 1) & 1);
842 y = (be16_to_cpup((__be16 *)&data[4]) << 1) | (data[9] & 1);
843 distance = data[9] >> 2;
844 if (features->type < INTUOS3S) {
845 x >>= 1;
846 y >>= 1;
847 distance >>= 1;
848 }
576 (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2;
577
578 wacom_report_numbered_buttons(input, nbuttons, buttons);
579
580 for (i = 0; i < nkeys; i++)
581 input_report_key(input, KEY_PROG1 + i, keys & (1 << i));
582
583 input_report_abs(input, ABS_RX, strip1);

--- 257 unchanged lines hidden (view full) ---

841 x = (be16_to_cpup((__be16 *)&data[2]) << 1) | ((data[9] >> 1) & 1);
842 y = (be16_to_cpup((__be16 *)&data[4]) << 1) | (data[9] & 1);
843 distance = data[9] >> 2;
844 if (features->type < INTUOS3S) {
845 x >>= 1;
846 y >>= 1;
847 distance >>= 1;
848 }
849 if (features->type == INTUOSHT2)
850 distance = features->distance_max - distance;
851 input_report_abs(input, ABS_X, x);
852 input_report_abs(input, ABS_Y, y);
853 input_report_abs(input, ABS_DISTANCE, distance);
854
855 switch (type) {
856 case 0x00:
857 case 0x01:
858 case 0x02:

--- 197 unchanged lines hidden (view full) ---

1056 input_report_key(input, BTN_X, (data[10] & 0x20));
1057 input_report_key(input, BTN_Y, (data[10] & 0x40));
1058 input_report_key(input, BTN_Z, (data[10] & 0x80));
1059
1060 input_report_key(input, BTN_BASE, (data[11] & 0x01));
1061 input_report_key(input, BTN_BASE2, (data[11] & 0x02));
1062
1063 if (data[12] & 0x80)
849 input_report_abs(input, ABS_X, x);
850 input_report_abs(input, ABS_Y, y);
851 input_report_abs(input, ABS_DISTANCE, distance);
852
853 switch (type) {
854 case 0x00:
855 case 0x01:
856 case 0x02:

--- 197 unchanged lines hidden (view full) ---

1054 input_report_key(input, BTN_X, (data[10] & 0x20));
1055 input_report_key(input, BTN_Y, (data[10] & 0x40));
1056 input_report_key(input, BTN_Z, (data[10] & 0x80));
1057
1058 input_report_key(input, BTN_BASE, (data[11] & 0x01));
1059 input_report_key(input, BTN_BASE2, (data[11] & 0x02));
1060
1061 if (data[12] & 0x80)
1064 input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f) - 1);
1062 input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f));
1065 else
1066 input_report_abs(input, ABS_WHEEL, 0);
1067
1068 bat_percent = data[7] & 0x7f;
1069 bat_charging = !!(data[7] & 0x80);
1070
1071 if (data[9] | data[10] | (data[11] & 0x03) | data[12])
1072 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);

--- 214 unchanged lines hidden (view full) ---

1287 (char)frame[8]);
1288 input_report_abs(pen_input, ABS_Z, rotation);
1289 input_report_abs(pen_input, ABS_WHEEL,
1290 get_unaligned_le16(&frame[11]));
1291 }
1292 }
1293 if (wacom->tool[0]) {
1294 input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
1063 else
1064 input_report_abs(input, ABS_WHEEL, 0);
1065
1066 bat_percent = data[7] & 0x7f;
1067 bat_charging = !!(data[7] & 0x80);
1068
1069 if (data[9] | data[10] | (data[11] & 0x03) | data[12])
1070 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);

--- 214 unchanged lines hidden (view full) ---

1285 (char)frame[8]);
1286 input_report_abs(pen_input, ABS_Z, rotation);
1287 input_report_abs(pen_input, ABS_WHEEL,
1288 get_unaligned_le16(&frame[11]));
1289 }
1290 }
1291 if (wacom->tool[0]) {
1292 input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
1295 if (wacom->features.type == INTUOSP2_BT ||
1296 wacom->features.type == INTUOSP2S_BT) {
1293 if (wacom->features.type == INTUOSP2_BT) {
1297 input_report_abs(pen_input, ABS_DISTANCE,
1298 range ? frame[13] : wacom->features.distance_max);
1299 } else {
1300 input_report_abs(pen_input, ABS_DISTANCE,
1301 range ? frame[7] : wacom->features.distance_max);
1302 }
1303
1304 input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x09);

--- 3565 unchanged lines hidden ---
1294 input_report_abs(pen_input, ABS_DISTANCE,
1295 range ? frame[13] : wacom->features.distance_max);
1296 } else {
1297 input_report_abs(pen_input, ABS_DISTANCE,
1298 range ? frame[7] : wacom->features.distance_max);
1299 }
1300
1301 input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x09);

--- 3565 unchanged lines hidden ---