aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/win.c19
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/win.h10
2 files changed, 29 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/tbi/win.c b/Library/UefiShellUfmCommandLib/tbi/win.c
index 55171da..6ef09a2 100644
--- a/Library/UefiShellUfmCommandLib/tbi/win.c
+++ b/Library/UefiShellUfmCommandLib/tbi/win.c
@@ -5,6 +5,7 @@
#include <Library/PrintLib.h> // UnicodeVSPrint()
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
#include "screen.h"
#include "win.h"
@@ -122,6 +123,24 @@ VOID echo(struct window *w, BOOLEAN state)
w->echo = state;
}
+EFI_INPUT_KEY wgetch(struct window *w)
+{
+ UINTN key_event = 0;
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL *stdin;
+ EFI_INPUT_KEY key = { 0 };
+
+ ASSERT(w != NULL);
+
+ stdin = w->scr->stdin;
+ gBS->WaitForEvent(1, &stdin->WaitForKey, &key_event);
+ stdin->ReadKeyStroke(stdin, &key);
+
+ if(echo) {
+ ; // print char
+ }
+ return key;
+}
+
BOOLEAN wmove(struct window *w, INT32 x, INT32 y)
{
ASSERT(w != NULL);
diff --git a/Library/UefiShellUfmCommandLib/tbi/win.h b/Library/UefiShellUfmCommandLib/tbi/win.h
index 02822d4..0dfe41b 100644
--- a/Library/UefiShellUfmCommandLib/tbi/win.h
+++ b/Library/UefiShellUfmCommandLib/tbi/win.h
@@ -87,6 +87,16 @@ VOID wattroff(struct window *w);
VOID echo(struct window *w, BOOLEAN state);
/*
+ * Gets character from the input device.
+ *
+ * w: the window on which to operate
+ *
+ * return: A pointer to a buffer that is filled in with the keystroke
+ * information for the key that was pressed.
+*/
+EFI_INPUT_KEY wgetch(struct window *w);
+
+/*
* Moves cursor position to specified coordinates
*
* w: the window on which to operate