Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k Pull LUNA's keyboard driver changes from Op...
details: https://anonhg.NetBSD.org/src/rev/79069c3237e4
branches: trunk
changeset: 330750:79069c3237e4
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jul 20 11:14:56 2014 +0000
description:
Pull LUNA's keyboard driver changes from OpenBSD/luna88k.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
diffstat:
sys/arch/luna68k/conf/files.luna68k | 4 +-
sys/arch/luna68k/dev/lunaws.c | 173 +++++---------------
sys/arch/luna68k/dev/omkbdmap.c | 303 ++++++++++++++++++++++++++++++++++++
sys/arch/luna68k/dev/omkbdmap.h | 23 ++
4 files changed, 374 insertions(+), 129 deletions(-)
diffs (truncated from 600 to 300 lines):
diff -r 48fc2367a291 -r 79069c3237e4 sys/arch/luna68k/conf/files.luna68k
--- a/sys/arch/luna68k/conf/files.luna68k Sun Jul 20 10:22:54 2014 +0000
+++ b/sys/arch/luna68k/conf/files.luna68k Sun Jul 20 11:14:56 2014 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: files.luna68k,v 1.23 2011/11/15 13:25:44 tsutsui Exp $
+# $NetBSD: files.luna68k,v 1.24 2014/07/20 11:14:56 tsutsui Exp $
#
maxpartitions 8
maxusers 2 8 64
@@ -42,9 +42,11 @@
device siotty: tty
attach siotty at sio
file arch/luna68k/dev/siotty.c siotty needs-flag
+
device ws: wskbddev,wsmousedev
attach ws at sio
file arch/luna68k/dev/lunaws.c ws
+file arch/luna68k/dev/omkbdmap.c ws
device fb: wsemuldisplaydev
attach fb at mainbus
diff -r 48fc2367a291 -r 79069c3237e4 sys/arch/luna68k/dev/lunaws.c
--- a/sys/arch/luna68k/dev/lunaws.c Sun Jul 20 10:22:54 2014 +0000
+++ b/sys/arch/luna68k/dev/lunaws.c Sun Jul 20 11:14:56 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.29 2014/07/18 18:02:08 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.30 2014/07/20 11:14:56 tsutsui Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,8 +31,9 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.29 2014/07/18 18:02:08 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.30 2014/07/20 11:14:56 tsutsui Exp $");
+#include "opt_wsdisplay_compat.h"
#include "wsmouse.h"
#include <sys/param.h>
@@ -46,6 +47,7 @@
#include <dev/wscons/wsksymvar.h>
#include <dev/wscons/wsmousevar.h>
+#include <luna68k/dev/omkbdmap.h>
#include <luna68k/dev/sioreg.h>
#include <luna68k/dev/siovar.h>
@@ -78,16 +80,15 @@
int sc_msbuttons, sc_msdx, sc_msdy;
#endif
void *sc_si;
+ int sc_rawkbd;
};
static void omkbd_input(void *, int);
-static int omkbd_decode(void *, int, u_int *, int *);
+static void omkbd_decode(void *, int, u_int *, int *);
static int omkbd_enable(void *, int);
static void omkbd_set_leds(void *, int);
static int omkbd_ioctl(void *, u_long, void *, int, struct lwp *);
-struct wscons_keydesc omkbd_keydesctab[];
-
static const struct wskbd_mapdata omkbd_keymapdata = {
omkbd_keydesctab,
KB_JP,
@@ -270,143 +271,48 @@
u_int type;
int key;
- if (omkbd_decode(v, data, &type, &key))
- wskbd_input(sc->sc_wskbddev, type, key);
+ omkbd_decode(v, data, &type, &key);
+
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ if (sc->sc_rawkbd) {
+ uint8_t cbuf[2];
+ int c, j = 0;
+
+ c = omkbd_raw[key];
+ if (c != 0x00) {
+ /* fake extended scancode if necessary */
+ if (c & 0x80)
+ cbuf[j++] = 0xe0;
+ cbuf[j] = c & 0x7f;
+ if (type == WSCONS_EVENT_KEY_UP)
+ cbuf[j] |= 0x80;
+ j++;
+
+ wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
+ }
+ } else
+#endif
+ {
+ if (sc->sc_wskbddev != NULL)
+ wskbd_input(sc->sc_wskbddev, type, key);
+ }
}
-static int
+static void
omkbd_decode(void *v, int datain, u_int *type, int *dataout)
{
*type = (datain & 0x80) ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
*dataout = datain & 0x7f;
- return 1;
}
-#define KC(n) KS_KEYCODE(n)
-
-static const keysym_t omkbd_keydesc_1[] = {
-/* pos command normal shifted */
- KC(0x9), KS_Tab,
- KC(0xa), KS_Control_L,
- KC(0xb), KS_Mode_switch, /* Kana */
- KC(0xc), KS_Shift_R,
- KC(0xd), KS_Shift_L,
- KC(0xe), KS_Caps_Lock,
- KC(0xf), KS_Meta_L, /* Zenmen */
- KC(0x10), KS_Escape,
- KC(0x11), KS_BackSpace,
- KC(0x12), KS_Return,
- KC(0x14), KS_space,
- KC(0x15), KS_Delete,
- KC(0x16), KS_Alt_L, /* Henkan */
- KC(0x17), KS_Alt_R, /* Kakutei */
- KC(0x18), KS_f11, /* Shokyo */
- KC(0x19), KS_f12, /* Yobidashi */
- KC(0x1a), KS_f13, /* Bunsetsu L */
- KC(0x1b), KS_f14, /* Bunsetsu R */
- KC(0x1c), KS_KP_Up,
- KC(0x1d), KS_KP_Left,
- KC(0x1e), KS_KP_Right,
- KC(0x1f), KS_KP_Down,
- /* KC(0x20), KS_f11, */
- /* KC(0x21), KS_f12, */
- KC(0x22), KS_1, KS_exclam,
- KC(0x23), KS_2, KS_quotedbl,
- KC(0x24), KS_3, KS_numbersign,
- KC(0x25), KS_4, KS_dollar,
- KC(0x26), KS_5, KS_percent,
- KC(0x27), KS_6, KS_ampersand,
- KC(0x28), KS_7, KS_apostrophe,
- KC(0x29), KS_8, KS_parenleft,
- KC(0x2a), KS_9, KS_parenright,
- KC(0x2b), KS_0,
- KC(0x2c), KS_minus, KS_equal,
- KC(0x2d), KS_asciicircum, KS_asciitilde,
- KC(0x2e), KS_backslash, KS_bar,
- /* KC(0x30), KS_f13, */
- /* KC(0x31), KS_f14, */
- KC(0x32), KS_q,
- KC(0x33), KS_w,
- KC(0x34), KS_e,
- KC(0x35), KS_r,
- KC(0x36), KS_t,
- KC(0x37), KS_y,
- KC(0x38), KS_u,
- KC(0x39), KS_i,
- KC(0x3a), KS_o,
- KC(0x3b), KS_p,
- KC(0x3c), KS_at, KS_grave,
- KC(0x3d), KS_bracketleft, KS_braceleft,
- KC(0x42), KS_a,
- KC(0x43), KS_s,
- KC(0x44), KS_d,
- KC(0x45), KS_f,
- KC(0x46), KS_g,
- KC(0x47), KS_h,
- KC(0x48), KS_j,
- KC(0x49), KS_k,
- KC(0x4a), KS_l,
- KC(0x4b), KS_semicolon, KS_plus,
- KC(0x4c), KS_colon, KS_asterisk,
- KC(0x4d), KS_bracketright, KS_braceright,
- KC(0x52), KS_z,
- KC(0x53), KS_x,
- KC(0x54), KS_c,
- KC(0x55), KS_v,
- KC(0x56), KS_b,
- KC(0x57), KS_n,
- KC(0x58), KS_m,
- KC(0x59), KS_comma, KS_less,
- KC(0x5a), KS_period, KS_greater,
- KC(0x5b), KS_slash, KS_question,
- KC(0x5c), KS_underscore,
- KC(0x60), KS_KP_Delete,
- KC(0x61), KS_KP_Add,
- KC(0x62), KS_KP_Subtract,
- KC(0x63), KS_KP_7,
- KC(0x64), KS_KP_8,
- KC(0x65), KS_KP_9,
- KC(0x66), KS_KP_4,
- KC(0x67), KS_KP_5,
- KC(0x68), KS_KP_6,
- KC(0x69), KS_KP_1,
- KC(0x6a), KS_KP_2,
- KC(0x6b), KS_KP_3,
- KC(0x6c), KS_KP_0,
- KC(0x6d), KS_KP_Decimal,
- KC(0x6e), KS_KP_Enter,
- KC(0x72), KS_f1,
- KC(0x73), KS_f2,
- KC(0x74), KS_f3,
- KC(0x75), KS_f4,
- KC(0x76), KS_f5,
- KC(0x77), KS_f6,
- KC(0x78), KS_f7,
- KC(0x79), KS_f8,
- KC(0x7a), KS_f9,
- KC(0x7b), KS_f10,
- KC(0x7c), KS_KP_Multiply,
- KC(0x7d), KS_KP_Divide,
- KC(0x7e), KS_KP_Equal,
- KC(0x7f), KS_KP_Separator,
-};
-
-#define SIZE(map) (sizeof(map)/sizeof(keysym_t))
-
-struct wscons_keydesc omkbd_keydesctab[] = {
- { KB_JP, 0, SIZE(omkbd_keydesc_1), omkbd_keydesc_1, },
- { 0, 0, 0, 0 },
-};
-
static void
ws_cngetc(void *v, u_int *type, int *data)
{
int code;
- do {
- code = syscngetc((dev_t)1);
- } while (!omkbd_decode(v, code, type, data));
+ code = syscngetc((dev_t)1);
+ omkbd_decode(v, code, type, data);
}
static void
@@ -446,6 +352,9 @@
static int
omkbd_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
{
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ struct ws_softc *sc = v;
+#endif
switch (cmd) {
case WSKBDIO_GTYPE:
@@ -455,6 +364,14 @@
case WSKBDIO_GETLEDS:
case WSKBDIO_COMPLEXBELL: /* XXX capable of complex bell */
return 0;
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ case WSKBDIO_SETMODE:
+ sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
+ return 0;
+ case WSKBDIO_GETMODE:
+ *(int *)data = sc->sc_rawkbd;
+ return 0;
+#endif
}
return EPASSTHROUGH;
}
diff -r 48fc2367a291 -r 79069c3237e4 sys/arch/luna68k/dev/omkbdmap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/luna68k/dev/omkbdmap.c Sun Jul 20 11:14:56 2014 +0000
@@ -0,0 +1,303 @@
+/* $NetBSD: omkbdmap.c,v 1.1 2014/07/20 11:14:56 tsutsui Exp $ */
+/* $OpenBSD: omkbdmap.c,v 1.2 2013/11/16 18:31:44 miod Exp $ */
+
+/* Partially from:
+ * $NetBSD: omkbdmap.c,v 1.1 2014/07/20 11:14:56 tsutsui Exp $
+ *
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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)
Home |
Main Index |
Thread Index |
Old Index