From: Ping Cheng <pingli...@gmail.com>

Sometime valid events may not be supported by the driver yet. Make
sure we don't process them when the code is not ready.

This fix prevents a kernel panic due to unsupported HID events.

Signed-off-by: Ping Cheng <ping.ch...@wacom.com>
Reviewed-By: Jason Gerecke <jason.gere...@wacom.com>
Signed-off-by: Jiri Kosina <jkos...@suse.cz>
[jason.gere...@wacom.com: Imported into input-wacom repository (6f46cf9)]
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
[jason.gere...@wacom.com: Backported from input-wacom repository (b6b76bb)]
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 3.17/wacom_wac.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 7560dfa..d0acd1d 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -2117,11 +2117,11 @@ void wacom_wac_event(struct hid_device *hdev, struct 
hid_field *field,
        if (wacom->wacom_wac.features.type != HID_GENERIC)
                return;
 
-       if (WACOM_PAD_FIELD(field))
+       if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
                wacom_wac_pad_event(hdev, field, usage, value);
-       else if (WACOM_PEN_FIELD(field))
+       else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
                wacom_wac_pen_event(hdev, field, usage, value);
-       else if (WACOM_FINGER_FIELD(field))
+       else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
                wacom_wac_finger_event(hdev, field, usage, value);
 }
 
@@ -2153,20 +2153,20 @@ void wacom_wac_report(struct hid_device *hdev, struct 
hid_report *report)
        if (wacom_wac->features.type != HID_GENERIC)
                return;
 
-       if (WACOM_PAD_FIELD(field))
+       if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
                wacom_wac_pad_pre_report(hdev, report);
-       else if (WACOM_PEN_FIELD(field))
+       else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
                wacom_wac_pen_pre_report(hdev, report);
-       else if (WACOM_FINGER_FIELD(field))
+       else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
                wacom_wac_finger_pre_report(hdev, report);
 
        wacom_report_events(hdev, report);
 
-       if (WACOM_PAD_FIELD(field))
+       if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
                return wacom_wac_pad_report(hdev, report);
-       else if (WACOM_PEN_FIELD(field))
+       else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
                return wacom_wac_pen_report(hdev, report);
-       else if (WACOM_FINGER_FIELD(field))
+       else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
                return wacom_wac_finger_report(hdev, report);
 }
 
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to