Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Work around quirk of Fountain and Geyser 1 track...



details:   https://anonhg.NetBSD.org/src/rev/076965cd6582
branches:  trunk
changeset: 1006758:076965cd6582
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jan 26 22:19:27 2020 +0000

description:
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.

diffstat:

 sys/dev/usb/uatp.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 5b2f7feaec99 -r 076965cd6582 sys/dev/usb/uatp.c
--- a/sys/dev/usb/uatp.c        Sun Jan 26 21:43:52 2020 +0000
+++ b/sys/dev/usb/uatp.c        Sun Jan 26 22:19:27 2020 +0000
@@ -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 @@
                    (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



Home | Main Index | Thread Index | Old Index