Re: PROBLEM: Regression likely in hid_uclogic driver breaks Huion Inspiroy H640 drawing tablet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Sat, Aug 13, 2022 at 1:09 PM José Expósito <jose.exposito89@xxxxxxxxx> wrote:

Hi Benjamin,

On Thu, Aug 11, 2022 at 05:23:52PM +0200, Benjamin Tissoires wrote:
> On Thu, Aug 4, 2022 at 8:24 PM José Expósito <jose.exposito89@xxxxxxxxx> wrote:
> >
> > Hi again,
> >
> > On 2022-07-26 18:48, José Expósito wrote:
> > > The first bad commit is 87562fcd1342 ("HID: input: remove the need for
> > > HID_QUIRK_INVERT"):
> > > https://lore.kernel.org/all/20220203143226.4023622-11-benjamin.tissoires@xxxxxxxxxx/
> > > (CCing the folks whose email is in the patch tags)
> > >
> > > I reverted the patch on hid/for-next and, after fixing a tiny conflict,
> > > I can confirm that the tablet works again as expected.
> > >
> > > I'd need to investigate a bit more over the weekend, but I think that
> > > all HUION tablets with the latest firmware (internally, v2) are
> > > affected.
> >
> > Indeed, it looks like v2 devices are affected. Similar reports:
> >
> >  - https://github.com/DIGImend/digimend-kernel-drivers/issues/626
> >  - https://bugzilla.kernel.org/show_bug.cgi?id=216106
> >
> > Kindly sending this thread back to your inbox to see if we could fix
> > this regression.
>
> [sorry, I was out on vacation the past 2 weeks and this week was the
> usual "urgent" thing I have to day for yesterday]

No problem, I hope you enjoyed your holidays :D

> Ideally, I'd like to not revert that commit. It solves a bunch of
> issues on many devices, so that's maybe not the way forward.
>
> FWIW, it was quite painful to tweak and that was a solution that
> matches the hid-multitouch devices I could find.
>
> I tried to process your email when you described the succession of
> events without much success.
>
> Would you mind dumping a hid-record when exposing the bug?

Sure, I added as an attachment in the existing report in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=216106#c2

I hope it helps you to debug the issue. Let me know if you need more
recordings, help testing patches or any other information.

In future changes to tablet code, feel free to cc me. I have a bunch of
non Wacom devices and I'll help you testing your changes.

FWIW, I found the issue: the hid-uclogic driver is emitting input data
behind hid-input, and the state between the 2 is desynchronized.

The following patch seems to be working (with the Huion v1 protocol I
have here that I have tweaked to resemble a v2):
---
From aeedd318e6cb4dbee551f67616302cc7c4308c58 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
Date: Thu, 18 Aug 2022 15:09:25 +0200
Subject: [PATCH] Fix uclogic

---
 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 c6b27aab9041..a3e2397bb3a7 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1530,7 +1530,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.36.1

---

Can someone with an affected device test it?

Cheers,
Benjamin


Best wishes,
Jose

> Cheers,
> Benjamin
>
>
> >
> > Best wishes,
> > Jose
> >
> > > Those tablets do not set the inrange bit (UCLOGIC_PARAMS_PEN_INRANGE_NONE).
> > > The driver sets it and uses a timer to remove it.
> > > See drivers/hid/hid-uclogic-core.c, function uclogic_raw_event_pen().
> > > [...]
> >
>





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux