Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm support WSDISPLAY_COMPAT_RAWKBD for TWINTAIL...
details: https://anonhg.NetBSD.org/src/rev/db4492702931
branches: trunk
changeset: 778547:db4492702931
user: bsh <bsh%NetBSD.org@localhost>
date: Wed Apr 04 01:40:57 2012 +0000
description:
support WSDISPLAY_COMPAT_RAWKBD for TWINTAIL's on-board matrix keys.
diffstat:
sys/arch/evbarm/conf/TWINTAIL | 7 ++-
sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c | 58 +++++++++++++++++++++++++++++---
2 files changed, 55 insertions(+), 10 deletions(-)
diffs (145 lines):
diff -r a602ebf4a1b6 -r db4492702931 sys/arch/evbarm/conf/TWINTAIL
--- a/sys/arch/evbarm/conf/TWINTAIL Wed Apr 04 01:23:26 2012 +0000
+++ b/sys/arch/evbarm/conf/TWINTAIL Wed Apr 04 01:40:57 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: TWINTAIL,v 1.48 2011/12/18 05:49:26 dholland Exp $
+# $NetBSD: TWINTAIL,v 1.49 2012/04/04 01:40:57 bsh Exp $
#
# TWINTAIL -- Genetec corp. G4255EB-X002 Evaluation Board Kernel
#
@@ -193,7 +193,8 @@
#options G4250_LCD_NEC_NL3224BC35
kmkbd* at obio?
-wskbd* at kmkbd? # console ?
+wskbd* at kmkbd? # mux 1 # console ?
+options WSDISPLAY_COMPAT_RAWKBD
# GB-225 option board
opio0 at obio? intr 2
@@ -410,6 +411,6 @@
pseudo-device clockctl # user control of clock subsystem
# wscons pseudo-devices
-#pseudo-device wsmux # mouse & keyboard multiplexor
+pseudo-device wsmux # mouse & keyboard multiplexor
#pseudo-device wsfont
pseudo-device ksyms # /dev/ksyms
diff -r a602ebf4a1b6 -r db4492702931 sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c
--- a/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c Wed Apr 04 01:23:26 2012 +0000
+++ b/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c Wed Apr 04 01:40:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: g42xxeb_kmkbd.c,v 1.12 2011/07/01 20:38:17 dyoung Exp $ */
+/* $NetBSD: g42xxeb_kmkbd.c,v 1.13 2012/04/04 01:40:57 bsh Exp $ */
/*-
* Copyright (c) 2002, 2003, 2005 Genetec corp.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: g42xxeb_kmkbd.c,v 1.12 2011/07/01 20:38:17 dyoung Exp $" );
+__KERNEL_RCSID(0, "$NetBSD: g42xxeb_kmkbd.c,v 1.13 2012/04/04 01:40:57 bsh Exp $" );
#include <sys/param.h>
#include <sys/systm.h>
@@ -57,13 +57,13 @@
#include <arch/evbarm/g42xxeb/g42xxeb_var.h>
#include "locators.h"
-
-/*#include "opt_pckbd_layout.h"*/
-/*#include "opt_wsdisplay_compat.h"*/
+#include "opt_wsdisplay_compat.h"
#define DEBOUNCE_TICKS ((hz<=50)?1:hz/50) /* 20ms */
#define RELEASE_WATCH_TICKS (hz/10) /* 100ms */
+#define NUMKEYS (4*5) /* the number of keys */
+
struct kmkbd_softc {
device_t dev;
@@ -76,6 +76,7 @@
u_char debounce_counter;
#define DEBOUNCE_COUNT 3
u_char polling;
+ u_char rawkbd;
enum kmkbd_state {
ST_INIT,
ST_DISABLED,
@@ -211,6 +212,9 @@
state0 = ST_DISABLED;
}
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ sc->rawkbd = 0;
+#endif
callout_init(&sc->callout, 0);
s = spltty();
@@ -266,7 +270,9 @@
static int
kmkbd_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
{
- /*struct kmkbd_softc *sc = v;*/
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ struct kmkbd_softc *sc = v;
+#endif
switch (cmd) {
case WSKBDIO_GTYPE:
@@ -435,6 +441,39 @@
sc->notified_bits = bitset;
}
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+static void
+kmkbd_report_raw(struct kmkbd_softc *sc, u_int bitset)
+{
+ int i, nc;
+ char cbuf[NUMKEYS];
+ u_int changed;
+
+ if (bitset == sc->notified_bits)
+ return;
+
+ nc = 0;
+ changed = bitset ^ sc->notified_bits;
+
+ while (changed) {
+ i = ffs(changed) - 1;
+ if (nc < NUMKEYS) {
+ cbuf[nc] = i + 1;
+ if (0 == (bitset & (1<<i))) {
+ /* the key is released */
+ cbuf[nc] |= 0x80;
+ }
+ ++nc;
+ }
+
+ changed &= ~(1<<i);
+ }
+
+ wskbd_rawinput(sc->wskbddev, cbuf, nc);
+ sc->notified_bits = bitset;
+}
+#endif
+
static int
kmkbd_intr(void *arg)
{
@@ -468,7 +507,12 @@
}
else if( ++(sc->debounce_counter) >= DEBOUNCE_COUNT ){
new_state = newbits == 0 ? ST_ALL_UP : ST_KEY_PRESSED;
- kmkbd_report(sc, newbits);
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ if (sc->rawkbd)
+ kmkbd_report_raw(sc, newbits);
+ else
+#endif
+ kmkbd_report(sc, newbits);
}
kmkbd_new_state(sc, new_state);
Home |
Main Index |
Thread Index |
Old Index