From 35cbb796aa85dadeb5451104c536a33acf1ebcfe Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 12 Sep 2018 00:05:32 +0200 Subject: efi_loader: support Unicode text input Up to now the EFI_TEXT_INPUT_PROTOCOL only supported ASCII characters. With the patch it can consume UTF-8 from the console. Currently only the serial console and the console can deliver UTF-8. Local consoles are restricted to ASCII. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- lib/efi_loader/efi_console.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/efi_loader') diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 3ca6fe536c..6af083984c 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -449,23 +449,24 @@ static efi_status_t EFIAPI efi_cin_read_key_stroke( struct efi_simple_text_input_protocol *this, struct efi_input_key *key) { + efi_status_t ret; struct efi_input_key pressed_key = { .scan_code = 0, .unicode_char = 0, }; - char ch; + s32 ch; EFI_ENTRY("%p, %p", this, key); /* We don't do interrupts, so check for timers cooperatively */ efi_timer_check(); - if (!tstc()) { - /* No key pressed */ + ret = console_read_unicode(&ch); + if (ret) return EFI_EXIT(EFI_NOT_READY); - } - - ch = getc(); + /* We do not support multi-word codes */ + if (ch >= 0x10000) + ch = '?'; if (ch == cESC) { /* * Xterm Control Sequences -- cgit