Commit 0fd80a77 authored by KT Liao's avatar KT Liao Committed by Dmitry Torokhov

Input: update input_mt_report_pointer_emulation to support hovering

For devices that are incapable of reporting per-contact distance and can
only report ABS_DISTANCE, just distance is not enough for upper layers of
OS to determine whether contact is leaving the area or if it is continuing
hovering, we need BTN_TOOL_FINGER for that:

                                   Contact State
                    Inactive          Hovering            Active
                   (far away)    (inside hover area)  (touching surface)
BTN_TOUCH              0                 0                   1
BTN_TOOL_FINGER        0                 1                   1
ABS_DISTANCE          N/A                1                   0
Signed-off-by: default avatarKT Liao <kt.liao@emc.com.tw>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent cd467299
...@@ -218,8 +218,23 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) ...@@ -218,8 +218,23 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
} }
input_event(dev, EV_KEY, BTN_TOUCH, count > 0); input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
if (use_count)
if (use_count) {
if (count == 0 &&
!test_bit(ABS_MT_DISTANCE, dev->absbit) &&
test_bit(ABS_DISTANCE, dev->absbit) &&
input_abs_get_val(dev, ABS_DISTANCE) != 0) {
/*
* Force reporting BTN_TOOL_FINGER for devices that
* only report general hover (and not per-contact
* distance) when contact is in proximity but not
* on the surface.
*/
count = 1;
}
input_mt_report_finger_count(dev, count); input_mt_report_finger_count(dev, count);
}
if (oldest) { if (oldest) {
int x = input_mt_get_value(oldest, ABS_MT_POSITION_X); int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
......
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