[haiku] [PATCH 2/2] Factorize the keyboard driver wait_for_key() in console_wait_for_key()

  • From: Louis Feuvrier <manny@xxxxxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Fri, 21 Mar 2014 15:59:35 +0100

From: Louis Feuvrier <louis@xxxxxxxxxxxx>

After a quick look at the code, I found that the code in console_wait_for_key()
that waits for a key from the keyboard is actually the one we can find in the
keyboard driver wait_for_key() function. This change thus seems appropriate to
me.
---
 src/system/boot/platform/efi/console.cpp | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/system/boot/platform/efi/console.cpp 
b/src/system/boot/platform/efi/console.cpp
index 04437b5..1923ecd 100644
--- a/src/system/boot/platform/efi/console.cpp
+++ b/src/system/boot/platform/efi/console.cpp
@@ -6,6 +6,7 @@
 
 #include "console.h"
 #include "efi_platform.h"
+#include "keyboard.h""
 
 #include <SupportDefs.h>
 #include <util/kernel_cpp.h>
@@ -137,14 +138,7 @@ console_set_color(int32 foreground, int32 background)
 int
 console_wait_for_key(void)
 {
-       UINTN index;
-       EFI_INPUT_KEY key;
-       EFI_EVENT event = kSystemTable->ConIn->WaitForKey;
-
-       do {
-               kSystemTable->BootServices->WaitForEvent(1, &event, &index);
-       } while (kSystemTable->ConIn->ReadKeyStroke(kSystemTable->ConIn, &key)
-                       == EFI_NOT_READY);
+       EFI_INPUT_KEY key = wait_for_key();
 
        if (key.UnicodeChar > 0)
                return (int) key.UnicodeChar;
-- 
1.9.0


Other related posts:

  • » [haiku] [PATCH 2/2] Factorize the keyboard driver wait_for_key() in console_wait_for_key() - Louis Feuvrier