Source-Changes-HG archive

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

[src/trunk]: src/sys Remove auto-repeat key functions in WSKBD_RAW mode.



details:   https://anonhg.NetBSD.org/src/rev/2806715fdc83
branches:  trunk
changeset: 822804:2806715fdc83
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Apr 08 17:04:56 2017 +0000

description:
Remove auto-repeat key functions in WSKBD_RAW mode.

Pulled from OpenBSD:
 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/hp300/dev/Attic/dnkbd.c#rev1.18
 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/hil/hilkbd.c#rev1.15
> WSKBD_RAW mode used in X, but X independently implements auto-repeat keys.

Tested with Xorg server on HP425t with topcat.

diffstat:

 sys/arch/hp300/dev/dnkbd.c |  46 +++-------------------------------------------
 sys/dev/hil/hilkbd.c       |  46 +++-------------------------------------------
 2 files changed, 6 insertions(+), 86 deletions(-)

diffs (216 lines):

diff -r 6c5e9bf2c3e8 -r 2806715fdc83 sys/arch/hp300/dev/dnkbd.c
--- a/sys/arch/hp300/dev/dnkbd.c        Sat Apr 08 13:50:23 2017 +0000
+++ b/sys/arch/hp300/dev/dnkbd.c        Sat Apr 08 17:04:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dnkbd.c,v 1.9 2017/03/25 22:08:27 tsutsui Exp $        */
+/*     $NetBSD: dnkbd.c,v 1.10 2017/04/08 17:04:56 tsutsui Exp $       */
 /*     $OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $     */
 
 /*
@@ -188,11 +188,6 @@
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
        int             sc_rawkbd;
-       int             sc_nrep;
-       char            sc_rep[2];      /* at most, one key */
-       struct callout  sc_rawrepeat_ch;
-#define        REP_DELAY1      400
-#define        REP_DELAYN      100
 #endif
 };
 
@@ -259,9 +254,6 @@
 static int     dnkbd_pollin(struct dnkbd_softc *, u_int);
 static int     dnkbd_pollout(struct dnkbd_softc *, int);
 static int     dnkbd_probe(struct dnkbd_softc *);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-static void    dnkbd_rawrepeat(void *);
-#endif
 static int     dnkbd_send(struct dnkbd_softc *, const uint8_t *, size_t);
 static void    dnkbd_break(struct dnkbd_softc *, int);
 
@@ -300,10 +292,6 @@
 
        callout_init(&sc->sc_bellstop_tmo, 0);
        callout_setfunc(&sc->sc_bellstop_tmo, dnkbd_bellstop, sc);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-       callout_init(&sc->sc_rawrepeat_ch, 0);
-       callout_setfunc(&sc->sc_rawrepeat_ch, dnkbd_rawrepeat, sc);
-#endif
 
        /* reset the port */
        dnkbd_init(sc, 1200, LCR_8BITS | LCR_PEVEN | LCR_PENAB);
@@ -706,9 +694,9 @@
 #ifdef WSDISPLAY_COMPAT_RAWKBD
        if (sc->sc_rawkbd) {
                u_char cbuf[2];
-               int c, j, npress;
+               int c, j;
 
-               npress = j = 0;
+               j = 0;
                c = dnkbd_raw[key];
                if (c != 0) {
                        /* fake extended scancode if necessary */
@@ -717,12 +705,6 @@
                        cbuf[j] = c & 0x7f;
                        if (type == WSCONS_EVENT_KEY_UP)
                                cbuf[j] |= 0x80;
-                       else {
-                               /* remember pressed key for autorepeat */
-                               if (c & 0x80)
-                                       sc->sc_rep[npress++] = 0xe0;
-                               sc->sc_rep[npress++] = c & 0x7f;
-                       }
                        j++;
                }
 
@@ -730,12 +712,6 @@
                        s = spltty();
                        wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
                        splx(s);
-                       callout_stop(&sc->sc_rawrepeat_ch);
-                       sc->sc_nrep = npress;
-                       if (npress != 0) {
-                               callout_schedule(&sc->sc_rawrepeat_ch,
-                                   mstohz(REP_DELAY1));
-                       }
                }
        } else
 #endif
