Rebased ref, commits from common ancestor: commit 3261e07c923c449f08a96a8439c97479b7ff899c Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Nov 18 13:00:09 2016 +1000
synaptics 1.9.0 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 970dd5f..6d814d5 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-synaptics], - [1.8.99.2], + [1.9.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-synaptics]) AC_CONFIG_SRCDIR([Makefile.am]) commit a7d76f4275a88d98b18eed29a1ee94a70e7fa367 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Sun Oct 9 19:27:47 2016 +1000 synaptics 1.8.99.2 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index b3d0545..970dd5f 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-synaptics], - [1.8.99.1], + [1.8.99.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-synaptics]) AC_CONFIG_SRCDIR([Makefile.am]) commit 35b9472a189c88415fed137fb4c62a5081caaea5 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Sep 15 13:47:09 2016 +1000 Remove unused fraction calculations 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.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index bdc9605..c7ba9ad 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -2198,28 +2198,8 @@ static void get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw, enum EdgeType edge, double *dx, double *dy) { - double integral; - double tmpf; - *dx = hw->x - HIST(0).x; *dy = hw->y - HIST(0).y; - - /* report edge speed as synthetic motion. Of course, it would be - * cooler to report floats than to buffer, but anyway. */ - - /* FIXME: When these values go NaN, bad things happen. Root cause is unknown - * thus far though. */ - if (isnan(priv->frac_x)) - priv->frac_x = 0; - if (isnan(priv->frac_y)) - priv->frac_y = 0; - - tmpf = *dx + priv->frac_x; - priv->frac_x = modf(tmpf, &integral); - *dx = integral; - tmpf = *dy + priv->frac_y; - priv->frac_y = modf(tmpf, &integral); - *dy = integral; } /* Vector length, but not sqrt'ed, we only need it for comparison */ diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 905b78b..33524e5 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -288,7 +288,6 @@ struct _SynapticsPrivateRec { Bool circ_scroll_on; /* Keeps track of currently active scroll modes */ Bool circ_scroll_vert; /* True: Generate vertical scroll events False: Generate horizontal events */ - double frac_x, frac_y; /* absolute -> relative fraction */ enum MidButtonEmulation mid_emu_state; /* emulated 3rd button */ int repeatButtons; /* buttons for repeat */ int nextRepeat; /* Time when to trigger next auto repeat event */ commit 486322116d70365c2e2a1d9f45830057fa03153e Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Aug 17 11:32:12 2016 +1000 eventcomm: don't ever probe if a device is set 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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> diff --git a/src/eventcomm.c b/src/eventcomm.c index 9c9a036..f65d532 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -1009,13 +1009,13 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device) if (!(pInfo->flags & XI86_SERVER_FD)) SYSCALL(close(fd)); - - /* if a device is set and not a touchpad (or already grabbed), - * we must return FALSE. Otherwise, we'll add a device that - * wasn't requested for and repeat - * f5687a6741a19ef3081e7fd83ac55f6df8bcd5c2. */ - return touchpad_found; } + + /* if a device is set and not a touchpad (or already grabbed), + * we must return FALSE. Otherwise, we'll add a device that + * wasn't requested for and repeat + * f5687a6741a19ef3081e7fd83ac55f6df8bcd5c2. */ + return touchpad_found; } i = scandir(DEV_INPUT_EVENT, &namelist, EventDevOnly, alphasort); commit cd9f9799235aefff1ec1a0af9ec6b45969119659 Author: Anton Lindqvist <anton.lindqv...@gmail.com> Date: Fri Aug 5 10:21:59 2016 +0200 syndaemon: enable touchpad when pressing a modifier combo When ignoring modifiers, ensure the touchpad is enabled once a modifier key is pressed disregarding any previous key press that caused the touchpad to be disabled. Signed-off-by: Anton Lindqvist <anton.lindqv...@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/tools/syndaemon.c b/tools/syndaemon.c index 29e75f5..f716827 100644 --- a/tools/syndaemon.c +++ b/tools/syndaemon.c @@ -47,6 +47,12 @@ #include "synaptics-properties.h" +enum KeyboardActivity { + ActivityNew, + ActivityNone, + ActivityReset +}; + enum TouchpadState { TouchpadOn = 0, TouchpadOff = 1, @@ -181,29 +187,29 @@ install_signal_handler(void) } } -/** - * Return non-zero if the keyboard state has changed since the last call. - */ -static int +static enum KeyboardActivity keyboard_activity(Display * display) { static unsigned char old_key_state[KEYMAP_SIZE]; unsigned char key_state[KEYMAP_SIZE]; int i; - int ret = 0; + int ret = ActivityNone; XQueryKeymap(display, (char *) key_state); for (i = 0; i < KEYMAP_SIZE; i++) { if ((key_state[i] & ~old_key_state[i]) & keyboard_mask[i]) { - ret = 1; + ret = ActivityNew; break; } } if (ignore_modifier_combos) { for (i = 0; i < KEYMAP_SIZE; i++) { if (key_state[i] & ~keyboard_mask[i]) { - ret = 0; + if (old_key_state[i] & ~keyboard_mask[i]) + ret = ActivityNone; + else + ret = ActivityReset; break; } } @@ -232,8 +238,17 @@ main_loop(Display * display, double idle_time, int poll_delay) for (;;) { current_time = get_time(); - if (keyboard_activity(display)) - last_activity = current_time; + switch (keyboard_activity(display)) { + case ActivityNew: + last_activity = current_time; + break; + case ActivityNone: + /* NOP */; + break; + case ActivityReset: + last_activity = 0.0; + break; + } /* If system times goes backwards, touchpad can get locked. Make * sure our last activity wasn't in the future and reset if it was. */ @@ -423,6 +438,7 @@ record_main_loop(Display * display, double idle_time) fd_set read_fds; int ret; int disable_event = 0; + int modifier_event = 0; struct timeval timeout; FD_ZERO(&read_fds); @@ -454,9 +470,14 @@ record_main_loop(Display * display, double idle_time) disable_event = 1; } - if (cbres.non_modifier_event && - !(ignore_modifier_combos && is_modifier_pressed(&cbres))) { - disable_event = 1; + if (cbres.non_modifier_event) { + if (ignore_modifier_combos && is_modifier_pressed(&cbres)) { + modifier_event = 1; + } else { + disable_event = 1; + } + } else if (ignore_modifier_keys) { + modifier_event = 1; } } @@ -468,10 +489,13 @@ record_main_loop(Display * display, double idle_time) toggle_touchpad(False); } - if (ret == 0 && pad_disabled) { /* timeout => enable event */ + if (modifier_event && pad_disabled) { toggle_touchpad(True); } + if (ret == 0 && pad_disabled) { /* timeout => enable event */ + toggle_touchpad(True); + } } /* end while(1) */ XFreeModifiermap(cbres.modifiers); commit 248c5936a0151d0766a95457330c7d3ef9335b94 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Jun 2 10:05:02 2016 +1000 Support XINPUT ABI version 23 Use input_lock/input_unlock calls instead of SIGIO functions Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index 70b7f3b..bdc9605 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1601,9 +1601,11 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg) SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); struct SynapticsHwState *hw = priv->local_hw_state; int delay; - int sigstate; - - sigstate = xf86BlockSIGIO(); +#if !HAVE_THREADED_INPUT + int sigstate = xf86BlockSIGIO(); +#else + input_lock(); +#endif priv->hwState->millis += now - priv->timer_time; SynapticsCopyHwState(hw, priv->hwState); @@ -1613,7 +1615,11 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg) priv->timer_time = now; priv->timer = TimerSet(priv->timer, 0, delay, timerFunc, pInfo); +#if !HAVE_THREADED_INPUT xf86UnblockSIGIO(sigstate); +#else + input_unlock(); +#endif return 0; } diff --git a/src/synapticsstr.h b/src/synapticsstr.h index f8ab14e..905b78b 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -36,6 +36,10 @@ #define NO_DRIVER_SCALING 1 #endif +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23 +#define HAVE_THREADED_INPUT 1 +#endif + #ifdef DBG #undef DBG #endif commit 59e5db025307404fbfbc82f2fb3fe91d6a3005d7 Author: Stefan Dirsch <sndir...@suse.de> Date: Thu May 19 17:35:57 2016 +0200 conf: rename to 70-synaptics.conf Bump up the synaptics driver to 70, so it get's preferred over libinput, which was dropped down to 60. The synaptics driver is more of a leaf package than libinput (which covers a multitude of device types) and can be removed by default. When specifically installed by the user, the synaptics driver should override the system default. Similar to what was done for wacom configuration file. https://bugzilla.suse.com/show_bug.cgi?id=979554 Signed-off-by: Stefan Dirsch <sndir...@suse.de> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/conf/50-synaptics.conf b/conf/50-synaptics.conf deleted file mode 100644 index aa50456..0000000 --- a/conf/50-synaptics.conf +++ /dev/null @@ -1,46 +0,0 @@ -# Example xorg.conf.d snippet that assigns the touchpad driver -# to all touchpads. See xorg.conf.d(5) for more information on -# InputClass. -# DO NOT EDIT THIS FILE, your distribution will likely overwrite -# it when updating. Copy (and rename) this file into -# /etc/X11/xorg.conf.d first. -# Additional options may be added in the form of -# Option "OptionName" "value" -# -Section "InputClass" - Identifier "touchpad catchall" - Driver "synaptics" - MatchIsTouchpad "on" -# This option is recommend on all Linux systems using evdev, but cannot be -# enabled by default. See the following link for details: -# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html -# MatchDevicePath "/dev/input/event*" -EndSection - -Section "InputClass" - Identifier "touchpad ignore duplicates" - MatchIsTouchpad "on" - MatchOS "Linux" - MatchDevicePath "/dev/input/mouse*" - Option "Ignore" "on" -EndSection - -# This option enables the bottom right corner to be a right button on clickpads -# and the right and middle top areas to be right / middle buttons on clickpads -# with a top button area. -# This option is only interpreted by clickpads. -Section "InputClass" - Identifier "Default clickpad buttons" - MatchDriver "synaptics" - Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0" - Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%" -EndSection - -# This option disables software buttons on Apple touchpads. -# This option is only interpreted by clickpads. -Section "InputClass" - Identifier "Disable clickpad buttons on Apple touchpads" - MatchProduct "Apple|bcm5974" - MatchDriver "synaptics" - Option "SoftButtonAreas" "0 0 0 0 0 0 0 0" -EndSection diff --git a/conf/70-synaptics.conf b/conf/70-synaptics.conf new file mode 100644 index 0000000..aa50456 --- /dev/null +++ b/conf/70-synaptics.conf @@ -0,0 +1,46 @@ +# Example xorg.conf.d snippet that assigns the touchpad driver +# to all touchpads. See xorg.conf.d(5) for more information on +# InputClass. +# DO NOT EDIT THIS FILE, your distribution will likely overwrite +# it when updating. Copy (and rename) this file into +# /etc/X11/xorg.conf.d first. +# Additional options may be added in the form of +# Option "OptionName" "value" +# +Section "InputClass" + Identifier "touchpad catchall" + Driver "synaptics" + MatchIsTouchpad "on" +# This option is recommend on all Linux systems using evdev, but cannot be +# enabled by default. See the following link for details: +# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html +# MatchDevicePath "/dev/input/event*" +EndSection + +Section "InputClass" + Identifier "touchpad ignore duplicates" + MatchIsTouchpad "on" + MatchOS "Linux" + MatchDevicePath "/dev/input/mouse*" + Option "Ignore" "on" +EndSection + +# This option enables the bottom right corner to be a right button on clickpads +# and the right and middle top areas to be right / middle buttons on clickpads +# with a top button area. +# This option is only interpreted by clickpads. +Section "InputClass" + Identifier "Default clickpad buttons" + MatchDriver "synaptics" + Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0" + Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%" +EndSection + +# This option disables software buttons on Apple touchpads. +# This option is only interpreted by clickpads. +Section "InputClass" + Identifier "Disable clickpad buttons on Apple touchpads" + MatchProduct "Apple|bcm5974" + MatchDriver "synaptics" + Option "SoftButtonAreas" "0 0 0 0 0 0 0 0" +EndSection diff --git a/conf/Makefile.am b/conf/Makefile.am index 38d2a01..b883c10 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -20,7 +20,7 @@ if HAS_XORG_CONF_DIR -dist_config_DATA = 50-synaptics.conf +dist_config_DATA = 70-synaptics.conf else fdidir = $(datadir)/hal/fdi/policy/20thirdparty dist_fdi_DATA = 11-x11-synaptics.fdi diff --git a/man/synaptics.man b/man/synaptics.man index 7083b3a..4f87b01 100644 --- a/man/synaptics.man +++ b/man/synaptics.man @@ -923,7 +923,7 @@ Configuration through .I InputClass sections is recommended in X servers 1.8 and later. See xorg.conf.d(5) for more details. An example xorg.conf.d snippet is provided in -.I ${sourcecode}/conf/50-synaptics.conf +.I ${sourcecode}/conf/70-synaptics.conf .LP Configuration through hal fdi files is recommended in X servers 1.5, 1.6 and 1.7. An example hal policy file is provided in commit 979fbec84197cd2c8ea3ffdd8e7726e8a617328b Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Apr 29 10:51:17 2016 +1000 Revert MaxDoubleTapTime back to 180 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.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index 550b31c..70b7f3b 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -671,7 +671,7 @@ set_default_parameters(InputInfoPtr pInfo) pars->finger_high = xf86SetIntOption(opts, "FingerHigh", fingerHigh); pars->tap_time = xf86SetIntOption(opts, "MaxTapTime", 180); pars->tap_move = xf86SetIntOption(opts, "MaxTapMove", tapMove); - pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 100); + pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 180); pars->click_time = xf86SetIntOption(opts, "ClickTime", 100); pars->clickpad = xf86SetBoolOption(opts, "ClickPad", pars->clickpad); /* Probed */ if (pars->clickpad) commit 2a1a17244f067b2ae893ea01d737e135586b151c Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Apr 29 08:48:19 2016 +1000 synaptics 1.8.99.1 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 0a2bfb6..b3d0545 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-synaptics], - [1.8.99], + [1.8.99.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-synaptics]) AC_CONFIG_SRCDIR([Makefile.am]) commit f1f58fffbf482de74bc7907e0af69feb9fe88a45 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Apr 27 09:29:27 2016 +1000 eventcomm: fix typo checking for two-finger scrolling Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/eventcomm.c b/src/eventcomm.c index 5f55141..9c9a036 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -710,7 +710,7 @@ EventReadHwState(InputInfoPtr pInfo, /* 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)) || + !(priv->vert_scroll_twofinger_on || priv->horiz_scroll_twofinger_on)) || hw->z < para->finger_low) { hw->cumulative_dx = hw->x; hw->cumulative_dy = hw->y; commit 0a4cf80a00663ff3ce8e76baf0940782576efe13 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Mar 26 16:28:56 2015 +1000 Drop touch events from the driver 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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> diff --git a/src/synaptics.c b/src/synaptics.c index 955b042..550b31c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1190,49 +1190,19 @@ DeviceInitTouch(DeviceIntPtr dev, Atom *axes_labels) { InputInfoPtr pInfo = dev->public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); - int i; - - if (priv->has_touch) { - priv->num_slots = - priv->max_touches ? priv->max_touches : SYNAPTICS_MAX_TOUCHES; - - priv->open_slots = malloc(priv->num_slots * sizeof(int)); - if (!priv->open_slots) { - xf86IDrvMsg(pInfo, X_ERROR, - "failed to allocate open touch slots array\n"); - priv->has_touch = 0; - priv->num_slots = 0; - return; - } - - /* x/y + whatever other MT axes we found */ - if (!InitTouchClassDeviceStruct(dev, priv->max_touches, - XIDependentTouch, - 2 + priv->num_mt_axes)) { - xf86IDrvMsg(pInfo, X_ERROR, - "failed to initialize touch class device\n"); - priv->has_touch = 0; - priv->num_slots = 0; - free(priv->open_slots); - priv->open_slots = NULL; - return; - } - for (i = 0; i < priv->num_mt_axes; i++) { - SynapticsTouchAxisRec *axis = &priv->touch_axes[i]; - int axnum = 4 + i; /* Skip x, y, and scroll axes */ + if (!priv->has_touch) + return; - if (!xf86InitValuatorAxisStruct(dev, axnum, axes_labels[axnum], - axis->min, axis->max, axis->res, 0, - axis->res, Absolute)) { - xf86IDrvMsg(pInfo, X_WARNING, - "failed to initialize axis %s, skipping\n", - axis->label); - continue; - } + priv->num_slots = + priv->max_touches ? priv->max_touches : SYNAPTICS_MAX_TOUCHES; - xf86InitValuatorDefaults(dev, axnum); - } + priv->open_slots = malloc(priv->num_slots * sizeof(int)); + if (!priv->open_slots) { + xf86IDrvMsg(pInfo, X_ERROR, + "failed to allocate open touch slots array\n"); + priv->has_touch = 0; + priv->num_slots = 0; } } @@ -3009,18 +2979,9 @@ static void HandleTouches(InputInfoPtr pInfo, struct SynapticsHwState *hw) { SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; - SynapticsParameters *para = &priv->synpara; int new_active_touches = priv->num_active_touches; - int min_touches = 2; - Bool restart_touches = FALSE; int i; - if (para->click_action[F3_CLICK1] || para->tap_action[F3_TAP]) - min_touches = 4; - else if (para->click_action[F2_CLICK1] || para->tap_action[F2_TAP] || - para->scroll_twofinger_vert || para->scroll_twofinger_horiz) - min_touches = 3; - /* Count new number of active touches */ for (i = 0; i < hw->num_mt_mask; i++) { if (hw->slot_state[i] == SLOTSTATE_OPEN) @@ -3029,60 +2990,6 @@ HandleTouches(InputInfoPtr pInfo, struct SynapticsHwState *hw) new_active_touches--; } - if (priv->has_semi_mt) - goto out; - - if (priv->num_active_touches < min_touches && - new_active_touches < min_touches) { - /* We stayed below number of touches needed to send events */ - goto out; - } - else if (priv->num_active_touches >= min_touches && - new_active_touches < min_touches) { - /* We are transitioning to less than the number of touches needed to - * send events. End all currently open touches. */ - for (i = 0; i < priv->num_active_touches; i++) { - int slot = priv->open_slots[i]; - - xf86PostTouchEvent(pInfo->dev, slot, XI_TouchEnd, 0, - hw->mt_mask[slot]); - } - - /* Don't send any more events */ - goto out; - } - else if (priv->num_active_touches < min_touches && - new_active_touches >= min_touches) { - /* We are transitioning to more than the number of touches needed to - * send events. Begin all already open touches. */ - restart_touches = TRUE; - for (i = 0; i < priv->num_active_touches; i++) { - int slot = priv->open_slots[i]; - - xf86PostTouchEvent(pInfo->dev, slot, XI_TouchBegin, 0, - hw->mt_mask[slot]); - } - } - - /* Send touch begin events for all new touches */ - for (i = 0; i < hw->num_mt_mask; i++) - if (hw->slot_state[i] == SLOTSTATE_OPEN) - xf86PostTouchEvent(pInfo->dev, i, XI_TouchBegin, 0, hw->mt_mask[i]); - - /* Send touch update/end events for all the rest */ - for (i = 0; i < priv->num_active_touches; i++) { - int slot = priv->open_slots[i]; - - /* Don't send update event if we just reopened the touch above */ - if (hw->slot_state[slot] == SLOTSTATE_UPDATE && !restart_touches) - xf86PostTouchEvent(pInfo->dev, slot, XI_TouchUpdate, 0, - hw->mt_mask[slot]); - else if (hw->slot_state[slot] == SLOTSTATE_CLOSE) - xf86PostTouchEvent(pInfo->dev, slot, XI_TouchEnd, 0, - hw->mt_mask[slot]); - } - - out: UpdateTouchState(pInfo, hw); } commit 7aa327603fb2a8af58c8df6f4a4dd46e8294050e Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Jun 17 15:31:08 2015 +1000 eventcomm: ignore key repeat events 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.hutte...@who-t.net> diff --git a/src/eventcomm.c b/src/eventcomm.c index 3a9d45d..5f55141 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -732,6 +732,10 @@ EventReadHwState(InputInfoPtr pInfo, } break; case EV_KEY: + /* ignore hw repeat events */ + if (ev.value > 1) + break; + v = (ev.value ? TRUE : FALSE); switch (ev.code) { case BTN_LEFT: commit fc9f490a2c87e6f87b0f483cd6bf5f526dddbb8d Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 24 15:41:39 2015 +1000 eventcomm: ignore fake and broken MT devices An MT device without X/Y is not a touchpad. And neither are fake MT devices. 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 cddf7fc..3a9d45d 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -325,6 +325,15 @@ event_query_is_touchpad(struct libevdev *evdev) libevdev_has_event_code(evdev, EV_ABS, BTN_TOOL_PEN)) /* Don't match wacom tablets */ return FALSE; + if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)) { + if (libevdev_get_num_slots(evdev) == -1) + return FALSE; /* Ignore fake MT devices */ + + if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) || + !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) + return FALSE; + } + return TRUE; } commit 30866b97be6939b895327b930154ef758eed7ff8 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Mar 23 11:38:15 2015 +1000 eventcomm: prevent possibly division by zero 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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> diff --git a/src/eventcomm.c b/src/eventcomm.c index 53a0ca4..cddf7fc 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -436,6 +436,11 @@ event_query_axis_ranges(InputInfoPtr pInfo) event_get_abs(proto_data->evdev, ABS_Y, &priv->miny, &priv->maxy, &priv->synpara.hyst_y, &priv->resy); + if (priv->minx == priv->maxx || priv->miny == priv->maxy) { + xf86IDrvMsg(pInfo, X_ERROR, "Kernel bug: min == max on ABS_X/Y\n"); + return; + } + priv->has_pressure = libevdev_has_event_code(proto_data->evdev, EV_ABS, ABS_PRESSURE); priv->has_width = libevdev_has_event_code(proto_data->evdev, EV_ABS, ABS_TOOL_WIDTH); @@ -458,6 +463,11 @@ event_query_axis_ranges(InputInfoPtr pInfo) event_get_abs(proto_data->evdev, ABS_MT_POSITION_Y, &priv->miny, &priv->maxy, &priv->synpara.hyst_y, &priv->resy); + if (priv->minx == priv->maxx || priv->miny == priv->maxy) { + xf86IDrvMsg(pInfo, X_ERROR, "Kernel bug: min == max on ABS_MT_POSITION_X/Y\n"); + return; + } + proto_data->st_to_mt_offset[0] = priv->minx - st_minx; proto_data->st_to_mt_scale[0] = (priv->maxx - priv->minx) / (st_maxx - st_minx); commit 5378a020a003cbdfa565d43c9e01997b570059c9 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 17 16:06:41 2015 +1000 Revert "Support the new Lenovo X1 Carbon 3rd trackpoint buttons" 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.tissoi...@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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> diff --git a/conf/50-synaptics.conf b/conf/50-synaptics.conf index 5fb131e..aa50456 100644 --- a/conf/50-synaptics.conf +++ b/conf/50-synaptics.conf @@ -44,10 +44,3 @@ Section "InputClass" MatchDriver "synaptics" Option "SoftButtonAreas" "0 0 0 0 0 0 0 0" EndSection - -Section "InputClass" - Identifier "Lenovo *50 and Carbon 3rd trackpoint buttons" - MatchDriver "synaptics" - MatchTag "has_trackpoint_buttons" - Option "HasTrackpointButtons" "on" -EndSection diff --git a/conf/71-synaptics.rules b/conf/71-synaptics.rules deleted file mode 100644 index 7a89e14..0000000 --- a/conf/71-synaptics.rules +++ /dev/null @@ -1,20 +0,0 @@ -ACTION=="remove", GOTO="touchpad_end" -KERNEL!="event*", GOTO="touchpad_end" -ENV{ID_INPUT_TOUCHPAD}=="", GOTO="touchpad_end" - -# Lenovo X1 Carbon 3rd -KERNELS=="serio1", \ - ATTRS{firmware_id}=="*LEN0048*", \ - ENV{ID_INPUT.tags}="has_trackpoint_buttons" - -# Lenovo W451 -KERNELS=="serio1", \ - ATTRS{firmware_id}=="*LEN004a*", \ - ENV{ID_INPUT.tags}="has_trackpoint_buttons" - -# Lenovo T450s -KERNELS=="serio1", \ - ATTRS{firmware_id}=="*LEN200f*", \ - ENV{ID_INPUT.tags}="has_trackpoint_buttons" - -LABEL="touchpad_end" diff --git a/conf/Makefile.am b/conf/Makefile.am index 4dde902..38d2a01 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -25,10 +25,3 @@ else fdidir = $(datadir)/hal/fdi/policy/20thirdparty dist_fdi_DATA = 11-x11-synaptics.fdi endif - -if HAVE_UDEV_RULES_DIR -udevdir=$(UDEV_RULES_DIR) -udev_DATA = 71-synaptics.rules -endif - -EXTRA_DIST = 71-synaptics.rules diff --git a/configure.ac b/configure.ac index 2844da2..0a2bfb6 100644 --- a/configure.ac +++ b/configure.ac @@ -135,16 +135,6 @@ AM_CONDITIONAL([BUILD_EVENTCOMM], [test "x${BUILD_EVENTCOMM}" = "xyes"]) AM_CONDITIONAL([BUILD_PSMCOMM], [test "x${BUILD_PSMCOMM}" = "xyes"]) AM_CONDITIONAL([BUILD_PS2COMM], [test "x${BUILD_PS2COMM}" = "xyes"]) -AC_ARG_WITH(udev-rules-dir, - AS_HELP_STRING([--with-udev-rules-dir=DIR], - [Directory where udev expects its rules files - [[default=$libdir/udev/rules.d]]]), - [udevdir="$withval"], - [udevdir="$libdir/udev/rules.d"]) -UDEV_RULES_DIR=${udevdir} -AC_SUBST(UDEV_RULES_DIR) -AM_CONDITIONAL(HAVE_UDEV_RULES_DIR, [test "x$UDEV_RULES_DIR" != "xno"]) - # ----------------------------------------------------------------------------- # Dependencies for synclient and syndaemon # ----------------------------------------------------------------------------- diff --git a/man/synaptics.man b/man/synaptics.man index 65fb337..7083b3a 100644 --- a/man/synaptics.man +++ b/man/synaptics.man @@ -518,20 +518,6 @@ initialized if .B Option \*qHasSecondarySoftButtons\*q is enabled and this option is set in the __xconfigfile__(__filemansuffix__). . -.TP -.BI "Option \*qHasTrackpointButtons\*q \*q" boolean \*q -This option is only available on selected devices. You should never need to -set this option manually, your distribution should ship -__xconfigfile__(__filemansuffix__) snippets to enable this option where -required. Devices that require this option include the Lenovo X1 Carbon 3rd -and the Lenovo *50 series (T450, T550, etc.). -If enabled, the device is considered to have the trackpoint left, middle, -right buttons wired to the touchpad. If set, this option disables scroll -buttons, i.e. -.B Option \*qUpDownScrolling\*q, \*qLeftRightScrolling\*q -and the respective repeat options for scroll buttons. -This options is considered a hardware property and is not exposed as -configurable X Input device property. .SH CONFIGURATION DETAILS .SS Area handling diff --git a/src/synaptics.c b/src/synaptics.c index 07b012f..955b042 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -703,12 +703,6 @@ set_default_parameters(InputInfoPtr pInfo) pars->touchpad_off = xf86SetIntOption(opts, "TouchpadOff", TOUCHPAD_ON); if (priv->has_scrollbuttons) { - priv->has_trackpoint_buttons = xf86SetBoolOption(opts, "HasTrackpointButtons", FALSE); - if (priv->has_trackpoint_buttons) - priv->has_scrollbuttons = FALSE; - } - - if (priv->has_scrollbuttons) { pars->updown_button_scrolling = xf86SetBoolOption(opts, "UpDownScrolling", TRUE); pars->leftright_button_scrolling = @@ -1087,7 +1081,6 @@ SynapticsReset(SynapticsPrivate * priv) priv->mid_emu_state = MBE_OFF; priv->nextRepeat = 0; priv->lastButtons = 0; - priv->lastTrackpointButtons = 0; priv->prev_z = 0; priv->prevFingers = 0; priv->num_active_touches = 0; @@ -2786,34 +2779,6 @@ handle_clickfinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) } } -static void -handle_trackpoint_buttons(const InputInfoPtr pInfo, - struct SynapticsHwState *hw) -{ - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); - unsigned int buttons, change; - int id; - - buttons = (hw->multi[0] ? 0x1 : 0) | - (hw->multi[1] ? 0x4 : 0) | - (hw->multi[2] ? 0x2 : 0); - - change = buttons ^ priv->lastTrackpointButtons; - while (change) { - id = ffs(change); /* number of first set bit 1..32 is returned */ - change &= ~(1 << (id - 1)); - xf86PostButtonEvent(pInfo->dev, FALSE, id, - (buttons & (1 << (id - 1))), - 0, 0); - } - - hw->multi[0] = FALSE;