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>
No functional changes, just enables us to use 'continue' instead of piling up
negated conditions.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Right now, we fail if we call litest_push_event_frame() when already inside a
frame. For the semi-mt handling we need to do exactly that though, so turn it
into a counting semaphore instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We need to remember whether a tap was down or just hovering, otherwise we mess
up the state machine when we send tap release events for taps that never
switched to TOUCH_BEGIN. This is quick fix, really we should have a new state
here, but that's a lot harder to implement.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
As we switch to pressure-based touch detection, we need for all
pressure-capable touchpads to send pressure values. They'll do so by filling
in an axis default but that breaks our current hover code.
Make sure the hover litest helpers force a pressure of 0.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Now that the acceleration code doesn't use dpi-normalized coordinates anymore,
we don't need to use them in the touchpad code. Switch to physical distances
instead, it makes debugging a lot saner.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Make sure the events we deal with are the ones we actually honor. This reduces
the chance that we accidentally process events we weren't event supposed to
get based on some earlier device decision.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Nothing actually called that function, sprinkle a few calls into existing
tests to make sure it actually works.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The test suite (and tests) we have now all clean up nicely before calling the
final libinput_unref(). Add one where there's at least one device still
connected.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
./configure --enable-gcov adds the required flags to link everything ready for
gcov. A new make gcov target runs the test suite, then pulls all the gcov bits
together into ./test/gcov-reports/ including a summary file.
The script to pull everything out is used in libevdev too, we just have an
extra condition here to ignore the selftest gcov bits (it overwrites the
useful litest.c coverage output).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
When the filter code switched to raw device coordinates (bdd4264d) the input
data remained in device coordinates. Since the factor for touchpads was still
based on the physical velocity (and thus all touchpads get the same
acceleration factor for identical moves), the actual delta was dependent on
the resolution. e.g.
touchpad with 40u/mm: delta of 2/2 * accel factor 2 -> accel delta of 4/4
touchpad with 20u/mm: delta of 1/1 * accel factor 2 -> accel delta of 2/2
The normalized coordinates should be independent of the touchpad's resolution
though.
Affected by this was the standard mouse accel code and the touchpad accel
code, other filters always returned unnormalized coordinates (separate bug,
not addressed here).
This patch restores the correct behaviour for mice and touchpads
while leaving the special filters untouched. For comparision:
* 1000+dpi mice: accelerate normalized, return normalized
* touchpads: accelerate unnormalized, return normalized
* low-dpi mice: accelerate unnormalized, return unnormalized
* trackpoints: accelerate unnormalized, return unnormalized
* x230: don't touch, already does the right thing
https://bugs.freedesktop.org/show_bug.cgi?id=99383
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
We were just switching type here without actual normalization, the filter code
is in device units as of bdd4264d61.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>