Commit Graph

454 Commits

Author SHA1 Message Date
Gabriele Mazzotta
37d34f0356 Add a delay between the second button down-up event of double taps
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-02-18 16:52:56 +10:00
Peter Hutterer
064445364b Support the new Lenovo X1 Carbon 3rd trackpoint buttons
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-30 09:39:38 +10:00
Gabriele Mazzotta
a05894d169 Don't assume that touch devices report per finger width and pressure
The palm detection relies on both the width and the pressure.
a897147be0 ("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>
2015-01-08 09:14:39 +10:00
Gabriele Mazzotta
a897147be0 Use ABS_MT events for the palm detection when supported
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-17 15:29:51 +10:00
Peter Hutterer
41b2312c00 Limit the movement to 20 mm per event
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-17 14:47:17 +10:00
Peter Hutterer
049611bd7f Prohibit negative or zero x/y resolutions
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-16 10:59:04 +10:00
Peter Hutterer
afbbcfa10e When resetting, reset the open slots to -1
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-05 15:14:47 +10:00
Peter Hutterer
d239f831f1 eventcomm: add missing axis labels to avoid array overrun
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-05 14:29:16 +10:00
Peter Hutterer
4d3d761799 Shut up a coverity warning
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-05 14:18:11 +10:00
Peter Hutterer
536e17c83e Mark some switch case fallthroughs with comments
Just to make it explicit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-09-05 14:18:11 +10:00
Gabriele Mazzotta
ec0901e5f8 Use cumulative relative touch movements while scrolling
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-05 13:36:19 +10:00
Peter Hutterer
90d1930230 eventcomm: ensure we're on the same clock as the server
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-09-04 07:23:34 +10:00
Peter Hutterer
96e60a4ea2 Include xorg-server.h to fix build errors on newest glibc
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-29 08:05:05 +10:00
Peter Hutterer
68d22ecf14 Silence two compiler warnings
Potentially uninitialized, false positive in both cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-28 16:52:29 +10:00
Gabriele Mazzotta
7d0ff39519 Prevent two-finger taps from being ignored
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-14 15:53:55 +10:00
Peter Hutterer
a36edf8307 Use libevdev's per-device logging functions instead of the global handler
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-08-08 11:09:01 +10:00
Peter Hutterer
ddd8844a47 eventcomm: Drop requirement for a grab during init
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-05-20 15:38:39 +10:00
Clinton Sprain
efa424b5c9 Fix product ID cutoff for MODEL_APPLETOUCH/MODEL_UNIBODY_MACBOOK
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-30 11:41:03 +10:00
Hans de Goede
7bf2756841 Add support for INPUT_PROP_TOPBUTTONPAD
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-30 11:41:03 +10:00
Hans de Goede
a6f0f4c9a5 Always count tripletap + click as 3 fingerclick on pads with < 3 touches
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-23 08:43:57 +10:00
Peter Hutterer
62ef210d11 Comment the touch states
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-09 11:46:43 +10:00
Peter Hutterer
bfceb1bc58 eventcomm: Hook up the libevdev log handler
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-09 11:44:47 +10:00
Peter Hutterer
6ad8567906 eventcomm: read one more event after finishing a sync
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-09 10:41:59 +10:00
Peter Hutterer
bec41416db eventcomm: drop superflous helper function
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-04-09 10:41:59 +10:00
Peter Hutterer
f1948e08ee Disable GrabEventDevice by default
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-24 09:15:25 +10:00
Peter Hutterer
dc5474964d If the touchpad is in TOUCHPAD_OFF mode, allow physical clicks
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>
2014-03-18 07:28:08 +10:00
Peter Hutterer
17bbcad280 Revert "Add another third state to TouchpadOff for disabling all but button clicks"
This third state is not needed, the behaviour of the touchpad driver is now
good enough to not need an external syndaemon instance to toggle this third
state.

This reverts commit eea7335876.

Conflicts:
	man/synaptics.man
	src/synaptics.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-12 14:13:18 +10:00
Stephen Chandler Paul
b40a5255fe Don't allow any type of movement starting in the top softbutton area
Clicking in the top soft button area causes the trackpad to begin
registering motion, even if the finger never leaves the top soft button
area. We don't want this kind of behavior for the top soft button area,
since it makes clicking and dragging items much more difficult when
using a pointing stick.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-12 14:09:59 +10:00
Stephen Chandler Paul
9a419ba01c Replace is_inside_anybutton_area with current_button_area
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-12 11:28:16 +10:00
Peter Hutterer
2e5c0cf439 eventcomm: drop mtdev
All kernel touchpad devices now support slots, there isn't really a need to
support protocol A devices in synaptics. If such devices exist, we just treat
them as non-multitouch devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-03-12 07:36:40 +10:00
Peter Hutterer
c90a76ab0e eventcomm: drop some use of mtdev
When checking the device don't open a new mtdev instance, use the existing
libevdev struct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-03-12 07:36:37 +10:00
Peter Hutterer
5b7e172636 eventcomm: drop calculation of slot offset
The kernel guarantees slots start at 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-03-11 17:41:27 +10:00
Peter Hutterer
040dfeba68 eventcomm: fix wrong event code for SYN_REPORT
This was supposed to emulate a SYN_REPORT event so that the upper layers
process what's in the queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-03-11 17:41:27 +10:00
Peter Hutterer
66240dc329 Add property support for secondary (top) software buttons
This was originally intended as a fixed xorg.conf option only (and still
largely is seen as such). Secondary software button are required only on a specific series
of touchpads and should be pre-configured by the system and/or the
distribution. As such, the property will not be initialized if it is not set
in the xorg.conf and will thus not respond to runtime changes.

Exposing the property in this way gives clients a chance of detecting if a top
software button area is present and thus adjust their behaviour accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-03-11 15:32:06 +10:00
Hans de Goede
80efc2f54f synaptics: Add support for server managed fds
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-11 14:59:15 +10:00
Hans de Goede
bbe4c56c49 Wait for *new* coordinates on a clickpad click before reporting the click
It is possible for a click to get reported before any related touch events
get reported, here is the relevant part of an evemu-record session on a T440s:

E: 3.985585 0000 0000 0000	# ------------ SYN_REPORT (0) ----------
E: 3.997419 0003 0039 -001	# EV_ABS / ABS_MT_TRACKING_ID   -1
E: 3.997419 0001 014a 0000	# EV_KEY / BTN_TOUCH            0
E: 3.997419 0003 0018 0000	# EV_ABS / ABS_PRESSURE         0
E: 3.997419 0001 0145 0000	# EV_KEY / BTN_TOOL_FINGER      0
E: 3.997419 0000 0000 0000	# ------------ SYN_REPORT (0) ----------
E: 5.117881 0001 0110 0001	# EV_KEY / BTN_LEFT             1
E: 5.117881 0000 0000 0000	# ------------ SYN_REPORT (0) ----------
E: 5.133422 0003 0039 0187	# EV_ABS / ABS_MT_TRACKING_ID   187
E: 5.133422 0003 0035 3098	# EV_ABS / ABS_MT_POSITION_X    3098
E: 5.133422 0003 0036 3282	# EV_ABS / ABS_MT_POSITION_Y    3282
E: 5.133422 0003 003a 0046	# EV_ABS / ABS_MT_PRESSURE      46
E: 5.133422 0001 014a 0001	# EV_KEY / BTN_TOUCH            1
E: 5.133422 0003 0000 3102	# EV_ABS / ABS_X                3102
E: 5.133422 0003 0001 3282	# EV_ABS / ABS_Y                3282
E: 5.133422 0003 0018 0046	# EV_ABS / ABS_PRESSURE         46
E: 5.133422 0001 0145 0001	# EV_KEY / BTN_TOOL_FINGER      1
E: 5.133422 0000 0000 0000	# ------------ SYN_REPORT (0) ----------

Notice the BTN_LEFT event all by itself!

If this happens, it may lead to the following problem scenario:
-touch the touchpad in its right click area
-let go of the touchpad
-rapidly click in the middle area, so that BTN_LEFT gets reported before the
 new coordinates (such as seen in the trace above, this may require some
 practicing with evemu-record to reproduce)
-the driver registers the click as a right click because it uses the
 old coordinates from the cumulative coordinates to determine the
 click location

This commit fixes this by:
1) Resetting the cumulative coordinates not only when no button is pressed,
   but also when there is no finger touching the touchpad, so that when
   we do get a touch the cumulative coordinates start at the right place
