|
@@ -22,6 +22,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
22
|
22
|
#include <realmode.h>
|
23
|
23
|
#include <ipxe/console.h>
|
24
|
24
|
#include <ipxe/ansiesc.h>
|
|
25
|
+#include <ipxe/keymap.h>
|
25
|
26
|
|
26
|
27
|
#define ATTR_BOLD 0x08
|
27
|
28
|
|
|
@@ -228,6 +229,22 @@ static const char * scancode_to_ansi_seq ( unsigned int scancode ) {
|
228
|
229
|
return NULL;
|
229
|
230
|
}
|
230
|
231
|
|
|
232
|
+/**
|
|
233
|
+ * Map a key
|
|
234
|
+ *
|
|
235
|
+ * @v character Character read from console
|
|
236
|
+ * @ret character Mapped character
|
|
237
|
+ */
|
|
238
|
+static int bios_keymap ( unsigned int character ) {
|
|
239
|
+ struct key_mapping *mapping;
|
|
240
|
+
|
|
241
|
+ for_each_table_entry ( mapping, KEYMAP ) {
|
|
242
|
+ if ( mapping->from == character )
|
|
243
|
+ return mapping->to;
|
|
244
|
+ }
|
|
245
|
+ return character;
|
|
246
|
+}
|
|
247
|
+
|
231
|
248
|
/**
|
232
|
249
|
* Get character from BIOS console
|
233
|
250
|
*
|
|
@@ -251,9 +268,9 @@ static int bios_getchar ( void ) {
|
251
|
268
|
: "=a" ( keypress ) : "a" ( 0x1000 ) );
|
252
|
269
|
character = ( keypress & 0xff );
|
253
|
270
|
|
254
|
|
- /* If it's a normal character, just return it */
|
|
271
|
+ /* If it's a normal character, just map and return it */
|
255
|
272
|
if ( character && ( character < 0x80 ) )
|
256
|
|
- return character;
|
|
273
|
+ return bios_keymap ( character );
|
257
|
274
|
|
258
|
275
|
/* Otherwise, check for a special key that we know about */
|
259
|
276
|
if ( ( ansi_seq = scancode_to_ansi_seq ( keypress >> 8 ) ) ) {
|