Skip to content

Commit 5703e52

Browse files
jwrdegoedeJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent b61d43e commit 5703e52

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

drivers/hid/hid-asus.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
6565
#define QUIRK_NO_CONSUMER_USAGES BIT(4)
6666
#define QUIRK_USE_KBD_BACKLIGHT BIT(5)
6767
#define QUIRK_T100_KEYBOARD BIT(6)
68+
#define QUIRK_T100CHI BIT(7)
6869

6970
#define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
7071
QUIRK_NO_INIT_REPORTS | \
@@ -619,11 +620,34 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
619620
hid_info(hdev, "Fixing up Asus notebook report descriptor\n");
620621
rdesc[55] = 0xdd;
621622
}
623+
/* For the T100TA keyboard dock */
622624
if (drvdata->quirks & QUIRK_T100_KEYBOARD &&
623625
*rsize == 76 && rdesc[73] == 0x81 && rdesc[74] == 0x01) {
624626
hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n");
625627
rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT;
626628
}
629+
/* For the T100CHI keyboard dock */
630+
if (drvdata->quirks & QUIRK_T100CHI &&
631+
*rsize == 403 && rdesc[388] == 0x09 && rdesc[389] == 0x76) {
632+
/*
633+
* Change Usage (76h) to Usage Minimum (00h), Usage Maximum
634+
* (FFh) and clear the flags in the Input() byte.
635+
* Note the descriptor has a bogus 0 byte at the end so we
636+
* only need 1 extra byte.
637+
*/
638+
*rsize = 404;
639+
rdesc = kmemdup(rdesc, *rsize, GFP_KERNEL);
640+
if (!rdesc)
641+
return NULL;
642+
643+
hid_info(hdev, "Fixing up T100CHI keyb report descriptor\n");
644+
memmove(rdesc + 392, rdesc + 390, 12);
645+
rdesc[388] = 0x19;
646+
rdesc[389] = 0x00;
647+
rdesc[390] = 0x29;
648+
rdesc[391] = 0xff;
649+
rdesc[402] = 0x00;
650+
}
627651

628652
return rdesc;
629653
}
@@ -643,6 +667,9 @@ static const struct hid_device_id asus_devices[] = {
643667
{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
644668
{ HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) },
645669
{ HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
670+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK,
671+
USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI },
672+
646673
{ }
647674
};
648675
MODULE_DEVICE_TABLE(hid, asus_devices);

drivers/hid/hid-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
19821982
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) },
19831983
{ HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
19841984
{ 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) },
19851986
#endif
19861987
#if IS_ENABLED(CONFIG_HID_AUREAL)
19871988
{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
#define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
177177
#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
178178
#define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0
179+
#define USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD 0x8502
179180
#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
180181
#define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
181182
#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854

0 commit comments

Comments
 (0)