aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-asus.c
diff options
context:
space:
mode:
authorYusuke Fujimaki <usk.fujimaki@gmail.com>2016-03-21 16:18:42 +0900
committerJiri Kosina <jkosina@suse.cz>2016-04-01 11:47:04 +0200
commiteeb01a57921a5e373302733d7cdf1ca87da5375a (patch)
treec82df28f699040858e7eb2354f8d4610aac534fb /drivers/hid/hid-asus.c
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid (diff)
downloadlinux-dev-eeb01a57921a5e373302733d7cdf1ca87da5375a.tar.xz
linux-dev-eeb01a57921a5e373302733d7cdf1ca87da5375a.zip
HID: Asus X205TA keyboard driver
Asus X205TA built-in keyboard contains wrong logical maximum value in report descriptor. 0x05, 0x01, // Usage Page (Generic Desktop) 0x09, 0x06, // Usage (Keyboard) 0xa1, 0x01, // Collection (Application) 0x85, 0x01, // Report ID (1) 0x05, 0x07, // Usage Page (Keyboard/Keypad) 0x19, 0xe0, // Usage Minimum (224) 0x29, 0xe7, // Usage Maximum (231) 0x15, 0x00, // Logical Minimum (0) 0x25, 0x01, // Logical Maximum (1) 0x75, 0x01, // Report Size (1) 0x95, 0x08, // Report Count (8) 0x81, 0x02, // Input (Data,Array,Abs) 0x95, 0x01, // Report Count (1) 0x75, 0x08, // Report Size (8) 0x81, 0x03, // Input (Const,Var,Abs) 0x95, 0x05, // Report Count (5) 0x75, 0x01, // Report Size (1) 0x05, 0x08, // Usage (LED) 0x19, 0x01, // Usage Minimum (1) 0x29, 0x05, // Usage Maximum (5) 0x91, 0x02, // Output (Data,Var,Abs) 0x95, 0x01, // Report Count (1) 0x75, 0x03, // Report Size (3) 0x91, 0x03, // Output (Const,Var,Abs) 0x95, 0x06, // Report Count (6) 0x75, 0x08, // Report Size (8) 0x15, 0x00, // Logical Minimum (0) 0x25, 0x65, // Logical Maximum (101) * too small * 0x05, 0x07, // Usage Page (Keyboard/Keypad) 0x19, 0x00, // Usage Minimum (0) 0x29, 0xdd, // Usage Maximum (221) 0x81, 0x00, // Input(Data,Array,Abs) In Asus X205TA japanese keyboard model,there are language specific keys over usage id 101. This patch correct wrong logical maximum in report descriptor. Signed-off-by: Yusuke Fujimaki <usk.fujimaki@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-asus.c')
-rw-r--r--drivers/hid/hid-asus.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
new file mode 100644
index 000000000000..1734e11298ed
--- /dev/null
+++ b/drivers/hid/hid-asus.c
@@ -0,0 +1,48 @@
+/*
+ * HID driver for Asus X205TA built-in keyboard.
+ * Fixes small logical maximum to match usage maximum.
+ *
+ * Copyright (c) 2016 Yusuke Fujimaki <usk.fujimaki@gmail.com>
+ *
+ * This module based on hid-ortek by
+ * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
+ * Copyright (c) 2011 Jiri Kosina
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ unsigned int *rsize)
+{
+ if (*rsize >= 180 && rdesc[54] == 0x25 && rdesc[55] == 0x65) {
+ hid_info(hdev, "Fixing up Asus X205TA report descriptor\n");
+ rdesc[55] = 0xdd;
+ }
+ return rdesc;
+}
+
+static const struct hid_device_id asus_devices[] = {
+ { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_X205TA_KEYBOARD) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, asus_devices);
+
+static struct hid_driver asus_driver = {
+ .name = "asus",
+ .id_table = asus_devices,
+ .report_fixup = asus_report_fixup
+};
+module_hid_driver(asus_driver);
+
+MODULE_LICENSE("GPL");