Android-x86
Fork


コミットメタ情報

リビジョン1fccb76847ce6744436ac09b221c4c59802ff76d (tree)
日時2017-06-14 18:05:12
作者Hans de Goede <hdegoede@redh...>
コミッターChih-Wei Huang

ログメッセージ

HID: asus: Add support for T100 touchpad

Add support for the Asus T100 touchpad in multi-touch mode (rather
then mouse emulation mode). It turns out that the Asus T100 touchpad
is identical to the already supported i2c-hid Asus touchpads, so
adding support for it was easy.

The only significant difference is that the reported x-coordinates
range on the T100 touchpad is somewhat lower then the range on the
already supported touchpads.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

変更サマリ

差分

--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -29,6 +29,7 @@
2929 #include <linux/hid.h>
3030 #include <linux/module.h>
3131 #include <linux/input/mt.h>
32+#include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */
3233
3334 #include "hid-ids.h"
3435
@@ -38,6 +39,8 @@ MODULE_AUTHOR("Victor Vlasenko <victor.vlasenko@sysgears.com>");
3839 MODULE_AUTHOR("Frederik Wenigwieser <frederik.wenigwieser@gmail.com>");
3940 MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
4041
42+#define T100_TPAD_INTF 2
43+
4144 #define FEATURE_REPORT_ID 0x0d
4245 #define INPUT_REPORT_ID 0x5d
4346 #define FEATURE_KBD_REPORT_ID 0x5a
@@ -50,6 +53,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
5053 #define MAX_CONTACTS 5
5154
5255 #define MAX_X 2794
56+#define MAX_X_T100 2240
5357 #define MAX_Y 1758
5458 #define MAX_TOUCH_MAJOR 8
5559 #define MAX_PRESSURE 128
@@ -70,11 +74,12 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
7074 #define QUIRK_NO_CONSUMER_USAGES BIT(4)
7175 #define QUIRK_USE_KBD_BACKLIGHT BIT(5)
7276 #define QUIRK_T100_KEYBOARD BIT(6)
77+#define QUIRK_T100_TOUCHPAD BIT(7)
7378
7479 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
7580 QUIRK_NO_INIT_REPORTS | \
7681 QUIRK_NO_CONSUMER_USAGES)
77-#define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
82+#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
7883 QUIRK_SKIP_INPUT_MAPPING | \
7984 QUIRK_IS_MULTITOUCH)
8085
@@ -337,7 +342,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
337342 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
338343 int ret;
339344
340- input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0);
345+ if (drvdata->quirks & QUIRK_T100_TOUCHPAD)
346+ input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X_T100, 0, 0);
347+ else
348+ input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0);
341349 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0);
342350 input_set_abs_params(input, ABS_TOOL_WIDTH, 0, MAX_TOUCH_MAJOR, 0, 0);
343351 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, MAX_TOUCH_MAJOR, 0, 0);
@@ -490,6 +498,13 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
490498
491499 drvdata->quirks = id->driver_data;
492500
501+ if (drvdata->quirks & QUIRK_T100_KEYBOARD) {
502+ struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
503+
504+ if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF)
505+ drvdata->quirks = TOUCHPAD_QUIRKS | QUIRK_T100_TOUCHPAD;
506+ }
507+
493508 if (drvdata->quirks & QUIRK_NO_INIT_REPORTS)
494509 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
495510
@@ -564,7 +579,7 @@ static const struct hid_device_id asus_devices[] = {
564579 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
565580 USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS},
566581 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
567- USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), I2C_TOUCHPAD_QUIRKS },
582+ USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), TOUCHPAD_QUIRKS },
568583 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
569584 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
570585 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
旧リポジトリブラウザで表示