Re: [PATCH] HID: wacom: Set a default resolution for older tablets

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

 



On Mon, May 8, 2023 at 7:44 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, May 09, 2023 at 09:34:24AM +0700, Bagas Sanjaya wrote:
> > On Mon, May 08, 2023 at 06:05:02PM -0700, Ping Cheng wrote:
> > > Hi Stable maintainers,
> > >
> > > This patch, ID 08a46b4190d3, fixes an issue for a few older devices.
> > > It can be backported as is to all the current Long Term Supported
> > > kernels.
> > >
> >
> > Now that your fix has been upstreamed, can you provide a backport
> > for each supported stable versions (v4.14 up to v6.3)?

To speed up the process, I tested the patch on all stable branches.
The upstream patch can be APPLIED to kernels 5.15 and later, AS IS.

The attached patch applies to kernels 4.14 to 5.10. If you'd like me
to send the patch in a separate email, please let me know. Thank you
for your effort!

> Why? That's not needed if the commit can be cherry-picked cleanly
> everywhere.

Thank you @Greg KH  for your support. The Linux community would not
have got this far without people like you!

Cheers,
Ping
From 3eef69d84901f1d4369a436f87b3049e430b4b37 Mon Sep 17 00:00:00 2001
From: Ping Cheng <ping.cheng@xxxxxxxxx>
Date: Wed, 10 May 2023 10:20:14 -0700
Subject: [PATCH Longterm 4.11 1/5] HID: wacom: Set a default resolution for older tablets

Some older tablets may not report physical maximum for X/Y
coordinates. Set a default to prevent undefined resolution.

Signed-off-by: Ping Cheng <ping.cheng@xxxxxxxxx>
---
 drivers/hid/wacom_wac.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 417e1083556b..921d5184196d 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1734,6 +1734,7 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
 	int fmax = field->logical_maximum;
 	unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
 	int resolution_code = code;
+	int resolution = hidinput_calc_abs_res(field, resolution_code);
 
 	if (equivalent_usage == HID_DG_TWIST) {
 		resolution_code = ABS_RZ;
@@ -1756,8 +1757,15 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
 	switch (type) {
 	case EV_ABS:
 		input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
-		input_abs_set_res(input, code,
-				  hidinput_calc_abs_res(field, resolution_code));
+
+		/* older tablet may miss physical usage */
+		if ((code == ABS_X || code == ABS_Y) && !resolution) {
+			resolution = WACOM_INTUOS_RES;
+			hid_warn(input,
+				 "Wacom usage (%d) missing resolution \n",
+				 code);
+		}
+		input_abs_set_res(input, code, resolution);
 		break;
 	case EV_KEY:
 		input_set_capability(input, EV_KEY, code);
-- 
2.40.1


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux