リビジョン | 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>
@@ -29,6 +29,7 @@ | ||
29 | 29 | #include <linux/hid.h> |
30 | 30 | #include <linux/module.h> |
31 | 31 | #include <linux/input/mt.h> |
32 | +#include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */ | |
32 | 33 | |
33 | 34 | #include "hid-ids.h" |
34 | 35 |
@@ -38,6 +39,8 @@ MODULE_AUTHOR("Victor Vlasenko <victor.vlasenko@sysgears.com>"); | ||
38 | 39 | MODULE_AUTHOR("Frederik Wenigwieser <frederik.wenigwieser@gmail.com>"); |
39 | 40 | MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); |
40 | 41 | |
42 | +#define T100_TPAD_INTF 2 | |
43 | + | |
41 | 44 | #define FEATURE_REPORT_ID 0x0d |
42 | 45 | #define INPUT_REPORT_ID 0x5d |
43 | 46 | #define FEATURE_KBD_REPORT_ID 0x5a |
@@ -50,6 +53,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); | ||
50 | 53 | #define MAX_CONTACTS 5 |
51 | 54 | |
52 | 55 | #define MAX_X 2794 |
56 | +#define MAX_X_T100 2240 | |
53 | 57 | #define MAX_Y 1758 |
54 | 58 | #define MAX_TOUCH_MAJOR 8 |
55 | 59 | #define MAX_PRESSURE 128 |
@@ -70,11 +74,12 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); | ||
70 | 74 | #define QUIRK_NO_CONSUMER_USAGES BIT(4) |
71 | 75 | #define QUIRK_USE_KBD_BACKLIGHT BIT(5) |
72 | 76 | #define QUIRK_T100_KEYBOARD BIT(6) |
77 | +#define QUIRK_T100_TOUCHPAD BIT(7) | |
73 | 78 | |
74 | 79 | #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ |
75 | 80 | QUIRK_NO_INIT_REPORTS | \ |
76 | 81 | QUIRK_NO_CONSUMER_USAGES) |
77 | -#define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ | |
82 | +#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ | |
78 | 83 | QUIRK_SKIP_INPUT_MAPPING | \ |
79 | 84 | QUIRK_IS_MULTITOUCH) |
80 | 85 |
@@ -337,7 +342,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) | ||
337 | 342 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { |
338 | 343 | int ret; |
339 | 344 | |
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); | |
341 | 349 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); |
342 | 350 | input_set_abs_params(input, ABS_TOOL_WIDTH, 0, MAX_TOUCH_MAJOR, 0, 0); |
343 | 351 | 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) | ||
490 | 498 | |
491 | 499 | drvdata->quirks = id->driver_data; |
492 | 500 | |
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 | + | |
493 | 508 | if (drvdata->quirks & QUIRK_NO_INIT_REPORTS) |
494 | 509 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; |
495 | 510 |
@@ -564,7 +579,7 @@ static const struct hid_device_id asus_devices[] = { | ||
564 | 579 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, |
565 | 580 | USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS}, |
566 | 581 | { 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 }, | |
568 | 583 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, |
569 | 584 | USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, |
570 | 585 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, |