diff options
author | Hans de Goede <hdegoede@redhat.com> | 2017-05-25 10:49:21 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-07-20 10:01:05 -0400 |
commit | 57573c541be6c7bca5c27427a5f908d8a22d0b00 (patch) | |
tree | dcf3faffe810849551955127f770dcc1de2bd01b | |
parent | a91ab911df51ac364e594d5950ed508d91091498 (diff) |
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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-asus.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index a4a3c38bc145..7cdb218b7e43 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/hid.h> | 29 | #include <linux/hid.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/input/mt.h> | 31 | #include <linux/input/mt.h> |
32 | #include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */ | ||
32 | 33 | ||
33 | #include "hid-ids.h" | 34 | #include "hid-ids.h" |
34 | 35 | ||
@@ -38,6 +39,8 @@ MODULE_AUTHOR("Victor Vlasenko <victor.vlasenko@sysgears.com>"); | |||
38 | MODULE_AUTHOR("Frederik Wenigwieser <frederik.wenigwieser@gmail.com>"); | 39 | MODULE_AUTHOR("Frederik Wenigwieser <frederik.wenigwieser@gmail.com>"); |
39 | MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); | 40 | MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); |
40 | 41 | ||
42 | #define T100_TPAD_INTF 2 | ||
43 | |||
41 | #define FEATURE_REPORT_ID 0x0d | 44 | #define FEATURE_REPORT_ID 0x0d |
42 | #define INPUT_REPORT_ID 0x5d | 45 | #define INPUT_REPORT_ID 0x5d |
43 | #define FEATURE_KBD_REPORT_ID 0x5a | 46 | #define FEATURE_KBD_REPORT_ID 0x5a |
@@ -50,6 +53,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); | |||
50 | #define MAX_CONTACTS 5 | 53 | #define MAX_CONTACTS 5 |
51 | 54 | ||
52 | #define MAX_X 2794 | 55 | #define MAX_X 2794 |
56 | #define MAX_X_T100 2240 | ||
53 | #define MAX_Y 1758 | 57 | #define MAX_Y 1758 |
54 | #define MAX_TOUCH_MAJOR 8 | 58 | #define MAX_TOUCH_MAJOR 8 |
55 | #define MAX_PRESSURE 128 | 59 | #define MAX_PRESSURE 128 |
@@ -70,11 +74,12 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); | |||
70 | #define QUIRK_NO_CONSUMER_USAGES BIT(4) | 74 | #define QUIRK_NO_CONSUMER_USAGES BIT(4) |
71 | #define QUIRK_USE_KBD_BACKLIGHT BIT(5) | 75 | #define QUIRK_USE_KBD_BACKLIGHT BIT(5) |
72 | #define QUIRK_T100_KEYBOARD BIT(6) | 76 | #define QUIRK_T100_KEYBOARD BIT(6) |
77 | #define QUIRK_T100_TOUCHPAD BIT(7) | ||
73 | 78 | ||
74 | #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ | 79 | #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ |
75 | QUIRK_NO_INIT_REPORTS | \ | 80 | QUIRK_NO_INIT_REPORTS | \ |
76 | QUIRK_NO_CONSUMER_USAGES) | 81 | QUIRK_NO_CONSUMER_USAGES) |
77 | #define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ | 82 | #define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ |
78 | QUIRK_SKIP_INPUT_MAPPING | \ | 83 | QUIRK_SKIP_INPUT_MAPPING | \ |
79 | QUIRK_IS_MULTITOUCH) | 84 | QUIRK_IS_MULTITOUCH) |
80 | 85 | ||
@@ -337,7 +342,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) | |||
337 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { | 342 | if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { |
338 | int ret; | 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 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); | 349 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); |
342 | input_set_abs_params(input, ABS_TOOL_WIDTH, 0, MAX_TOUCH_MAJOR, 0, 0); | 350 | input_set_abs_params(input, ABS_TOOL_WIDTH, 0, MAX_TOUCH_MAJOR, 0, 0); |
343 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, MAX_TOUCH_MAJOR, 0, 0); | 351 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, MAX_TOUCH_MAJOR, 0, 0); |
@@ -517,6 +525,13 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
517 | 525 | ||
518 | drvdata->quirks = id->driver_data; | 526 | drvdata->quirks = id->driver_data; |
519 | 527 | ||
528 | if (drvdata->quirks & QUIRK_T100_KEYBOARD) { | ||
529 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
530 | |||
531 | if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) | ||
532 | drvdata->quirks = TOUCHPAD_QUIRKS | QUIRK_T100_TOUCHPAD; | ||
533 | } | ||
534 | |||
520 | if (drvdata->quirks & QUIRK_NO_INIT_REPORTS) | 535 | if (drvdata->quirks & QUIRK_NO_INIT_REPORTS) |
521 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; | 536 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; |
522 | 537 | ||
@@ -591,7 +606,7 @@ static const struct hid_device_id asus_devices[] = { | |||
591 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, | 606 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, |
592 | USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS}, | 607 | USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS}, |
593 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, | 608 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, |
594 | USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), I2C_TOUCHPAD_QUIRKS }, | 609 | USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), TOUCHPAD_QUIRKS }, |
595 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, | 610 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, |
596 | USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, | 611 | USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, |
597 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, | 612 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, |