[PATCH 1/5] menu: remove CTRL+C to quit

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Feb 10 12:44:20 CET 2023


On 2/2/23 10:24, Masahisa Kojima wrote:
> On the sandbox called without "--terminal raw" CTRL+C leaves U-Boot,
> "ESC/CTRL+C to quit" is misleading.
>
> Let's remove CTRL+C to quit key handling from bootmenu and eficonfig menu.

I guess my review was misleading.

CTRL+C on the sandbox leaves the u-boot program. Therefore advising its
use in the GUI is not a good idea. Reacting on the CTRL+C on other
systems does no harm.

I will just take the text changes and leave the code as is.

Best regards

Heinrich

>
> Signed-off-by: Masahisa Kojima <masahisa.kojima at linaro.org>
> ---
>   cmd/bootmenu.c               | 2 +-
>   cmd/eficonfig.c              | 6 +++---
>   common/menu.c                | 1 -
>   doc/usage/cmd/bootmenu.rst   | 2 +-
>   lib/efi_loader/efi_console.c | 2 +-
>   5 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> index 3236ca5d79..8dc133c236 100644
> --- a/cmd/bootmenu.c
> +++ b/cmd/bootmenu.c
> @@ -437,7 +437,7 @@ static void menu_display_statusline(struct menu *m)
>   	printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
>   	puts(ANSI_CLEAR_LINE);
>   	printf(ANSI_CURSOR_POSITION, menu->count + 6, 3);
> -	puts("Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit");
> +	puts("Press UP/DOWN to move, ENTER to select, ESC to quit");
>   	puts(ANSI_CLEAR_LINE_TO_END);
>   	printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
>   	puts(ANSI_CLEAR_LINE);
> diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> index 47c04cf536..f365a988d4 100644
> --- a/cmd/eficonfig.c
> +++ b/cmd/eficonfig.c
> @@ -23,12 +23,12 @@
>
>   static struct efi_simple_text_input_protocol *cin;
>   const char *eficonfig_menu_desc =
> -	"  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit";
> +	"  Press UP/DOWN to move, ENTER to select, ESC to quit";
>
>   static const char *eficonfig_change_boot_order_desc =
>   	"  Press UP/DOWN to move, +/- to change orde\n"
>   	"  Press SPACE to activate or deactivate the entry\n"
> -	"  Select [Save] to complete, ESC/CTRL+C to quit";
> +	"  Select [Save] to complete, ESC to quit";
>
>   static struct efi_simple_text_output_protocol *cout;
>   static int avail_row;
> @@ -927,7 +927,7 @@ static efi_status_t handle_user_input(u16 *buf, int buf_size,
>   	       ANSI_CURSOR_POSITION
>   	       "%s"
>   	       ANSI_CURSOR_POSITION
> -	       "  Press ENTER to complete, ESC/CTRL+C to quit",
> +	       "  Press ENTER to complete, ESC to quit",
>   	       0, 1, msg, 8, 1);
>
>   	/* tmp is used to accept user cancel */
> diff --git a/common/menu.c b/common/menu.c
> index cdcdbb2a18..56401695de 100644
> --- a/common/menu.c
> +++ b/common/menu.c
> @@ -492,7 +492,6 @@ enum bootmenu_key bootmenu_conv_key(int ichar)
>   		/* enter key was pressed */
>   		key = BKEY_SELECT;
>   		break;
> -	case CTL_CH('c'):
>   	case '\e':
>   		/* ^C was pressed */
>   		key = BKEY_QUIT;
> diff --git a/doc/usage/cmd/bootmenu.rst b/doc/usage/cmd/bootmenu.rst
> index cb3c8d2f93..684a18d8e1 100644
> --- a/doc/usage/cmd/bootmenu.rst
> +++ b/doc/usage/cmd/bootmenu.rst
> @@ -122,7 +122,7 @@ Example bootmenu is as below::
>   Default behavior when user exits from the bootmenu
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   User can exit from bootmenu by selecting the last entry
> -"U-Boot console"/"Quit" or ESC/CTRL+C key.
> +"U-Boot console"/"Quit" or ESC key.
>
>   When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is disabled,
>   user exits from the bootmenu and returns to the U-Boot console.
> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
> index 1ed8c7aa36..2c7536107a 100644
> --- a/lib/efi_loader/efi_console.c
> +++ b/lib/efi_loader/efi_console.c
> @@ -1395,7 +1395,7 @@ efi_status_t efi_console_get_u16_string(struct efi_simple_text_input_protocol *c
>   		} else if (key.unicode_char == u'\r') {
>   			buf[len] = u'\0';
>   			return EFI_SUCCESS;
> -		} else if (key.unicode_char == 0x3 || key.scan_code == 23) {
> +		} else if (key.scan_code == 23) {
>   			return EFI_ABORTED;
>   		} else if (key.unicode_char < 0x20) {
>   			/* ignore control codes other than Ctrl+C, '\r' and '\b' */


More information about the U-Boot mailing list