nicely ask the keyboard to distinguish between left and right Control, Alt

and Shift keys.
Welcome to the world of accents and diacritics!
This commit is contained in:
macallan 2014-11-08 16:52:35 +00:00
parent ca24710343
commit caa649f527
3 changed files with 33 additions and 9 deletions

View File

@ -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 self, void *aux)
#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 self, void *aux)
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;

View File

@ -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,
};

View File

@ -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
};