Module Name:    src
Committed By:   riastradh
Date:           Sun Jan 26 22:19:27 UTC 2020

Modified Files:
        src/sys/dev/usb: uatp.c

Log Message:
Work around quirk of Fountain and Geyser 1 trackpads.

Sometimes they get desynchronized, but we know the last packet is a
17-byte packet, so if we get one early then stop here.

Tested by macallan on an iBook and a PowerBook.  This code path
shouldn't break anything on MacBooks because they have different
total numbers of sensors so this branch won't be reached.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/usb/uatp.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/usb/uatp.c
diff -u src/sys/dev/usb/uatp.c:1.19 src/sys/dev/usb/uatp.c:1.20
--- src/sys/dev/usb/uatp.c:1.19	Tue Jan 22 06:47:20 2019
+++ src/sys/dev/usb/uatp.c	Sun Jan 26 22:19:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uatp.c,v 1.19 2019/01/22 06:47:20 skrll Exp $	*/
+/*	$NetBSD: uatp.c,v 1.20 2020/01/26 22:19:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 The NetBSD Foundation, Inc.
@@ -146,7 +146,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uatp.c,v 1.19 2019/01/22 06:47:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uatp.c,v 1.20 2020/01/26 22:19:27 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1416,6 +1416,19 @@ uatp_intr(struct uhidev *addr, void *ibu
 		    (sc->sc_input_index + len));
 		sc->sc_input_index = 0;
 		return;
+	} else if (sc->sc_input_size == 81 && len == 17 &&
+	    sc->sc_input_index != 64) {
+		/*
+		 * Quirk of Fountain and Geyser 1 devices: a 17-byte
+		 * packet seems to mean the last one, but sometimes we
+		 * get desynchronized, so drop this one and start over
+		 * if we see a 17-byte packet that's not at the end.
+		 */
+		aprint_error_dev(uatp_dev(sc),
+		    "discarding 17-byte nonterminal input at %u\n",
+		    sc->sc_input_index);
+		sc->sc_input_index = 0;
+		return;
 	}
 
 #if UATP_DEBUG

Reply via email to