nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0185-Make-grub_getkeystatus-helper-funtion-available-ever.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Hans de Goede <hdegoede@redhat.com>
8631a2
Date: Wed, 6 Jun 2018 16:47:11 +0200
8631a2
Subject: [PATCH] Make grub_getkeystatus helper funtion available everywhere
8631a2
8631a2
Move the grub_getkeystatus helper function from
8631a2
grub-core/commands/keystatus.c to grub-core/kern/term.c
8631a2
and export it so that it can be used outside of the
8631a2
keystatus command code too.
8631a2
8631a2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
8631a2
---
8631a2
 grub-core/commands/keystatus.c | 18 ------------------
8631a2
 grub-core/kern/term.c          | 18 ++++++++++++++++++
8631a2
 include/grub/term.h            |  1 +
8631a2
 3 files changed, 19 insertions(+), 18 deletions(-)
8631a2
8631a2
diff --git a/grub-core/commands/keystatus.c b/grub-core/commands/keystatus.c
b32e65
index 460cf4e7e..ff3f58781 100644
8631a2
--- a/grub-core/commands/keystatus.c
8631a2
+++ b/grub-core/commands/keystatus.c
8631a2
@@ -35,24 +35,6 @@ static const struct grub_arg_option options[] =
8631a2
     {0, 0, 0, 0, 0, 0}
8631a2
   };
8631a2
 
8631a2
-static int
8631a2
-grub_getkeystatus (void)
8631a2
-{
8631a2
-  int status = 0;
8631a2
-  grub_term_input_t term;
8631a2
-
8631a2
-  if (grub_term_poll_usb)
8631a2
-    grub_term_poll_usb (0);
8631a2
-
8631a2
-  FOR_ACTIVE_TERM_INPUTS(term)
8631a2
-  {
8631a2
-    if (term->getkeystatus)
8631a2
-      status |= term->getkeystatus (term);
8631a2
-  }
8631a2
-
8631a2
-  return status;
8631a2
-}
8631a2
-
8631a2
 static grub_err_t
8631a2
 grub_cmd_keystatus (grub_extcmd_context_t ctxt,
8631a2
 		    int argc __attribute__ ((unused)),
8631a2
diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c
b32e65
index 07720ee67..93bd3378d 100644
8631a2
--- a/grub-core/kern/term.c
8631a2
+++ b/grub-core/kern/term.c
8631a2
@@ -120,6 +120,24 @@ grub_getkey (void)
8631a2
     }
8631a2
 }
8631a2
 
8631a2
+int
8631a2
+grub_getkeystatus (void)
8631a2
+{
8631a2
+  int status = 0;
8631a2
+  grub_term_input_t term;
8631a2
+
8631a2
+  if (grub_term_poll_usb)
8631a2
+    grub_term_poll_usb (0);
8631a2
+
8631a2
+  FOR_ACTIVE_TERM_INPUTS(term)
8631a2
+  {
8631a2
+    if (term->getkeystatus)
8631a2
+      status |= term->getkeystatus (term);
8631a2
+  }
8631a2
+
8631a2
+  return status;
8631a2
+}
8631a2
+
8631a2
 void
8631a2
 grub_refresh (void)
8631a2
 {
8631a2
diff --git a/include/grub/term.h b/include/grub/term.h
b32e65
index 8117e2a24..c21513338 100644
8631a2
--- a/include/grub/term.h
8631a2
+++ b/include/grub/term.h
8631a2
@@ -327,6 +327,7 @@ grub_term_unregister_output (grub_term_output_t term)
8631a2
 void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
8631a2
 int EXPORT_FUNC(grub_getkey) (void);
8631a2
 int EXPORT_FUNC(grub_getkey_noblock) (void);
8631a2
+int EXPORT_FUNC(grub_getkeystatus) (void);
8631a2
 void grub_cls (void);
8631a2
 void EXPORT_FUNC(grub_refresh) (void);
8631a2
 void grub_puts_terminal (const char *str, struct grub_term_output *term);