From 568d527caa4d0564b765ac082e948e19d1d22e13 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 10 Jan 2017 15:58:21 +1000 Subject: 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 --- test/litest-device-synaptics-hover.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/litest-device-synaptics-hover.c') 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 = { -- cgit v1.2.3