diff options
author | KT Liao <kt.liao@emc.com.tw> | 2016-05-19 17:38:07 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-06-01 14:21:10 -0700 |
commit | 0fd80a77e4d2f34e9fe66a73edf81d4a30bd4ca4 (patch) | |
tree | c3b43a4910e78e27b1b9839d8cd2717fe756d806 /drivers/input | |
parent | cd467299c1153b780e8031e7490a8f8fa0a3f853 (diff) | |
download | linux-stable-0fd80a77e4d2f34e9fe66a73edf81d4a30bd4ca4.tar.gz linux-stable-0fd80a77e4d2f34e9fe66a73edf81d4a30bd4ca4.tar.bz2 linux-stable-0fd80a77e4d2f34e9fe66a73edf81d4a30bd4ca4.zip |
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: KT Liao <kt.liao@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/input-mt.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index 54fce56c8023..a1bbec9cda8d 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -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); - 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); + } if (oldest) { int x = input_mt_get_value(oldest, ABS_MT_POSITION_X); |