Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Two finger scrolling



Hi,

Can I add sysctl node to disable two finger scroll as follows?

And
https://mail-index.netbsd.org/source-changes/2020/03/14/msg115107.html
is essential for my Synaptics 8.16 TouchPad in HP Sectre x360 13-inch
year 2017 model (ae019TU).
If it is removed, I cannot perform any drag-and-drop with two fingers.
My patch also adds this part if two finger scroll is disabled.

Index: sys/dev/pckbport/synaptics.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pckbport/synaptics.c,v
retrieving revision 1.62
diff -u -r1.62 synaptics.c
--- sys/dev/pckbport/synaptics.c	16 Mar 2020 11:13:19 -0000	1.62
+++ sys/dev/pckbport/synaptics.c	18 Mar 2020 03:52:45 -0000
@@ -124,6 +124,7 @@
 static int synaptics_fscroll_max = 14;
 static int synaptics_dz_hold = 30;
 static int synaptics_movement_enable = 1;
+static int synaptics_finger_scroll_enable = 1;
 
 /* Sysctl nodes. */
 static int synaptics_button_boundary_nodenum;
@@ -152,6 +153,7 @@
 static int synaptics_finger_scroll_max_nodenum;
 static int synaptics_dz_hold_nodenum;
 static int synaptics_movement_enable_nodenum;
+static int synaptics_finger_scroll_enable_nodenum;
 
 static int
 synaptics_poll_cmd(struct pms_softc *psc, ...)
@@ -763,6 +765,18 @@
 
 	if ((rc = sysctl_createv(clog, 0, NULL, &node,
 	    CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+	    CTLTYPE_INT, "finger_scroll_enable",
+	    SYSCTL_DESCR("Enable finger scroll"),
+	    pms_sysctl_synaptics_verify, 0,
+	    &synaptics_finger_scroll_enable,
+	    0, CTL_HW, root_num, CTL_CREATE,
+	    CTL_EOL)) != 0)
+		goto err;
+
+	synaptics_finger_scroll_enable_nodenum = node->sysctl_num;
+
+	if ((rc = sysctl_createv(clog, 0, NULL, &node,
+	    CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
 	    CTLTYPE_INT, "button_boundary",
 	    SYSCTL_DESCR("Top edge of button area"),
 	    pms_sysctl_synaptics_verify, 0,
@@ -921,7 +935,8 @@
 		if (t < 0)
 			return (EINVAL);
 	} else
-	if (node.sysctl_num == synaptics_movement_enable_nodenum) {
+	if (node.sysctl_num == synaptics_movement_enable_nodenum ||
+	    node.sysctl_num == synaptics_finger_scroll_enable_nodenum) {
 		if (t < 0 || t > 1)
 			return (EINVAL);
 	} else
@@ -1285,7 +1300,15 @@
 		return (0);
 	}
 
-	if (sc->flags & SYN_FLAG_HAS_MULTI_FINGER) {
+	/*
+	 * If two finger scroll is disabled,
+	 * detect 2 and 3 fingers if supported, but only if multiple
+	 * fingers appear within the tap gesture time period.
+	 */
+	if ((sc->flags & SYN_FLAG_HAS_MULTI_FINGER &&
+	    synaptics_finger_scroll_enable) ||
+	    SYN_TIME(sc, sc->gesture_start_packet,
+	    sp->sp_finger) < synaptics_gesture_length) {
 		switch (sp->sp_w) {
 		case SYNAPTICS_WIDTH_TWO_FINGERS:
 			fingers = 2;
@@ -1732,7 +1755,7 @@
 
 			synaptics_movement(sc, sp, sp->sp_finger,
 				z_emul, &dx, &dy, &dz);
-		} else if (fingers > 1) {
+		} else if (fingers > 1 && synaptics_finger_scroll_enable) {
 			/*
 			 * Multiple finger movement. Interpret it as scrolling.
 			 */


nia <nia%NetBSD.org@localhost> writes:

> I've just committed a handful of changes to synaptics.c that give me
> smooth two-finger scrolling out of the box.
>
> I'm curious how many others are using multitouch touchpads and whether
> you notice any improvement.
>
> The existing approximation (sysctl hw.synaptics.finger_scroll...) wasn't
> working for me at all, tweaking hw.synaptics.finger_scroll-min either
> gave me no scrolling or registered normal mouse movements as scrolling
>
> I suspect my fingers are significantly smaller than whoever wrote this
> code. Was anyone using this successfully, and how does scrolling compare
> after my changes?

-- 
Ryo ONODERA // ryo%tetera.org@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Home | Main Index | Thread Index | Old Index