linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: input: fix uclogic tablets
@ 2022-08-22  6:22 Benjamin Tissoires
  2022-08-25  9:47 ` Jiri Kosina
  2022-08-28  9:56 ` José Expósito
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2022-08-22  6:22 UTC (permalink / raw)
  To: Jiri Kosina, Stefan Hansson, José Expósito
  Cc: linux-input, linux-kernel, Benjamin Tissoires

commit 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT")
made the assumption that it was the only one handling tablets and thus
kept an internal state regarding the tool.

Turns out that the uclogic driver has a timer to release the in range
bit, effectively making hid-input ignoring all in range information
after the very first one.

Fix that by having a more rationale approach which consists in forwarding
every event and let the input stack filter out the duplicates.

Reported-by: Stefan Hansson <newbie13xd@gmail.com>
Fixes: 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT")
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/hid-input.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 48c1c02c69f4..871a185a0f1f 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1532,7 +1532,10 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 			 * assume ours
 			 */
 			if (!report->tool)
-				hid_report_set_tool(report, input, usage->code);
+				report->tool = usage->code;
+
+			/* drivers may have changed the value behind our back, resend it */
+			hid_report_set_tool(report, input, report->tool);
 		} else {
 			hid_report_release_tool(report, input, usage->code);
 		}
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: input: fix uclogic tablets
  2022-08-22  6:22 [PATCH] HID: input: fix uclogic tablets Benjamin Tissoires
@ 2022-08-25  9:47 ` Jiri Kosina
  2022-08-28  9:56 ` José Expósito
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2022-08-25  9:47 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Stefan Hansson, José Expósito, linux-input, linux-kernel

On Mon, 22 Aug 2022, Benjamin Tissoires wrote:

> commit 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT")
> made the assumption that it was the only one handling tablets and thus
> kept an internal state regarding the tool.
> 
> Turns out that the uclogic driver has a timer to release the in range
> bit, effectively making hid-input ignoring all in range information
> after the very first one.
> 
> Fix that by having a more rationale approach which consists in forwarding
> every event and let the input stack filter out the duplicates.
> 
> Reported-by: Stefan Hansson <newbie13xd@gmail.com>
> Fixes: 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT")
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>  drivers/hid/hid-input.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 48c1c02c69f4..871a185a0f1f 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -1532,7 +1532,10 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
>  			 * assume ours
>  			 */
>  			if (!report->tool)
> -				hid_report_set_tool(report, input, usage->code);
> +				report->tool = usage->code;
> +
> +			/* drivers may have changed the value behind our back, resend it */
> +			hid_report_set_tool(report, input, report->tool);
>  		} else {
>  			hid_report_release_tool(report, input, usage->code);

Queued in for-6.0/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: input: fix uclogic tablets
  2022-08-22  6:22 [PATCH] HID: input: fix uclogic tablets Benjamin Tissoires
  2022-08-25  9:47 ` Jiri Kosina
@ 2022-08-28  9:56 ` José Expósito
  1 sibling, 0 replies; 3+ messages in thread
From: José Expósito @ 2022-08-28  9:56 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Jiri Kosina, Stefan Hansson, linux-input, linux-kernel

Hi Benjamin,

On Mon, Aug 22, 2022 at 08:22:47AM +0200, Benjamin Tissoires wrote:
> commit 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT")
> made the assumption that it was the only one handling tablets and thus
> kept an internal state regarding the tool.
> 
> Turns out that the uclogic driver has a timer to release the in range
> bit, effectively making hid-input ignoring all in range information
> after the very first one.
> 
> Fix that by having a more rationale approach which consists in forwarding
> every event and let the input stack filter out the duplicates.

Apologies for the delayed response, I was on holiday.

Tested on the affected device (HUION H640P) and I can confirm that the
issue is fixed.

I also tested in other non-Wacom tablets and they keep working as
expected.

Best wishes,
Jose

> Reported-by: Stefan Hansson <newbie13xd@gmail.com>
> Fixes: 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT")
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>  drivers/hid/hid-input.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 48c1c02c69f4..871a185a0f1f 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -1532,7 +1532,10 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
>  			 * assume ours
>  			 */
>  			if (!report->tool)
> -				hid_report_set_tool(report, input, usage->code);
> +				report->tool = usage->code;
> +
> +			/* drivers may have changed the value behind our back, resend it */
> +			hid_report_set_tool(report, input, report->tool);
>  		} else {
>  			hid_report_release_tool(report, input, usage->code);
>  		}
> -- 
> 2.37.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-28  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22  6:22 [PATCH] HID: input: fix uclogic tablets Benjamin Tissoires
2022-08-25  9:47 ` Jiri Kosina
2022-08-28  9:56 ` José Expósito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).