summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 19:59:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:06 +0100
commitf1f47dbf94a8657aad37091eb72d33991d116a95 (patch)
tree0609a639efae60f8d1899f3ae92abb39208c2056
parent4c402a058e38e0a23571678bd90b713b114aedfd (diff)
downloadbarebox-f1f47dbf94a8.tar.gz
barebox-f1f47dbf94a8.tar.xz
efi-stdio: wait for extended input key event when using extended input
Extended input protocol support was added to deal with EFI firmwares that don't report control characters rendering utilities like barebox edit unusable. The extended input support comes with its own event for use with the wait_for_event boot service, which we should use instead of the non-extended variant in case we are going to read the key with the extended protocol. Fixes: 438f80e98658 ("serial: efi-stdio: Add simple_text_input_ex_protocol backend") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-74-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/serial/efi-stdio.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index d31de5f537..235d67a303 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -79,17 +79,23 @@ static int xlate_keypress(struct efi_input_key *k)
return k->unicode_char & 0xff;
}
-static int efi_read_key(struct efi_console_priv *priv, bool wait)
+static void efi_wait_single_event(void *event)
{
unsigned long index;
- efi_status_t efiret;
- struct efi_key_data kd;
/* wait until key is pressed */
- if (wait)
- BS->wait_for_event(1, &priv->in->wait_for_key, &index);
+ BS->wait_for_event(1, &event, &index);
+}
+
+static int efi_read_key(struct efi_console_priv *priv, bool wait)
+{
+ efi_status_t efiret;
+ struct efi_key_data kd;
if (priv->inex) {
+ if (wait)
+ efi_wait_single_event(priv->inex->wait_for_key_ex);
+
efiret = priv->inex->read_key_stroke_ex(priv->inex, &kd);
if (efiret == EFI_NOT_READY)
@@ -118,6 +124,9 @@ static int efi_read_key(struct efi_console_priv *priv, bool wait)
}
}
+ if (wait)
+ efi_wait_single_event(priv->in->wait_for_key);
+
efiret = priv->in->read_key_stroke(priv->in, &kd.key);
if (EFI_ERROR(efiret))