Limit inverting the in-range bit in raw reports to tablet product ID
only. This will make adding handling of other, non-tablet products,
easier.

Signed-off-by: Nikolai Kondrashov <[email protected]>
---
 drivers/hid/hid-huion.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-huion.c b/drivers/hid/hid-huion.c
index 25d01cd..db24472 100644
--- a/drivers/hid/hid-huion.c
+++ b/drivers/hid/hid-huion.c
@@ -151,9 +151,15 @@ err:
 static int huion_raw_event(struct hid_device *hdev, struct hid_report *report,
                        u8 *data, int size)
 {
-       /* If this is a pen input report then invert the in-range bit */
-       if (report->type == HID_INPUT_REPORT && report->id == 0x07 && size >= 2)
-               data[1] ^= 0x40;
+       switch (hdev->product) {
+       case USB_DEVICE_ID_HUION_TABLET:
+               /* If this is a pen input report */
+               if (report->type == HID_INPUT_REPORT &&
+                   report->id == 0x07 && size >= 2)
+                       /* Invert the in-range bit */
+                       data[1] ^= 0x40;
+               break;
+       }
 
        return 0;
 }
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to