[PATCH v2 073/113] efi-stdio: wait for extended input key event when using extended input

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Extended input protocol support was added to deal with EFI firmwares that
don't report control characters rendering utilities like barebox edit

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@xxxxxxxxxxxxxx>
 drivers/serial/efi-stdio.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index d31de5f53796..235d67a303ed 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;
+	/* wait until key is pressed */
+	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;
-	/* wait until key is pressed */
-	if (wait)
-		BS->wait_for_event(1, &priv->in->wait_for_key, &index);
 	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))

[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux