Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcmips Raw keyboard mode support. I'd tested this ...
details: https://anonhg.NetBSD.org/src/rev/46a9ca3c19c7
branches: trunk
changeset: 485737:46a9ca3c19c7
user: takemura <takemura%NetBSD.org@localhost>
date: Thu May 04 08:18:59 2000 +0000
description:
Raw keyboard mode support. I'd tested this on MC/R530.
I don't sure if skbd work or not.
diffstat:
sys/arch/hpcmips/conf/GENERIC | 9 ++-
sys/arch/hpcmips/conf/files.hpcmips | 14 +---
sys/arch/hpcmips/dev/btnmgr.c | 107 ++++++++++++++++++-----------------
sys/arch/hpcmips/dev/pckbd_encode.c | 76 +++++++++++++++++++++++++
sys/arch/hpcmips/dev/pckbd_encode.h | 36 ++++++++++++
sys/arch/hpcmips/dev/skbd.c | 28 ++++++++-
sys/arch/hpcmips/vr/vrkiu.c | 38 ++++++++++--
7 files changed, 235 insertions(+), 73 deletions(-)
diffs (truncated from 513 to 300 lines):
diff -r 2881de8a7fc4 -r 46a9ca3c19c7 sys/arch/hpcmips/conf/GENERIC
--- a/sys/arch/hpcmips/conf/GENERIC Thu May 04 06:14:05 2000 +0000
+++ b/sys/arch/hpcmips/conf/GENERIC Thu May 04 08:18:59 2000 +0000
@@ -2,11 +2,11 @@
# Distribution kernel (NEC VR based model) kernel config file
#
-# $NetBSD: GENERIC,v 1.47 2000/04/28 07:19:33 shin Exp $
+# $NetBSD: GENERIC,v 1.48 2000/05/04 08:18:59 takemura Exp $
#
include "arch/hpcmips/conf/std.hpcmips"
-#ident "GENERIC-$Revision: 1.47 $"
+#ident "GENERIC-$Revision: 1.48 $"
maxusers 8
@@ -101,6 +101,11 @@
options WSDISPLAY_DEFAULTSCREENS=4
#options FONT_VT220L8x8
options FONT_VT220L8x10
+# compatibility to other console drivers
+options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
+options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
+options WSDISPLAY_COMPAT_USL # VT handling
+options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
vrip* at mainbus0
vrcmu* at vrip? addr 0x0b000060 size 0x20
diff -r 2881de8a7fc4 -r 46a9ca3c19c7 sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips Thu May 04 06:14:05 2000 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips Thu May 04 08:18:59 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hpcmips,v 1.30 2000/05/02 17:50:52 uch Exp $
+# $NetBSD: files.hpcmips,v 1.31 2000/05/04 08:18:59 takemura Exp $
# maxpartitions must be first item in files.${ARCH}.
maxpartitions 8
@@ -69,6 +69,9 @@
# Workstation Console
#
include "dev/wscons/files.wscons"
+file dev/pckbc/wskbdmap_mfii.c btnmgr | vrkiu | skbd
+file arch/hpcmips/dev/pckbd_encode.c btnmgr | vrkiu | skbd
+defopt PCKBD_LAYOUT
define hpcfbif {}
device hpcfb: wsemuldisplaydev, rasops1, rasops2, rasops8, rasops15, rasops16
@@ -142,15 +145,6 @@
attach vrkiu at vrip
file arch/hpcmips/vr/vrkiu.c vrkiu needs-flag
-#
-# XXX files.pckbc XXX
-#
-device pckbd: wskbddev
-attach pckbd at pckbc
-file dev/pckbc/pckbd.c pckbd needs-flag
-file dev/pckbc/wskbdmap_mfii.c pckbd | vrkiu | skbd
-defopt PCKBD_LAYOUT
-
device vrpmu
attach vrpmu at vrip
file arch/hpcmips/vr/vrpmu.c vrpmu needs-flag
diff -r 2881de8a7fc4 -r 46a9ca3c19c7 sys/arch/hpcmips/dev/btnmgr.c
--- a/sys/arch/hpcmips/dev/btnmgr.c Thu May 04 06:14:05 2000 +0000
+++ b/sys/arch/hpcmips/dev/btnmgr.c Thu May 04 08:18:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: btnmgr.c,v 1.6 2000/03/30 03:29:47 sato Exp $ */
+/* $NetBSD: btnmgr.c,v 1.7 2000/05/04 08:19:00 takemura Exp $ */
/*-
* Copyright (c) 1999
@@ -43,9 +43,13 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
+#include "opt_wsdisplay_compat.h"
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wskbdvar.h>
#include <dev/wscons/wsksymdef.h>
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+#include <hpcmips/dev/pckbd_encode.h>
+#endif
#include <machine/bus.h>
#include <machine/autoconf.h>
@@ -70,6 +74,9 @@
config_hook_tag sc_hook_tag;
int sc_enabled;
struct device *sc_wskbddev;
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ int sc_rawkbd;
+#endif
};
/*
@@ -109,58 +116,35 @@
int keycode;
char *name;
} button_config[] = {
- /* kevent keycode name id */
- { 0, 1, "Power" }, /* CONFIG_HOOK_BUTTONEVENT_POWER */
- { 1, 2, "OK" }, /* CONFIG_HOOK_BUTTONEVENT_OK */
- { 1, 3, "Cancel" }, /* CONFIG_HOOK_BUTTONEVENT_CANCEL */
- { 1, 4, "Up" }, /* CONFIG_HOOK_BUTTONEVENT_UP */
- { 1, 5, "Down" }, /* CONFIG_HOOK_BUTTONEVENT_DOWN */
- { 0, 6, "Rec" }, /* CONFIG_HOOK_BUTTONEVENT_REC */
- { 0, 7, "Cover" }, /* CONFIG_HOOK_BUTTONEVENT_COVER */
- { 0, 8, "Light" }, /* CONFIG_HOOK_BUTTONEVENT_LIGHT */
- { 0, 9, "Contrast" }, /* CONFIG_HOOK_BUTTONEVENT_CONTRAST */
- { 1, 10, "Application 0" },/* CONFIG_HOOK_BUTTONEVENT_APP0 */
- { 1, 11, "Application 1" },/* CONFIG_HOOK_BUTTONEVENT_APP1 */
- { 1, 12, "Application 2" },/* CONFIG_HOOK_BUTTONEVENT_APP2 */
- { 1, 13, "Application 3" },/* CONFIG_HOOK_BUTTONEVENT_APP3 */
+ /* id kevent keycode name */
+ [CONFIG_HOOK_BUTTONEVENT_POWER] = { 0, 0, "Power" },
+ [CONFIG_HOOK_BUTTONEVENT_OK] = { 1, 28, "OK" },
+ [CONFIG_HOOK_BUTTONEVENT_CANCEL] = { 1, 0, "Cancel" },
+ [CONFIG_HOOK_BUTTONEVENT_UP] = { 1, 72, "Up" },
+ [CONFIG_HOOK_BUTTONEVENT_DOWN] = { 1, 80, "Down" },
+ [CONFIG_HOOK_BUTTONEVENT_REC] = { 0, 0, "Rec" },
+ [CONFIG_HOOK_BUTTONEVENT_COVER] = { 0, 0, "Cover" },
+ [CONFIG_HOOK_BUTTONEVENT_LIGHT] = { 0, 0, "Light" },
+ [CONFIG_HOOK_BUTTONEVENT_CONTRAST] = { 0, 0, "Contrast" },
+ [CONFIG_HOOK_BUTTONEVENT_APP0] = { 1, 67, "Application 0" },
+ [CONFIG_HOOK_BUTTONEVENT_APP1] = { 1, 68, "Application 1" },
+ [CONFIG_HOOK_BUTTONEVENT_APP2] = { 1, 87, "Application 2" },
+ [CONFIG_HOOK_BUTTONEVENT_APP3] = { 1, 88, "Application 3" },
};
-
static const int n_button_config =
sizeof(button_config) / sizeof(*button_config);
-static const struct {
- long id;
- char *name;
-} button_names[] = {
-/* button id name key code */
- { CONFIG_HOOK_BUTTONEVENT_POWER, "Power" }, /* 1 */
- { CONFIG_HOOK_BUTTONEVENT_OK, "OK" }, /* 2 */
- { CONFIG_HOOK_BUTTONEVENT_CANCEL, "Cancel" }, /* 3 */
- { CONFIG_HOOK_BUTTONEVENT_UP, "Up" }, /* 4 */
- { CONFIG_HOOK_BUTTONEVENT_DOWN, "Down" }, /* 5 */
- { CONFIG_HOOK_BUTTONEVENT_REC, "Rec" }, /* 6 */
- { CONFIG_HOOK_BUTTONEVENT_COVER, "Cover" }, /* 7 */
- { CONFIG_HOOK_BUTTONEVENT_LIGHT, "Light" }, /* 8 */
- { CONFIG_HOOK_BUTTONEVENT_CONTRAST, "Contrast" }, /* 9 */
- { CONFIG_HOOK_BUTTONEVENT_APP0, "Application 0" }, /* 10 */
- { CONFIG_HOOK_BUTTONEVENT_APP1, "Application 1" }, /* 11 */
- { CONFIG_HOOK_BUTTONEVENT_APP2, "Application 2" }, /* 12 */
- { CONFIG_HOOK_BUTTONEVENT_APP3, "Application 3" }, /* 13 */
-};
-static const int n_button_names =
- sizeof(button_names) / sizeof(*button_names);
-
#define KC(n) KS_KEYCODE(n)
static const keysym_t btnmgr_keydesc_default[] = {
/* pos normal shifted altgr shift-altgr */
- KC(2), KS_Return,
- KC(3), KS_Escape,
- KC(4), KS_KP_Up,
- KC(5), KS_KP_Down,
- KC(10), KS_f9,
- KC(11), KS_f10,
- KC(12), KS_f11,
- KC(13), KS_f12,
+ KC(1), KS_Escape,
+ KC(28), KS_Return,
+ KC(67), KS_f9,
+ KC(68), KS_f10,
+ KC(72), KS_KP_Up,
+ KC(80), KS_KP_Down,
+ KC(87), KS_f11,
+ KC(88), KS_f12,
};
#undef KC
#define KBD_MAP(name, base, map) \
@@ -234,10 +218,21 @@
DPRINTF(("%s button: %s\n", btnmgr_name(id), msg ? "ON" : "OFF"));
- if (button_config[id].kevent)
- wskbd_input(sc->sc_wskbddev,
- msg ? WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP,
- button_config[id].keycode);
+ if (button_config[id].kevent) {
+ u_int evtype;
+ evtype = msg ? WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP;
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ if (sc->sc_rawkbd) {
+ int n;
+ u_char data[16];
+ n = pckbd_encode(evtype, button_config[id].keycode,
+ data);
+ wskbd_rawinput(sc->sc_wskbddev, data, n);
+ } else
+#endif
+ wskbd_input(sc->sc_wskbddev, evtype,
+ button_config[id].keycode);
+ }
return (0);
}
@@ -287,6 +282,9 @@
int flag;
struct proc *p;
{
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ struct btnmgr_softc *sc = scx;
+#endif
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_HPC_BTN;
@@ -298,8 +296,15 @@
DPRINTF(("%s(%d): no LED\n", __FILE__, __LINE__));
*(int *)data = 0;
return (0);
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ case WSKBDIO_SETMODE:
+ sc->sc_rawkbd = (*(int *)data == WSKBD_RAW);
+ DPRINTF(("%s(%d): rawkbd is %s\n", __FILE__, __LINE__,
+ sc->sc_rawkbd ? "on" : "off"));
+ return (0);
+#endif
}
- return -1;
+ return (-1);
}
#ifdef notyet
diff -r 2881de8a7fc4 -r 46a9ca3c19c7 sys/arch/hpcmips/dev/pckbd_encode.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcmips/dev/pckbd_encode.c Thu May 04 08:18:59 2000 +0000
@@ -0,0 +1,76 @@
+/* $NetBSD: pckbd_encode.c,v 1.1 2000/05/04 08:20:26 takemura Exp $ */
+
+/*-
+ * Copyright (c) 2000 TAKEMRUA, Shin All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the PocketBSD project
+ * and its contributors.
+ * 4. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "opt_wsdisplay_compat.h"
+
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+#include <sys/param.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/pckbc/pckbdreg.h>
+#include <hpcmips/dev/pckbd_encode.h>
+
+/*
+ * pckbd_encode() is inverse function of pckbd_decode() in dev/pckbc/pckbd.c.
+ */
+int
+pckbd_encode(type, datain, dataout)
+ u_int type;
+ int datain;
+ u_char *dataout;
+{
+ int res;
+ u_char updown;
+
+ res = 0;
+ updown = (type == WSCONS_EVENT_KEY_UP) ? 0x80 : 0;
+
+ /* 0x7f means BREAK key */
+ if (datain == 0x7f) {
+ dataout[res++] = KBR_EXTENDED1;
+ dataout[res++] = (0x1d | updown);
+ datain = 0x45;
+ }
+
Home |
Main Index |
Thread Index |
Old Index