]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Feb 2017 15:45:11 +0000 (16:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Feb 2017 15:45:11 +0000 (16:45 +0100)
added patches:
hid-wacom-fix-poor-prox-handling-in-wacom_pl_irq.patch

queue-4.4/hid-wacom-fix-poor-prox-handling-in-wacom_pl_irq.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/hid-wacom-fix-poor-prox-handling-in-wacom_pl_irq.patch b/queue-4.4/hid-wacom-fix-poor-prox-handling-in-wacom_pl_irq.patch
new file mode 100644 (file)
index 0000000..d445694
--- /dev/null
@@ -0,0 +1,68 @@
+From 282e4637bc1c0b338708bcebd09d31c69abec070 Mon Sep 17 00:00:00 2001
+From: Jason Gerecke <killertofu@gmail.com>
+Date: Thu, 26 Jan 2017 09:06:22 -0800
+Subject: HID: wacom: Fix poor prox handling in 'wacom_pl_irq'
+
+From: Jason Gerecke <killertofu@gmail.com>
+
+commit 282e4637bc1c0b338708bcebd09d31c69abec070 upstream.
+
+Commit 025bcc1 performed cleanup work on the 'wacom_pl_irq' function, making
+it follow the standards used in the rest of the codebase. The change
+unintiontionally allowed the function to send input events from reports
+that are not marked as being in prox. This can cause problems as the
+report values for X, Y, etc. are not guaranteed to be correct. In
+particular, occasionally the tablet will send a report with these values
+set to zero. If such a report is received it can caus an unexpected jump
+in the XY position.
+
+This patch surrounds more of the processing code with a proximity check,
+preventing these zeroed reports from overwriting the current state. To
+be safe, only the tool type and ABS_MISC events should be reported when
+the pen is marked as being out of prox.
+
+Fixes: 025bcc1540 ("HID: wacom: Simplify 'wacom_pl_irq'")
+Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
+Reviewed-by: Ping Cheng <pingc@wacom.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/wacom_wac.c |   24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+--- a/drivers/hid/wacom_wac.c
++++ b/drivers/hid/wacom_wac.c
+@@ -148,19 +148,21 @@ static int wacom_pl_irq(struct wacom_wac
+               wacom->id[0] = STYLUS_DEVICE_ID;
+       }
+-      pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
+-      if (features->pressure_max > 255)
+-              pressure = (pressure << 1) | ((data[4] >> 6) & 1);
+-      pressure += (features->pressure_max + 1) / 2;
++      if (prox) {
++              pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
++              if (features->pressure_max > 255)
++                      pressure = (pressure << 1) | ((data[4] >> 6) & 1);
++              pressure += (features->pressure_max + 1) / 2;
+-      input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
+-      input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
+-      input_report_abs(input, ABS_PRESSURE, pressure);
++              input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
++              input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
++              input_report_abs(input, ABS_PRESSURE, pressure);
+-      input_report_key(input, BTN_TOUCH, data[4] & 0x08);
+-      input_report_key(input, BTN_STYLUS, data[4] & 0x10);
+-      /* Only allow the stylus2 button to be reported for the pen tool. */
+-      input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20));
++              input_report_key(input, BTN_TOUCH, data[4] & 0x08);
++              input_report_key(input, BTN_STYLUS, data[4] & 0x10);
++              /* Only allow the stylus2 button to be reported for the pen tool. */
++              input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20));
++      }
+       if (!prox)
+               wacom->id[0] = 0;
index a1db7422403bb6a7c25cab82b19a52e6c96f7e66..624319e3ecf39508bc1169b3c1ad042c58993d2f 100644 (file)
@@ -19,3 +19,4 @@ mm-fs-check-for-fatal-signals-in-do_generic_file_read.patch
 can-bcm-fix-hrtimer-tasklet-termination-in-bcm-op-removal.patch
 mmc-sdhci-ignore-unexpected-card_int-interrupts.patch
 percpu-refcount-fix-reference-leak-during-percpu-atomic-transition.patch
+hid-wacom-fix-poor-prox-handling-in-wacom_pl_irq.patch