This repository was archived by the owner on Jun 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +75
-5
lines changed
Expand file tree Collapse file tree 2 files changed +75
-5
lines changed Original file line number Diff line number Diff line change 11#include "ueficore.h"
22#include <libpayload.h>
3- #include <stdio.h>
3+ #include <curses.h>
4+
5+ #define KEY_ESC 27
6+ #define KEY_TAB '\t'
7+ #define ASCII_CHAR (x ) ((x) & 0xFF)
48
59EFI_STATUS
610EFIAPI
@@ -83,12 +87,74 @@ EfiSimpleTextInputReadKeyStroke (
8387 EFI_INPUT_KEY * Key
8488 )
8589{
86- CHAR16 Char ;
90+ CHAR16 c ;
91+
92+ c = getchar ();
93+
94+ if (c == KEY_TAB ) {
95+ Key -> ScanCode = 0x00 ;
96+ Key -> UnicodeChar = '\t' ;
97+ return EFI_SUCCESS ;
98+ }
99+
100+ if (c == KEY_ESC ) {
101+ Key -> ScanCode = 0x17 ;
102+ Key -> UnicodeChar = 0x00 ;
103+ return EFI_SUCCESS ;
104+ }
105+
106+ if (c == KEY_ENTER ) {
107+ Key -> ScanCode = 0x00 ;
108+ Key -> UnicodeChar = '\n' ;
109+ return EFI_SUCCESS ;
110+ }
87111
88- Char = (CHAR16 )getchar ();
112+ if (c == KEY_BACKSPACE ) {
113+ Key -> ScanCode = 0x00 ;
114+ Key -> UnicodeChar = 0x08 ;
115+ return EFI_SUCCESS ;
116+ }
117+
118+ if (c == KEY_DC ) {
119+ Key -> ScanCode = 0x08 ;
120+ Key -> UnicodeChar = 0x00 ;
121+ return EFI_SUCCESS ;
122+ }
123+
124+ if (c >= KEY_F (1 ) && c <= KEY_F (10 )) {
125+ Key -> ScanCode = (CHAR16 )(0x0b + c - KEY_F (1 ));
126+ Key -> UnicodeChar = 0x00 ;
127+ return EFI_SUCCESS ;
128+ }
129+
130+ Key -> UnicodeChar = 0x00 ;
131+ switch (c ) {
132+ case KEY_UP :
133+ Key -> ScanCode = 0x09 ;
134+ break ;
135+ case KEY_DOWN :
136+ Key -> ScanCode = 0x0a ;
137+ break ;
138+ case KEY_DC :
139+ Key -> ScanCode = 0x08 ;
140+ break ;
141+ case KEY_HOME :
142+ Key -> ScanCode = 0x05 ;
143+ break ;
144+ case KEY_END :
145+ Key -> ScanCode = 0x06 ;
146+ break ;
147+ default :
148+ Key -> ScanCode = 0x00 ;
149+ Key -> UnicodeChar = c ;
150+ break ;
151+ }
89152
90- Key -> ScanCode = 0x00 ;
91- Key -> UnicodeChar = Char ;
153+ if (c == ERR ) {
154+ Key -> ScanCode = 0x00 ;
155+ Key -> UnicodeChar = 0x00 ;
156+ return EFI_SUCCESS ;
157+ }
92158
93159 return EFI_SUCCESS ;
94160}
Original file line number Diff line number Diff line change @@ -197,6 +197,10 @@ Return Value:
197197 }
198198
199199 //EfipPcatEnumerateVideo();
200+
201+ keyboard_init ();
202+ keyboard_set_layout ("us" );
203+
200204 return EFI_SUCCESS ;
201205}
202206
You can’t perform that action at this time.
0 commit comments