diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-01-10 15:58:21 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-01-30 10:50:28 +1000 |
commit | 568d527caa4d0564b765ac082e948e19d1d22e13 (patch) | |
tree | 1c17e58103e15eedfe3a3cf3e9609da3fa56dc81 /test/litest-device-synaptics-hover.c | |
parent | 2b3fe1a73ebbea1f051869ac9abfa3e8f4bcfab5 (diff) |
touchpad: use pressure values for touch is-down decision
Don't rely on BTN_TOUCH for "finger down", the value for that is hardcoded in
the kernel and not always suitable. Some devices need a different value to
avoid reacting to accidental touches or hovering fingers.
Implement a basic Schmitt trigger, same as we have in the synaptics driver. We
also take the default values from there but these will likely see some
updates.
A special case is when we have more fingers down than slots. Since we can't
detect the pressure on fake fingers (we only get a bit for 'is down') we
assume that *all* fingers are down with sufficient pressure. It's too much of
a niche case to have this work any other way.
This patch drops the handling of ABS_DISTANCE because it's simply not needed
anymore.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/litest-device-synaptics-hover.c')
-rw-r--r-- | test/litest-device-synaptics-hover.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/litest-device-synaptics-hover.c b/test/litest-device-synaptics-hover.c index 8439f10..9c0c7bd 100644 --- a/test/litest-device-synaptics-hover.c +++ b/test/litest-device-synaptics-hover.c @@ -60,9 +60,23 @@ static struct input_event move[] = { { .type = -1, .code = -1 }, }; +static int +get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) +{ + switch (evcode) { + case ABS_PRESSURE: + case ABS_MT_PRESSURE: + *value = 30; + return 0; + } + return 1; +} + static struct litest_device_interface interface = { .touch_down_events = down, .touch_move_events = move, + + .get_axis_default = get_axis_default, }; static struct input_id input_id = { |