diff options
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_drv.c | 16 | ||||
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_kbd.c | 8 |
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 */ { |