diff options
author | Duson Lin <dusonlin@emc.com.tw> | 2015-04-20 12:59:04 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-04-20 13:28:30 -0400 |
commit | 090ad325068810a9edb09dfe8fec97a724c5743f (patch) | |
tree | b3866e846a36e95f5b7150b024e840ff43600c39 | |
parent | 8c0776a8f046d5fb1804e525c3b6e9f897fe0d3f (diff) |
Input: elan_i2c - report hovering contacts
When hover is detected report ABS_MT_DISTANCE as 1; for active contacts
the distance is reported as 0.
Signed-off-by: Duson Lin <dusonlin@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/mouse/elan_i2c_core.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 22f38521c083..fd5068b2542d 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #define ETP_REPORT_ID_OFFSET 2 | 52 | #define ETP_REPORT_ID_OFFSET 2 |
53 | #define ETP_TOUCH_INFO_OFFSET 3 | 53 | #define ETP_TOUCH_INFO_OFFSET 3 |
54 | #define ETP_FINGER_DATA_OFFSET 4 | 54 | #define ETP_FINGER_DATA_OFFSET 4 |
55 | #define ETP_HOVER_INFO_OFFSET 30 | ||
55 | #define ETP_MAX_REPORT_LEN 34 | 56 | #define ETP_MAX_REPORT_LEN 34 |
56 | 57 | ||
57 | /* The main device structure */ | 58 | /* The main device structure */ |
@@ -725,7 +726,7 @@ static const struct attribute_group *elan_sysfs_groups[] = { | |||
725 | */ | 726 | */ |
726 | static void elan_report_contact(struct elan_tp_data *data, | 727 | static void elan_report_contact(struct elan_tp_data *data, |
727 | int contact_num, bool contact_valid, | 728 | int contact_num, bool contact_valid, |
728 | u8 *finger_data) | 729 | bool hover_event, u8 *finger_data) |
729 | { | 730 | { |
730 | struct input_dev *input = data->input; | 731 | struct input_dev *input = data->input; |
731 | unsigned int pos_x, pos_y; | 732 | unsigned int pos_x, pos_y; |
@@ -769,7 +770,9 @@ static void elan_report_contact(struct elan_tp_data *data, | |||
769 | input_mt_report_slot_state(input, MT_TOOL_FINGER, true); | 770 | input_mt_report_slot_state(input, MT_TOOL_FINGER, true); |
770 | input_report_abs(input, ABS_MT_POSITION_X, pos_x); | 771 | input_report_abs(input, ABS_MT_POSITION_X, pos_x); |
771 | input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y); | 772 | input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y); |
772 | input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure); | 773 | input_report_abs(input, ABS_MT_DISTANCE, hover_event); |
774 | input_report_abs(input, ABS_MT_PRESSURE, | ||
775 | hover_event ? 0 : scaled_pressure); | ||
773 | input_report_abs(input, ABS_TOOL_WIDTH, mk_x); | 776 | input_report_abs(input, ABS_TOOL_WIDTH, mk_x); |
774 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, major); | 777 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, major); |
775 | input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); | 778 | input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); |
@@ -785,11 +788,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) | |||
785 | u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET]; | 788 | u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET]; |
786 | int i; | 789 | int i; |
787 | u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET]; | 790 | u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET]; |
788 | bool contact_valid; | 791 | u8 hover_info = packet[ETP_HOVER_INFO_OFFSET]; |
792 | bool contact_valid, hover_event; | ||
789 | 793 | ||
794 | hover_event = hover_info & 0x40; | ||
790 | for (i = 0; i < ETP_MAX_FINGERS; i++) { | 795 | for (i = 0; i < ETP_MAX_FINGERS; i++) { |
791 | contact_valid = tp_info & (1U << (3 + i)); | 796 | contact_valid = tp_info & (1U << (3 + i)); |
792 | elan_report_contact(data, i, contact_valid, finger_data); | 797 | elan_report_contact(data, i, contact_valid, hover_event, |
798 | finger_data); | ||
793 | 799 | ||
794 | if (contact_valid) | 800 | if (contact_valid) |
795 | finger_data += ETP_FINGER_DATA_LEN; | 801 | finger_data += ETP_FINGER_DATA_LEN; |
@@ -883,6 +889,7 @@ static int elan_setup_input_device(struct elan_tp_data *data) | |||
883 | ETP_FINGER_WIDTH * max_width, 0, 0); | 889 | ETP_FINGER_WIDTH * max_width, 0, 0); |
884 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, | 890 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, |
885 | ETP_FINGER_WIDTH * min_width, 0, 0); | 891 | ETP_FINGER_WIDTH * min_width, 0, 0); |
892 | input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0); | ||
886 | 893 | ||
887 | data->input = input; | 894 | data->input = input; |
888 | 895 | ||