From 0e526b608e92adabcc72c59e7bdcdc35ce1cd4ae Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sun, 11 Jan 2009 16:12:16 +0000 Subject: Define a limit to the input which can be fed to sunkbd_input() at once, will be necessary for rawkbd mode. --- sys/arch/sparc/dev/z8530kbd.c | 4 ++-- sys/arch/sparc64/dev/comkbd_ebus.c | 12 +++++++++--- sys/arch/sparc64/dev/z8530kbd.c | 4 ++-- sys/dev/sun/sunkbdvar.h | 4 +++- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/arch/sparc/dev/z8530kbd.c b/sys/arch/sparc/dev/z8530kbd.c index 07f768ceeca..1738294377c 100644 --- a/sys/arch/sparc/dev/z8530kbd.c +++ b/sys/arch/sparc/dev/z8530kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530kbd.c,v 1.11 2009/01/11 15:53:56 miod Exp $ */ +/* $OpenBSD: z8530kbd.c,v 1.12 2009/01/11 16:12:14 miod Exp $ */ /* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -941,7 +941,7 @@ zskbd_rxsoft(zst) u_char rr1; int code; int s; - u_int8_t cbuf[64], *c; + u_int8_t cbuf[SUNKBD_MAX_INPUT_SIZE], *c; end = zst->zst_ebuf; get = zst->zst_rbget; diff --git a/sys/arch/sparc64/dev/comkbd_ebus.c b/sys/arch/sparc64/dev/comkbd_ebus.c index 67177de29ed..1ee82f962bd 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.19 2009/01/11 15:53:58 miod Exp $ */ +/* $OpenBSD: comkbd_ebus.c,v 1.20 2009/01/11 16:12:15 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -354,16 +354,22 @@ comkbd_soft(vsc) { struct comkbd_softc *sc = vsc; struct sunkbd_softc *ss = (void *)sc; - u_int8_t cbuf[COMK_RX_RING], *cptr = cbuf; + u_int8_t cbuf[SUNKBD_MAX_INPUT_SIZE], *cptr; u_int8_t c; + cptr = cbuf; while (sc->sc_rxcnt) { *cptr++ = *sc->sc_rxget; if (++sc->sc_rxget == sc->sc_rxend) sc->sc_rxget = sc->sc_rxbeg; sc->sc_rxcnt--; - sunkbd_input(ss, cbuf, cptr - cbuf); + if (cptr - cbuf == sizeof cbuf) { + sunkbd_input(ss, cbuf, cptr - cbuf); + cptr = cbuf; + } } + if (cptr != cbuf) + sunkbd_input(ss, cbuf, cptr - cbuf); if (sc->sc_txcnt) { c = sc->sc_ier | IER_ETXRDY; diff --git a/sys/arch/sparc64/dev/z8530kbd.c b/sys/arch/sparc64/dev/z8530kbd.c index cfb6f74f30c..9509e79797e 100644 --- a/sys/arch/sparc64/dev/z8530kbd.c +++ b/sys/arch/sparc64/dev/z8530kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530kbd.c,v 1.21 2009/01/11 15:53:58 miod Exp $ */ +/* $OpenBSD: z8530kbd.c,v 1.22 2009/01/11 16:12:15 miod Exp $ */ /* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -924,7 +924,7 @@ zskbd_rxsoft(zst) u_char rr1; int code; int s; - u_int8_t cbuf[64], *c; + u_int8_t cbuf[SUNKBD_MAX_INPUT_SIZE], *c; end = zst->zst_ebuf; get = zst->zst_rbget; diff --git a/sys/dev/sun/sunkbdvar.h b/sys/dev/sun/sunkbdvar.h index 912d276ac40..db0f1efdb3f 100644 --- a/sys/dev/sun/sunkbdvar.h +++ b/sys/dev/sun/sunkbdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sunkbdvar.h,v 1.11 2009/01/11 15:53:58 miod Exp $ */ +/* $OpenBSD: sunkbdvar.h,v 1.12 2009/01/11 16:12:15 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -31,6 +31,8 @@ * */ +#define SUNKBD_MAX_INPUT_SIZE 64 + struct sunkbd_softc { struct device sc_dev; -- cgit v1.2.3