summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-08-12 21:31:07 +0000
committerjoerg <joerg@FreeBSD.org>1996-08-12 21:31:07 +0000
commitdcde70f16b3def70b46002b990f4080b63850b7c (patch)
treeb18f0e7ff333c94c5c3bc3bf09bca8bc8f51532e /sys
parent084c9a9ee62a92c88d40e132afda3e098c2fa304 (diff)
downloadFreeBSD-src-dcde70f16b3def70b46002b990f4080b63850b7c.zip
FreeBSD-src-dcde70f16b3def70b46002b990f4080b63850b7c.tar.gz
Fix two minor oddities introduced by my yesterday's patches:
. preserve a multi-char sequence in a small static buffer inside pccngetc(), so it won't be clobbered later (used to happen when breaking into DDB user Ctrl-Alt-ESC), and . simplify the ``keystroke is present'' determination in sgetc(), thus making pccncheck() actually working without waiting for a keystroke.
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c16
-rw-r--r--sys/i386/isa/pcvt/pcvt_kbd.c8
2 files changed, 15 insertions, 9 deletions
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index 977d86e..debb60f 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -1207,7 +1207,8 @@ int
pccngetc(Dev_t dev)
{
register int s;
- static u_char *cp;
+ static u_char *cp, cbuf[4]; /* Temp buf for multi-char key sequence. */
+ register u_char c;
#ifdef XSERVER
@@ -1233,14 +1234,21 @@ pccngetc(Dev_t dev)
cp = sgetc(0);
kbd_polling = 0;
splx(s);
+ c = *cp++;
+ if (c && *cp) {
+ /* Preserve the multi-char sequence for the next call. */
+ bcopy(cp, cbuf, 3); /* take care for a trailing '\0' */
+ cp = cbuf;
+ } else
+ cp = 0;
#if ! (PCVT_FREEBSD >= 201)
/* this belongs to cons.c */
- if (*cp == '\r')
- *cp = '\n';
+ if (c == '\r')
+ c = '\n';
#endif /* ! (PCVT_FREEBSD >= 201) */
- return (*cp++);
+ return c;
}
#if PCVT_FREEBSD >= 200
diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c
index e39b04e..14f83d7 100644
--- a/sys/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/i386/isa/pcvt/pcvt_kbd.c
@@ -935,10 +935,9 @@ loop:
/* see if there is data from the keyboard available either from */
/* the keyboard fifo or from the 8042 keyboard controller */
- if ((noblock && pcvt_kbd_count) ||
- ((!noblock || kbd_polling) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
+ if (pcvt_kbd_count || (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))
{
- if (!noblock || kbd_polling) /* source = 8042 */
+ if (!pcvt_kbd_count) /* source = 8042 */
{
PCVT_KBD_DELAY(); /* 7 us delay */
dt = inb(CONTROLLER_DATA); /* get from obuf */
@@ -1245,8 +1244,7 @@ no_mouse_event:
/* see if there is data from the keyboard available either from */
/* the keyboard fifo or from the 8042 keyboard controller */
- if ((noblock && pcvt_kbd_count) ||
- ((!noblock || kbd_polling) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
+ if (pcvt_kbd_count || (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))
{
if (!noblock || kbd_polling) /* source = 8042 */
{
OpenPOWER on IntegriCloud