[PATCH 16/24] menu: Factor out menu-keypress decoding

Simon Glass sjg at chromium.org
Wed Oct 19 15:18:09 CEST 2022


Hi Heinrich,

On Mon, 17 Oct 2022 at 16:23, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > Move this code into a separate function so that it can be used in the new
> > VBE menu.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >   common/menu.c  | 48 ++++++++++++++++++++++++++++++------------------
> >   include/menu.h | 10 ++++++++++
> >   2 files changed, 40 insertions(+), 18 deletions(-)
> >
> > diff --git a/common/menu.c b/common/menu.c
> > index c2e3ec592e3..4606cb7d1b1 100644
> > --- a/common/menu.c
> > +++ b/common/menu.c
> > @@ -483,26 +483,11 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu,
> >       return key;
> >   }
> >
> > -enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
> > -                             struct cli_ch_state *cch)
> > +enum bootmenu_key bootmenu_conv_key(int ichar)
> >   {
>
> Please, extract a common library function from
> efi_cin_read_key_stroke_ex(). We should avoid code duplication.

No, that is EFI code. It also seems to use unicode somehow. We should
have EFI code using normal U-Boot functions, not duplicating
functionality elsewhere.

As you can see, my approach here is to refactor the common code to do
what is needed. Please update the EFI code to do the same.

Re unicode, we need to be very careful...what is the use case for
unicode keyboard input?

Regards,
SImon


More information about the U-Boot mailing list