[PATCH 2/5] hid: huion: Invert in-range on specific product

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <spbnick@xxxxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux