Commit 314f04e8 authored by Hans de Goede's avatar Hans de Goede Committed by Jiri Kosina

HID: elan: Hardcode finger-count and usb-interface

There is no need to have these configurable.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 2f612de2
...@@ -23,16 +23,16 @@ ...@@ -23,16 +23,16 @@
#define ELAN_MT_FIRST_FINGER 0x82 #define ELAN_MT_FIRST_FINGER 0x82
#define ELAN_MT_SECOND_FINGER 0x83 #define ELAN_MT_SECOND_FINGER 0x83
#define ELAN_INPUT_REPORT_SIZE 8 #define ELAN_INPUT_REPORT_SIZE 8
#define ELAN_MAX_FINGERS 5
#define ELAN_MAX_PRESSURE 255 #define ELAN_MAX_PRESSURE 255
#define ELAN_TP_USB_INTF 1
#define ELAN_MUTE_LED_REPORT 0xBC #define ELAN_MUTE_LED_REPORT 0xBC
#define ELAN_LED_REPORT_SIZE 8 #define ELAN_LED_REPORT_SIZE 8
struct elan_touchpad_settings { struct elan_touchpad_settings {
u8 max_fingers;
u16 max_x; u16 max_x;
u16 max_y; u16 max_y;
int usb_bInterfaceNumber;
}; };
struct elan_drvdata { struct elan_drvdata {
...@@ -46,9 +46,8 @@ struct elan_drvdata { ...@@ -46,9 +46,8 @@ struct elan_drvdata {
static int is_not_elan_touchpad(struct hid_device *hdev) static int is_not_elan_touchpad(struct hid_device *hdev)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
struct elan_drvdata *drvdata = hid_get_drvdata(hdev);
return (intf->altsetting->desc.bInterfaceNumber != drvdata->settings->usb_bInterfaceNumber); return (intf->altsetting->desc.bInterfaceNumber != ELAN_TP_USB_INTF);
} }
static int elan_input_mapping(struct hid_device *hdev, struct hid_input *hi, 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,8 +97,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
__set_bit(BTN_LEFT, input->keybit); __set_bit(BTN_LEFT, input->keybit);
__set_bit(INPUT_PROP_BUTTONPAD, input->propbit); __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
ret = input_mt_init_slots(input, drvdata->settings->max_fingers, ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
INPUT_MT_POINTER);
if (ret) { if (ret) {
hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
return ret; return ret;
...@@ -181,7 +179,7 @@ static void elan_report_input(struct elan_drvdata *drvdata, u8 *data) ...@@ -181,7 +179,7 @@ static void elan_report_input(struct elan_drvdata *drvdata, u8 *data)
*/ */
if (data[0] == ELAN_SINGLE_FINGER) { if (data[0] == ELAN_SINGLE_FINGER) {
for (i = 0; i < drvdata->settings->max_fingers; i++) { for (i = 0; i < ELAN_MAX_FINGERS; i++) {
if (data[2] & BIT(i + 3)) if (data[2] & BIT(i + 3))
elan_report_mt_slot(drvdata, data + 3, i); elan_report_mt_slot(drvdata, data + 3, i);
else else
...@@ -208,7 +206,7 @@ static void elan_report_input(struct elan_drvdata *drvdata, u8 *data) ...@@ -208,7 +206,7 @@ static void elan_report_input(struct elan_drvdata *drvdata, u8 *data)
if (prev_report[0] != ELAN_MT_FIRST_FINGER) if (prev_report[0] != ELAN_MT_FIRST_FINGER)
return; return;
for (i = 0; i < drvdata->settings->max_fingers; i++) { for (i = 0; i < ELAN_MAX_FINGERS; i++) {
if (prev_report[2] & BIT(i + 3)) { if (prev_report[2] & BIT(i + 3)) {
if (!first) { if (!first) {
first = 1; first = 1;
...@@ -385,10 +383,8 @@ static void elan_remove(struct hid_device *hdev) ...@@ -385,10 +383,8 @@ static void elan_remove(struct hid_device *hdev)
} }
static const struct elan_touchpad_settings hp_x2_10_touchpad_data = { static const struct elan_touchpad_settings hp_x2_10_touchpad_data = {
.max_fingers = 5,
.max_x = 2930, .max_x = 2930,
.max_y = 1250, .max_y = 1250,
.usb_bInterfaceNumber = 1,
}; };
static const struct hid_device_id elan_devices[] = { static const struct hid_device_id elan_devices[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment