diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-01-11 15:53:59 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-01-11 15:53:59 +0000 |
commit | e0da449a4c028352b876410600579b9836e82522 (patch) | |
tree | d6de0657015fbfe385d67c3cc7eb87494bf6269e /sys/arch | |
parent | 891ebaa99d35c349cc9a96ece0b9f25654289ab4 (diff) |
Factor a bit more sunkbd common parts; paves the way for upcoming
WSDISPLAY_COMPAT_RAWKBD support.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/dev/z8530kbd.c | 19 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/comkbd_ebus.c | 12 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/z8530kbd.c | 19 |
3 files changed, 31 insertions, 19 deletions
diff --git a/sys/arch/sparc/dev/z8530kbd.c b/sys/arch/sparc/dev/z8530kbd.c index 0f275b93c75..07f768ceeca 100644 --- a/sys/arch/sparc/dev/z8530kbd.c +++ b/sys/arch/sparc/dev/z8530kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530kbd.c,v 1.10 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: z8530kbd.c,v 1.11 2009/01/11 15:53:56 miod Exp $ */ /* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -427,7 +427,7 @@ zskbd_attach(parent, self, aux) if (console) wskbd_cnattach(&zskbd_consops, zst, a.keymap); - ss->sc_wskbddev = config_found(self, &a, wskbddevprint); + sunkbd_attach(ss, &a); } int @@ -937,10 +937,11 @@ zskbd_rxsoft(zst) struct sunkbd_softc *ss = (void *)zst; struct zs_chanstate *cs = zst->zst_cs; u_char *get, *end; - u_int cc, scc, type; + u_int cc, scc; u_char rr1; - int code, value; + int code; int s; + u_int8_t cbuf[64], *c; end = zst->zst_ebuf; get = zst->zst_rbget; @@ -952,6 +953,7 @@ zskbd_rxsoft(zst) timeout_add_sec(&zst->zst_diag_ch, 60); } + c = cbuf; while (cc) { code = get[0]; rr1 = get[1]; @@ -967,14 +969,19 @@ zskbd_rxsoft(zst) SET(code, TTY_PE); } - sunkbd_decode(code, &type, &value); - wskbd_input(ss->sc_wskbddev, type, value); + *c++ = code; + if (c - cbuf == sizeof cbuf) { + sunkbd_input(ss, cbuf, c - cbuf); + c = cbuf; + } get += 2; if (get >= end) get = zst->zst_rbuf; cc--; } + if (c != cbuf) + sunkbd_input(ss, cbuf, c - cbuf); if (cc != scc) { zst->zst_rbget = get; diff --git a/sys/arch/sparc64/dev/comkbd_ebus.c b/sys/arch/sparc64/dev/comkbd_ebus.c index bde4a3d4295..67177de29ed 100644 --- a/sys/arch/sparc64/dev/comkbd_ebus.c +++ b/sys/arch/sparc64/dev/comkbd_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: comkbd_ebus.c,v 1.18 2005/11/11 16:44:51 miod Exp $ */ +/* $OpenBSD: comkbd_ebus.c,v 1.19 2009/01/11 15:53:58 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -255,7 +255,7 @@ comkbd_attach(parent, self, aux) COM_WRITE(sc, com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS); } - ss->sc_wskbddev = config_found(self, &a, wskbddevprint); + sunkbd_attach(ss, &a); } void @@ -354,17 +354,15 @@ comkbd_soft(vsc) { struct comkbd_softc *sc = vsc; struct sunkbd_softc *ss = (void *)sc; - u_int type; - int value; + u_int8_t cbuf[COMK_RX_RING], *cptr = cbuf; u_int8_t c; while (sc->sc_rxcnt) { - c = *sc->sc_rxget; + *cptr++ = *sc->sc_rxget; if (++sc->sc_rxget == sc->sc_rxend) sc->sc_rxget = sc->sc_rxbeg; sc->sc_rxcnt--; - sunkbd_decode(c, &type, &value); - wskbd_input(ss->sc_wskbddev, type, value); + sunkbd_input(ss, cbuf, cptr - cbuf); } if (sc->sc_txcnt) { diff --git a/sys/arch/sparc64/dev/z8530kbd.c b/sys/arch/sparc64/dev/z8530kbd.c index 5610131842a..cfb6f74f30c 100644 --- a/sys/arch/sparc64/dev/z8530kbd.c +++ b/sys/arch/sparc64/dev/z8530kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530kbd.c,v 1.20 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: z8530kbd.c,v 1.21 2009/01/11 15:53:58 miod Exp $ */ /* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -413,7 +413,7 @@ zskbd_attach(parent, self, aux) if (console) wskbd_cnattach(&zskbd_consops, zst, a.keymap); - ss->sc_wskbddev = config_found(self, &a, wskbddevprint); + sunkbd_attach(ss, &a); } int @@ -920,10 +920,11 @@ zskbd_rxsoft(zst) struct sunkbd_softc *ss = (void *)zst; struct zs_chanstate *cs = zst->zst_cs; u_char *get, *end; - u_int cc, scc, type; + u_int cc, scc; u_char rr1; - int code, value; + int code; int s; + u_int8_t cbuf[64], *c; end = zst->zst_ebuf; get = zst->zst_rbget; @@ -935,6 +936,7 @@ zskbd_rxsoft(zst) timeout_add_sec(&zst->zst_diag_ch, 60); } + c = cbuf; while (cc) { code = get[0]; rr1 = get[1]; @@ -950,14 +952,19 @@ zskbd_rxsoft(zst) SET(code, TTY_PE); } - sunkbd_decode(code, &type, &value); - wskbd_input(ss->sc_wskbddev, type, value); + *c++ = code; + if (c - cbuf == sizeof cbuf) { + sunkbd_input(ss, cbuf, c - cbuf); + c = cbuf; + } get += 2; if (get >= end) get = zst->zst_rbuf; cc--; } + if (c != cbuf) + sunkbd_input(ss, cbuf, c - cbuf); if (cc != scc) { zst->zst_rbget = get; |