this will allow you to create a box style entry
via C API by specifying the type as
struct menu_entry me = {
.display "test",
.type = MENU_ENTRY_BOX,
.box_state = 1,
.action = action_to_run,
}
and via shell
menu -e -a -m <menu> -c <command> [-R] [-b 0|1] -d <description>
menu -e -a -m <menu> -u submenu -d [-b 0|1] <description>
-b with 0 for not selected and 1 for selected
and -c for the command to run when changing state
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
this will allow to automaticaly run an entry if the user do no choice
this is usefull for boot menu as example
with menu -s -m boot -A 3 -d "Auto Boot in"
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Clients now only have to call menu_add_submenu or menu_add_command_entry
instead of allocating many strings.
This also fixes some problems in the menu code. The priv field in struct
menu_entry was a pointer to struct menu or a pointer to an allocated string.
It was never freed, only had to be freed when it was an allocated string.
The reference to a submenu is now kept as a string and not to the menu
itself. The code checked the existence of the submenu when creating it, but
crashed when the submenu was removed and referenced afterwards. Now the
code hapily allows references to nonexistant menus but complains during
runtime when the menu is not there.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Introduce a menu framework that allow us to create list menu to simplify
barebox and make it more user-frendly
This kind of menu is very usefull when you do not have a keyboard or a
serial console attached to your board to allow you to interract with
barebox
For the develloper part,
The framework introduce two API
1) C
that allow you to create menu, submenu, entry and complex menu action
2) Command
that allow you as the C API to create menu, submenu, entry and complex
menu action but this time the actions will be store in a function and
then be evaluated and excecuted at runtime.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>