diff options
author | Hans de Goede <hdegoede@redhat.com> | 2018-07-11 06:38:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2018-07-17 09:25:39 -0400 |
commit | 314f04e85cabf0027f098866897db57fdaf6cf19 (patch) | |
tree | cb175c7231ff253d5ff08894a7c421e2d948ee19 | |
parent | 2f612de2d67dca26191e6c3db544f4c30beb6838 (diff) |
HID: elan: Hardcode finger-count and usb-interface
There is no need to have these configurable.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-elan.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c index d0971f5e5523..1a012d2b9fa1 100644 --- a/drivers/hid/hid-elan.c +++ b/drivers/hid/hid-elan.c | |||
@@ -23,16 +23,16 @@ | |||
23 | #define ELAN_MT_FIRST_FINGER 0x82 | 23 | #define ELAN_MT_FIRST_FINGER 0x82 |
24 | #define ELAN_MT_SECOND_FINGER 0x83 | 24 | #define ELAN_MT_SECOND_FINGER 0x83 |
25 | #define ELAN_INPUT_REPORT_SIZE 8 | 25 | #define ELAN_INPUT_REPORT_SIZE 8 |
26 | #define ELAN_MAX_FINGERS 5 | ||
26 | #define ELAN_MAX_PRESSURE 255 | 27 | #define ELAN_MAX_PRESSURE 255 |
28 | #define ELAN_TP_USB_INTF 1 | ||
27 | 29 | ||
28 | #define ELAN_MUTE_LED_REPORT 0xBC | 30 | #define ELAN_MUTE_LED_REPORT 0xBC |
29 | #define ELAN_LED_REPORT_SIZE 8 | 31 | #define ELAN_LED_REPORT_SIZE 8 |
30 | 32 | ||
31 | struct elan_touchpad_settings { | 33 | struct elan_touchpad_settings { |
32 | u8 max_fingers; | ||
33 | u16 max_x; | 34 | u16 max_x; |
34 | u16 max_y; | 35 | u16 max_y; |
35 | int usb_bInterfaceNumber; | ||
36 | }; | 36 | }; |
37 | 37 | ||
38 | struct elan_drvdata { | 38 | struct elan_drvdata { |
@@ -46,9 +46,8 @@ struct elan_drvdata { | |||
46 | static int is_not_elan_touchpad(struct hid_device *hdev) | 46 | static int is_not_elan_touchpad(struct hid_device *hdev) |
47 | { | 47 | { |
48 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 48 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
49 | struct elan_drvdata *drvdata = hid_get_drvdata(hdev); | ||
50 | 49 | ||
51 | return (intf->altsetting->desc.bInterfaceNumber != drvdata->settings->usb_bInterfaceNumber); | 50 | return (intf->altsetting->desc.bInterfaceNumber != ELAN_TP_USB_INTF); |
52 | } | 51 | } |
53 | 52 | ||
54 | static int elan_input_mapping(struct hid_device *hdev, struct hid_input *hi, | 53 | static int elan_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
@@ -98,8 +97,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) | |||
98 | __set_bit(BTN_LEFT, input->keybit); | 97 | __set_bit(BTN_LEFT, input->keybit); |
99 | __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); | 98 | __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); |
100 | 99 | ||
101 | ret = input_mt_init_slots(input, drvdata->settings->max_fingers, | 100 | ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER); |
102 | INPUT_MT_POINTER); | ||
103 | if (ret) { | 101 | if (ret) { |
104 | hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); | 102 | hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); |
105 | return ret; | 103 | return ret; |
@@ -181,7 +179,7 @@ static void elan_report_input(struct elan_drvdata *drvdata, u8 *data) | |||
181 | */ | 179 | */ |
182 | 180 | ||
183 | if (data[0] == ELAN_SINGLE_FINGER) { | 181 | if (data[0] == ELAN_SINGLE_FINGER) { |
184 | for (i = 0; i < drvdata->settings->max_fingers; i++) { | 182 | for (i = 0; i < ELAN_MAX_FINGERS; i++) { |
185 | if (data[2] & BIT(i + 3)) | 183 | if (data[2] & BIT(i + 3)) |
186 | elan_report_mt_slot(drvdata, data + 3, i); | 184 | elan_report_mt_slot(drvdata, data + 3, i); |
187 | else | 185 | else |
@@ -208,7 +206,7 @@ static void elan_report_input(struct elan_drvdata *drvdata, u8 *data) | |||
208 | if (prev_report[0] != ELAN_MT_FIRST_FINGER) | 206 | if (prev_report[0] != ELAN_MT_FIRST_FINGER) |
209 | return; | 207 | return; |
210 | 208 | ||
211 | for (i = 0; i < drvdata->settings->max_fingers; i++) { | 209 | for (i = 0; i < ELAN_MAX_FINGERS; i++) { |
212 | if (prev_report[2] & BIT(i + 3)) { | 210 | if (prev_report[2] & BIT(i + 3)) { |
213 | if (!first) { | 211 | if (!first) { |
214 | first = 1; | 212 | first = 1; |
@@ -385,10 +383,8 @@ static void elan_remove(struct hid_device *hdev) | |||
385 | } | 383 | } |
386 | 384 | ||
387 | static const struct elan_touchpad_settings hp_x2_10_touchpad_data = { | 385 | static const struct elan_touchpad_settings hp_x2_10_touchpad_data = { |
388 | .max_fingers = 5, | ||
389 | .max_x = 2930, | 386 | .max_x = 2930, |
390 | .max_y = 1250, | 387 | .max_y = 1250, |
391 | .usb_bInterfaceNumber = 1, | ||
392 | }; | 388 | }; |
393 | 389 | ||
394 | static const struct hid_device_id elan_devices[] = { | 390 | static const struct hid_device_id elan_devices[] = { |