1 /* Minimal polling PC keyboard driver
6 * still Enough For Me to type a filename.
8 * 2003-07 by SONE Takesh
9 * 2004-04 moved by LYH From filo to Etherboot
14 #include <ipxe/console.h>
16 static char key_map[][128] = {
18 "\0\x1b""1234567890-=\b\t"
21 "bnm,./\0*\0 \0\0\0\0\0\0"
22 "\0\0\0\0\0\0\0""789-456+1"
25 "\0\x1b""!@#$%^&*()_+\b\t"
28 "BNM<>?\0\0\0 \0\0\0\0\0\0"
29 "\0\0\0\0\0\0\0""789-456+1"
35 static unsigned int shift_state;
40 static int get_scancode(void)
44 if ((inb(0x64) & 1) == 0)
55 shift_state &= ~SHIFT;
58 shift_state |= CONTROL;
61 shift_state &= ~CONTROL;
69 return 0; /* ignore break code or 0xe0 etc! */
73 static int kbd_havekey(void)
76 cur_scan = get_scancode();
80 static int kbd_ischar(void)
84 if (!key_map[shift_state & SHIFT][cur_scan]) {
91 static int kbd_getc(void)
97 c = key_map[shift_state & SHIFT][cur_scan];
98 if (shift_state & (CONTROL | CAPS)) {
99 if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
100 if (shift_state & CONTROL)
102 else if (shift_state & CAPS)
110 struct console_driver pc_kbd_console __console_driver = {