summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-07-02evdev-mt-touchpad: Enable timestamp smoothing support for bluetooth touchpadsHEADmasterHans de Goede3-3/+11
Bluetooth wreaks havoc with the timestamp of the input events coming from the touchpad, enable timestamp smoothing support to counter this. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2017-07-02filter: Add timestamp smoothing supportHans de Goede1-7/+18
Some devices, specifically some bluetooth touchpads generate quite unreliable timestamps for their events. The problem seems to be that (some of) these touchpads sample at aprox 90 Hz, but the bluetooth stack only communicates about every 30 ms (*) and then sends mutiple HID input reports in one batch. This results in 2-4 packets / SYNs every 30 ms. With timestamps really close together. The finger coordinate deltas in these packets change by aprox. the same amount between each packet when moving a finger at constant speed. But the time deltas are e.g. 28 ms, 1 ms, 1 ms resulting in calculate_tracker_velocity returning vastly different speeds for the 1st and 2nd packet, which in turn results in very "jerky" mouse pointer movement. *) Maybe it is waiting for a transmit time slot or some such. This commit adds support for a real simple timestamp smoothing algorithm, intended *only* for use with touchpads. Since touchpads will send a contineous stream of events at their sample rate when a finger is down, this filter simply assumes that any events which are under event_delta_smooth_threshold us apart are part of a smooth continuous stream of events with each event being event_delta_smooth_value us apart. Theoritically a very still finger may send the exact same coordinates and pressure twice, but even if this happens that is not a problem because a still finger generates coordinates changes below the hyst treshold so we ignore it anyways. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2017-06-26touchpad: ignore the tap motion threshold if fingers > slotsPeter Hutterer1-0/+12
Do so on the synaptics serial touchpads at least, they're known to cause cursor jumps when the third finger is down. Not detecting a tap move means three-finger taps get more reliable on these touchpads. This change affects gestures who now effectively have to wait for the tap timeout to happen. It's a trade-off. https://bugs.freedesktop.org/show_bug.cgi?id=101435 https://bugzilla.redhat.com/show_bug.cgi?id=1455443 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-23Skip restorecon if it cannot be foundPeter Hutterer1-2/+4
https://bugs.freedesktop.org/show_bug.cgi?id=101557 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-21touchpad: update the timestamp even when we only get other axesPeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-21touchpad: rename tp_touch->millis to tp_touch->timePeter Hutterer4-11/+11
This is in µs and hasn't been in ms for a long time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-21meson: restore the SELinux context for our .so file on installPeter Hutterer2-1/+11
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2017-06-19touchpad: use the "is internal keyboard" tag to enable dwtPeter Hutterer1-31/+10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-19evdev: default to log error priorityPeter Hutterer1-1/+1
Fixes compiler warning: evdev.c:2899:2: warning: 'pri' may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02Add tv2us helper functionPeter Hutterer2-1/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02evdev: hook up the libevdev log handlerPeter Hutterer1-1/+36
Make sure any messages from libevdev end up in the same place as libinput's messages Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23Revert "lid: force the lid to open when the keyboard device is removed"Peter Hutterer1-23/+11
This reverts commit 1e2b66fb9a0de8956abc7d996afdd24a11893eb6.
2017-05-23lid: force the lid to open when the keyboard device is removedPeter Hutterer1-11/+23
On unreliable tablets (Surface3), always force the lid switch to open when the paired keyboard is removed. This way the lid can't be stuck in a closed state when there's nothing attached that can actually trigger that state. https://bugs.freedesktop.org/show_bug.cgi?id=101100 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23lid: setup the keyboard notifier when pairing itBenjamin Tissoires1-2/+5
On unreliable LID switches, we might have the LID declared as closed while it is actually not. We can not wait for the first switch event to setup the keyboard listener: it will never occur. https://bugs.freedesktop.org/show_bug.cgi?id=101099 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23lid: track the notifier initial state internally, but not externallyBenjamin Tissoires1-26/+23
What we do not want is libinput to believe the LID is closed while it's not. But the internal notifier state need to be in sync with the evdev node, or it's going to be a pain setting the keyboard listener. But since we don't know if the state is reliable, we track the internal state separately from the external state so that we can set up the keyboard listener when the lid is closed, without having libinput actually send lid closed events for unreliable devices. https://bugs.freedesktop.org/show_bug.cgi?id=101099 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23lid: tighten the lid-keyboard pairingPeter Hutterer1-17/+11
Only pair if the keyboard is either tagged as internal device. This has another (unlikely) behaviour change: previously we would override the paired keyboards with ones that look more accurate (e.g. a usb keyboard paired before a serial would be unpaired and the serial keyboard takes its place). Now we assume there can only be one internal keyboard, once we have it we ignore all others. This shouldn't matter in real life provided the tagging is correct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23evdev: read LIBINPUT_ATTR_KEYBOARD_INTEGRATION propertyPeter Hutterer3-4/+33
We have heuristics for detecting whether a keyboard is internal or external, but in some cases (e.g. Surface 3) these heuristics fail. Add a udev property that we can apply to these cases so we have something that's reliable. This will likely eventually become ID_INPUT_KEYBOARD_INTEGRATION as shipped by systemd, similar to the touchpad property. https://bugs.freedesktop.org/show_bug.cgi?id=101101 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23lid: add a comment for why we post the switch state therePeter Hutterer1-0/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-22Remove write-only CYAPA model tagPeter Hutterer2-2/+0
Obsolete since we moved pressure into the hwdb in 8d5f4decb4086e2b7982c3cd1e24afd9c11f551f Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-17util: harmonize container_of() definition with linux kernel oneGabriel Laskar6-26/+17
commit 3925936 introduced changes to container_of, this is hopefully the last part of it. In the linux kernel, container_of() takes a type name, and not a variable. Without this, in some cases it is needed to declare an unused variable in order to call container_of(). example: return container_of(dispatch, struct fallback_dispatch, base); instead of: struct fallback_dispatch *p; return container_of(dispatch, p, base); This introduce also list_first_entry(), a simple wrapper around container_of() to retrieve the first element of a non empty list. It allows to simplify list_for_each() and list_for_each_safe(). Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15util: use offsetof in container_ofGabriel Laskar1-2/+3
gcc and clang supports offsetof (defined in stddef.h) as defined by C99 and POSIX.1-2001, use it in container_of. Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-11touchpad: pull the tap exclusion zone down to the full edge zonePeter Hutterer1-9/+2
This was originally left outside of the button areas in case users tap in those zones, but we're getting false tap events in that zone. On a 100mm touchpad, the edge zone is merely 5mm, it's acceptable to ignore taps in that area even in the software button. We can revisit this if we see tap detection failures in the future. https://bugzilla.redhat.com/show_bug.cgi?id=1415796 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-05-11evdev: replace null sentinel with ARRAY_SIZEEric Engestrom1-10/+5
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-10Ensure enums are size intPeter Hutterer1-0/+31
Because otherwise things go boom, but unless you passed -fshort-enums this shouldn't happen anyway. And gcc's documentation says don't do that. So don't do that, or we'll scream at you. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Tested-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10Fix va_start compiler warningPeter Hutterer1-1/+1
../src/libinput.c:56:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] The enum's size is compiler-defined, so the enum gets promoted to whatever the compiler chose. That promotion is undefined, so let's use an int here. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Tested-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10util: fix container_of() macroPeter Hutterer1-1/+1
Fixes a bunch of warnings of the kind ../src/evdev.h:378:32: warning: variable 'f' is uninitialized when used here [-Wuninitialized] return container_of(dispatch, f, base); Just typecasting NULL means we can ignore sample but for the type. https://bugs.freedesktop.org/show_bug.cgi?id=100976 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Tested-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10util: drop GCC specifics for container_ofPeter Hutterer1-6/+0
clang supports __typeof__ which was the only real difference. Not sure any other compilers matter (that don't support __typeof__) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Tested-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-05lid: remove the keyboard listener on remove and re-init the listenerPeter Hutterer1-2/+19
If the event listener is added, then removed again on a lid switch on/off event, the list is set to null. This can trigger two crashes: * when the keyboard is removed first, the call to libinput_device_remove_event_listener() dereferences the null pointer * when the switch is removed first, the call to device_destroy will find a remaining event listener and assert https://bugzilla.redhat.com/show_bug.cgi?id=1440927 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05touchpad: remove the lid switch listener on device_removedPeter Hutterer1-0/+6
Sequence triggered by the xorg driver, but basically: if the touchpad is destroyed before the lid switch, the event listener wasn't removed and an assertion was triggered. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04util: add asserts with useful error messages to catch uninitialized listsPeter Hutterer1-0/+9
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04Merge branch 'wip/touchpad-tap-timestamps'Peter Hutterer6-52/+180
2017-05-03lid: fix some indentationPeter Hutterer1-5/+5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-03touchpad: make use of use tp_for_each_touchMarcos Paulo de Souza2-12/+5
Instead of reimplementing a for loop every time. Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02doc: fix doxygen group for libinput_event_tablet_pad_get_timePeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02doc: document the event timestampsPeter Hutterer1-0/+42
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02udev: Remove unused Elantech touchpad model bindingPaul Kocialkowski2-2/+0
The Elantech touchpad model binding in udev is currently unused, since pressure values were moved to a udev binding of their own. This gets rid of the deprecated model binding. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28Put a check in to make sure our events have correct timestampsPeter Hutterer2-37/+51
This is for debugging purposes only, we cannot guarantee that event timestamps always go up - at least not across devices. Example: tapping on a touchpad may delay an event until a timeout expires, but that event is then sent with the original touch timestamps (i.e. in the past). If any other device produces events during that timeout period, our timestamps are out-of-order. This isn't really a bug because we are forced to do that, but for bug-fixing it can be useful to detect. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28touchpad: add touch state debugging helperPeter Hutterer1-0/+25
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28touchpad: for 2/3-finger tap, use the last finger down as press timePeter Hutterer1-1/+9
This makes the tapping times shorter and hopefully more obvious. It also fixes a bug where repeated tripletap (by tapping with one finger while leaving the other two down) could cause incorrect timestamps. https://bugs.freedesktop.org/show_bug.cgi?id=100796 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28touchpad: send multitap button events with the correct timestampsPeter Hutterer2-14/+47
For multitap, we're one tap behind with the button clicks, i.e. we send the first full click button on the second tap, etc. Remember the timestamps of the touches so we can send the events with the right timestamps. This makes tapping more accurate because the time between taps and various timeouts matter less for double-click detection. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28touchpad: fix the button timestamps for double/tripletapPeter Hutterer1-2/+8
Both events had the same timestamp but we have the timestamp from the original event - use it. https://bugs.freedesktop.org/show_bug.cgi?id=100796 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26Merge branch 'wip/touchpad-custom-pressure-values'Peter Hutterer4-21/+69
2017-04-26touchpad: drop the unused touchpad_model enumPeter Hutterer1-9/+0
A leftover from synaptics where we do this detection in the driver. libinput pushes this to the hwdb and sets the model flags accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26touchpad: move the pressure range to a hwdb entryPeter Hutterer3-12/+69
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26Merge branch 'wip/touchpad-mt-tool-palm'Peter Hutterer2-32/+120
2017-04-25Add doc to discourage use of libinput_device_get_output_name()Peter Hutterer1-0/+8
This is a leftover from when libinput was part of weston and we could interpret properties correctly. Realistically, the only way this could work with libinput as external library is if we define precisely what the definition of an output is. Practically, it's a lot easier to just throw up our hands and leave it all to the caller. https://bugs.freedesktop.org/show_bug.cgi?id=100707 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-24evdev: improve default scroll button detectionPeter Hutterer1-0/+9
Try to guess the default scroll buttons a bit better. Right now we default to scroll button 0 (disabled) whenever a device doesn't have a middle button but we might as well cast a wider net here as setting a scroll button only has a direct effect when button scrolling is enabled. Use the first extra button we find or fall back onto the right button if we don't have any extra buttons. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: add MT_TOOL-based palm detectionPeter Hutterer2-0/+45
If the touchpad driver tells us something is a palm, go with that. https://bugs.freedesktop.org/show_bug.cgi?id=100243 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: add helper function for stopping current actionsPeter Hutterer1-6/+10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: move edge palm init to separate helperPeter Hutterer1-12/+18
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>