diff mbox series

[v2] HID: wacom: Correct distance scale for 2nd-gen Intuos devices

Message ID 20190807211155.4280-1-jason.gerecke@wacom.com (mailing list archive)
State Mainlined
Commit b72fb1dcd2ea9d29417711cb302cef3006fa8d5a
Delegated to: Jiri Kosina
Headers show
Series [v2] HID: wacom: Correct distance scale for 2nd-gen Intuos devices | expand

Commit Message

Gerecke, Jason Aug. 7, 2019, 9:11 p.m. UTC
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(+)

Comments

Jiri Kosina Aug. 19, 2019, 12:09 p.m. UTC | #1
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,
diff mbox series

Patch

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