]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Use EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL if available
authorMichael Brown <mcb30@ipxe.org>
Tue, 26 Jan 2021 20:46:57 +0000 (20:46 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 27 Jan 2021 12:45:53 +0000 (12:45 +0000)
commita08244ecc4caad567d2607f84cd303e8a3c0ae98
tree481554ed373a0c9ed7dd7da7afe4ff89cf5fc20b
parent8488c989cc109efc8eead4a089d773848d092d02
[efi] Use EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL if available

The original EFI_SIMPLE_TEXT_INPUT_PROTOCOL is not technically
required to handle the use of the Ctrl key, and the long-obsolete EFI
1.10 specification lists only backspace, tab, linefeed, and carriage
return as required.  Some particularly brain-dead vendor UEFI firmware
implementations dutifully put in the extra effort of ensuring that all
other control characters (such as Ctrl-C) are impossible to type via
EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

Current versions of the UEFI specification mandate that the console
input handle must support both EFI_SIMPLE_TEXT_INPUT_PROTOCOL and
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL, the latter of which at least
provides access to modifier key state.

Unlike EFI_SIMPLE_TEXT_INPUT_PROTOCOL, the pointer to the
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance does not appear within the
EFI system table and must therefore be opened explicitly.  The UEFI
specification provides no safe way to do so, since we cannot open the
handle BY_DRIVER or BY_CHILD_CONTROLLER and so nothing guarantees that
this pointer will remain valid for the lifetime of iPXE.  We must
simply hope that no UEFI firmware implementation ever discovers a
motivation for reinstalling the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
instance.

Use EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL if available, falling back to
the existing EFI_SIMPLE_TEXT_PROTOCOL otherwise.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_console.c