Skip to content

Commit 9c59843

Browse files
Pinglinuxjigpu
authored andcommitted
HID: wacom: Only report rotation for art pen
The generic routine, wacom_wac_pen_event, turns rotation value 90 degree anti-clockwise before posting the events. This non-zero event trggers a non-zero ABS_Z event for non art pen tools. However, HID_DG_TWIST is only supported by art pen. [[email protected]: fix build: add missing brace] Cc: [email protected] Signed-off-by: Ping Cheng <[email protected]> Reviewed-by: Jason Gerecke <[email protected]> -- Hi Jiri, This is kind of a version 2 of the last one I posted two days ago. I updated the logic so it has less changed lines: 29 vs 158! Hopefully, the logic is easier to follow now. Please ignore the last one. Thank you! Signed-off-by: Jiri Kosina <[email protected]> [[email protected]: Imported into input-wacom (7ccced33a0)] Signed-off-by: Jason Gerecke <[email protected]>
1 parent 09a55bc commit 9c59843

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

4.5/wacom_wac.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,26 @@ static int wacom_intuos_id_mangle(int tool_id)
642642
return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF);
643643
}
644644

645+
static bool wacom_is_art_pen(int tool_id)
646+
{
647+
bool is_art_pen = false;
648+
649+
switch (tool_id) {
650+
case 0x885: /* Intuos3 Marker Pen */
651+
case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */
652+
case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */
653+
is_art_pen = true;
654+
break;
655+
}
656+
return is_art_pen;
657+
}
658+
645659
static int wacom_intuos_get_tool_type(int tool_id)
646660
{
647-
int tool_type;
661+
int tool_type = BTN_TOOL_PEN;
662+
663+
if (wacom_is_art_pen(tool_id))
664+
return tool_type;
648665

649666
switch (tool_id) {
650667
case 0x812: /* Inking pen */
@@ -659,12 +676,9 @@ static int wacom_intuos_get_tool_type(int tool_id)
659676
case 0x852:
660677
case 0x823: /* Intuos3 Grip Pen */
661678
case 0x813: /* Intuos3 Classic Pen */
662-
case 0x885: /* Intuos3 Marker Pen */
663679
case 0x802: /* Intuos4/5 13HD/24HD General Pen */
664-
case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */
665680
case 0x8e2: /* IntuosHT2 pen */
666681
case 0x022:
667-
case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */
668682
case 0x10842: /* MobileStudio Pro Pro Pen slim */
669683
case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */
670684
case 0x16802: /* Cintiq 13HD Pro Pen */
@@ -722,10 +736,6 @@ static int wacom_intuos_get_tool_type(int tool_id)
722736
case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */
723737
tool_type = BTN_TOOL_AIRBRUSH;
724738
break;
725-
726-
default: /* Unknown tool */
727-
tool_type = BTN_TOOL_PEN;
728-
break;
729739
}
730740
return tool_type;
731741
}
@@ -2345,6 +2355,9 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
23452355
}
23462356
return;
23472357
case HID_DG_TWIST:
2358+
/* don't modify the value if the pen doesn't support the feature */
2359+
if (!wacom_is_art_pen(wacom_wac->id[0])) return;
2360+
23482361
/*
23492362
* Userspace expects pen twist to have its zero point when
23502363
* the buttons/finger is on the tablet's left. HID values

0 commit comments

Comments
 (0)