2) Delaying processing the BTN_LEFT down transition if there is no finger
   touching the touchpad

This approach has one downside, if we wrongly identify a touchpad as
a clickpad, then the left button won't work unless the user touches the
touchpad while clicking the left button.

If we want we can fix this by doing something like this:
1) Making update_hw_button_state return a delay; and
2) Tracking that we've delayed BTN_LEFT down transition processing; and
3) When we've delayed BTN_LEFT down transition return a small delay value; and
4) If when we're called again we still don't have a finger down, just
   treat the click as a BTN_LEFT

But this is not worth the trouble IMHO, the proper thing to do in this
scenario is to fix the mis-identification of the touchpad as a clickpad.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 14:42:15 +10:00
Hans de Goede
743c45b9cf On button down update cumulative to current x and y, instead of previous
When a button click and new coordinates get reported in one go we sync the
cumulative coordinates to the old x and y, rather then the newly reported ones.

This keeping of the old coordinates causes the following issue:
-touch the touchpad in its right click area
-let go of the touchpad
-rapidly click in the left click area (or middle area), so that the
 new location and the click get reported in one syn (may require some
 practicing with evemu-record to reproduce)
-the driver registers the click as a right click because it uses the
 old coordinates from the cumulative coordinates to determine the
 click location

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 14:42:15 +10:00
Hans de Goede
71652fe1f0 Ignore motion the first X ms after a clickpad click
This fixes my #1 anoyance with clickpads, where 2 out of 3 clicks turn into
a click + drag unless I hold my finger really really still.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Replaced property with a hardcoded 100ms. This is not something that we should
expose as property, we should find a delay that works best and live with it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 14:42:15 +10:00
Hans de Goede
3adaf46238 Don't report motion inside soft-button areas
Unless the motion has started outside the soft-button area.

