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

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