@@ -746,21 +722,6 @@
        }
 }
 
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-void
-dnkbd_rawrepeat(void *v)
-{
-       struct dnkbd_softc *sc = v;
-       int s;
-
-       s = spltty();
-       wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
-       splx(s);
-
-       callout_schedule(&sc->sc_rawrepeat_ch, mstohz(REP_DELAYN));
-}
-#endif
-
 #if NWSMOUSE > 0
 void
 dnevent_mouse(struct dnkbd_softc *sc, uint8_t *dat)
@@ -1040,7 +1001,6 @@
 #ifdef WSDISPLAY_COMPAT_RAWKBD
        case WSKBDIO_SETMODE:
                sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
-               callout_stop(&sc->sc_rawrepeat_ch);
                return 0;
 #endif
        }
diff -r 6c5e9bf2c3e8 -r 2806715fdc83 sys/dev/hil/hilkbd.c
--- a/sys/dev/hil/hilkbd.c      Sat Apr 08 13:50:23 2017 +0000
+++ b/sys/dev/hil/hilkbd.c      Sat Apr 08 17:04:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hilkbd.c,v 1.3 2011/02/21 12:33:05 he Exp $    */
+/*     $NetBSD: hilkbd.c,v 1.4 2017/04/08 17:04:56 tsutsui Exp $       */
 /*     $OpenBSD: hilkbd.c,v 1.14 2009/01/21 21:53:59 grange Exp $      */
 /*
  * Copyright (c) 2003, Miodrag Vallat.
@@ -64,11 +64,6 @@
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
        int             sc_rawkbd;
-       int             sc_nrep;
-       char            sc_rep[HILBUFSIZE * 2];
-       struct callout  sc_rawrepeat_ch;
-#define        REP_DELAY1      400
-#define        REP_DELAYN      100
 #endif
 };
 
@@ -122,9 +117,6 @@
 static void    hilkbd_decode(struct hilkbd_softc *, uint8_t, u_int *, int *,
                    int);
 static int     hilkbd_is_console(int);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-static void    hilkbd_rawrepeat(void *);
-#endif
 
 static int     seen_hilkbd_console;
 
@@ -195,11 +187,6 @@
         */
        ps2 = (sc->sc_numleds != 0);
 
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-       callout_init(&sc->sc_rawrepeat_ch, 0);
-       callout_setfunc(&sc->sc_rawrepeat_ch, hilkbd_rawrepeat, sc);
-#endif
-
        /* Do not consider button boxes as console devices. */
        if (ha->ha_type == HIL_DEVICE_BUTTONBOX)
                a.console = 0;
@@ -316,7 +303,6 @@
 #ifdef WSDISPLAY_COMPAT_RAWKBD
        case WSKBDIO_SETMODE:
                sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
-               callout_stop(&sc->sc_rawrepeat_ch);
                return 0;
 #endif
        case WSKBDIO_COMPLEXBELL:
@@ -409,9 +395,9 @@
 #ifdef WSDISPLAY_COMPAT_RAWKBD
        if (sc->sc_rawkbd) {
                uint8_t cbuf[HILBUFSIZE * 2];
-               int c, j, npress;
+               int c, j;
 
-               npress = j = 0;
+               j = 0;
                for (i = 1, buf++; i < buflen; i++) {
                        hilkbd_decode(sc, *buf++, &type, &key, kbdtype);
                        c = hilkbd_raw[key];
@@ -423,24 +409,12 @@
                        cbuf[j] = c & 0x7f;
                        if (type == WSCONS_EVENT_KEY_UP)
                                cbuf[j] |= 0x80;
-                       else {
-                               /* remember pressed keys for autorepeat */
-                               if (c & 0x80)
-                                       sc->sc_rep[npress++] = 0xe0;
-                               sc->sc_rep[npress++] = c & 0x7f;
-                       }
                        j++;
                }
 
                s = spltty();
                wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
                splx(s);
-               callout_stop(&sc->sc_rawrepeat_ch);
-               sc->sc_nrep = npress;
-               if (npress != 0) {
-                       callout_schedule(&sc->sc_rawrepeat_ch,
-                           mstohz(REP_DELAY1));
-               }
        } else
 #endif
        {
@@ -485,17 +459,3 @@
        seen_hilkbd_console = 1;
        return 1;
 }
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-void
-hilkbd_rawrepeat(void *v)
-{
-       struct hilkbd_softc *sc = v;
-       int s;
-
-       s = spltty();
-       wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
-       splx(s);
-       callout_schedule(&sc->sc_rawrepeat_ch, mstohz(REP_DELAYN));
-}
-#endif



Home | Main Index | Thread Index | Old Index