From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 13 Aug 2014 23:04:01 +0200
Subject: [PATCH] * grub-core/term/at_keyboard.c: Retry probing keyboard
if scancode setup failed.
---
grub-core/term/at_keyboard.c | 11 +++++------
ChangeLog | 5 +++++
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
index b4257e84a04..c234e92f246 100644
--- a/grub-core/term/at_keyboard.c
+++ b/grub-core/term/at_keyboard.c
@@ -226,7 +226,7 @@ static const struct
{0x7d, GRUB_KEYBOARD_KEY_PPAGE},
};
-static int alive = 0, ping_sent;
+static int ping_sent;
static void
keyboard_controller_wait_until_ready (void)
@@ -373,7 +373,7 @@ set_scancodes (void)
grub_dprintf ("atkeyb", "returned set %d\n", current_set);
if (current_set == 1)
return;
- grub_printf ("No supported scancode set found\n");
+ grub_dprintf ("atkeyb", "no supported scancode set found\n");
#endif
}
@@ -543,7 +543,7 @@ grub_keyboard_getkey (void)
int
grub_at_keyboard_is_alive (void)
{
- if (alive)
+ if (current_set != 0)
return 1;
if (ping_sent
&& KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))
@@ -611,7 +611,6 @@ static void
grub_keyboard_controller_init (void)
{
at_keyboard_status = 0;
- alive = 1;
/* Drain input buffer. */
while (1)
{
@@ -639,7 +638,7 @@ grub_keyboard_controller_init (void)
static grub_err_t
grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused)))
{
- if (!alive)
+ if (current_set == 0)
return GRUB_ERR_NONE;
if (grub_keyboard_orig_set)
write_mode (grub_keyboard_orig_set);
@@ -656,7 +655,7 @@ grub_at_fini_hw (int noreturn __attribute__ ((unused)))
static grub_err_t
grub_at_restore_hw (void)
{
- if (!alive)
+ if (current_set == 0)
return GRUB_ERR_NONE;
/* Drain input buffer. */
diff --git a/ChangeLog b/ChangeLog
index d3f26cf2f0d..f3afd5cad8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
* grub-core/kern/emu/hostfs.c: use _DEFAULT_SOURCE in addition to
_BSD_SOURCE to avoid warnings under glibc 2.20+.
+2014-08-13 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/term/at_keyboard.c: Retry probing keyboard if
+ scancode setup failed.
+
2014-06-21 Роман Пехов <roman_pekhov>
* grub-core/commands/loadenv.c (check_blocklists): Fix overlap check.