All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: Set a default resolution for older tablets
@ 2023-04-09 16:42 Ping Cheng
  2023-04-13 14:37 ` Benjamin Tissoires
  2023-05-09  1:05 ` Ping Cheng
  0 siblings, 2 replies; 9+ messages in thread
From: Ping Cheng @ 2023-04-09 16:42 UTC (permalink / raw)
  To: linux-input
  Cc: jkosina, jason.gerecke, aaron.skomra, joshua.dickens, Ping Cheng

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@wacom.com>
---
 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 9312d611db8e..e499b447d48c 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1895,6 +1895,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;
@@ -1915,8 +1916,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:
 	case EV_MSC:
-- 
2.39.2


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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-04-09 16:42 [PATCH] HID: wacom: Set a default resolution for older tablets Ping Cheng
@ 2023-04-13 14:37 ` Benjamin Tissoires
  2023-04-13 23:30   ` Ping Cheng
  2023-05-09  1:05 ` Ping Cheng
  1 sibling, 1 reply; 9+ messages in thread
From: Benjamin Tissoires @ 2023-04-13 14:37 UTC (permalink / raw)
  To: linux-input, Ping Cheng
  Cc: jkosina, jason.gerecke, aaron.skomra, joshua.dickens, Ping Cheng

On Sun, 09 Apr 2023 09:42:29 -0700, Ping Cheng wrote:
> Some older tablets may not report physical maximum for X/Y
> coordinates. Set a default to prevent undefined resolution.
> 
> 

Applied to hid/hid.git (for-6.4/wacom), thanks!

[1/1] HID: wacom: Set a default resolution for older tablets
      https://git.kernel.org/hid/hid/c/08a46b4190d3

Cheers,
-- 
Benjamin Tissoires <benjamin.tissoires@redhat.com>


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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-04-13 14:37 ` Benjamin Tissoires
@ 2023-04-13 23:30   ` Ping Cheng
  2023-04-14  7:55     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Ping Cheng @ 2023-04-13 23:30 UTC (permalink / raw)
  To: stable # v4 . 10

On Thu, Apr 13, 2023 at 7:37 AM Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>
> On Sun, 09 Apr 2023 09:42:29 -0700, Ping Cheng wrote:
> > Some older tablets may not report physical maximum for X/Y
> > coordinates. Set a default to prevent undefined resolution.
> >
> >
>
> Applied to hid/hid.git (for-6.4/wacom), thanks!
>
> [1/1] HID: wacom: Set a default resolution for older tablets
>       https://git.kernel.org/hid/hid/c/08a46b4190d3

This patch can be backported to kernels as early as 3.18. It fixes a
firmware HID descriptor issue.

Thank you,
Ping

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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-04-13 23:30   ` Ping Cheng
@ 2023-04-14  7:55     ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2023-04-14  7:55 UTC (permalink / raw)
  To: Ping Cheng; +Cc: stable # v4 . 10

On Thu, Apr 13, 2023 at 04:30:33PM -0700, Ping Cheng wrote:
> On Thu, Apr 13, 2023 at 7:37 AM Benjamin Tissoires
> <benjamin.tissoires@redhat.com> wrote:
> >
> > On Sun, 09 Apr 2023 09:42:29 -0700, Ping Cheng wrote:
> > > Some older tablets may not report physical maximum for X/Y
> > > coordinates. Set a default to prevent undefined resolution.
> > >
> > >
> >
> > Applied to hid/hid.git (for-6.4/wacom), thanks!
> >
> > [1/1] HID: wacom: Set a default resolution for older tablets
> >       https://git.kernel.org/hid/hid/c/08a46b4190d3
> 
> This patch can be backported to kernels as early as 3.18. It fixes a
> firmware HID descriptor issue.


<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

* [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-04-09 16:42 [PATCH] HID: wacom: Set a default resolution for older tablets Ping Cheng
  2023-04-13 14:37 ` Benjamin Tissoires
@ 2023-05-09  1:05 ` Ping Cheng
  2023-05-09  2:34   ` Bagas Sanjaya
  1 sibling, 1 reply; 9+ messages in thread
From: Ping Cheng @ 2023-05-09  1:05 UTC (permalink / raw)
  To: stable # v4 . 10

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.

Thank you,
Ping

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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-05-09  1:05 ` Ping Cheng
@ 2023-05-09  2:34   ` Bagas Sanjaya
  2023-05-09  2:44     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Bagas Sanjaya @ 2023-05-09  2:34 UTC (permalink / raw)
  To: Ping Cheng, Linux Stable

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

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)?

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-05-09  2:34   ` Bagas Sanjaya
@ 2023-05-09  2:44     ` Greg KH
  2023-05-11  0:06       ` Ping Cheng
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2023-05-09  2:44 UTC (permalink / raw)
  To: Bagas Sanjaya; +Cc: Ping Cheng, Linux Stable

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)?

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

Please do not ask people to do unnecessary things.

greg k-h

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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-05-09  2:44     ` Greg KH
@ 2023-05-11  0:06       ` Ping Cheng
  2023-05-13  7:50         ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Ping Cheng @ 2023-05-11  0:06 UTC (permalink / raw)
  To: Greg KH; +Cc: Bagas Sanjaya, Linux Stable

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

On Mon, May 8, 2023 at 7:44 PM Greg KH <gregkh@linuxfoundation.org> 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

[-- Attachment #2: 0001-HID-wacom-Set-a-default-resolution-for-older-tablets.patch --]
[-- Type: text/x-patch, Size: 1685 bytes --]

From 3eef69d84901f1d4369a436f87b3049e430b4b37 Mon Sep 17 00:00:00 2001
From: Ping Cheng <ping.cheng@wacom.com>
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@wacom.com>
---
 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


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

* Re: [PATCH] HID: wacom: Set a default resolution for older tablets
  2023-05-11  0:06       ` Ping Cheng
@ 2023-05-13  7:50         ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2023-05-13  7:50 UTC (permalink / raw)
  To: Ping Cheng; +Cc: Bagas Sanjaya, Linux Stable

On Wed, May 10, 2023 at 05:06:03PM -0700, Ping Cheng wrote:
> On Mon, May 8, 2023 at 7:44 PM Greg KH <gregkh@linuxfoundation.org> 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!

All now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2023-05-13  8:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-09 16:42 [PATCH] HID: wacom: Set a default resolution for older tablets Ping Cheng
2023-04-13 14:37 ` Benjamin Tissoires
2023-04-13 23:30   ` Ping Cheng
2023-04-14  7:55     ` Greg KH
2023-05-09  1:05 ` Ping Cheng
2023-05-09  2:34   ` Bagas Sanjaya
2023-05-09  2:44     ` Greg KH
2023-05-11  0:06       ` Ping Cheng
2023-05-13  7:50         ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.