Module Name: src
Committed By: macallan
Date: Sat Nov 8 16:52:35 UTC 2014
Modified Files:
src/sys/dev/adb: adb_kbd.c adb_keymap.h adb_usb_map.c
Log Message:
nicely ask the keyboard to distinguish between left and right Control, Alt
and Shift keys.
Welcome to the world of accents and diacritics!
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/adb/adb_keymap.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/adb/adb_usb_map.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/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.22 src/sys/dev/adb/adb_kbd.c:1.23
--- src/sys/dev/adb/adb_kbd.c:1.22 Mon Nov 18 11:02:34 2013
+++ src/sys/dev/adb/adb_kbd.c Sat Nov 8 16:52:35 2014
@@ -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 @@ adbkbd_attach(device_t parent, device_t
#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 @@ adbkbd_attach(device_t parent, device_t
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;
Index: src/sys/dev/adb/adb_keymap.h
diff -u src/sys/dev/adb/adb_keymap.h:1.4 src/sys/dev/adb/adb_keymap.h:1.5
--- src/sys/dev/adb/adb_keymap.h:1.4 Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/adb_keymap.h Sat Nov 8 16:52:35 2014
@@ -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 @@ static const keysym_t akbd_keydesc_us[]
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,
};
Index: src/sys/dev/adb/adb_usb_map.c
diff -u src/sys/dev/adb/adb_usb_map.c:1.1 src/sys/dev/adb/adb_usb_map.c:1.2
--- src/sys/dev/adb/adb_usb_map.c:1.1 Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/adb_usb_map.c Sat Nov 8 16:52:35 2014
@@ -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 @@ keysym_t adb_to_usb[] = {
/* 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
};