Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/adb nicely ask the keyboard to distinguish between l...



details:   https://anonhg.NetBSD.org/src/rev/561e0d9ae210
branches:  trunk
changeset: 333555:561e0d9ae210
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Nov 08 16:52:35 2014 +0000

description:
nicely ask the keyboard to distinguish between left and right Control, Alt
and Shift keys.
Welcome to the world of accents and diacritics!

diffstat:

 sys/dev/adb/adb_kbd.c     |  26 ++++++++++++++++++++++++--
 sys/dev/adb/adb_keymap.h  |   6 ++++--
 sys/dev/adb/adb_usb_map.c |  10 +++++-----
 3 files changed, 33 insertions(+), 9 deletions(-)

diffs (105 lines):

diff -r 1bdeda676926 -r 561e0d9ae210 sys/dev/adb/adb_kbd.c
--- a/sys/dev/adb/adb_kbd.c     Sat Nov 08 16:20:23 2014 +0000
+++ b/sys/dev/adb/adb_kbd.c     Sat Nov 08 16:52:35 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $    */
+/*     $NetBSD: adb_kbd.c,v 1.23 2014/11/08 16:52:35 macallan Exp $    */
 
 /*
  * Copyright (C) 1998  Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.23 2014/11/08 16:52:35 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -190,6 +190,7 @@
 #if NWSMOUSE > 0
        struct wsmousedev_attach_args am;
 #endif
+       uint8_t buffer[2];
 
        sc->sc_dev = self;
        sc->sc_ops = aaa->ops;
@@ -333,6 +334,27 @@
                break;
        }
 
+       /*
+        * try to switch to extended protocol
+        * as in, tell the keyboard to distinguish between left and right
+        * Shift, Control and Alt keys
+        */
+       cmd = ADBLISTEN(sc->sc_adbdev->current_addr, 3);
+       buffer[0] = sc->sc_adbdev->current_addr;
+       buffer[1] = 3;
+       sc->sc_msg_len = 0;
+       sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 2, buffer);
+       adbkbd_wait(sc, 10);
+
+       cmd = ADBTALK(sc->sc_adbdev->current_addr, 3);
+       sc->sc_msg_len = 0;
+       sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 0, NULL);
+       adbkbd_wait(sc, 10);
+       if ((sc->sc_msg_len == 4) && (sc->sc_buffer[3] == 3)) {
+               printf("%s: extended protocol enabled\n",
+                   device_xname(sc->sc_dev));
+       }
+
        if (adbkbd_is_console && (adbkbd_console_attached == 0)) {
                wskbd_cnattach(&adbkbd_consops, sc, &adbkbd_keymapdata);
                adbkbd_console_attached = 1;
diff -r 1bdeda676926 -r 561e0d9ae210 sys/dev/adb/adb_keymap.h
--- a/sys/dev/adb/adb_keymap.h  Sat Nov 08 16:20:23 2014 +0000
+++ b/sys/dev/adb/adb_keymap.h  Sat Nov 08 16:52:35 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_keymap.h,v 1.4 2012/08/29 02:44:07 macallan Exp $  */
+/*     $NetBSD: adb_keymap.h,v 1.5 2014/11/08 16:52:35 macallan Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -148,7 +148,9 @@
     KC(120),KS_Cmd_Screen1,    KS_f2,
     KC(121),KS_Cmd_ScrollFastDown, KS_Next,
     KC(122),KS_Cmd_Screen0,    KS_f1,
-
+    KC(123),                   KS_Shift_R,
+    KC(124),                   KS_Alt_R,
+    KC(125),                   KS_Control_R,
     KC(127),  KS_Cmd_Debugger,
 };
 
diff -r 1bdeda676926 -r 561e0d9ae210 sys/dev/adb/adb_usb_map.c
--- a/sys/dev/adb/adb_usb_map.c Sat Nov 08 16:20:23 2014 +0000
+++ b/sys/dev/adb/adb_usb_map.c Sat Nov 08 16:52:35 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_usb_map.c,v 1.1 2012/08/29 02:44:07 macallan Exp $ */
+/*     $NetBSD: adb_usb_map.c,v 1.2 2014/11/08 16:52:35 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb_usb_map.c,v 1.1 2012/08/29 02:44:07 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_usb_map.c,v 1.2 2014/11/08 16:52:35 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -158,9 +158,9 @@
 /* 120, KS_f2          */              59,
 /* 121, KS_Next                */              78,
 /* 122, KS_f1          */              58,
-/* 123                 */              0,
-/* 124                 */              0,
-/* 125                 */              0,
+/* 123, KS_Shift_R     */              229,
+/* 124, KS_Alt_R       */              230,
+/* 125, KS_Control_R   */              228,
 /* 126                 */              0,
 /* 127, KS_Cmd_Debugger        */              102
 };



Home | Main Index | Thread Index | Old Index