configure.ac | 7 +++ debian/changelog | 5 ++ src/eventcomm.c | 99 ++++++++++++++++++++++++++++++++++++++--------------- src/eventcomm.h | 2 + src/properties.c | 1 src/ps2comm.c | 3 + src/ps2comm.h | 2 + src/synaptics.c | 69 +++++++++++++++++++++++++++++++++--- src/synapticsstr.h | 2 + src/synproto.h | 2 + 10 files changed, 157 insertions(+), 35 deletions(-)
New commits: commit 98176cb65b7d451a5678a5327079382077b0db69 Author: maximilian attems <m...@debian.org> Date: Thu Sep 18 00:02:11 2014 +0200 prepare to release 1.8.1-1 Signed-off-by: maximilian attems <m...@debian.org> diff --git a/debian/changelog b/debian/changelog index e7089c4..5cbc02d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,13 @@ -xserver-xorg-input-synaptics (1.8.99-1) UNRELEASED; urgency=medium +xserver-xorg-input-synaptics (1.8.1-1) unstable; urgency=medium * New upstream release + - eventcomm: ensure we're on the same clock as the server (closes: #760779) + - Limit the movement to 20 mm per event (closes: #672601) [ Maarten Lankhorst ] * Drop libmtdev-dev, unused in 1.8.0. * Add dependency on libxtst-dev again to enable support for XRecord. + (closes: #759345) -- maximilian attems <m...@debian.org> Wed, 16 Jul 2014 22:04:44 +0200 commit a897147be04d74ed452cda166fd4e01f9615ff72 Author: Gabriele Mazzotta <gabriele....@gmail.com> Date: Tue Sep 16 17:20:15 2014 +0200 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....@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/eventcomm.c b/src/eventcomm.c index e789f0e..4850331 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -606,6 +606,14 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw, hw->slot_state[slot_index] = SLOTSTATE_CLOSE; proto_data->num_touches--; } + + /* When there are no fingers on the touchpad, set width and + * pressure to zero as ABS_MT_TOUCH_MAJOR and ABS_MT_PRESSURE + * are not zero when fingers are released. */ + if (proto_data->num_touches == 0) { + hw->fingerWidth = 0; + hw->z = 0; + } } else { ValuatorMask *mask = proto_data->last_mt_vals[slot_index]; @@ -618,6 +626,10 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw, hw->cumulative_dx += ev->value - last_val; else if (ev->code == ABS_MT_POSITION_Y) hw->cumulative_dy += ev->value - last_val; + else if (ev->code == ABS_MT_TOUCH_MAJOR) + hw->fingerWidth = ev->value; + else if (ev->code == ABS_MT_PRESSURE) + hw->z = ev->value; } valuator_mask_set(mask, map, ev->value); diff --git a/src/synaptics.c b/src/synaptics.c index 756751d..9807439 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1829,6 +1829,9 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) if ((hw->z > para->palm_min_z) && (hw->fingerWidth > para->palm_min_width)) return FS_BLOCKED; + if (priv->has_touch) + return finger; + if (hw->x == 0 || priv->finger_state == FS_UNTOUCHED) priv->avg_width = 0; else commit 41b2312c006fca1f24e1a366174d3203a63fa04a Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Sep 16 08:52:56 2014 +1000 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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> diff --git a/src/synaptics.c b/src/synaptics.c index 2e3ad0c..756751d 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -780,6 +780,23 @@ set_default_parameters(InputInfoPtr pInfo) pars->resolution_vert = 1; } + /* Touchpad sampling rate is too low to detect all movements. + A user may lift one finger and put another one down within the same + EV_SYN or even between samplings so the driver doesn't notice at all. + + We limit the movement to 20 mm within one event, that is more than + recordings showed is needed (17mm on a T440). + */ + if (pars->resolution_horiz > 1 && + pars->resolution_vert > 1) + pars->maxDeltaMM = 20; + else { + /* on devices without resolution set the vector length to 0.25 of + the touchpad diagonal */ + pars->maxDeltaMM = diag * 0.25; + } + + /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */ if (pars->top_edge > pars->bottom_edge) { int tmp = pars->top_edge; @@ -2229,6 +2246,13 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw, *dy = integral; } +/* Vector length, but not sqrt'ed, we only need it for comparison */ +static inline double +vlenpow2(double x, double y) +{ + return x * x + y * y; +} + /** * Compute relative motion ('deltas') including edge motion. */ @@ -2238,6 +2262,7 @@ ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw, { enum MovingState moving_state; double dx, dy; + double vlen; int delay = 1000000000; dx = dy = 0; @@ -2283,6 +2308,14 @@ ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw, out: priv->prevFingers = hw->numFingers; + vlen = vlenpow2(dx/priv->synpara.resolution_horiz, + dy/priv->synpara.resolution_vert); + + if (vlen > priv->synpara.maxDeltaMM * priv->synpara.maxDeltaMM) { + dx = 0; + dy = 0; + } + *dxP = dx; *dyP = dy; diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 4bd32ac..75f52d5 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -226,6 +226,8 @@ typedef struct _SynapticsParameters { int area_left_edge, area_right_edge, area_top_edge, area_bottom_edge; /* area coordinates absolute */ int softbutton_areas[4][4]; /* soft button area coordinates, 0 => right, 1 => middle , 2 => secondary right, 3 => secondary middle button */ int hyst_x, hyst_y; /* x and y width of hysteresis box */ + + int maxDeltaMM; /* maximum delta movement (vector length) in mm */ } SynapticsParameters; struct _SynapticsPrivateRec { commit 049611bd7f04e285909c55807478306cce83385f Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Sep 16 10:44:40 2014 +1000 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.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index 8e6022a..2e3ad0c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -769,6 +769,16 @@ set_default_parameters(InputInfoPtr pInfo) xf86SetIntOption(opts, "HorizResolution", horizResolution); pars->resolution_vert = xf86SetIntOption(opts, "VertResolution", vertResolution); + if (pars->resolution_horiz <= 0) { + xf86IDrvMsg(pInfo, X_ERROR, + "Invalid X resolution, using 1 instead.\n"); + pars->resolution_horiz = 1; + } + if (pars->resolution_vert <= 0) { + xf86IDrvMsg(pInfo, X_ERROR, + "Invalid Y resolution, using 1 instead.\n"); + pars->resolution_vert = 1; + } /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */ if (pars->top_edge > pars->bottom_edge) { commit afbbcfa10eb3a2295823720907f35bb59972dd82 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Sep 5 15:14:47 2014 +1000 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.hutte...@who-t.net> Reviewed-by: Keith Packard <kei...@keithp.com> diff --git a/src/synaptics.c b/src/synaptics.c index ace0ec7..8e6022a 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1026,6 +1026,8 @@ error: static void SynapticsReset(SynapticsPrivate * priv) { + int i; + SynapticsResetHwState(priv->hwState); SynapticsResetHwState(priv->local_hw_state); SynapticsResetHwState(priv->comm.hwState); @@ -1055,7 +1057,9 @@ SynapticsReset(SynapticsPrivate * priv) priv->prev_z = 0; priv->prevFingers = 0; priv->num_active_touches = 0; - memset(priv->open_slots, 0, priv->num_slots * sizeof(int)); + + for (i = 0; i < priv->num_slots; i++) + priv->open_slots[i] = -1; } static int @@ -1352,6 +1356,8 @@ DeviceInit(DeviceIntPtr dev) InitDeviceProperties(pInfo); XIRegisterPropertyHandler(pInfo->dev, SetProperty, NULL, NULL); + SynapticsReset(priv); + return Success; fail: commit d239f831f17ccf5468f5dc6b2f199a9c1f6e35af Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Sep 5 14:24:29 2014 +1000 eventcomm: add missing axis labels to avoid array overrun And warn when we run out of labels. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Keith Packard <kei...@keithp.com> diff --git a/src/eventcomm.c b/src/eventcomm.c index faaa57d..e789f0e 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -843,7 +843,7 @@ event_query_touch(InputInfoPtr pInfo) if (priv->has_touch) { int axnum; - static const char *labels[] = { + static const char *labels[ABS_MT_MAX] = { AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, @@ -855,6 +855,9 @@ event_query_touch(InputInfoPtr pInfo) AXIS_LABEL_PROP_ABS_MT_BLOB_ID, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, AXIS_LABEL_PROP_ABS_MT_PRESSURE, + AXIS_LABEL_PROP_ABS_MT_DISTANCE, + AXIS_LABEL_PROP_ABS_MT_TOOL_X, + AXIS_LABEL_PROP_ABS_MT_TOOL_Y, }; priv->max_touches = libevdev_get_num_slots(dev); @@ -888,7 +891,13 @@ event_query_touch(InputInfoPtr pInfo) break; default: - priv->touch_axes[axnum].label = labels[axis_idx]; + if (axis_idx >= sizeof(labels)/sizeof(labels[0])) { + xf86IDrvMsg(pInfo, X_ERROR, + "Axis %d out of label range. This is a bug\n", + axis); + priv->touch_axes[axnum].label = NULL; + } else + priv->touch_axes[axnum].label = labels[axis_idx]; priv->touch_axes[axnum].min = libevdev_get_abs_minimum(dev, axis); priv->touch_axes[axnum].max = libevdev_get_abs_maximum(dev, axis); /* Kernel provides units/mm, X wants units/m */ commit 4d3d761799436e80fbcf0d99797eed35e68c90d2 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Sep 5 14:15:46 2014 +1000 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.hutte...@who-t.net> Reviewed-by: Keith Packard <kei...@keithp.com> diff --git a/src/synaptics.c b/src/synaptics.c index e8a08d2..ace0ec7 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -495,7 +495,7 @@ set_softbutton_areas_option(InputInfoPtr pInfo, char *option_name, int offset) values[i] = value; if (next_num != end_str) { - if (end_str && *end_str == '%') { + if (*end_str == '%') { in_percent |= 1 << i; end_str++; } commit 536e17c83e565ddba9c7c5a4cd613edf8378e9aa Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Sep 5 14:13:08 2014 +1000 Mark some switch case fallthroughs with comments Just to make it explicit Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Keith Packard <kei...@keithp.com> diff --git a/src/ps2comm.c b/src/ps2comm.c index ed2f751..c474c07 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -582,12 +582,15 @@ PS2ReadHwStateProto(InputInfoPtr pInfo, case 8: hw->multi[7] = ((buf[5] & 0x08)) ? 1 : 0; hw->multi[6] = ((buf[4] & 0x08)) ? 1 : 0; + /* fallthrough */ case 6: hw->multi[5] = ((buf[5] & 0x04)) ? 1 : 0; hw->multi[4] = ((buf[4] & 0x04)) ? 1 : 0; + /* fallthrough */ case 4: hw->multi[3] = ((buf[5] & 0x02)) ? 1 : 0; hw->multi[2] = ((buf[4] & 0x02)) ? 1 : 0; + /* fallthrough */ case 2: hw->multi[1] = ((buf[5] & 0x01)) ? 1 : 0; hw->multi[0] = ((buf[4] & 0x01)) ? 1 : 0; commit ec0901e5f81d9cad6cc8bbdcb5ea075009c13de5 Author: Gabriele Mazzotta <gabriele....@gmail.com> Date: Thu Aug 14 20:03:42 2014 +0200 Use cumulative relative touch movements while scrolling Signed-off-by: Gabriele Mazzotta <gabriele....@gmail.com> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/eventcomm.c b/src/eventcomm.c index 4a646af..faaa57d 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -674,9 +674,11 @@ EventReadHwState(InputInfoPtr pInfo, SynapticsResetTouchHwState(hw, FALSE); - /* Reset cumulative values if buttons were not previously pressed, - * or no finger was previously present. */ - if ((!hw->left && !hw->right && !hw->middle) || hw->z < para->finger_low) { + /* Reset cumulative values if buttons were not previously pressed and no + * two-finger scrolling is ongoing, or no finger was previously present. */ + if (((!hw->left && !hw->right && !hw->middle) && + !(priv->vert_scroll_twofinger_on || priv->vert_scroll_twofinger_on)) || + hw->z < para->finger_low) { hw->cumulative_dx = hw->x; hw->cumulative_dy = hw->y; sync_cumulative = TRUE; diff --git a/src/synaptics.c b/src/synaptics.c index b49957c..e8a08d2 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -3098,9 +3098,11 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, } } - /* If a physical button is pressed on a clickpad, use cumulative relative - * touch movements for motion */ - if (para->clickpad && (priv->lastButtons & 7) && + /* If a physical button is pressed on a clickpad or a two-finger scrolling + * is ongoing, use cumulative relative touch movements for motion */ + if (para->clickpad && + ((priv->lastButtons & 7) || + (priv->vert_scroll_twofinger_on || priv->horiz_scroll_twofinger_on)) && priv->last_button_area != TOP_BUTTON_AREA) { hw->x = hw->cumulative_dx; hw->y = hw->cumulative_dy; commit 90d19302306f49722e210227b2fb5161e6f51880 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Aug 28 14:13:38 2014 +1000 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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> diff --git a/src/eventcomm.c b/src/eventcomm.c index 845f547..4a646af 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -39,6 +39,7 @@ #include <dirent.h> #include <string.h> #include <stdio.h> +#include <time.h> #include "synproto.h" #include "synapticsstr.h" #include <xf86.h> @@ -88,6 +89,8 @@ struct eventcomm_proto_data { struct libevdev *evdev; enum libevdev_read_flag read_flag; + + int have_monotonic_clock; }; #ifdef HAVE_LIBEVDEV_DEVICE_LOG_FUNCS @@ -234,6 +237,7 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para) SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; + int ret; if (libevdev_get_fd(proto_data->evdev) != -1) { struct input_event ev; @@ -253,7 +257,6 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para) if (para->grab_event_device) { /* Try to grab the event device so that data don't leak to /dev/input/mice */ - int ret; ret = libevdev_grab(proto_data->evdev, LIBEVDEV_GRAB); if (ret < 0) { @@ -265,6 +268,9 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para) proto_data->need_grab = FALSE; + ret = libevdev_set_clock_id(proto_data->evdev, CLOCK_MONOTONIC); + proto_data->have_monotonic_clock = (ret == 0); + InitializeTouch(pInfo); return TRUE; @@ -682,7 +688,10 @@ EventReadHwState(InputInfoPtr pInfo, switch (ev.code) { case SYN_REPORT: hw->numFingers = count_fingers(pInfo, comm); - hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000; + if (proto_data->have_monotonic_clock) + hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000; + else + hw->millis = GetTimeInMillis(); SynapticsCopyHwState(hwRet, hw); return TRUE; } commit 96e60a4ea242d2decf109835981ae186cc36f642 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Aug 29 07:57:41 2014 +1000 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.hutte...@who-t.net> diff --git a/src/eventcomm.h b/src/eventcomm.h index 4d759ff..e0f8743 100644 --- a/src/eventcomm.h +++ b/src/eventcomm.h @@ -27,6 +27,8 @@ #ifndef _EVENTCOMM_H_ #define _EVENTCOMM_H_ +#include <xorg-server.h> + #include <linux/input.h> #include <linux/version.h> #include <xf86Xinput.h> diff --git a/src/ps2comm.h b/src/ps2comm.h index 2be55e4..fa71d10 100644 --- a/src/ps2comm.h +++ b/src/ps2comm.h @@ -22,6 +22,8 @@ #ifndef _PS2COMM_H_ #define _PS2COMM_H_ +#include <xorg-server.h> + #include <unistd.h> #include <sys/ioctl.h> #include "xf86_OSproc.h" diff --git a/src/synproto.h b/src/synproto.h index c52838c..6ba6740 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -31,6 +31,8 @@ #include "config.h" #endif +#include <xorg-server.h> + #include <unistd.h> #include <sys/ioctl.h> #include <xf86Xinput.h> commit 68d22ecf145bb9073121fd3a9fc1fdd0f880e48b Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Aug 28 16:50:18 2014 +1000 Silence two compiler warnings Potentially uninitialized, false positive in both cases. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/eventcomm.c b/src/eventcomm.c index 1f440b8..845f547 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -111,7 +111,10 @@ libevdev_log_func(const struct libevdev *dev, switch(priority) { case LIBEVDEV_LOG_ERROR: verbosity = 0; break; case LIBEVDEV_LOG_INFO: verbosity = 4; break; - case LIBEVDEV_LOG_DEBUG: verbosity = 10; break; + case LIBEVDEV_LOG_DEBUG: + default: + verbosity = 10; + break; } LogVMessageVerbSigSafe(X_NOTICE, verbosity, format, args); diff --git a/src/properties.c b/src/properties.c index 718d054..c776e6c 100644 --- a/src/properties.c +++ b/src/properties.c @@ -129,6 +129,7 @@ InitTypedAtom(DeviceIntPtr dev, char *name, Atom type, int format, int nvalues, converted = val_16; break; case 32: + default: converted = val_32; break; } commit 7d0ff39519e4d3760722b914883bee276035061c Author: Gabriele Mazzotta <gabriele....@gmail.com> Date: Sun Jul 27 12:58:18 2014 +0200 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.hutte...@who-t.net> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index b25c902..b49957c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1960,8 +1960,9 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw, (priv->tap_max_fingers <= ((priv->horiz_scroll_twofinger_on || priv->vert_scroll_twofinger_on) ? 2 : 1)) && - ((abs(hw->x - priv->touch_on.x) >= para->tap_move) || - (abs(hw->y - priv->touch_on.y) >= para->tap_move))); + (priv->prevFingers == hw->numFingers && + ((abs(hw->x - priv->touch_on.x) >= para->tap_move) || + (abs(hw->y - priv->touch_on.y) >= para->tap_move)))); press = (hw->left || hw->right || hw->middle); if (touch) { commit a36edf8307ab9b5bffca103dd875623a66012c0b Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu May 15 08:34:55 2014 +1000 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.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 4b3a726..0a2bfb6 100644 --- a/configure.ac +++ b/configure.ac @@ -117,6 +117,13 @@ esac if test "x$BUILD_EVENTCOMM" = xyes; then AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4]) + SAVE_LIBS="$LIBS" + LIBS="$LIBEVDEV_LIBS" + AC_CHECK_LIB(evdev, libevdev_set_device_log_function, + [AC_DEFINE(HAVE_LIBEVDEV_DEVICE_LOG_FUNCS, 1, + [libevdev supports per-device log functions])], + []) + LIBS="$SAVE_LIBS" fi if test "x$BUILD_PSMCOMM" = xyes; then AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) diff --git a/src/eventcomm.c b/src/eventcomm.c index 2ee072b..1f440b8 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -90,15 +90,18 @@ struct eventcomm_proto_data { enum libevdev_read_flag read_flag; }; +#ifdef HAVE_LIBEVDEV_DEVICE_LOG_FUNCS static void -libevdev_log_func(enum libevdev_log_priority priority, +libevdev_log_func(const struct libevdev *dev, + enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args) -_X_ATTRIBUTE_PRINTF(6, 0); +_X_ATTRIBUTE_PRINTF(7, 0); static void -libevdev_log_func(enum libevdev_log_priority priority, +libevdev_log_func(const struct libevdev *dev, + enum libevdev_log_priority priority, void *data, const char *file, int line, const char *func, const char *format, va_list args) @@ -113,14 +116,7 @@ libevdev_log_func(enum libevdev_log_priority priority, LogVMessageVerbSigSafe(X_NOTICE, verbosity, format, args); } - -static void -set_libevdev_log_handler(void) -{ - /* be quiet, gcc *handwave* */ - libevdev_set_log_function((libevdev_log_func_t)libevdev_log_func, NULL); - libevdev_set_log_priority(LIBEVDEV_LOG_DEBUG); -} +#endif struct eventcomm_proto_data * EventProtoDataAlloc(int fd) @@ -128,7 +124,6 @@ EventProtoDataAlloc(int fd) struct eventcomm_proto_data *proto_data; int rc; - set_libevdev_log_handler(); proto_data = calloc(1, sizeof(struct eventcomm_proto_data)); if (!proto_data) @@ -137,12 +132,31 @@ EventProtoDataAlloc(int fd) proto_data->st_to_mt_scale[0] = 1; proto_data->st_to_mt_scale[1] = 1; - rc = libevdev_new_from_fd(fd, &proto_data->evdev); + proto_data->evdev = libevdev_new(); + if (!proto_data->evdev) { + rc = -1; + goto out; + } + +#ifdef HAVE_LIBEVDEV_DEVICE_LOG_FUNCS + libevdev_set_device_log_function(proto_data->evdev, libevdev_log_func, + LIBEVDEV_LOG_DEBUG, NULL); +#endif + + rc = libevdev_set_fd(proto_data->evdev, fd); if (rc < 0) { + goto out; + } + + proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL; + +out: + if (rc < 0) { + if (proto_data && proto_data->evdev) + libevdev_free(proto_data->evdev); free(proto_data); proto_data = NULL; - } else - proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL; + } return proto_data; } @@ -218,8 +232,6 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para) struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; - set_libevdev_log_handler(); - if (libevdev_get_fd(proto_data->evdev) != -1) { struct input_event ev; @@ -651,8 +663,6 @@ EventReadHwState(InputInfoPtr pInfo, struct eventcomm_proto_data *proto_data = priv->proto_data; Bool sync_cumulative = FALSE; - set_libevdev_log_handler(); - SynapticsResetTouchHwState(hw, FALSE); /* Reset cumulative values if buttons were not previously pressed, -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/e1xuns1-0001ma...@moszumanska.debian.org