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 <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 3ca6fe5..6af0839 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -449,23 +449,24 @@
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