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

HID: asus: Add T100CHI bluetooth keyboard dock special keys mapping

The Asus Transformer T100CHI comes with a Bluetooth keyboard dock which
uses the same 0xff31 Asus vendor HUT page as other Asus keyboards.

This commit adds its device-id to hid-asus and fixes an issue in the
descriptor of the 0xff31 Usage, which together fixes the special keys
on this keyboard not working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Hans de Goede and committed by
Jiri Kosina
5703e52c b61d43e6

+29
+27
drivers/hid/hid-asus.c
··· 65 65 #define QUIRK_NO_CONSUMER_USAGES BIT(4) 66 66 #define QUIRK_USE_KBD_BACKLIGHT BIT(5) 67 67 #define QUIRK_T100_KEYBOARD BIT(6) 68 + #define QUIRK_T100CHI BIT(7) 68 69 69 70 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ 70 71 QUIRK_NO_INIT_REPORTS | \ ··· 620 619 hid_info(hdev, "Fixing up Asus notebook report descriptor\n"); 621 620 rdesc[55] = 0xdd; 622 621 } 622 + /* For the T100TA keyboard dock */ 623 623 if (drvdata->quirks & QUIRK_T100_KEYBOARD && 624 624 *rsize == 76 && rdesc[73] == 0x81 && rdesc[74] == 0x01) { 625 625 hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n"); 626 626 rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT; 627 + } 628 + /* For the T100CHI keyboard dock */ 629 + if (drvdata->quirks & QUIRK_T100CHI && 630 + *rsize == 403 && rdesc[388] == 0x09 && rdesc[389] == 0x76) { 631 + /* 632 + * Change Usage (76h) to Usage Minimum (00h), Usage Maximum 633 + * (FFh) and clear the flags in the Input() byte. 634 + * Note the descriptor has a bogus 0 byte at the end so we 635 + * only need 1 extra byte. 636 + */ 637 + *rsize = 404; 638 + rdesc = kmemdup(rdesc, *rsize, GFP_KERNEL); 639 + if (!rdesc) 640 + return NULL; 641 + 642 + hid_info(hdev, "Fixing up T100CHI keyb report descriptor\n"); 643 + memmove(rdesc + 392, rdesc + 390, 12); 644 + rdesc[388] = 0x19; 645 + rdesc[389] = 0x00; 646 + rdesc[390] = 0x29; 647 + rdesc[391] = 0xff; 648 + rdesc[402] = 0x00; 627 649 } 628 650 629 651 return rdesc; ··· 667 643 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) }, 668 644 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) }, 669 645 { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) }, 646 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, 647 + USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI }, 648 + 670 649 { } 671 650 }; 672 651 MODULE_DEVICE_TABLE(hid, asus_devices);
+1
drivers/hid/hid-core.c
··· 1982 1982 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) }, 1983 1983 { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) }, 1984 1984 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) }, 1985 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD) }, 1985 1986 #endif 1986 1987 #if IS_ENABLED(CONFIG_HID_AUREAL) 1987 1988 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
+1
drivers/hid/hid-ids.h
··· 176 176 #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 177 177 #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b 178 178 #define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0 179 + #define USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD 0x8502 179 180 #define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585 180 181 #define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101 181 182 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854