Module Name: src Committed By: ryoon Date: Mon Feb 10 16:12:59 UTC 2020
Modified Files: src/sys/dev/pckbport: alps.c Log Message: Introduce hw.alps.touchpad_movement_threshold to better button area clicks To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pckbport/alps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pckbport/alps.c diff -u src/sys/dev/pckbport/alps.c:1.13 src/sys/dev/pckbport/alps.c:1.14 --- src/sys/dev/pckbport/alps.c:1.13 Mon Feb 10 15:29:05 2020 +++ src/sys/dev/pckbport/alps.c Mon Feb 10 16:12:58 2020 @@ -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 <r...@tetera.org> @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.1 /* #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 @@ pms_sysctl_alps_verify(SYSCTLFN_ARGS) 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 @@ pms_sysctl_alps(struct sysctllog **clog) 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 @@ pms_alps_decode_touchpad_packet_v7(struc 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)) {