menu: add support to check if menu needs to be reprinted

This patch adds a new callback named need_reprint for menu.
The need_reprint will be called before printing the menu. If the
callback exists and returns FALSE, menu printing will be canceled.

This is very useful if the menu was not changed. It can save time
for serial-based menu to handle more input data.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Weijie Gao
2024-10-29 17:47:16 +08:00
committed by Tom Rini
parent ddac69885e
commit ccdd7948e2
5 changed files with 15 additions and 3 deletions

View File

@@ -1474,7 +1474,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
* Create a menu and add items for all the labels.
*/
m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
cfg->prompt, NULL, label_print, NULL, NULL);
cfg->prompt, NULL, label_print, NULL, NULL, NULL);
if (!m)
return NULL;