[PATCH] HID: wacom: Hardcode (non-inverted) AES pens as BTN_TOOL_PEN

Gerecke, Jason posted 1 patch 1 month, 2 weeks ago
drivers/hid/wacom_wac.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] HID: wacom: Hardcode (non-inverted) AES pens as BTN_TOOL_PEN
Posted by Gerecke, Jason 1 month, 2 weeks ago
From: Jason Gerecke <jason.gerecke@wacom.com>

Unlike EMR tools which encode type information in their tool ID, tools
for AES sensors are all "generic pens". It is inappropriate to make use
of the wacom_intuos_get_tool_type function when dealing with these kinds
of devices. Instead, we should only ever report BTN_TOOL_PEN or
BTN_TOOL_RUBBER, as depending on the state of the Eraser and Invert
bits.

Fixes: 9c2913b962da ("HID: wacom: more appropriate tool type categorization")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Cc: stable@vger.kernel.org
---
 drivers/hid/wacom_wac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 59a13ad9371cd..413606bdf476d 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2567,6 +2567,8 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
 		/* Going into range select tool */
 		if (wacom_wac->hid_data.invert_state)
 			wacom_wac->tool[0] = BTN_TOOL_RUBBER;
+		else if (wacom_wac->features.quirks & WACOM_QUIRK_AESPEN)
+			wacom_wac->tool[0] = BTN_TOOL_PEN;
 		else if (wacom_wac->id[0])
 			wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]);
 		else
-- 
2.46.2
Re: [PATCH] HID: wacom: Hardcode (non-inverted) AES pens as BTN_TOOL_PEN
Posted by Benjamin Tissoires 1 month, 2 weeks ago
On Oct 08 2024, Gerecke, Jason wrote:
> From: Jason Gerecke <jason.gerecke@wacom.com>
> 
> Unlike EMR tools which encode type information in their tool ID, tools
> for AES sensors are all "generic pens". It is inappropriate to make use
> of the wacom_intuos_get_tool_type function when dealing with these kinds
> of devices. Instead, we should only ever report BTN_TOOL_PEN or
> BTN_TOOL_RUBBER, as depending on the state of the Eraser and Invert
> bits.
> 
> Fixes: 9c2913b962da ("HID: wacom: more appropriate tool type categorization")
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Cc: stable@vger.kernel.org

Thanks for the quick fix Jason.

You are however missing a few links/reported-by:

Reported-by: Daniel Jutz <daniel@djutz.com>
Closes: https://lore.kernel.org/linux-input/3cd82004-c5b8-4f2a-9a3b-d88d855c65e4@heusel.eu/
Bisected-by: Christian Heusel <christian@heusel.eu>
Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1041
Link: https://github.com/linuxwacom/input-wacom/issues/440
Acked-by: Benjamin Tissoires <bentiss@kernel.org>

Hopefully with the above b4 would pick those out without having to send
a v2.

Cheers,
Benjamin

> ---
>  drivers/hid/wacom_wac.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 59a13ad9371cd..413606bdf476d 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -2567,6 +2567,8 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
>  		/* Going into range select tool */
>  		if (wacom_wac->hid_data.invert_state)
>  			wacom_wac->tool[0] = BTN_TOOL_RUBBER;
> +		else if (wacom_wac->features.quirks & WACOM_QUIRK_AESPEN)
> +			wacom_wac->tool[0] = BTN_TOOL_PEN;
>  		else if (wacom_wac->id[0])
>  			wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]);
>  		else
> -- 
> 2.46.2
>