pvgrub: ignore NUL

When using pvgrub in graphical mode with vnc, the grub timeout doesn't
work: the countdown doesn't even start. With a serial terminal the
problem doesn't occur and the countdown works as expected.

It turns out that the problem is that when using a graphical terminal,
checkkey () returns 0 instead of -1 when there is no activity on the
mouse or keyboard. As a consequence grub thinks that the user typed
something and interrupts the count down.

To fix the issue simply ignore keystrokes returning 0, that is the NUL
character anyway. Add a patch to grub.patches to do that.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Steven Haigh <netwiz@crc.id.au>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Stefano Stabellini authored and Ian Campbell committed 2014-11-10 12:03:36 +00:00
1 parent fda1614e1e
commit e6fa63d6cf
1 file changed
+13
@@ -0,0 +1,13 @@
diff --git a/stage2/stage2.c b/stage2/stage2.c
index 9d9fcc3..8353a3b 100644
--- a/stage2/stage2.c
+++ b/stage2/stage2.c
@@ -395,7 +395,7 @@ restart:
pressed.
This avoids polling (relevant in the grub-shell and later on
in grub if interrupt driven I/O is done). */
- if (checkkey () >= 0 || grub_timeout < 0)
+ if (checkkey () > 0 || grub_timeout < 0)
{
/* Key was pressed, show which entry is selected before GETKEY,
since we're comming in here also on GRUB_TIMEOUT == -1 and
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.