Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Dec 2009 17:46:57 +0000 (UTC)
From:      Jean-Sebastien Pedron <dumbbell@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200674 - in head: share/man/man4 sys/dev/atkbdc
Message-ID:  <200912181746.nBIHkvod000814@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dumbbell
Date: Fri Dec 18 17:46:57 2009
New Revision: 200674
URL: http://svn.freebsd.org/changeset/base/200674

Log:
  Add new "hw.psm.tap_enabled" tunable and sysctl.
  
  This tunable allows one to enable (1) or disable (0) gestures like tap
  and tap-hold on Synaptics TouchPad when the Extended mode isn't enabled
  (ie. "hw.psm.synaptics_support" not set).
  
  By default, the value is -1 in order to keep the current behaviour of
  not enabling/disabling gestures explicitly.
  
  PR:		kern/139272
  Submitted by:	David Horn <dhorn2000 AT gmail DOT com>
  Reviewed by:	David Horn <dhorn2000 AT gmail DOT com>

Modified:
  head/share/man/man4/psm.4
  head/sys/dev/atkbdc/psm.c

Modified: head/share/man/man4/psm.4
==============================================================================
--- head/share/man/man4/psm.4	Fri Dec 18 17:22:21 2009	(r200673)
+++ head/share/man/man4/psm.4	Fri Dec 18 17:46:57 2009	(r200674)
@@ -359,6 +359,18 @@ at boot-time.
 This will enable
 .Nm
 to handle packets from guest devices (sticks) and extra buttons.
+.Pp
+Tap and drag gestures can be disabled by setting
+.Va hw.psm.tap_enabled
+to
+.Em 0
+at boot-time.
+Currently, this is only supported on Synaptics touchpads with Extended
+support disabled. The behaviour may be changed after boot by setting
+the sysctl with the same name and by restarting
+.Xr moused 8
+using
+.Pa /etc/rc.d/moused .
 .Sh IOCTLS
 There are a few
 .Xr ioctl 2

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Fri Dec 18 17:22:21 2009	(r200673)
+++ head/sys/dev/atkbdc/psm.c	Fri Dec 18 17:46:57 2009	(r200674)
@@ -343,6 +343,9 @@ static devclass_t psm_devclass;
 #define	PSM_FLAGS_FINGERDOWN	0x0001	/* VersaPad finger down */
 
 /* Tunables */
+static int tap_enabled = -1;
+TUNABLE_INT("hw.psm.tap_enabled", &tap_enabled);
+
 static int synaptics_support = 0;
 TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support);
 
@@ -901,6 +904,36 @@ doopen(struct psm_softc *sc, int command
 		}
 	}
 
+	/*
+	 * A user may want to disable tap and drag gestures on a Synaptics
+	 * TouchPad when it operates in Relative Mode.
+	 */
+	if (sc->hw.model == MOUSE_MODEL_GENERIC) {
+		if (tap_enabled > 0) {
+			/*
+			 * Enable tap & drag gestures. We use a Mode Byte
+			 * and clear the DisGest bit (see §2.5 of Synaptics
+			 * TouchPad Interfacing Guide).
+			 */
+			VLOG(2, (LOG_DEBUG,
+			    "psm%d: enable tap and drag gestures\n",
+			    sc->unit));
+			mouse_ext_command(sc->kbdc, 0x00);
+			set_mouse_sampling_rate(sc->kbdc, 20);
+		} else if (tap_enabled == 0) {
+			/*
+			 * Disable tap & drag gestures. We use a Mode Byte
+			 * and set the DisGest bit (see §2.5 of Synaptics
+			 * TouchPad Interfacing Guide).
+			 */
+			VLOG(2, (LOG_DEBUG,
+			    "psm%d: disable tap and drag gestures\n",
+			    sc->unit));
+			mouse_ext_command(sc->kbdc, 0x04);
+			set_mouse_sampling_rate(sc->kbdc, 20);
+		}
+	}
+
 	/* enable the mouse device */
 	if (!enable_aux_dev(sc->kbdc)) {
 		/* MOUSE ERROR: failed to enable the mouse because:
@@ -2261,6 +2294,8 @@ static int pkterrthresh = 2;
 SYSCTL_INT(_debug_psm, OID_AUTO, pkterrthresh, CTLFLAG_RW, &pkterrthresh, 0,
     "Number of error packets allowed before reinitializing the mouse");
 
+SYSCTL_INT(_hw_psm, OID_AUTO, tap_enabled, CTLFLAG_RW, &tap_enabled, 0,
+    "Enable tap and drag gestures");
 static int tap_threshold = PSM_TAP_THRESHOLD;
 SYSCTL_INT(_hw_psm, OID_AUTO, tap_threshold, CTLFLAG_RW, &tap_threshold, 0,
     "Button tap threshold");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912181746.nBIHkvod000814>