summaryrefslogtreecommitdiff
path: root/test/litest-device-atmel-hover.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-01-10 15:58:21 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-01-30 10:50:28 +1000
commit568d527caa4d0564b765ac082e948e19d1d22e13 (patch)
tree1c17e58103e15eedfe3a3cf3e9609da3fa56dc81 /test/litest-device-atmel-hover.c
parent2b3fe1a73ebbea1f051869ac9abfa3e8f4bcfab5 (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-atmel-hover.c')
-rw-r--r--test/litest-device-atmel-hover.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/litest-device-atmel-hover.c b/test/litest-device-atmel-hover.c
index c856d081..942744e2 100644
--- a/test/litest-device-atmel-hover.c
+++ b/test/litest-device-atmel-hover.c
@@ -76,10 +76,24 @@ static struct input_event up[] = {
{ .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,
.touch_up_events = up,
+
+ .get_axis_default = get_axis_default,
};
static struct input_id input_id = {