kern/term: Make grub_getkeystatus helper funtion available everywhere
PATCH 6/10 kern/term: Make grub_getkeystatus helper funtion available everywhere
From: Hans de Goede <[email protected]>
Move the grub_getkeystatus helper function from grub-core/commands/keystatus.c to grub-core/kern/term.c and export it so that it can be used outside of the keystatus command code too.
---
grub-core/commands/keystatus.c | 18 ------------------ grub-core/kern/term.c | 18 ++++++++++++++++++ include/grub/term.h | 1 + 3 files changed, 19 insertions(+), 18 deletions(-)
grub-core/commands/keystatus.c +0 -18
@@ -35,24 +35,6 @@ static const struct grub_arg_option options[] = {0, 0, 0, 0, 0, 0} }; -static int -grub_getkeystatus (void ) -{ -int status =0 ; -grub_term_input_t term; - -if (grub_term_poll_usb) -grub_term_poll_usb (0 ); - -FOR_ACTIVE_TERM_INPUTS (term) - { -if (term->getkeystatus) - status |= term->getkeystatus (term); - } - -return status; -} - static grub_err_t grub_cmd_keystatus (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
grub-core/kern/term.c +18 -0
@@ -120,6 +120,24 @@ grub_getkey (void) } } +int +grub_getkeystatus (void ) +{ +int status =0 ; +grub_term_input_t term; + +if (grub_term_poll_usb) +grub_term_poll_usb (0 ); + +FOR_ACTIVE_TERM_INPUTS (term) + { +if (term->getkeystatus) + status |= term->getkeystatus (term); + } + +return status; +} +void grub_refresh (void ) {
include/grub/term.h +1 -0
@@ -329,6 +329,7 @@ grub_term_unregister_output (grub_term_output_t term)void grub_putcode (grub_uint32_t code,struct grub_term_output *term);int EXPORT_FUNC (grub_getkey ) (void );int EXPORT_FUNC (grub_getkey_noblock ) (void ); +int EXPORT_FUNC (grub_getkeystatus ) (void );void grub_cls (void );void EXPORT_FUNC (grub_refresh ) (void );void grub_puts_terminal (const char *str,struct grub_term_output *term);
Signature · 1 line
2.24.1
Quoted 9 lines · Javier Martinez Canillas
From: Hans de Goede <[email protected]>
Move the
grub_getkeystatushelper function fromgrub-core/commands/keystatus.ctogrub-core/kern/term.cand export it so that it can be used outside of the keystatus command code too.Signed-off-by Hans de Goede <[email protected]>Signed-off-by Javier Martinez Canillas <[email protected]>
Again, why? And it would be nice if you mention in the patches like this that the logic is unchanged.
Additionally, please put all code shuffling patches at the beginning of the patchset.
If you do that you can add my RB.
Daniel