summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-05-12Take care of -Wempty-body warning from call to empty PS2DBG macroAlan Coopersmith1-1/+1
ps2comm.c: In function ‘ps2_synaptics_get_packet’: ps2comm.c:477:49: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] 477 | PS2DBG("faked reset received\n"); | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-synaptics/-/merge_requests/17>
2024-05-12Clear 9 of 9 -Wimplicit-fallthrough warningsAlan Coopersmith1-0/+9
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-synaptics/-/merge_requests/17>
2024-05-12Fix -Wold-style-declaration warningAlan Coopersmith1-1/+1
synaptics.c:143:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] 143 | const static struct { | ^~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-synaptics/-/merge_requests/17>
2024-05-12Raise minimum supported Xserver version from 1.12 to 1.15Alan Coopersmith2-61/+0
Drops support for ABI_XINPUT_VERSION < 20, including removing support for driver-side coordinate scaling, since the X server handles it now. Xserver 1.15 was released in Dec. 2013. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-01-05Handle 5 -Wmissing-prototypes warningsAlan Coopersmith2-4/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-01-05Fix 185 -Wdiscarded-qualifiers warningsAlan Coopersmith2-5/+6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-01-05Add X.Org's standard C warning flags to AM_CFLAGSAlan Coopersmith1-1/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16Convert remaining source files from ISO-8859-1 to UTF-8Alan Coopersmith4-29/+29
Most were already converted. Fixes error raised by FlawFinder in CI: Error: encoding error in ./src/synaptics.c 'utf-8' codec can't decode byte 0xa9 in position 16: invalid start byte Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16Fix spelling/wording issuesAlan Coopersmith3-5/+5
Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-28eventcomm: fix compile with pre-time64 kernelsAriadne Conill1-0/+8
2020-07-22eventcomm: use 64-bit time safe accessors instead of timeval directlyAriadne Conill1-4/+7
when building on a 32-bit host with 64-bit time_t, using the input_event and input_event_usec accessors are necessary to deal with translation.
2019-02-11Use fabs() instead of abs() on double values.Matthieu Herrb1-4/+4
Silences clang warnings. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Walter Harms <wharms@bfs.de> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-15eventcomm: if we get a read error other than EAGAIN, remove the fdPeter Hutterer1-0/+1
Otherwise poll() keeps on triggering on our fd until udev gets around to notifying the server that the device is in some state of deadness. Meanwhile, the input thread is busy filling the log up with "Read error" messages. Great way to test file systems and their capacity to handle out of space scenarios but otherwise a bit pointless. Those FS developers should write their own tests instead of relying on the synaptics driver! Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-08-17Drop HandleTouches - it's a noopPeter Hutterer1-19/+1
With the removal of touch events in 0a4cf80a00663, this function is a noop. It merely counted the number of touches but discarded the result. And UpdateTouchState does the update anyway. https://bugs.freedesktop.org/show_bug.cgi?id=102209 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-15Remove unused fraction calculationsPeter Hutterer2-21/+0
hw.x and the motion history are integers so our deltas are always integers. It's a bit pointless to split them into the fractional and integral part. obsolete since defc1d008e5674306a or so Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-17eventcomm: don't ever probe if a device is setPeter Hutterer1-6/+6
If opening the fd fails we still need to fail the device. This is particularly the case when a device disappears before we can open it - the current code wouldn't exit but instead switch to auto-probe touchpad devices on the system. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-02Support XINPUT ABI version 23Peter Hutterer2-3/+13
Use input_lock/input_unlock calls instead of SIGIO functions Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29Revert MaxDoubleTapTime back to 180Peter Hutterer1-1/+1
Fallout from 90c6d7fc60f3db1bd9db1c7702062fcaef3b3352 where it got changed to 100ms. This is too short for triple-tap-and-drag gestures so revert it to the previous value. https://bugs.freedesktop.org/show_bug.cgi?id=95171 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-27eventcomm: fix typo checking for two-finger scrollingPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-12Drop touch events from the driverPeter Hutterer1-103/+10
This was a bad idea. No-one seems to use this and it gives us little benefits. To even get this feature a number of other features need to be turned off (like two-finger scrolling and tapping). Many of these are enabled by default, if they are disabled a client stack with full touchpad gesture support could in theory support true touchpad gestures. This has never happened. Drop the touch events from the synaptics driver. This allows us to switch the touchpad fully over to look like a relative device, thus also removing the bug that changes the touchpad speed whenever a monitor is added/removed in. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-08-12eventcomm: ignore key repeat eventsPeter Hutterer1-0/+4
Usually doesn't happen, but the evtest output in https://bugs.freedesktop.org/show_bug.cgi?id=90392 actually has repeat events for the button. Ignore them if they happen. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-25eventcomm: ignore fake and broken MT devicesPeter Hutterer1-0/+9
An MT device without X/Y is not a touchpad. And neither are fake MT devices. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-24eventcomm: prevent possibly division by zeroPeter Hutterer1-0/+10
This came up as a kernel bug, but it's valid to create uinput devices with a min == max range for x/y. Technically valid, but effectively useless, so catch it, complain and hobble on along. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-18Revert "Support the new Lenovo X1 Carbon 3rd trackpoint buttons"Peter Hutterer2-44/+0
This reverts commit 064445364b4775b25ba49c2250b22b169f291147. The Lenovo *50 series, including the X1 Carbon 3rd always require multiple kernel patches to enable the touchpad buttons. This patch in synaptics only addresses the re-routing of the top buttons. The final iteration of the kernel patches also route the trackpoint buttons through the trackpoint device, rendering this patch unnecessary. These patches are queued for 4.0. See kernel patch series up to commit cdd9dc195916ef5644cfac079094c3c1d1616e4c Author: Benjamin Tissoires <benjamin.tissoires@redhat.com> Date: Sun Mar 8 22:35:41 2015 -0700 Input: synaptics - re-route tracksticks buttons on the Lenovo 2015 series Currently in Dmitry's for-linus branch. Distributions running older kernels or the kernel stable series which has partial backports of the above patch series are encouraged to leave the 0644453 commit in and undo this revert. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-18Add a delay between the second button down-up event of double tapsGabriele Mazzotta2-22/+6
Some applications ignore the second tap of double taps because of the lack of a delay between the button down and button up events. Prevent this by replacing the transition from TS_2B to TS_START with a transition from TS_2B to TS_SINGLETAP that emits only a button down event. The button up event will be emitted when transitioning from TS_SINGLETAP to TS_START. In addition, decrease the default value of MaxDoubleTapTime from 180 ms to 100 ms in order to make double taps faster. Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-30Support the new Lenovo X1 Carbon 3rd trackpoint buttonsPeter Hutterer2-0/+44
This device has the trackpoint buttons wired up to the touchpad to send BTN_0, BTN_1 and BTN_2 for left, right, middle. This conflicts with previous touchpads that used those event codes for dedicated scroll buttons. Add an option HasTrackpointButtons that can be set via a xorg.conf.d snippets. This option is not intended as a user-set option, rather we expect distributions to ship some conglomerate of udev/hal rules with xorg.conf snippets that take effect. If the option is set, we look at the three affected buttons at the beginning of HandleState and send button events immediately for them. The HW state is reset to neutral and other processing continues. This saves us from having to synchronize these buttons with software buttons (also present on this device), tapping, etc. Since the buttons are physically different and (mentally) associated with the trackpoint device we also don't need to worry about having finger motion event correctly synced up with the button presses - it's acceptable to send the presses before the motion events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-01-08Don't assume that touch devices report per finger width and pressureGabriele Mazzotta3-3/+10
The palm detection relies on both the width and the pressure. a897147be04 ("Use ABS_MT events for the palm detection when supported") assumed that all the touch devices can report both ABS_MT_TOUCH_MAJOR and ABS_MT_PRESSURE, but this is not necessarily true. This assumption could hence break the palm detection when at least one of the mentioned events is not declared but both ABS_TOOL_WIDTH and ABS_PRESSURE are reported. Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-17Use ABS_MT events for the palm detection when supportedGabriele Mazzotta2-0/+15
Use ABS_MT_TOUCH_MAJOR and ABS_MT_PRESSURE instead of ABS_TOOL_WIDTH and ABS_PRESSURE when supported so that the pressure and the width of all the fingers is taken into account for the palm detection. This also fixes the palm detection for those touchpads for which the kernel only sends ABS_MT_TOUCH_MAJOR and not ABS_TOOL_WIDTH. Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-17Limit the movement to 20 mm per eventPeter Hutterer2-0/+35
Touchpads are limited by a fixed sampling rate (usually 80Hz). Some finger changes may happen too fast for this sampling rate, resulting in two distinct event sequences: * finger 1 up and finger 2 down in the same EV_SYN frame. Synaptics sees one finger down before and after and the changed coordinates * finger 1 up and finger 2 down _between_ two EV_SYN frames. Synaptics sees one touchpoint move from f1 position to f2 position. That move causes a large cursor jump. The former could be solved (with difficulty) by adding fake EV_SYN handling after releasing touchpoints but that won't fix the latter case. So as a solution for now limit the finger movement to 20mm per event. Tests on a T440 and an x220 showed that this is just above what a reasonable finger movement would trigger. If a movement is greater than that limit, reset it to 0/0. On devices without resolution, use 0.25 of the touchpad's diagonal instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-16Prohibit negative or zero x/y resolutionsPeter Hutterer1-0/+10
Default resolution is 1, don't allow setting 0 to avoid divisions by 0 or just general weirdness. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-05When resetting, reset the open slots to -1Peter Hutterer1-1/+7
open_slots holds the slot index, resetting it to 0 is a bad idea. And make sure that we do reset after DEVICE_INIT. We already do so on DEVICE_CLOSE, but after the first DEVICE_ON the data could still be random. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2014-09-05eventcomm: add missing axis labels to avoid array overrunPeter Hutterer1-2/+11
And warn when we run out of labels. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2014-09-05Shut up a coverity warningPeter Hutterer1-1/+1
xf86-input-synaptics-1.8.0/src/synaptics.c:498: var_compare_op: Comparing "end_str" to null implies that "end_str" might be null. end_str can't be null, so no need for this check and no need to get Coverity all confused. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2014-09-05Mark some switch case fallthroughs with commentsPeter Hutterer1-0/+3
Just to make it explicit Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2014-09-05Use cumulative relative touch movements while scrollingGabriele Mazzotta2-6/+10
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-04eventcomm: ensure we're on the same clock as the serverPeter Hutterer1-2/+11
Default on evdev devices is CLOCK_REALTIME. If that clock falls behind the server's CLOCK_MONOTONIC, motion after a clickpad click may be delayed by the difference in the clocks. In detail: When the timer func is triggered, GetTimeInMillis() which is CLOCK_MONOTONIC, is stored as hwState->millis. The eventcomm backend uses struct input_event time (CLOCK_REALTIME). When we read events from the device, if the evdev time is less than the server time, the fix for (#48777) sets the current event time to hwState->millis. Until the evdev time overtakes that stored time, all events have the hwState->millis time. If during that time a clickpad triggers a physical click, clickpad_click_millis is set to hwState->millis + the ignore-motion timeout. Thus, all motion is ignored until the event time overtakes that stored time. The whole issue is further enhanced by us unconditionally setting the timer func if we get any events, which is a separate issue anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-29Include xorg-server.h to fix build errors on newest glibcPeter Hutterer3-0/+6
In file included from /usr/include/string.h:634:0, from /usr/include/xorg/os.h:53, from /usr/include/xorg/misc.h:115, from /usr/include/xorg/xf86str.h:37, from /usr/include/xorg/xf86Xinput.h:54, from synproto.h:36, from synproto.c:24: /usr/include/xorg/os.h:579:1: error: expected identifier or '(' before '__extension__' strndup(const char *str, size_t n); See http://lists.freedesktop.org/archives/xorg-devel/2014-July/043070.html Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-28Silence two compiler warningsPeter Hutterer2-1/+5
Potentially uninitialized, false positive in both cases. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-14Prevent two-finger taps from being ignoredGabriele Mazzotta1-2/+3
When two fingers are used, the coordinates of only one of them is taken into account. This can lead to sudden variations of the absolute coordinates when two-fingers taps are performed if the finger considered changes. Take into account coordinates variations to prevent unwanted taps only if the number of fingers doesn't change. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-08Use libevdev's per-device logging functions instead of the global handlerPeter Hutterer1-19/+29
Per-device logging functions don't interfere with other drivers if they also use libevdev, so use those instead the global log handler if available. If not available, drop libevdev logging, I don't want to maintain the ifdef mess and the logging doesn't give us _that_ much benefit. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-20eventcomm: Drop requirement for a grab during initPeter Hutterer1-27/+10
When we required a grab on the device, this was a shortcut so we didn't have to query the device only to realise we can't read events off it anyway. Now that we don't actually grab the device by default, this is unnecessary. Something else may have a temporary grab on the device during init, in which case we just continue as usual and read events if and when they become available. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-30Fix product ID cutoff for MODEL_APPLETOUCH/MODEL_UNIBODY_MACBOOKClinton Sprain1-1/+3
Some Macbooks are being tagged as MODEL_UNIBODY_MACBOOKs when they should not be. This causes the default sensitivity to be very low for them, making the touchpad almost unusable. This change puts those devices into the correct bucket again. Signed-off-by: Clinton Sprain <clintonsprain@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-30Add support for INPUT_PROP_TOPBUTTONPADHans de Goede4-1/+18
Add a HasSecondaryButtons boolean config option which defaults to true for devices with the INPUT_PROP_TOPBUTTONPAD and false for all other devices. Only parse the SecondarySoftButtonAreas when this option is true, effectively disabling the top buttons when it is false. Likewise, only initialize the SecondarySoftButtonAreas property if we enable support for it. This means that it is now safe to always set a SecondarySoftButtonAreas default in 50-synaptics.conf, and that he section which was intended for use with future pnp-id matching can be dropped, as that is now all handled in the kernel. While at also remove the comment about disabling the bottom edge area, as that is now done automatically. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-23Always count tripletap + click as 3 fingerclick on pads with < 3 touchesHans de Goede1-20/+5
When trying to do a 3 fingerclick on a touchpad which only tracks 2 touches, this may register as a 3 or 2 fingerclick depending on the order in which the touchpad detects the fingers. If the 2 outer fingers of the 3 get seen first, then the 2 touches will be too far apart for the heuristic to see them as being close together, and the click gets counted as a 2 finger click. A user will likely never do a 2 finger click with a 3th finger resting somewhere else on the pad, where-as the above misdetection of the clicks is a real issue, so simply always count a click with trippletap set as a 3 finger click on pads which track less then 3 touches. https://bugzilla.redhat.com/show_bug.cgi?id=1086218 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-09Comment the touch statesPeter Hutterer1-5/+5
Everytime I look at this I get confused about OPEN_EMPTY vs EMPTY. Let's fix that. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-09eventcomm: Hook up the libevdev log handlerPeter Hutterer1-0/+40
This is a bit problematic: libevdev only has one global log handler. So if we have another driver use libevdev, we'll either overwrite that handler or get overwritten, whichever comes first. So we need to re-set the handler every time we get an event to make sure we log through our handler. Likewise, if we ever drop the device, we need to unset the log handler back to NULL because we may unload the module and our handler may disappear. Use the lowest logging priority, let the server filter based on the verbosity level instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-09eventcomm: read one more event after finishing a syncPeter Hutterer1-1/+3
Once the sync finishes, we get -EAGAIN. This only indicates the sync is done, but some events may still be waiting in the pipe for us to read. We must read those now, otherwise select may not trigger on further data. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-09eventcomm: drop superflous helper functionPeter Hutterer1-11/+1
last_mt_vals_slot is only used in one location and there we can just use cur_slot Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-03-24Disable GrabEventDevice by defaultPeter Hutterer1-1/+12
This was required when we started supporting hotplugging to avoid duplicate events. These days the drawback of not being able to record events in the case of a bug is significant. Check the configuration source on init. If the device was hotplugged through a a server config backend, disable the grab. If the device was statically configured through an xorg.conf then leave the default grab enabled to avoid a duplicate device. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-03-18If the touchpad is in TOUCHPAD_OFF mode, allow physical clicksPeter Hutterer1-10/+7
Enabling clicks in off mode also allows for the new Lenovo *40 series to use the top software buttons while the touchpad is disabled. This benefits those that usually disable touchpads altogether but still need the buttons for the trackstick. This changes existing behaviour, but TouchpadOff was always intended to stop erroneous events while typing. Physical button presses are hard to trigger accidentally. On the touchpads that TouchpadOff concept was originally designed for the buttons are nowhere near the keyboard and are physically separated from the touchpad anyway. On Clickpads, triggering a physical click requires more force than accidentally touching the surface. https://bugs.freedesktop.org/show_bug.cgi?id=76156 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>