diff mbox series

[2/5] eficonfig: CTRL+S to save the boot order

Message ID 20230202092447.28590-3-masahisa.kojima@linaro.org
State Accepted
Commit 88df36346c767f8756e54cc1941b6cda180b61db
Headers show
Series improve eficonfig usability | expand

Commit Message

Masahisa Kojima Feb. 2, 2023, 9:24 a.m. UTC
The change boot order menu in eficonfig can have at most INT_MAX lines
and it is troublesome to scroll down to the "Save" entry.

This commit assigns CTRL+S to save the boot order.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
---
 cmd/eficonfig.c | 6 +++++-
 common/menu.c   | 3 +++
 include/menu.h  | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
index f365a988d4..0a17b8cf34 100644
--- a/cmd/eficonfig.c
+++ b/cmd/eficonfig.c
@@ -28,7 +28,7 @@  const char *eficonfig_menu_desc =
 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 to quit";
+	"  CTRL+S to save, ESC to quit";
 
 static struct efi_simple_text_output_protocol *cout;
 static int avail_row;
@@ -1983,6 +1983,10 @@  char *eficonfig_choice_change_boot_order(void *data)
 				eficonfig_menu_down(efi_menu);
 
 			return NULL;
+		case BKEY_SAVE:
+			/* force to select "Save" entry */
+			efi_menu->active = efi_menu->count - 2;
+			fallthrough;
 		case BKEY_SELECT:
 			/* "Save" */
 			if (efi_menu->active == efi_menu->count - 2) {
diff --git a/common/menu.c b/common/menu.c
index 56401695de..da08f17747 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -502,6 +502,9 @@  enum bootmenu_key bootmenu_conv_key(int ichar)
 	case CTL_CH('n'):
 		key = BKEY_DOWN;
 		break;
+	case CTL_CH('s'):
+		key = BKEY_SAVE;
+		break;
 	case '+':
 		key = BKEY_PLUS;
 		break;
diff --git a/include/menu.h b/include/menu.h
index 1e88141d6b..64ce89b7d2 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -53,6 +53,7 @@  enum bootmenu_key {
 	BKEY_PLUS,
 	BKEY_MINUS,
 	BKEY_SPACE,
+	BKEY_SAVE,
 
 	BKEY_COUNT,
 };