2009-09-24 Robert Millan <rmh.grub@aybabtu.com>

* include/grub/i386/at_keyboard.h (KEYBOARD_ISREADY): Negate
        return value.
        * term/i386/pc/at_keyboard.c (grub_keyboard_getkey): Negate
        KEYBOARD_ISREADY check.
        (grub_at_keyboard_checkkey): Rename to ...
        (grub_at_keyboard_getkey_noblock): ... this.  Update all users.
        Remove gratuitous cast.
This commit is contained in:
robertmh 2009-09-24 13:15:51 +00:00
parent ff42022396
commit 74c958b180
3 changed files with 18 additions and 7 deletions

View file

@ -1,3 +1,13 @@
2009-09-24 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/at_keyboard.h (KEYBOARD_ISREADY): Negate
return value.
* term/i386/pc/at_keyboard.c (grub_keyboard_getkey): Negate
KEYBOARD_ISREADY check.
(grub_at_keyboard_checkkey): Rename to ...
(grub_at_keyboard_getkey_noblock): ... this. Update all users.
Remove gratuitous cast.
2009-09-23 Colin Watson <cjwatson@ubuntu.com> 2009-09-23 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Call AC_PROG_MKDIR_P. * configure.ac: Call AC_PROG_MKDIR_P.

View file

@ -39,7 +39,7 @@
#define KEYBOARD_SCANCODE_SET1 0x40 #define KEYBOARD_SCANCODE_SET1 0x40
#define KEYBOARD_ISMAKE(x) !((x) & 0x80) #define KEYBOARD_ISMAKE(x) !((x) & 0x80)
#define KEYBOARD_ISREADY(x) (((x) & 0x01) == 0) #define KEYBOARD_ISREADY(x) ((x) & 0x01)
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f) #define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
#ifdef GRUB_MACHINE_IEEE1275 #ifdef GRUB_MACHINE_IEEE1275

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008 Free Software Foundation, Inc. * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -135,7 +135,7 @@ static int
grub_keyboard_getkey (void) grub_keyboard_getkey (void)
{ {
grub_uint8_t key; grub_uint8_t key;
if (KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
return -1; return -1;
key = grub_inb (KEYBOARD_REG_DATA); key = grub_inb (KEYBOARD_REG_DATA);
/* FIXME */ grub_keyboard_isr (key); /* FIXME */ grub_keyboard_isr (key);
@ -146,7 +146,7 @@ grub_keyboard_getkey (void)
/* If there is a character pending, return it; otherwise return -1. */ /* If there is a character pending, return it; otherwise return -1. */
static int static int
grub_at_keyboard_checkkey (void) grub_at_keyboard_getkey_noblock (void)
{ {
int code, key; int code, key;
code = grub_keyboard_getkey (); code = grub_keyboard_getkey ();
@ -186,7 +186,7 @@ grub_at_keyboard_checkkey (void)
key += 'a' - 'A'; key += 'a' - 'A';
} }
} }
return (int) key; return key;
} }
static int static int
@ -195,7 +195,7 @@ grub_at_keyboard_getkey (void)
int key; int key;
do do
{ {
key = grub_at_keyboard_checkkey (); key = grub_at_keyboard_getkey_noblock ();
} while (key == -1); } while (key == -1);
return key; return key;
} }
@ -220,7 +220,8 @@ static struct grub_term_input grub_at_keyboard_term =
.name = "at_keyboard", .name = "at_keyboard",
.init = grub_keyboard_controller_init, .init = grub_keyboard_controller_init,
.fini = grub_keyboard_controller_fini, .fini = grub_keyboard_controller_fini,
.checkkey = grub_at_keyboard_checkkey, /* FIXME: This routine flushes input buffer, and it shouldn't. */
.checkkey = grub_at_keyboard_getkey_noblock,
.getkey = grub_at_keyboard_getkey, .getkey = grub_at_keyboard_getkey,
}; };