diff options
| author | Simon Glass <[email protected]> | 2025-05-02 08:46:16 -0600 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-30 09:49:31 +0100 |
| commit | bf9860459516d1837e92270340ca307211cd961a (patch) | |
| tree | 07a30de0e77474896d5a0f942fda3150ef14b44a /include | |
| parent | 5c365ecabcac6d3218cf7e560bda01629a46d88e (diff) | |
expo: Add a function to poll for input
Both bootflow_menu and cedit use similar logic to poll an expo. Move
this into the expo library so the code can be shared.
Update bootflow_menu_run() to return -EPIPE when the user quits without
choosing anything, since -EAGAIN is ambiguous and elsewhere means that
there is no input yet.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/bootflow.h | 2 | ||||
| -rw-r--r-- | include/expo.h | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/include/bootflow.h b/include/bootflow.h index d408b8c85bd..fe090d39ffb 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -508,7 +508,7 @@ int bootflow_menu_apply_theme(struct expo *exp, ofnode node); * @std: Bootstd information * @text_mode: Uses a text-based menu suitable for a serial port * @bflowp: Returns chosen bootflow (set to NULL if nothing is chosen) - * @return 0 if an option was chosen, -EAGAIN if nothing was chosen, -ve on + * @return 0 if an option was chosen, -EPIPE if nothing was chosen, -ve on * error */ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, diff --git a/include/expo.h b/include/expo.h index b3b9c0b8872..63452bbdd6a 100644 --- a/include/expo.h +++ b/include/expo.h @@ -772,4 +772,17 @@ int expo_build(ofnode root, struct expo **expp); */ int cb_expo_build(struct expo **expp); +/** + * expo_poll() - render an expo and see if the user takes an action + * + * Thsi calls expo_render() and then checks for a keypress. If there is one, it + * is processed and the resulting action returned, if any + * + * @exp: Expo to poll + * @act: Returns action on success + * Return: 0 if an action was obtained, -EAGAIN if not, other error if something + * went wrong + */ +int expo_poll(struct expo *exp, struct expo_action *act); + #endif /*__EXPO_H */ |