Note that we must start reporting motions regardless of whether we think we're
in the button area or not as soon as we've switched to using cumulative
coordinates, since then the coordinates are no longer absolute.

This fixes the reporting of unintended motion just before a click in a soft
button area which sometimes causes mis-clicks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 14:42:15 +10:00
Hans de Goede
effeee86c1 Get rid of old_hw_state
We only use it to store button state which we already have in
priv->lastButtons.

While at it also properly indent the code block checking the various
soft button areas.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 14:42:15 +10:00
Hans de Goede
840670508e Add an enum for the different soft_button_areas
While at it also move the enum for the soft button edges out of
is_inside_button_area() so that it can be used elsewhere too.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 14:41:08 +10:00
Peter Hutterer
eea7335876 Add another third state to TouchpadOff for disabling all but button clicks
On a new set of laptops like the Lenovo T440 the trackstick does not have
physical buttons. Instead, the touchpad's top edge is supposed to acts
software button area. To avoid spurious cursor jumps when the trackstick is in
use and the finger is resting on the touchpad, add another mode that disables
motion events.

Enabled by syndaemon with -t click-only, the default stays unchanged. No
specific integration with the traditional disable-while-typing is needed. On
such touchpads, disabling motion events is sufficient to avoid spurious
events and we don't want to stop HW buttons to send events.

Note that this only adds the new state to the driver and to syndaemon, there
is nothing hooked up otherwise to actually monitor the trackstick.

Special note for syndaemon: optional arguments are a GNU extension, so work
around it by messing with an optstring starting with ":" which allows us to
manually parse the options.

Original version of this patch by John Pham <jhnphm@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-24 08:25:29 +10:00
Keith Packard
ac78616d07 When re-opening evdev, set the fd before trying to grab
If we try to grab the evdev device before we've set the new file
descriptor, libevdev_grab returns -EFAULT, which causes DeviceOn to
fail.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-24 08:02:01 +10:00
Keith Packard
22fe8bdc66 Close device if DeviceOnHook fails
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-24 08:00:29 +10:00
Benjamin Tissoires
402cc87257 Add secondary (top) software buttons area
New generation of laptops with trackstick do not have physical buttons
associated with the trackstick, but instead rely on software buttons at
the top of the clickpad.
Adding a secondary software button area for this purpose.
As we're likely detecting the devices that need it based on udev tags
and MatchTag configuration items, this area doesn't need to be exposed
through properties. So static configuration is fine.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

[couple of man-page additions and rewrites]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-21 11:29:33 +10:00
Hans de Goede
945acfc261 Allow using the entire touchpad for motions started inside the active area
synaptics offers an option to make parts of the touchpad insensitive. This
is ie useful to do palm avoidance rather then palm detection (which may be
unreliable) by disabling an area of 15% on the right and left side of the
touchpad.

Currently a motion which has started inside the active area, stops as soon
as it moves outside of the active area.

If a motion started inside the active area and thus has already generated some
move events, this makes no sense. If the user moves outside of the active
area in this case, this is very likely because the user wants to continue
the motion.

This commit allows such motions to continue normally.

I would like to thank Juerd Waalboer for the basic idea, some coding and lots
of testing for this fix.

Cc: Juerd Waalboer <juerd@tnx.nl>
Reported-by: Juerd Waalboer <juerd@tnx.nl>
Tested-by: Juerd Waalboer <juerd@tnx.nl>
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-02-20 14:17:38 +10:00
Peter Hutterer
4f543ce1d6 Revert "Drop circular pad support"
This reverts commit 3b02e7fd81.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Conflicts:
	man/synaptics.man
	src/synaptics.c

Acked-by: Daniel Stone <daniel@fooishbar.org>
2014-02-18 07:51:47 +10:00
Peter Hutterer
e0069c1544 Revert "Purge scrollbuttons (repeat)"
This reverts commit 0903d99ada.

Scroll buttons are still present in some modern devices, e.g. the Fujitsu
Lifebook E782 and others in the series.

Conflicts:
	include/synaptics.h
	man/synaptics.man
	src/synaptics.c
2014-01-17 08:24:35 +10:00
Peter Hutterer
51b6bf3c10 On clickpads with two touchpoints, try to detect clickfinger 3 actions
Some touchpads provide BTN_TOOL_TRIPLETAP but do not track more than two
touchpoints. For those, try to detect clickfinger3 actions as best as we can.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9388b54a109bbd634e05611e6c90110d698f13d1)
2014-01-07 08:45:23 +10:00
Peter Hutterer
49fe70e99d Fix ABI detection for in-driver scaling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-03 11:28:36 +10:00