Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pckbport Introduce hw.alps.touchpad_movement_thresho...



details:   https://anonhg.NetBSD.org/src/rev/be8773a4cc62
branches:  trunk
changeset: 744680:be8773a4cc62
user:      ryoon <ryoon%NetBSD.org@localhost>
date:      Mon Feb 10 16:12:58 2020 +0000

description:
Introduce hw.alps.touchpad_movement_threshold to better button area clicks

diffstat:

 sys/dev/pckbport/alps.c |  27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diffs (72 lines):

diff -r e7d903ba8719 -r be8773a4cc62 sys/dev/pckbport/alps.c
--- a/sys/dev/pckbport/alps.c   Mon Feb 10 16:08:58 2020 +0000
+++ b/sys/dev/pckbport/alps.c   Mon Feb 10 16:12:58 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alps.c,v 1.13 2020/02/10 15:29:05 ryoon Exp $ */
+/* $NetBSD: alps.c,v 1.14 2020/02/10 16:12:58 ryoon Exp $ */
 
 /*-
  * Copyright (c) 2017 Ryo ONODERA <ryo%tetera.org@localhost>
@@ -30,7 +30,7 @@
 #include "opt_pms.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.13 2020/02/10 15:29:05 ryoon Exp $");
+__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.14 2020/02/10 16:12:58 ryoon Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,9 +51,11 @@
 
 /* #define ALPS_DEBUG */
 
+static int alps_touchpad_movement_threshold_nodenum;
 static int alps_touchpad_xy_unprecision_nodenum;
 static int alps_trackstick_xy_precision_nodenum;
 
+static int alps_touchpad_movement_threshold = 4;
 static int alps_touchpad_xy_unprecision = 2;
 static int alps_trackstick_xy_precision = 1;
 
@@ -77,6 +79,9 @@
                node.sysctl_num == alps_trackstick_xy_precision_nodenum) {
                if (t < 0 || t > 7)
                        return EINVAL;
+       } else if (node.sysctl_num == alps_touchpad_movement_threshold_nodenum) {
+               if (t < 0)
+                       return EINVAL;
        } else
                return EINVAL;
 
@@ -122,6 +127,17 @@
                        goto err;
        alps_trackstick_xy_precision_nodenum = node->sysctl_num;
 
+       if ((rc = sysctl_createv(clog, 0, NULL, &node,
+               CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+               CTLTYPE_INT, "touchpad_movement_threshold",
+               SYSCTL_DESCR("Minimum reported movement threshold"),
+               pms_sysctl_alps_verify, 0,
+               &alps_touchpad_movement_threshold,
+               0, CTL_HW, root_num, CTL_CREATE,
+               CTL_EOL)) != 0)
+                       goto err;
+       alps_touchpad_movement_threshold_nodenum = node->sysctl_num;
+
        return;
 
 err:
@@ -967,6 +983,13 @@
                dy1 = dy1 >> alps_touchpad_xy_unprecision;
        }
 
+       if (abs(dx1) < alps_touchpad_movement_threshold) {
+               dx1 = 0;
+       }
+       if (abs(dy1) < alps_touchpad_movement_threshold) {
+               dy1 = 0;
+       }
+
        /* Allow finger detouch during drag and drop */
        if ((sc->nfingers < sc->last_nfingers)
                && (cur_x2 == sc->last_x1) && (cur_y2 == sc->last_y1)) {



Home | Main Index | Thread Index | Old Index