From b07da6e7b4f9911e9a267ee2a9fe1f488108252f Mon Sep 17 00:00:00 2001 From: wulf Date: Sat, 20 Apr 2019 21:04:56 +0000 Subject: [PATCH] psm(4): respect tap_disabled configuration with enabled Extended support This fixes a bug where, even when hw.psm.tap_enabled=0, touchpad taps were processed. tap_enabled has three states: unconfigured, disabled, and enabled (-1, 0, 1). To respect PR kern/139272, taps are ignored only when explicity disabled. Submitted by: Ben LeMasurier (initial version) MFC after: 2 weeks --- share/man/man4/psm.4 | 4 ++-- sys/dev/atkbdc/psm.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/share/man/man4/psm.4 b/share/man/man4/psm.4 index 7b16d73ff493..ad4f5f24d92d 100644 --- a/share/man/man4/psm.4 +++ b/share/man/man4/psm.4 @@ -354,8 +354,8 @@ Tap and drag gestures can be disabled by setting to .Em 0 at boot-time. -Currently, this is only supported on Synaptics touchpads with Extended -support disabled. +Currently, this is supported on Synaptics touchpads regardless of Extended +support state and on Elantech touchpads with Extended support enabled. The behaviour may be changed after boot by setting the sysctl with the same name and by restarting .Xr moused 8 diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index f1c9c07e85cf..272f2cb8d299 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -3820,9 +3820,15 @@ psmgestures(struct psm_softc *sc, finger_t *fingers, int nfingers, gest->in_vscroll = 0; /* Compute tap timeout. */ - gest->taptimeout.tv_sec = tap_timeout / 1000000; - gest->taptimeout.tv_usec = tap_timeout % 1000000; - timevaladd(&gest->taptimeout, &sc->lastsoftintr); + if (tap_enabled != 0) { + gest->taptimeout = (struct timeval) { + .tv_sec = tap_timeout / 1000000, + .tv_usec = tap_timeout % 1000000, + }; + timevaladd( + &gest->taptimeout, &sc->lastsoftintr); + } else + timevalclear(&gest->taptimeout); sc->flags |= PSM_FLAGS_FINGERDOWN;