NetBSD-Bugs archive

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

Re: port-i386/44563: boot loader prompt doesn't read keyboard input on a MacBook1,1



   Date: Sun, 13 Feb 2011 22:32:49 +0000 (UTC)
   From: Taylor R Campbell <campbell+netbsd%mumble.net@localhost>

   I tried adapting getchar in pcio.c to wait POLL_FREQ intervals
   in a loop until iskey(0) returns true before calling consgetc,
   but that didn't help.

I must have botched that, because I just tried it again and now it
works.  Here are two patches, both of which I have confirmed to work.
The first is simpler but makes some redundant BIOS calls in awaitkey;
the second avoids them, and is more general but perhaps needlessly so.

Index: pcio.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/pcio.c,v
retrieving revision 1.23.8.2
diff -p -u -r1.23.8.2 pcio.c
--- pcio.c      28 Nov 2009 15:40:47 -0000      1.23.8.2
+++ pcio.c      14 Feb 2011 22:16:53 -0000
@@ -265,6 +265,8 @@ getchar(void)
        default: /* to make gcc -Wall happy... */
        case CONSDEV_PC:
 #endif
+               while (!coniskey())
+                       wait(POLL_FREQ);
                c = congetc();
 #ifdef CONSOLE_KEYMAP
                {


Index: pcio.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/pcio.c,v
retrieving revision 1.23.8.2
diff -p -u -r1.23.8.2 pcio.c
--- pcio.c      28 Nov 2009 15:40:47 -0000      1.23.8.2
+++ pcio.c      14 Feb 2011 22:16:12 -0000
@@ -256,8 +256,8 @@ putchar(int c)
        internal_putchar(c);
 }
 
-int
-getchar(void)
+static int
+internal_getchar(void)
 {
        int c;
 #ifdef SUPPORT_SERIAL
@@ -321,6 +321,14 @@ iskey(int intr)
 #endif /* SUPPORT_SERIAL */
 }
 
+int
+getchar(void)
+{
+       while (!iskey(0))
+               wait(POLL_FREQ);
+       return internal_getchar();
+}
+
 char
 awaitkey(int timeout, int tell)
 {
@@ -348,7 +356,7 @@ awaitkey(int timeout, int tell)
                if (iskey(1)) {
                        /* flush input buffer */
                        while (iskey(0))
-                               c = getchar();
+                               c = internal_getchar();
                        if (c == 0)
                                c = -1;
                        goto out;


Home | Main Index | Thread Index | Old Index