linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: update PenMount USB report descriptor so that only one button is reported
@ 2015-07-20 12:07 Andrew Shadura
  2015-07-23 16:20 ` [PATCH v2] " Andrew Shadura
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Shadura @ 2015-07-20 12:07 UTC (permalink / raw)
  To: Linux Input Mailing List

PenMount USB resistive touchscreen reports it has three buttons, while in reality
it doesn't have any and doesn't support active styli, and only generates touch
events.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
---
 drivers/hid/hid-penmount.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hid/hid-penmount.c b/drivers/hid/hid-penmount.c
index c11dce8..4e12502 100644
--- a/drivers/hid/hid-penmount.c
+++ b/drivers/hid/hid-penmount.c
@@ -30,6 +30,21 @@ static int penmount_input_mapping(struct hid_device *hdev,
 	return 0;
 }
 
+static __u8 *penmount_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+        unsigned int *rsize)
+{
+	if (*rsize == 76 &&
+		rdesc[2] == 0x09 && rdesc[3] == 0x02 /* mouse */ &&
+		rdesc[22] == 0x05 && rdesc[23] == 0x09 /* button */ &&
+		rdesc[26] == 0x29 && rdesc[27] == 0x03 /* maximum */) {
+		hid_info(hdev,
+			"fixing up PenMount USB touchscreen report descriptor\n");
+
+		rdesc[27] = 0x01; /* just one button */
+	}
+	return rdesc;
+}
+
 static const struct hid_device_id penmount_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
 	{ }
@@ -39,6 +54,7 @@ MODULE_DEVICE_TABLE(hid, penmount_devices);
 static struct hid_driver penmount_driver = {
 	.name = "hid-penmount",
 	.id_table = penmount_devices,
+	.report_fixup = penmount_report_fixup,
 	.input_mapping = penmount_input_mapping,
 };
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-13 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 12:07 [PATCH] HID: update PenMount USB report descriptor so that only one button is reported Andrew Shadura
2015-07-23 16:20 ` [PATCH v2] " Andrew Shadura
2015-10-13 14:08   ` Benjamin Tissoires

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).