Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/stand/libsa Fix a bug in check_getchar() (call...



details:   https://anonhg.NetBSD.org/src/rev/9be5de7f59fe
branches:  trunk
changeset: 782001:9be5de7f59fe
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Oct 12 18:01:53 2012 +0000

description:
Fix a bug in check_getchar() (called from awaitkey_1sec()).
It didn't clear input key data when non ASCII keys (CTRL, OPT.1 etc)
were pressed so it couldn't detect further key inputs and
"any other key for boot menu" interrupt during boot didn't work
in that case.

The problem was tracked by Y.Sugahara,
and tested on X68030 and XM6i by me.

diffstat:

 sys/arch/x68k/stand/libsa/consio.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r e21f1c70cb9e -r 9be5de7f59fe sys/arch/x68k/stand/libsa/consio.c
--- a/sys/arch/x68k/stand/libsa/consio.c        Fri Oct 12 17:18:02 2012 +0000
+++ b/sys/arch/x68k/stand/libsa/consio.c        Fri Oct 12 18:01:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: consio.c,v 1.9 2011/07/17 20:54:49 joerg Exp $ */
+/*     $NetBSD: consio.c,v 1.10 2012/10/12 18:01:53 tsutsui Exp $      */
 
 /*
  * Copyright (c) 2001 MINOURA Makoto.
@@ -103,10 +103,21 @@
 int
 check_getchar(void)
 {
+       int keycode;
 
        switch (x68k_console_device) {
        case ITE:
-               return IOCS_B_KEYSNS() & 0xff;
+               while ((keycode = IOCS_B_KEYSNS()) != 0) {
+                       keycode &= 0xff;
+                       if (keycode != 0) {
+                               /* valid ASCII code */
+                               return keycode;
+                       }
+                       /* discard non ASCII keys (CTRL, OPT.1 etc) */
+                       (void)IOCS_B_KEYINP();
+               } 
+               /* no input */
+               return 0;
        case SERIAL:
                return IOCS_ISNS232C() & 0xff;
        }



Home | Main Index | Thread Index | Old Index