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 <sjg@chromium.org>
diff --git a/cmd/bootflow.c b/cmd/bootflow.c
index d4f7d33..f266223 100644
--- a/cmd/bootflow.c
+++ b/cmd/bootflow.c
@@ -110,7 +110,7 @@
ret = bootflow_menu_run(std, text_mode, &bflow);
if (ret) {
- if (ret == -EAGAIN) {
+ if (ret == -EPIPE) {
printf("Nothing chosen\n");
std->cur_bootflow = NULL;
} else {