menu: Rename KEY_... to BKEY_...

This enum values conflict with linux/input.h so rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-01-06 08:52:22 -06:00 committed by Tom Rini
parent ee6c7eb46f
commit 2da4a15e7e
4 changed files with 51 additions and 51 deletions

View file

@ -86,7 +86,7 @@ static char *bootmenu_choice_entry(void *data)
{ {
struct bootmenu_data *menu = data; struct bootmenu_data *menu = data;
struct bootmenu_entry *iter; struct bootmenu_entry *iter;
enum bootmenu_key key = KEY_NONE; enum bootmenu_key key = BKEY_NONE;
int esc = 0; int esc = 0;
int i; int i;
@ -100,22 +100,22 @@ static char *bootmenu_choice_entry(void *data)
} }
switch (key) { switch (key) {
case KEY_UP: case BKEY_UP:
if (menu->active > 0) if (menu->active > 0)
--menu->active; --menu->active;
/* no menu key selected, regenerate menu */ /* no menu key selected, regenerate menu */
return NULL; return NULL;
case KEY_DOWN: case BKEY_DOWN:
if (menu->active < menu->count - 1) if (menu->active < menu->count - 1)
++menu->active; ++menu->active;
/* no menu key selected, regenerate menu */ /* no menu key selected, regenerate menu */
return NULL; return NULL;
case KEY_SELECT: case BKEY_SELECT:
iter = menu->first; iter = menu->first;
for (i = 0; i < menu->active; ++i) for (i = 0; i < menu->active; ++i)
iter = iter->next; iter = iter->next;
return iter->key; return iter->key;
case KEY_QUIT: case BKEY_QUIT:
/* Quit by choosing the last entry - U-Boot console */ /* Quit by choosing the last entry - U-Boot console */
iter = menu->first; iter = menu->first;
while (iter->next) while (iter->next)

View file

@ -187,31 +187,31 @@ static char *eficonfig_choice_entry(void *data)
int esc = 0; int esc = 0;
struct list_head *pos, *n; struct list_head *pos, *n;
struct eficonfig_entry *entry; struct eficonfig_entry *entry;
enum bootmenu_key key = KEY_NONE; enum bootmenu_key key = BKEY_NONE;
struct efimenu *efi_menu = data; struct efimenu *efi_menu = data;
while (1) { while (1) {
bootmenu_loop((struct bootmenu_data *)efi_menu, &key, &esc); bootmenu_loop((struct bootmenu_data *)efi_menu, &key, &esc);
switch (key) { switch (key) {
case KEY_UP: case BKEY_UP:
if (efi_menu->active > 0) if (efi_menu->active > 0)
--efi_menu->active; --efi_menu->active;
/* no menu key selected, regenerate menu */ /* no menu key selected, regenerate menu */
return NULL; return NULL;
case KEY_DOWN: case BKEY_DOWN:
if (efi_menu->active < efi_menu->count - 1) if (efi_menu->active < efi_menu->count - 1)
++efi_menu->active; ++efi_menu->active;
/* no menu key selected, regenerate menu */ /* no menu key selected, regenerate menu */
return NULL; return NULL;
case KEY_SELECT: case BKEY_SELECT:
list_for_each_safe(pos, n, &efi_menu->list) { list_for_each_safe(pos, n, &efi_menu->list) {
entry = list_entry(pos, struct eficonfig_entry, list); entry = list_entry(pos, struct eficonfig_entry, list);
if (entry->num == efi_menu->active) if (entry->num == efi_menu->active)
return entry->key; return entry->key;
} }
break; break;
case KEY_QUIT: case BKEY_QUIT:
/* Quit by choosing the last entry */ /* Quit by choosing the last entry */
entry = list_last_entry(&efi_menu->list, struct eficonfig_entry, list); entry = list_last_entry(&efi_menu->list, struct eficonfig_entry, list);
return entry->key; return entry->key;
@ -1864,14 +1864,14 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
{ {
int esc = 0; int esc = 0;
struct list_head *pos, *n; struct list_head *pos, *n;
enum bootmenu_key key = KEY_NONE; enum bootmenu_key key = BKEY_NONE;
struct eficonfig_entry *entry, *tmp; struct eficonfig_entry *entry, *tmp;
while (1) { while (1) {
bootmenu_loop(NULL, &key, &esc); bootmenu_loop(NULL, &key, &esc);
switch (key) { switch (key) {
case KEY_PLUS: case BKEY_PLUS:
if (efi_menu->active > 0) { if (efi_menu->active > 0) {
list_for_each_safe(pos, n, &efi_menu->list) { list_for_each_safe(pos, n, &efi_menu->list) {
entry = list_entry(pos, struct eficonfig_entry, list); entry = list_entry(pos, struct eficonfig_entry, list);
@ -1885,11 +1885,11 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
list_add(&tmp->list, &entry->list); list_add(&tmp->list, &entry->list);
} }
fallthrough; fallthrough;
case KEY_UP: case BKEY_UP:
if (efi_menu->active > 0) if (efi_menu->active > 0)
--efi_menu->active; --efi_menu->active;
return EFI_NOT_READY; return EFI_NOT_READY;
case KEY_MINUS: case BKEY_MINUS:
if (efi_menu->active < efi_menu->count - 3) { if (efi_menu->active < efi_menu->count - 3) {
list_for_each_safe(pos, n, &efi_menu->list) { list_for_each_safe(pos, n, &efi_menu->list) {
entry = list_entry(pos, struct eficonfig_entry, list); entry = list_entry(pos, struct eficonfig_entry, list);
@ -1905,11 +1905,11 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
++efi_menu->active; ++efi_menu->active;
} }
return EFI_NOT_READY; return EFI_NOT_READY;
case KEY_DOWN: case BKEY_DOWN:
if (efi_menu->active < efi_menu->count - 1) if (efi_menu->active < efi_menu->count - 1)
++efi_menu->active; ++efi_menu->active;
return EFI_NOT_READY; return EFI_NOT_READY;
case KEY_SELECT: case BKEY_SELECT:
/* "Save" */ /* "Save" */
if (efi_menu->active == efi_menu->count - 2) if (efi_menu->active == efi_menu->count - 2)
return EFI_SUCCESS; return EFI_SUCCESS;
@ -1919,7 +1919,7 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
return EFI_ABORTED; return EFI_ABORTED;
break; break;
case KEY_SPACE: case BKEY_SPACE:
if (efi_menu->active < efi_menu->count - 2) { if (efi_menu->active < efi_menu->count - 2) {
list_for_each_safe(pos, n, &efi_menu->list) { list_for_each_safe(pos, n, &efi_menu->list) {
entry = list_entry(pos, struct eficonfig_entry, list); entry = list_entry(pos, struct eficonfig_entry, list);
@ -1932,7 +1932,7 @@ static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu)
} }
} }
break; break;
case KEY_QUIT: case BKEY_QUIT:
return EFI_ABORTED; return EFI_ABORTED;
default: default:
/* Pressed key is not valid, no need to regenerate the menu */ /* Pressed key is not valid, no need to regenerate the menu */

View file

@ -446,16 +446,16 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
switch (c) { switch (c) {
case '\e': case '\e':
*esc = 1; *esc = 1;
*key = KEY_NONE; *key = BKEY_NONE;
break; break;
case '\r': case '\r':
*key = KEY_SELECT; *key = BKEY_SELECT;
break; break;
case 0x3: /* ^C */ case 0x3: /* ^C */
*key = KEY_QUIT; *key = BKEY_QUIT;
break; break;
default: default:
*key = KEY_NONE; *key = BKEY_NONE;
break; break;
} }
@ -471,7 +471,7 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
printf(ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, menu->count + 5, 1); printf(ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, menu->count + 5, 1);
if (menu->delay == 0) if (menu->delay == 0)
*key = KEY_SELECT; *key = BKEY_SELECT;
} }
void bootmenu_loop(struct bootmenu_data *menu, void bootmenu_loop(struct bootmenu_data *menu,
@ -503,17 +503,17 @@ void bootmenu_loop(struct bootmenu_data *menu,
/* First char of ANSI escape sequence '\e' */ /* First char of ANSI escape sequence '\e' */
if (c == '\e') { if (c == '\e') {
*esc = 1; *esc = 1;
*key = KEY_NONE; *key = BKEY_NONE;
} }
break; break;
case 1: case 1:
/* Second char of ANSI '[' */ /* Second char of ANSI '[' */
if (c == '[') { if (c == '[') {
*esc = 2; *esc = 2;
*key = KEY_NONE; *key = BKEY_NONE;
} else { } else {
/* Alone ESC key was pressed */ /* Alone ESC key was pressed */
*key = KEY_QUIT; *key = BKEY_QUIT;
*esc = (c == '\e') ? 1 : 0; *esc = (c == '\e') ? 1 : 0;
} }
break; break;
@ -522,7 +522,7 @@ void bootmenu_loop(struct bootmenu_data *menu,
/* Third char of ANSI (number '1') - optional */ /* Third char of ANSI (number '1') - optional */
if (*esc == 2 && c == '1') { if (*esc == 2 && c == '1') {
*esc = 3; *esc = 3;
*key = KEY_NONE; *key = BKEY_NONE;
break; break;
} }
@ -530,31 +530,31 @@ void bootmenu_loop(struct bootmenu_data *menu,
/* ANSI 'A' - key up was pressed */ /* ANSI 'A' - key up was pressed */
if (c == 'A') if (c == 'A')
*key = KEY_UP; *key = BKEY_UP;
/* ANSI 'B' - key down was pressed */ /* ANSI 'B' - key down was pressed */
else if (c == 'B') else if (c == 'B')
*key = KEY_DOWN; *key = BKEY_DOWN;
/* other key was pressed */ /* other key was pressed */
else else
*key = KEY_NONE; *key = BKEY_NONE;
break; break;
} }
/* enter key was pressed */ /* enter key was pressed */
if (c == '\r') if (c == '\r')
*key = KEY_SELECT; *key = BKEY_SELECT;
/* ^C was pressed */ /* ^C was pressed */
if (c == 0x3) if (c == 0x3)
*key = KEY_QUIT; *key = BKEY_QUIT;
if (c == '+') if (c == '+')
*key = KEY_PLUS; *key = BKEY_PLUS;
if (c == '-') if (c == '-')
*key = KEY_MINUS; *key = BKEY_MINUS;
if (c == ' ') if (c == ' ')
*key = KEY_SPACE; *key = BKEY_SPACE;
} }

View file

@ -44,14 +44,14 @@ struct bootmenu_data {
/** enum bootmenu_key - keys that can be returned by the bootmenu */ /** enum bootmenu_key - keys that can be returned by the bootmenu */
enum bootmenu_key { enum bootmenu_key {
KEY_NONE = 0, BKEY_NONE = 0,
KEY_UP, BKEY_UP,
KEY_DOWN, BKEY_DOWN,
KEY_SELECT, BKEY_SELECT,
KEY_QUIT, BKEY_QUIT,
KEY_PLUS, BKEY_PLUS,
KEY_MINUS, BKEY_MINUS,
KEY_SPACE, BKEY_SPACE,
}; };
/** /**
@ -85,14 +85,14 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
* *
* @menu: Menu being processed * @menu: Menu being processed
* @key: Returns the code for the key the user pressed: * @key: Returns the code for the key the user pressed:
* enter: KEY_SELECT * enter: BKEY_SELECT
* Ctrl-C: KEY_QUIT * Ctrl-C: BKEY_QUIT
* Up arrow: KEY_UP * Up arrow: BKEY_UP
* Down arrow: KEY_DOWN * Down arrow: BKEY_DOWN
* Escape (by itself): KEY_QUIT * Escape (by itself): BKEY_QUIT
* Plus: KEY_PLUS * Plus: BKEY_PLUS
* Minus: KEY_MINUS * Minus: BKEY_MINUS
* Space: KEY_SPACE * Space: BKEY_SPACE
* @esc: On input, a non-zero value indicates that an escape sequence has * @esc: On input, a non-zero value indicates that an escape sequence has
* resulted in that many characters so far. On exit this is updated to the * resulted in that many characters so far. On exit this is updated to the
* new number of characters * new number of characters