Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yusuke Fujimaki and committed by
Jiri Kosina
eeb01a57 d66435cc

+57
+6
drivers/hid/Kconfig
··· 134 134 135 135 Say Y here if you want support for Apple infrared remote control. 136 136 137 + config HID_ASUS 138 + tristate "Asus" 139 + depends on I2C_HID 140 + ---help--- 141 + Support for Asus X205TA built-in keyboard via i2c. 142 + 137 143 config HID_AUREAL 138 144 tristate "Aureal" 139 145 depends on HID
+1
drivers/hid/Makefile
··· 24 24 obj-$(CONFIG_HID_ACRUX) += hid-axff.o 25 25 obj-$(CONFIG_HID_APPLE) += hid-apple.o 26 26 obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o 27 + obj-$(CONFIG_HID_ASUS) += hid-asus.o 27 28 obj-$(CONFIG_HID_AUREAL) += hid-aureal.o 28 29 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 29 30 obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
+48
drivers/hid/hid-asus.c
··· 1 + /* 2 + * HID driver for Asus X205TA built-in keyboard. 3 + * Fixes small logical maximum to match usage maximum. 4 + * 5 + * Copyright (c) 2016 Yusuke Fujimaki <usk.fujimaki@gmail.com> 6 + * 7 + * This module based on hid-ortek by 8 + * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com> 9 + * Copyright (c) 2011 Jiri Kosina 10 + */ 11 + 12 + /* 13 + * This program is free software; you can redistribute it and/or modify it 14 + * under the terms of the GNU General Public License as published by the Free 15 + * Software Foundation; either version 2 of the License, or (at your option) 16 + * any later version. 17 + */ 18 + 19 + #include <linux/device.h> 20 + #include <linux/hid.h> 21 + #include <linux/module.h> 22 + 23 + #include "hid-ids.h" 24 + 25 + static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc, 26 + unsigned int *rsize) 27 + { 28 + if (*rsize >= 180 && rdesc[54] == 0x25 && rdesc[55] == 0x65) { 29 + hid_info(hdev, "Fixing up Asus X205TA report descriptor\n"); 30 + rdesc[55] = 0xdd; 31 + } 32 + return rdesc; 33 + } 34 + 35 + static const struct hid_device_id asus_devices[] = { 36 + { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_X205TA_KEYBOARD) }, 37 + { } 38 + }; 39 + MODULE_DEVICE_TABLE(hid, asus_devices); 40 + 41 + static struct hid_driver asus_driver = { 42 + .name = "asus", 43 + .id_table = asus_devices, 44 + .report_fixup = asus_report_fixup 45 + }; 46 + module_hid_driver(asus_driver); 47 + 48 + MODULE_LICENSE("GPL");
+1
drivers/hid/hid-core.c
··· 1856 1856 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, 1857 1857 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1858 1858 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1859 + { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_X205TA_KEYBOARD) }, 1859 1860 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, 1860 1861 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1861 1862 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+1
drivers/hid/hid-ids.h
··· 163 163 #define USB_VENDOR_ID_ASUSTEK 0x0b05 164 164 #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 165 165 #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b 166 + #define USB_DEVICE_ID_ASUSTEK_X205TA_KEYBOARD 0x8585 166 167 167 168 #define USB_VENDOR_ID_ATEN 0x0557 168 169 #define USB_DEVICE_ID_ATEN_UC100KM 0x2004