From 762f948c97132967b8154f48909daf221d090777 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 Nov 2017 16:40:10 +0100 Subject: HID: asus: Add product-id for the T100TAF and T100HA keyboard docks The T100TAF and T100HA keyboard docks have the same special keys and custom protocol multitouch touchpad as the T100TA, but use a different product id. The T100TAF and T100HA both use the same product id, but the T100HA's touchpad has a different coordinate range. This commits adds supports for the new USB id and uses a dmi-check to determine if we're dealing with the T100TAF or T100HA. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197849 Signed-off-by: Hans de Goede Signed-off-by: Jiri Kosina --- drivers/hid/hid-asus.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'drivers/hid/hid-asus.c') diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 1bb7b63b3150..6d2894b7d8e7 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -26,6 +26,7 @@ * any later version. */ +#include #include #include #include @@ -119,6 +120,15 @@ static const struct asus_touchpad_info asus_t100ta_tp = { .max_contacts = 5, }; +static const struct asus_touchpad_info asus_t100ha_tp = { + .max_x = 2640, + .max_y = 1320, + .res_x = 30, /* units/mm */ + .res_y = 29, /* units/mm */ + .contact_size = 5, + .max_contacts = 5, +}; + static const struct asus_touchpad_info asus_t100chi_tp = { .max_x = 2640, .max_y = 1320, @@ -606,7 +616,14 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { drvdata->quirks = QUIRK_SKIP_INPUT_MAPPING; - drvdata->tp = &asus_t100ta_tp; + /* + * The T100HA uses the same USB-ids as the T100TAF, + * but has different max_x / max_y values. + */ + if (dmi_match(DMI_PRODUCT_NAME, "T100HAN")) + drvdata->tp = &asus_t100ha_tp; + else + drvdata->tp = &asus_t100ta_tp; } } @@ -751,7 +768,10 @@ static const struct hid_device_id asus_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3), QUIRK_G752_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, - USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD), + USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD), + QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, + USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD), QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) }, { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) }, -- cgit v1.2.3-59-g8ed1b From dbd3ef28e046b00114d0c0b5577f8e726255fe6c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 5 Jan 2018 12:09:18 +0100 Subject: HID: asus: Add touchpad max x/y and resolution info for the T200TA The Asus T200TA uses the same USB device-id for its keyboard dock as the T100TA, but the touchpad has a different size and corresponding different max x/y values. Add a separate asus_touchpad_info struct for the T200TA and select this based on the DMI product-name (as we are already doing for the T100HA), so that we report the correct info to userspace. Signed-off-by: Hans de Goede Acked-by: Benjamin Tissoires Signed-off-by: Jiri Kosina --- drivers/hid/hid-asus.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'drivers/hid/hid-asus.c') diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 6d2894b7d8e7..07525bc99b6a 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -129,6 +129,15 @@ static const struct asus_touchpad_info asus_t100ha_tp = { .max_contacts = 5, }; +static const struct asus_touchpad_info asus_t200ta_tp = { + .max_x = 3120, + .max_y = 1716, + .res_x = 30, /* units/mm */ + .res_y = 28, /* units/mm */ + .contact_size = 5, + .max_contacts = 5, +}; + static const struct asus_touchpad_info asus_t100chi_tp = { .max_x = 2640, .max_y = 1320, @@ -617,11 +626,14 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { drvdata->quirks = QUIRK_SKIP_INPUT_MAPPING; /* - * The T100HA uses the same USB-ids as the T100TAF, - * but has different max_x / max_y values. + * The T100HA uses the same USB-ids as the T100TAF and + * the T200TA uses the same USB-ids as the T100TA, while + * both have different max x/y values as the T100TA[F]. */ if (dmi_match(DMI_PRODUCT_NAME, "T100HAN")) drvdata->tp = &asus_t100ha_tp; + else if (dmi_match(DMI_PRODUCT_NAME, "T200TA")) + drvdata->tp = &asus_t200ta_tp; else drvdata->tp = &asus_t100ta_tp; } -- cgit v1.2.3-59-g8ed1b From 33edee4f3c6fd9fcd8cf7f2ad5317ec7477c087b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 5 Jan 2018 12:09:19 +0100 Subject: HID: asus: Fix special function keys on T200TA Just like on the T100TA the T200TA HID descriptors for the 0xff32 Asus vendor usage page need a small fixup. But on the T200TA the HID descriptors are larger because they have descrriptors for one more (unused) HID report appended. Extend the T100TA descriptor fixup to also check for the T200TA's descriptors size. Signed-off-by: Hans de Goede Acked-by: Benjamin Tissoires Signed-off-by: Jiri Kosina --- drivers/hid/hid-asus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/hid/hid-asus.c') diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 07525bc99b6a..88b9703318e4 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -715,9 +715,10 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc, hid_info(hdev, "Fixing up Asus notebook report descriptor\n"); rdesc[55] = 0xdd; } - /* For the T100TA keyboard dock */ + /* For the T100TA/T200TA keyboard dock */ if (drvdata->quirks & QUIRK_T100_KEYBOARD && - *rsize == 76 && rdesc[73] == 0x81 && rdesc[74] == 0x01) { + (*rsize == 76 || *rsize == 101) && + rdesc[73] == 0x81 && rdesc[74] == 0x01) { hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n"); rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT; } -- cgit v1.2.3-59-g8ed1b