mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-27 04:39:15 +00:00
Allow Shift to interrupt 'sleep --interruptible'.
This commit is contained in:
parent
089fcef395
commit
642b736aa1
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -10,6 +10,7 @@ grub2 (2.00-16) UNRELEASED; urgency=low
|
||||
Sitter).
|
||||
- Make any EFI system boot into the shim (if installed) even if
|
||||
SecureBoot is disabled (Stéphane Graber).
|
||||
- Allow Shift to interrupt 'sleep --interruptible'.
|
||||
|
||||
-- Colin Watson <cjwatson@debian.org> Sun, 11 Aug 2013 12:12:54 +0100
|
||||
|
||||
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -49,3 +49,4 @@ acpihalt_improvements.patch
|
||||
script_check_no_commands.patch
|
||||
texinfo_ordering.patch
|
||||
mkconfig_emacs_autosave.patch
|
||||
sleep_shift.patch
|
||||
|
53
debian/patches/sleep_shift.patch
vendored
Normal file
53
debian/patches/sleep_shift.patch
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
Description: Allow Shift to interrupt 'sleep --interruptible'
|
||||
Upstream would like to consider this at more length. See
|
||||
http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00718.html, and the
|
||||
rest of the thread for context.
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00694.html
|
||||
Last-Update: 2012-09-06
|
||||
|
||||
Index: b/grub-core/commands/sleep.c
|
||||
===================================================================
|
||||
--- a/grub-core/commands/sleep.c
|
||||
+++ b/grub-core/commands/sleep.c
|
||||
@@ -46,6 +46,31 @@
|
||||
grub_refresh ();
|
||||
}
|
||||
|
||||
+static int
|
||||
+grub_check_keyboard (void)
|
||||
+{
|
||||
+ int mods = 0;
|
||||
+ grub_term_input_t term;
|
||||
+
|
||||
+ if (grub_term_poll_usb)
|
||||
+ grub_term_poll_usb ();
|
||||
+
|
||||
+ FOR_ACTIVE_TERM_INPUTS(term)
|
||||
+ {
|
||||
+ if (term->getkeystatus)
|
||||
+ mods |= term->getkeystatus (term);
|
||||
+ }
|
||||
+
|
||||
+ if (mods >= 0 &&
|
||||
+ (mods & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) != 0)
|
||||
+ return 1;
|
||||
+
|
||||
+ if (grub_getkey_noblock () == GRUB_TERM_ESC)
|
||||
+ return 1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* Based on grub_millisleep() from kern/generic/millisleep.c. */
|
||||
static int
|
||||
grub_interruptible_millisleep (grub_uint32_t ms)
|
||||
@@ -55,7 +80,7 @@
|
||||
start = grub_get_time_ms ();
|
||||
|
||||
while (grub_get_time_ms () - start < ms)
|
||||
- if (grub_getkey_noblock () == GRUB_TERM_ESC)
|
||||
+ if (grub_check_keyboard ())
|
||||
return 1;
|
||||
|
||||
return 0;
|
@ -46,6 +46,31 @@ do_print (int n)
|
||||
grub_refresh ();
|
||||
}
|
||||
|
||||
static int
|
||||
grub_check_keyboard (void)
|
||||
{
|
||||
int mods = 0;
|
||||
grub_term_input_t term;
|
||||
|
||||
if (grub_term_poll_usb)
|
||||
grub_term_poll_usb ();
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
{
|
||||
if (term->getkeystatus)
|
||||
mods |= term->getkeystatus (term);
|
||||
}
|
||||
|
||||
if (mods >= 0 &&
|
||||
(mods & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) != 0)
|
||||
return 1;
|
||||
|
||||
if (grub_getkey_noblock () == GRUB_TERM_ESC)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Based on grub_millisleep() from kern/generic/millisleep.c. */
|
||||
static int
|
||||
grub_interruptible_millisleep (grub_uint32_t ms)
|
||||
@ -55,7 +80,7 @@ grub_interruptible_millisleep (grub_uint32_t ms)
|
||||
start = grub_get_time_ms ();
|
||||
|
||||
while (grub_get_time_ms () - start < ms)
|
||||
if (grub_getkey_noblock () == GRUB_TERM_ESC)
|
||||
if (grub_check_keyboard ())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user