Sat Mar 14 22:23:17 2020 UTC ()
synaptics: Detect multiple fingers outside the gesture period

I suspect this code doesn't make any sense if we want two-finger scrolling


(nia)
diff -r1.59 -r1.60 src/sys/dev/pckbport/synaptics.c

cvs diff -r1.59 -r1.60 src/sys/dev/pckbport/synaptics.c (expand / switch to unified diff)

--- src/sys/dev/pckbport/synaptics.c 2020/03/14 21:56:08 1.59
+++ src/sys/dev/pckbport/synaptics.c 2020/03/14 22:23:17 1.60
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: synaptics.c,v 1.59 2020/03/14 21:56:08 nia Exp $ */ 1/* $NetBSD: synaptics.c,v 1.60 2020/03/14 22:23:17 nia Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005, Steve C. Woodford 4 * Copyright (c) 2005, Steve C. Woodford
5 * Copyright (c) 2004, Ales Krenek 5 * Copyright (c) 2004, Ales Krenek
6 * Copyright (c) 2004, Kentaro A. Kurahone 6 * Copyright (c) 2004, Kentaro A. Kurahone
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 12 *
13 * * Redistributions of source code must retain the above copyright 13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38/* 38/*
39 * TODO: 39 * TODO:
40 * - Make the sysctl values per-instance instead of global. 40 * - Make the sysctl values per-instance instead of global.
41 * - Consider setting initial scaling factors at runtime according 41 * - Consider setting initial scaling factors at runtime according
42 * to the values returned by the 'Read Resolutions' command. 42 * to the values returned by the 'Read Resolutions' command.
43 * - Support the serial protocol (we only support PS/2 for now) 43 * - Support the serial protocol (we only support PS/2 for now)
44 * - Support auto-repeat for up/down button Z-axis emulation. 44 * - Support auto-repeat for up/down button Z-axis emulation.
45 * - Maybe add some more gestures (can we use Palm support somehow?) 45 * - Maybe add some more gestures (can we use Palm support somehow?)
46 */ 46 */
47 47
48#include "opt_pms.h" 48#include "opt_pms.h"
49 49
50#include <sys/cdefs.h> 50#include <sys/cdefs.h>
51__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.59 2020/03/14 21:56:08 nia Exp $"); 51__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.60 2020/03/14 22:23:17 nia Exp $");
52 52
53#include <sys/param.h> 53#include <sys/param.h>
54#include <sys/systm.h> 54#include <sys/systm.h>
55#include <sys/device.h> 55#include <sys/device.h>
56#include <sys/ioctl.h> 56#include <sys/ioctl.h>
57#include <sys/sysctl.h> 57#include <sys/sysctl.h>
58#include <sys/kernel.h> 58#include <sys/kernel.h>
59#include <sys/proc.h> 59#include <sys/proc.h>
60 60
61#include <sys/bus.h> 61#include <sys/bus.h>
62 62
63#include <dev/pckbport/pckbportvar.h> 63#include <dev/pckbport/pckbportvar.h>
64 64
@@ -1275,33 +1275,27 @@ synaptics_finger_detect(struct synaptics @@ -1275,33 +1275,27 @@ synaptics_finger_detect(struct synaptics
1275 sp->sp_w >= SYNAPTICS_WIDTH_PALM_MIN) 1275 sp->sp_w >= SYNAPTICS_WIDTH_PALM_MIN)
1276 *palmp = 1; 1276 *palmp = 1;
1277 1277
1278 if (sc->prev_fingers == 0 && 1278 if (sc->prev_fingers == 0 &&
1279 (sp->sp_z > SYNAPTICS_FINGER_FLAT || 1279 (sp->sp_z > SYNAPTICS_FINGER_FLAT ||
1280 sp->sp_w >= SYNAPTICS_WIDTH_PALM_MIN)) { 1280 sp->sp_w >= SYNAPTICS_WIDTH_PALM_MIN)) {
1281 /* 1281 /*
1282 * Contact area or pressure is too great to be a finger. 1282 * Contact area or pressure is too great to be a finger.
1283 * Just ignore it for now. 1283 * Just ignore it for now.
1284 */ 1284 */
1285 return (0); 1285 return (0);
1286 } 1286 }
1287 1287
1288 /* 1288 if (sc->flags & SYN_FLAG_HAS_MULTI_FINGER) {
1289 * Detect 2 and 3 fingers if supported, but only if multiple 
1290 * fingers appear within the tap gesture time period. 
1291 */ 
1292 if (sc->flags & SYN_FLAG_HAS_MULTI_FINGER && 
1293 SYN_TIME(sc, sc->gesture_start_packet, 
1294 sp->sp_finger) < synaptics_gesture_length) { 
1295 switch (sp->sp_w) { 1289 switch (sp->sp_w) {
1296 case SYNAPTICS_WIDTH_TWO_FINGERS: 1290 case SYNAPTICS_WIDTH_TWO_FINGERS:
1297 fingers = 2; 1291 fingers = 2;
1298 break; 1292 break;
1299 1293
1300 case SYNAPTICS_WIDTH_THREE_OR_MORE: 1294 case SYNAPTICS_WIDTH_THREE_OR_MORE:
1301 fingers = 3; 1295 fingers = 3;
1302 break; 1296 break;
1303 1297
1304 case SYNAPTICS_WIDTH_PEN: 1298 case SYNAPTICS_WIDTH_PEN:
1305 fingers = 1; 1299 fingers = 1;
1306 break; 1300 break;
1307 1301