Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 3d8cc46

Browse files
libefiwrapper/conin: implement a simple ReadKeyStroke()
This patch implements the SIMPLE_INPUT_INTERFACE ReadKeyStroke() function using the POSIX getchar() function. Change-Id: I9cf513d7baf5ff7e36ca94f60ea84da528687730 Signed-off-by: Jeremy Compostella <[email protected]>
1 parent 9c574c5 commit 3d8cc46

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/libefiwrapper/external.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ int strncmp(const char *s1, const char *s2, size_t n);
7777
/* stdio.h */
7878
int printf(const char *format, ...);
7979
int snprintf(char *str, size_t size, const char *fmt, ...);
80+
int getchar(void);
8081

8182
/* libpayload.h */
8283
void ndelay(unsigned int n);

libefiwrapper/conin.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Intel Corporation
2+
* Copyright (c) 2016-2020, Intel Corporation
33
* All rights reserved.
44
*
55
* Author: Jérémy Compostella <[email protected]>
@@ -41,9 +41,10 @@ conin_reset(__attribute__((__unused__)) struct _SIMPLE_INPUT_INTERFACE *This,
4141

4242
static EFIAPI EFI_STATUS
4343
conin_read_key(__attribute__((__unused__)) struct _SIMPLE_INPUT_INTERFACE *This,
44-
__attribute__((__unused__)) EFI_INPUT_KEY *Key)
44+
EFI_INPUT_KEY *Key)
4545
{
46-
return EFI_NOT_FOUND;
46+
Key->UnicodeChar = getchar();
47+
return EFI_SUCCESS;
4748
}
4849

4950
static EFI_GUID guid = SIMPLE_TEXT_OUTPUT_PROTOCOL;

0 commit comments

Comments
 (0)