Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/adb make Kensington Turbo Mouse ( actually a trackba...



details:   https://anonhg.NetBSD.org/src/rev/7e90c3bb00cf
branches:  trunk
changeset: 965058:7e90c3bb00cf
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Aug 30 19:24:03 2019 +0000

description:
make Kensington Turbo Mouse ( actually a trackball ) work:
- this thing speaks EMP, act like it
- adjust the *way* excessive timeout for trying to enable EMP mode on mice -
  for some reason this trackball shows up as two devices - the trackball and a
  non-functional non-EMP mouse
- map both buttons to button 0 - one is an on/off switch for button 0, the
  other shows up as regular button 1

diffstat:

 sys/dev/adb/adb_ms.c |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (65 lines):

diff -r 2ff66a9c0ad9 -r 7e90c3bb00cf sys/dev/adb/adb_ms.c
--- a/sys/dev/adb/adb_ms.c      Fri Aug 30 18:52:00 2019 +0000
+++ b/sys/dev/adb/adb_ms.c      Fri Aug 30 19:24:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $     */
+/*     $NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $     */
 
 /*
  * Copyright (C) 1998  Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -337,6 +337,17 @@
        adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
        adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
        adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+
+#ifdef ADBMS_DEBUG
+       int i, reg;
+       for (reg = 1; reg < 4; reg++) {
+               adbms_send_sync(sc, ADBTALK(addr, reg), 0, NULL);
+               printf("reg %d", reg);
+               for (i = 0; i < sc->sc_msg_len; i++)
+                       printf(" %02x", sc->sc_buffer[i]);
+               printf("\n");
+       }
+#endif
 }
 
 static void
@@ -564,7 +575,8 @@
                        break;
        }
 
-       if (sc->sc_adbdev->handler_id != ADBMS_EXTENDED) {
+       if ((sc->sc_adbdev->handler_id != ADBMS_EXTENDED) &&
+           (sc->sc_adbdev->handler_id != ADBMS_TURBO)) {
                dx = ((int)(buffer[1] & 0x3f)) - ((buffer[1] & 0x40) ? 64 : 0);
                dy = ((int)(buffer[0] & 0x3f)) - ((buffer[0] & 0x40) ? 64 : 0);
        } else {
@@ -595,6 +607,9 @@
 #ifdef ADBMS_DEBUG
                printf("%d %d %08x %d\n", dx, dy, smask, shift);
 #endif
+               if (sc->sc_adbdev->handler_id == ADBMS_TURBO) {
+                       buttons = (buttons != 0) ? 1 : 0;
+               }
        }
 
        if (sc->sc_class == MSCLASS_TRACKPAD) {
@@ -806,7 +821,7 @@
                DPRINTF(" %02x", msg[i]);
        DPRINTF("\n");
        sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, len, msg);
-       adbms_wait(sc, 1000);
+       adbms_wait(sc, 3);
        return (sc->sc_msg_len != -1);
 }
 



Home | Main Index | Thread Index | Old Index