diff mbox

[SRU,Trusty,LTS-Utopic] HID: wacom - make sure touch_input is valid before using it

Message ID 1452277709-12447-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Jan. 8, 2016, 6:28 p.m. UTC
From: Ping Cheng <pinglinux@gmail.com>

touch_input is stored in wacom_shared for pen data to report touch
switch status. It is possible, although we didn't see it happen on
Linux yet, that pen data is procesed before touch interface is
fully probed.

As a by-product of this patch, it fixes the FreeBSD issue reported
by Denis Akiyakov http://www.spinics.net/lists/linux-input/msg33971.html

Reviewed-by: Hans Petter Selasky <hps@selasky.org>
Tested-by: Denis Akiyakov <d.akiyakov@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
BugLink: https://bugs.launchpad.net/bugs/1310800
(backported from commit 44b9683853c7b47d039366d7d2fd0d5380aba276)
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/tablet/wacom_wac.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Kamal Mostafa Jan. 8, 2016, 6:30 p.m. UTC | #1

Tim Gardner Jan. 8, 2016, 7:44 p.m. UTC | #2
While there are no test results in the bug report, it should be easy
enough to get someone to test the -proposed kernel.

The patch is straightforward.
Luis Henriques Jan. 11, 2016, 11:44 a.m. UTC | #3
Applied to trusty and lts-utopic master-next branches.

Cheers,
--
Luís
diff mbox

Patch

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 05f371df6c40..996cf28b0781 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1284,7 +1284,9 @@  static int wacom_bpt_pen(struct wacom_wac *wacom)
 	    return 0;
 
 	if (data[0] == WACOM_REPORT_USB) {
-		if (features->type == INTUOSHT && features->touch_max) {
+		if (features->type == INTUOSHT &&
+		    wacom->shared->touch_input &&
+		    features->touch_max) {
 			input_report_switch(wacom->shared->touch_input,
 					    SW_MUTE_DEVICE, data[8] & 0x40);
 			input_sync(wacom->shared->touch_input);
@@ -1377,7 +1379,8 @@  static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
 		int pid, battery;
 
 		if ((wacom->shared->type == INTUOSHT) &&
-				wacom->shared->touch_max) {
+		    wacom->shared->touch_input &&
+		    wacom->shared->touch_max) {
 			input_report_switch(wacom->shared->touch_input,
 					SW_MUTE_DEVICE, data[5] & 0x40);
 			input_sync(wacom->shared->touch_input);