linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: Correct distance scale for 2nd-gen Intuos devices
@ 2019-08-06 20:58 Gerecke, Jason
  2019-08-07  5:18 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Gerecke, Jason @ 2019-08-06 20:58 UTC (permalink / raw)
  To: linux-input, Jiri Kosina, Benjamin Tissoires
  Cc: Ping Cheng, Aaron Armstrong Skomra, Jason Gerecke, stable

From: Jason Gerecke <jason.gerecke@wacom.com>

Distance values reported by 2nd-gen Intuos tablets are on an inveted scale
(0 == far, 63 == near). We need to change them over to a normal scale before
reporting to userspace or else userspace drivers and applications can get
confused.

Ref: https://github.com/linuxwacom/input-wacom/issues/98
Fixes: eda01dab53 ("HID: wacom: Add four new Intuos devices")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Cc: <stable@vger.kernel.org> # v4.4+
---
 drivers/hid/wacom_wac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 7a8ddc999a8e..879e41fbf604 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -846,6 +846,9 @@ static int wacom_intuos_general(struct wacom_wac *wacom)
 		y >>= 1;
 		distance >>= 1;
 	}
+	if (features->type == INTUOSHT2) {
+		distance = features->distance_max - distance;
+	}
 	input_report_abs(input, ABS_X, x);
 	input_report_abs(input, ABS_Y, y);
 	input_report_abs(input, ABS_DISTANCE, distance);
-- 
2.22.0

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

* Re: [PATCH] HID: wacom: Correct distance scale for 2nd-gen Intuos devices
  2019-08-06 20:58 [PATCH] HID: wacom: Correct distance scale for 2nd-gen Intuos devices Gerecke, Jason
@ 2019-08-07  5:18 ` Greg KH
  2019-08-07 21:11   ` [PATCH v2] " Gerecke, Jason
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2019-08-07  5:18 UTC (permalink / raw)
  To: Gerecke, Jason
  Cc: linux-input, Jiri Kosina, Benjamin Tissoires, Ping Cheng,
	Aaron Armstrong Skomra, Jason Gerecke, stable

On Tue, Aug 06, 2019 at 01:58:05PM -0700, Gerecke, Jason wrote:
> From: Jason Gerecke <jason.gerecke@wacom.com>
> 
> Distance values reported by 2nd-gen Intuos tablets are on an inveted scale
> (0 == far, 63 == near). We need to change them over to a normal scale before
> reporting to userspace or else userspace drivers and applications can get
> confused.
> 
> Ref: https://github.com/linuxwacom/input-wacom/issues/98
> Fixes: eda01dab53 ("HID: wacom: Add four new Intuos devices")
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Cc: <stable@vger.kernel.org> # v4.4+
> ---
>  drivers/hid/wacom_wac.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 7a8ddc999a8e..879e41fbf604 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -846,6 +846,9 @@ static int wacom_intuos_general(struct wacom_wac *wacom)
>  		y >>= 1;
>  		distance >>= 1;
>  	}
> +	if (features->type == INTUOSHT2) {
> +		distance = features->distance_max - distance;
> +	}

{ } not needed, always run checkpatch.pl before sending stuff out :(

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

* [PATCH v2] HID: wacom: Correct distance scale for 2nd-gen Intuos devices
  2019-08-07  5:18 ` Greg KH
@ 2019-08-07 21:11   ` Gerecke, Jason
  2019-08-19 12:09     ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Gerecke, Jason @ 2019-08-07 21:11 UTC (permalink / raw)
  To: linux-input, Jiri Kosina, Benjamin Tissoires
  Cc: Ping Cheng, Aaron Armstrong Skomra, Greg KH, Jason Gerecke,
	stable

From: Jason Gerecke <jason.gerecke@wacom.com>

Distance values reported by 2nd-gen Intuos tablets are on an inverted
scale (0 == far, 63 == near). We need to change them over to a normal
scale before reporting to userspace or else userspace drivers and
applications can get confused.

Ref: https://github.com/linuxwacom/input-wacom/issues/98
Fixes: eda01dab53 ("HID: wacom: Add four new Intuos devices")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Cc: <stable@vger.kernel.org> # v4.4+
---
Make checkpatch happy -- *doh!*

 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 7a8ddc999a8e..8e5063492242 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -846,6 +846,8 @@ static int wacom_intuos_general(struct wacom_wac *wacom)
 		y >>= 1;
 		distance >>= 1;
 	}
+	if (features->type == INTUOSHT2)
+		distance = features->distance_max - distance;
 	input_report_abs(input, ABS_X, x);
 	input_report_abs(input, ABS_Y, y);
 	input_report_abs(input, ABS_DISTANCE, distance);
-- 
2.22.0

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

* Re: [PATCH v2] HID: wacom: Correct distance scale for 2nd-gen Intuos devices
  2019-08-07 21:11   ` [PATCH v2] " Gerecke, Jason
@ 2019-08-19 12:09     ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2019-08-19 12:09 UTC (permalink / raw)
  To: Gerecke, Jason
  Cc: linux-input, Benjamin Tissoires, Ping Cheng,
	Aaron Armstrong Skomra, Greg KH, Jason Gerecke, stable

On Wed, 7 Aug 2019, Gerecke, Jason wrote:

> From: Jason Gerecke <jason.gerecke@wacom.com>
> 
> Distance values reported by 2nd-gen Intuos tablets are on an inverted
> scale (0 == far, 63 == near). We need to change them over to a normal
> scale before reporting to userspace or else userspace drivers and
> applications can get confused.
> 
> Ref: https://github.com/linuxwacom/input-wacom/issues/98
> Fixes: eda01dab53 ("HID: wacom: Add four new Intuos devices")
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Cc: <stable@vger.kernel.org> # v4.4+

Applied to for-5.3/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2019-08-19 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-06 20:58 [PATCH] HID: wacom: Correct distance scale for 2nd-gen Intuos devices Gerecke, Jason
2019-08-07  5:18 ` Greg KH
2019-08-07 21:11   ` [PATCH v2] " Gerecke, Jason
2019-08-19 12:09     ` Jiri Kosina

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