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