@@ -483,11 +483,26 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu,
return key;
}
-enum bootmenu_key bootmenu_conv_key(int ichar)
+enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
+ struct cli_ch_state *cch)
{
- enum bootmenu_key key;
+ enum bootmenu_key key = BKEY_NONE;
+ int c;
+
+ c = cli_ch_process(cch, 0);
+ if (!c) {
+ while (!c && !tstc()) {
+ schedule();
+ mdelay(10);
+ c = cli_ch_process(cch, -ETIMEDOUT);
+ }
+ if (!c) {
+ c = getchar();
+ c = cli_ch_process(cch, c);
+ }
+ }
- switch (ichar) {
+ switch (c) {
case '\n':
/* enter key was pressed */
key = BKEY_SELECT;
@@ -515,34 +530,7 @@ enum bootmenu_key bootmenu_conv_key(int ichar)
case ' ':
key = BKEY_SPACE;
break;
- default:
- key = BKEY_NONE;
- break;
- }
-
- return key;
-}
-
-enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
- struct cli_ch_state *cch)
-{
- enum bootmenu_key key;
- int c;
-
- c = cli_ch_process(cch, 0);
- if (!c) {
- while (!c && !tstc()) {
- schedule();
- mdelay(10);
- c = cli_ch_process(cch, -ETIMEDOUT);
- }
- if (!c) {
- c = getchar();
- c = cli_ch_process(cch, c);
- }
}
- key = bootmenu_conv_key(c);
-
return key;
}
@@ -54,8 +54,6 @@ enum bootmenu_key {
BKEY_MINUS,
BKEY_SPACE,
BKEY_SAVE,
-
- BKEY_COUNT,
};
/**
@@ -104,12 +102,4 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu,
enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
struct cli_ch_state *cch);
-/**
- * bootmenu_conv_key() - Convert a U-Boot keypress into a menu key
- *
- * @ichar: Keypress to convert (ASCII, including control characters)
- * Returns: Menu key that corresponds to @ichar, or BKEY_NONE if none
- */
-enum bootmenu_key bootmenu_conv_key(int ichar);
-
#endif /* __MENU_H__ */
This reverts commit 9e7ac0b0be5cb663e539716554d66f8f0890ca83. Signed-off-by: Pali Rohár <pali@kernel.org> --- common/menu.c | 48 ++++++++++++++++++------------------------------ include/menu.h | 10 ---------- 2 files changed, 18 insertions(+), 40 deletions(-)