Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons support an optional table to translate scanco...



details:   https://anonhg.NetBSD.org/src/rev/4d1b0b12bc0a
branches:  trunk
changeset: 781230:4d1b0b12bc0a
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Aug 29 02:38:31 2012 +0000

description:
support an optional table to translate scancodes when in event mode

diffstat:

 sys/dev/wscons/wskbd.c    |  32 +++++++++++++++++++++++++++++---
 sys/dev/wscons/wskbdvar.h |   9 ++++++++-
 2 files changed, 37 insertions(+), 4 deletions(-)

diffs (94 lines):

diff -r f6df07e2e378 -r 4d1b0b12bc0a sys/dev/wscons/wskbd.c
--- a/sys/dev/wscons/wskbd.c    Tue Aug 28 15:54:40 2012 +0000
+++ b/sys/dev/wscons/wskbd.c    Wed Aug 29 02:38:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbd.c,v 1.131 2012/03/13 18:40:34 elad Exp $ */
+/* $NetBSD: wskbd.c,v 1.132 2012/08/29 02:38:31 macallan Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.131 2012/03/13 18:40:34 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.132 2012/08/29 02:38:31 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -207,6 +207,10 @@
 
        wskbd_hotkey_plugin *sc_hotkey;
        void *sc_hotkeycookie;
+
+       /* optional table to translate scancodes in event mode */
+       int             sc_evtrans_len;
+       keysym_t        *sc_evtrans;
 };
 
 #define MOD_SHIFT_L            (1 << 0)
@@ -418,6 +422,8 @@
        sc->sc_isconsole = ap->console;
        sc->sc_hotkey = NULL;
        sc->sc_hotkeycookie = NULL;
+       sc->sc_evtrans_len = 0;
+       sc->sc_evtrans = NULL;
 
 #if NWSMUX > 0 || NWSDISPLAY > 0
        sc->sc_base.me_ops = &wskbd_srcops;
@@ -744,7 +750,17 @@
 #endif
 
        event.type = type;
-       event.value = value;
+       event.value = 0;
+       DPRINTF(("%d ->", value));
+       if (sc->sc_evtrans_len > 0) {
+               if (sc->sc_evtrans_len > value) {
+                       DPRINTF(("%d", sc->sc_evtrans[value]));
+                       event.value = sc->sc_evtrans[value];
+               }
+       } else {
+               event.value = value;
+       }
+       DPRINTF(("\n"));
        if (wsevent_inject(evar, &event, 1) != 0)
                log(LOG_WARNING, "%s: event queue overflow\n",
                    device_xname(sc->sc_base.me_dv));
@@ -1878,3 +1894,13 @@
        id->t_symbols[0] = res;
        return (1);
 }
+
+void
+wskbd_set_evtrans(device_t dev, keysym_t *tab, int len)
+{
+       struct wskbd_softc *sc = device_private(dev);
+
+       sc->sc_evtrans_len = len;
+       sc->sc_evtrans = tab;
+}
+
diff -r f6df07e2e378 -r 4d1b0b12bc0a sys/dev/wscons/wskbdvar.h
--- a/sys/dev/wscons/wskbdvar.h Tue Aug 28 15:54:40 2012 +0000
+++ b/sys/dev/wscons/wskbdvar.h Wed Aug 29 02:38:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbdvar.h,v 1.17 2010/10/26 05:12:34 jruoho Exp $ */
+/* $NetBSD: wskbdvar.h,v 1.18 2012/08/29 02:38:31 macallan Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -103,6 +103,13 @@
 void    wskbd_hotkey_deregister(device_t);
 
 /*
+ * set a translation table for scancodes in event mode
+ * parameters are a pointer to the table and its length
+ * pass length zero to turn translation off
+ */
+void   wskbd_set_evtrans(device_t, keysym_t *, int);
+
+/*
  * Console interface.
  */
 int    wskbd_cngetc(dev_t);



Home | Main Index | Thread Index | Old Index