mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-22 23:32:39 +00:00
Support scancode set 2
This commit is contained in:
1 parent
efc3e75f4d
commit
5ea70ca5fa
5 files changed
+410
-214
No files matched your search
+320
-66
@@ -23,10 +23,10 @@
|
||||
#include <grub/misc.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/keyboard_layouts.h>
|
||||
#include <grub/atkeymap.h>
|
||||
|
||||
static short at_keyboard_status = 0;
|
||||
static int extended_pending = 0;
|
||||
static int e0_received = 0;
|
||||
static int f0_received = 0;
|
||||
static int pending_key = -1;
|
||||
|
||||
static grub_uint8_t led_status;
|
||||
@@ -36,6 +36,145 @@ static grub_uint8_t led_status;
|
||||
#define KEYBOARD_LED_CAPS (1 << 2)
|
||||
|
||||
static grub_uint8_t grub_keyboard_controller_orig;
|
||||
static grub_uint8_t grub_keyboard_orig_set;
|
||||
static grub_uint8_t current_set;
|
||||
|
||||
static const grub_uint8_t set1_mapping[128] =
|
||||
{
|
||||
/* 0x00 */ 0x00 /* Unused */, 0x29 /* Escape */,
|
||||
/* 0x02 */ 0x1e /* 1 */, 0x1f /* 2 */,
|
||||
/* 0x04 */ 0x20 /* 3 */, 0x21 /* 4 */,
|
||||
/* 0x06 */ 0x22 /* 5 */, 0x23 /* 6 */,
|
||||
/* 0x08 */ 0x24 /* 7 */, 0x25 /* 8 */,
|
||||
/* 0x0a */ 0x26 /* 9 */, 0x27 /* 0 */,
|
||||
/* 0x0c */ 0x2d /* - */, 0x2e /* = */,
|
||||
/* 0x0e */ 0x2a /* \b */, 0x2b /* \t */,
|
||||
/* 0x10 */ 0x14 /* q */, 0x1a /* w */,
|
||||
/* 0x12 */ 0x08 /* e */, 0x15 /* r */,
|
||||
/* 0x14 */ 0x17 /* t */, 0x1c /* y */,
|
||||
/* 0x16 */ 0x18 /* u */, 0x0c /* i */,
|
||||
/* 0x18 */ 0x12 /* o */, 0x13 /* p */,
|
||||
/* 0x1a */ 0x2f /* [ */, 0x30 /* ] */,
|
||||
/* 0x1c */ 0x28 /* Enter */, 0xe0 /* Left CTRL */,
|
||||
/* 0x1e */ 0x04 /* a */, 0x16 /* s */,
|
||||
/* 0x20 */ 0x07 /* d */, 0x09 /* f */,
|
||||
/* 0x22 */ 0x0a /* g */, 0x0b /* h */,
|
||||
/* 0x24 */ 0x0d /* j */, 0x0e /* k */,
|
||||
/* 0x26 */ 0x0f /* l */, 0x33 /* ; */,
|
||||
/* 0x28 */ 0x34 /* " */, 0x35 /* ` */,
|
||||
/* 0x2a */ 0xe1 /* Left Shift */, 0x32 /* \ */,
|
||||
/* 0x2c */ 0x1d /* z */, 0x1b /* x */,
|
||||
/* 0x2e */ 0x06 /* c */, 0x19 /* v */,
|
||||
/* 0x30 */ 0x05 /* b */, 0x11 /* n */,
|
||||
/* 0x32 */ 0x10 /* m */, 0x36 /* , */,
|
||||
/* 0x34 */ 0x37 /* . */, 0x38 /* / */,
|
||||
/* 0x36 */ 0xe5 /* Right Shift */, 0x55 /* Num * */,
|
||||
/* 0x38 */ 0xe2 /* Left ALT */, 0x2c /* Space */,
|
||||
/* 0x3a */ 0x39 /* Caps Lock */, 0x3a /* F1 */,
|
||||
/* 0x3c */ 0x3b /* F2 */, 0x3c /* F3 */,
|
||||
/* 0x3e */ 0x3d /* F4 */, 0x3e /* F5 */,
|
||||
/* 0x40 */ 0x3f /* F6 */, 0x40 /* F7 */,
|
||||
/* 0x42 */ 0x41 /* F8 */, 0x42 /* F9 */,
|
||||
/* 0x44 */ 0x43 /* F10 */, 0x53 /* NumLock */,
|
||||
/* 0x46 */ 0x47 /* Scroll Lock */, 0x5f /* Num 7 */,
|
||||
/* 0x48 */ 0x60 /* Num 8 */, 0x61 /* Num 9 */,
|
||||
/* 0x4a */ 0x56 /* Num - */, 0x5c /* Num 4 */,
|
||||
/* 0x4c */ 0x5d /* Num 5 */, 0x5e /* Num 6 */,
|
||||
/* 0x4e */ 0x57 /* Num + */, 0x59 /* Num 1 */,
|
||||
/* 0x50 */ 0x5a /* Num 2 */, 0x5b /* Num 3 */,
|
||||
/* 0x52 */ 0x62 /* Num 0 */, 0x63 /* Num . */,
|
||||
/* 0x54 */ 0x00, 0x00,
|
||||
/* 0x56 */ 0x64 /* 102nd key. */, 0x44 /* F11 */,
|
||||
/* 0x58 */ 0x45 /* F12 */, 0x00,
|
||||
/* 0x5a */ 0x00, 0x00,
|
||||
/* 0x5c */ 0x00, 0x00,
|
||||
/* 0x5e */ 0x00, 0x00,
|
||||
/* 0x60 */ 0x00, 0x00,
|
||||
/* 0x62 */ 0x00, 0x00,
|
||||
/* OLPC keys. Just mapped to normal keys. */
|
||||
/* 0x64 */ 0x00, 0x52 /* Up */,
|
||||
/* 0x66 */ 0x51 /* Down */, 0x50 /* Left */,
|
||||
/* 0x68 */ 0x4f /* Right */
|
||||
};
|
||||
|
||||
static const struct
|
||||
{
|
||||
grub_uint8_t from, to;
|
||||
} set1_e0_mapping[] =
|
||||
{
|
||||
{0x1c, 0x58 /* Num \n */},
|
||||
{0x1d, 0xe4 /* Right CTRL */},
|
||||
{0x35, 0x54 /* Num / */ },
|
||||
{0x38, 0xe6 /* Right ALT */},
|
||||
{0x47, 0x4a /* Home */ },
|
||||
{0x48, 0x52 /* Up */ },
|
||||
{0x49, 0x4e /* NPage */ },
|
||||
{0x4b, 0x50 /* Left */ },
|
||||
{0x4d, 0x4f /* Right */ },
|
||||
{0x4f, 0x4d /* End */ },
|
||||
{0x50, 0x51 /* Down */ },
|
||||
{0x51, 0x4b /* PPage */ },
|
||||
{0x52, 0x49 /* Insert */},
|
||||
{0x53, 0x4c /* DC */ },
|
||||
};
|
||||
|
||||
static const grub_uint8_t set2_mapping[256] =
|
||||
{
|
||||
/* 0x00 */ 0x00, 0x42 /* F9 */, 0x00, 0x3e /* F5 */,
|
||||
/* 0x04 */ 0x3c /* F3 */, 0x3a /* F1 */, 0x3b /* F2 */, 0x45 /* F12 */,
|
||||
/* 0x08 */ 0x00, 0x43 /* F10 */, 0x41 /* F8 */, 0x3f /* F6 */,
|
||||
/* 0x0c */ 0x3d /* F4 */, 0x2b /* \t */, 0x35 /* ` */, 0x00,
|
||||
/* 0x10 */ 0x00, GRUB_KEYBOARD_KEY_LEFT_ALT, GRUB_KEYBOARD_KEY_LEFT_SHIFT, 0x00,
|
||||
/* 0x14 */ GRUB_KEYBOARD_KEY_LEFT_CTRL, 0x14 /* q */, 0x1e /* 1 */, 0x00,
|
||||
/* 0x18 */ 0x00, 0x00, 0x1d /* s */, 0x16 /* s */,
|
||||
/* 0x1c */ 0x04 /* a */, 0x1a /* w */, 0x1f /* 2 */, 0x00,
|
||||
/* 0x20 */ 0x00, 0x06 /* c */, 0x1b /* x */, 0x07 /* d */,
|
||||
/* 0x24 */ 0x08 /* e */, 0x21 /* 4 */, 0x20 /* 3 */, 0x00,
|
||||
/* 0x28 */ 0x00, 0x2c /* Space */, 0x19 /* v */, 0x09 /* f */,
|
||||
/* 0x2c */ 0x17 /* t */, 0x15 /* r */, 0x22 /* 5 */, 0x00,
|
||||
/* 0x30 */ 0x00, 0x11 /* n */, 0x05 /* b */, 0x0b /* h */,
|
||||
/* 0x34 */ 0x0a /* g */, 0x1c /* y */, 0x23 /* 6 */, 0x00,
|
||||
/* 0x38 */ 0x00, 0x00, 0x10 /* m */, 0x0d /* j */,
|
||||
/* 0x3c */ 0x18 /* u */, 0x24 /* 7 */, 0x25 /* 8 */, 0x00,
|
||||
/* 0x40 */ 0x00, 0x37 /* . */, 0x0e /* k */, 0x0c /* i */,
|
||||
/* 0x44 */ 0x12 /* o */, 0x27 /* 0 */, 0x26 /* 9 */, 0x00,
|
||||
/* 0x48 */ 0x00, 0x36 /* , */, 0x38 /* / */, 0x0f /* l */,
|
||||
/* 0x4c */ 0x33 /* ; */, 0x13 /* p */, 0x2d /* - */, 0x00,
|
||||
/* 0x50 */ 0x00, 0x00, 0x34 /* ' */, 0x00,
|
||||
/* 0x54 */ 0x2f /* [ */, 0x2e /* = */, 0x00, 0x00,
|
||||
/* 0x58 */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_RIGHT_SHIFT, 0x28 /* \n */,0x30 /* ] */,
|
||||
/* 0x5c */ 0x00, 0x32 /* \ */, 0x00, 0x00,
|
||||
/* 0x60 */ 0x00, 0x64 /* 102nd key. */, 0x00, 0x00,
|
||||
/* 0x64 */ 0x00, 0x00, 0x2a /* \b */, 0x00,
|
||||
/* 0x68 */ 0x00, 0x59 /* Num 1 */, 0x00, 0x5c /* Num 4 */,
|
||||
/* 0x6c */ 0x5f /* Num 7 */, 0x00, 0x00, 0x00,
|
||||
/* 0x70 */ 0x62 /* Num 0 */, 0x63 /* Num 0 */, 0x5a /* Num 2 */, 0x5d /* Num 5 */,
|
||||
/* 0x74 */ 0x5e /* Num 6 */, 0x60 /* Num 8 */, 0x29 /* \e */, 0x53 /* NumLock */,
|
||||
/* 0x78 */ 0x44 /* F11 */, 0x57 /* Num + */, 0x5b /* Num 3 */, 0x56 /* Num - */,
|
||||
/* 0x7c */ 0x55 /* Num * */, 0x61 /* Num 9 */, 0x47 /* ScrollLock */, 0x00,
|
||||
/* 0x80 */ 0x00, 0x00, 0x00, 0x40 /* F7 */,
|
||||
};
|
||||
|
||||
static const struct
|
||||
{
|
||||
grub_uint8_t from, to;
|
||||
} set2_e0_mapping[] =
|
||||
{
|
||||
{0x11, GRUB_KEYBOARD_KEY_RIGHT_ALT},
|
||||
{0x14, GRUB_KEYBOARD_KEY_RIGHT_CTRL},
|
||||
{0x4a, 0x54}, /* Num / */
|
||||
{0x5a, 0x58}, /* Num enter */
|
||||
{0x69, 0x4d}, /* End */
|
||||
{0x6b, 0x50}, /* Left */
|
||||
{0x6c, 0x4a}, /* Home */
|
||||
{0x70, 0x49}, /* Insert */
|
||||
{0x71, 0x4c}, /* Delete */
|
||||
{0x72, 0x51}, /* Down */
|
||||
{0x74, 0x4f}, /* Right */
|
||||
{0x75, 0x52}, /* Up */
|
||||
{0x7a, 0x4e}, /* PageDown */
|
||||
{0x7d, 0x4b}, /* PageUp */
|
||||
};
|
||||
|
||||
static void
|
||||
keyboard_controller_wait_until_ready (void)
|
||||
@@ -51,6 +190,55 @@ grub_keyboard_controller_write (grub_uint8_t c)
|
||||
grub_outb (c, KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
static grub_uint8_t
|
||||
query_mode (int mode)
|
||||
{
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_outb (0xf0, KEYBOARD_REG_DATA);
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_inb (KEYBOARD_REG_DATA);
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_outb (mode, KEYBOARD_REG_DATA);
|
||||
|
||||
keyboard_controller_wait_until_ready ();
|
||||
|
||||
return grub_inb (KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
/* QEMU translates the set even in no-translate mode. */
|
||||
static inline int
|
||||
recover_mode (grub_uint8_t report)
|
||||
{
|
||||
if (report == 0x43 || report == 1)
|
||||
return 1;
|
||||
if (report == 0x41 || report == 2)
|
||||
return 2;
|
||||
if (report == 0x3f || report == 3)
|
||||
return 3;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
set_scancodes (void)
|
||||
{
|
||||
grub_keyboard_controller_write (grub_keyboard_controller_orig
|
||||
& ~KEYBOARD_AT_TRANSLATE);
|
||||
grub_keyboard_orig_set = recover_mode (query_mode (0));
|
||||
|
||||
query_mode (2);
|
||||
current_set = query_mode (0);
|
||||
current_set = recover_mode (current_set);
|
||||
if (current_set == 2)
|
||||
return;
|
||||
|
||||
query_mode (1);
|
||||
current_set = query_mode (0);
|
||||
current_set = recover_mode (current_set);
|
||||
if (current_set == 1)
|
||||
return;
|
||||
grub_printf ("No supported scancode set found\n");
|
||||
}
|
||||
|
||||
static grub_uint8_t
|
||||
grub_keyboard_controller_read (void)
|
||||
{
|
||||
@@ -68,48 +256,126 @@ keyboard_controller_led (grub_uint8_t leds)
|
||||
grub_outb (leds & 0x7, KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
static int
|
||||
fetch_key (int *is_break)
|
||||
{
|
||||
int was_ext = 0;
|
||||
grub_uint8_t at_key;
|
||||
int ret = 0;
|
||||
|
||||
if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
|
||||
return -1;
|
||||
at_key = grub_inb (KEYBOARD_REG_DATA);
|
||||
if (at_key == 0xe0)
|
||||
{
|
||||
e0_received = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
was_ext = e0_received;
|
||||
e0_received = 0;
|
||||
|
||||
switch (current_set)
|
||||
{
|
||||
case 1:
|
||||
*is_break = !!(at_key & 0x80);
|
||||
if (!was_ext)
|
||||
ret = set1_mapping[at_key & 0x7f];
|
||||
else
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE (set1_e0_mapping); i++)
|
||||
if (set1_e0_mapping[i].from == (at_key & 0x80))
|
||||
{
|
||||
ret = set1_e0_mapping[i].to;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (at_key == 0xf0)
|
||||
{
|
||||
f0_received = 1;
|
||||
return -1;
|
||||
}
|
||||
*is_break = f0_received;
|
||||
f0_received = 0;
|
||||
if (!was_ext)
|
||||
ret = set2_mapping[at_key];
|
||||
else
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE (set1_e0_mapping); i++)
|
||||
if (set1_e0_mapping[i].from == (at_key & 0x80))
|
||||
{
|
||||
ret = set1_e0_mapping[i].to;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
if (!ret)
|
||||
{
|
||||
grub_printf ("Unknown key 0x%02x from set %d\n\n", at_key, current_set);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* FIXME: This should become an interrupt service routine. For now
|
||||
it's just used to catch events from control keys. */
|
||||
static void
|
||||
grub_keyboard_isr (grub_uint8_t key)
|
||||
static int
|
||||
grub_keyboard_isr (grub_keyboard_key_t key, int is_break)
|
||||
{
|
||||
if (KEYBOARD_ISMAKE (key))
|
||||
switch (KEYBOARD_SCANCODE (key))
|
||||
if (!is_break)
|
||||
switch (key)
|
||||
{
|
||||
case SHIFT_L:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_LSHIFT;
|
||||
break;
|
||||
case SHIFT_R:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_RSHIFT;
|
||||
break;
|
||||
case CTRL:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_LCTRL;
|
||||
break;
|
||||
case ALT:
|
||||
if (extended_pending)
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_RALT;
|
||||
else
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_LALT;
|
||||
break;
|
||||
case GRUB_KEYBOARD_KEY_LEFT_SHIFT:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_LSHIFT;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_RIGHT_SHIFT:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_RSHIFT;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_LEFT_CTRL:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_LCTRL;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_RIGHT_CTRL:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_RCTRL;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_RIGHT_ALT:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_RALT;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_LEFT_ALT:
|
||||
at_keyboard_status |= GRUB_TERM_STATUS_LALT;
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
switch (KEYBOARD_SCANCODE (key))
|
||||
{
|
||||
case SHIFT_L:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_LSHIFT;
|
||||
break;
|
||||
case SHIFT_R:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_RSHIFT;
|
||||
break;
|
||||
case CTRL:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_LCTRL;
|
||||
break;
|
||||
case ALT:
|
||||
if (extended_pending)
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_RALT;
|
||||
else
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_LALT;
|
||||
break;
|
||||
case GRUB_KEYBOARD_KEY_LEFT_SHIFT:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_LSHIFT;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_RIGHT_SHIFT:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_RSHIFT;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_LEFT_CTRL:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_LCTRL;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_RIGHT_CTRL:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_RCTRL;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_RIGHT_ALT:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_RALT;
|
||||
return 1;
|
||||
case GRUB_KEYBOARD_KEY_LEFT_ALT:
|
||||
at_keyboard_status &= ~GRUB_TERM_STATUS_LALT;
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,31 +383,19 @@ grub_keyboard_isr (grub_uint8_t key)
|
||||
static int
|
||||
grub_keyboard_getkey (void)
|
||||
{
|
||||
grub_uint8_t key;
|
||||
grub_uint8_t ret;
|
||||
if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
|
||||
return -1;
|
||||
key = grub_inb (KEYBOARD_REG_DATA);
|
||||
if (key == 0xe0)
|
||||
{
|
||||
extended_pending = 1;
|
||||
return -1;
|
||||
}
|
||||
/* FIXME */ grub_keyboard_isr (key);
|
||||
ret = KEYBOARD_SCANCODE (key);
|
||||
if (ret == SHIFT_L || ret == SHIFT_R || ret == ALT || ret == CTRL)
|
||||
{
|
||||
extended_pending = 0;
|
||||
return -1;
|
||||
}
|
||||
if (extended_pending)
|
||||
ret |= 0x80;
|
||||
extended_pending = 0;
|
||||
if (! KEYBOARD_ISMAKE (key))
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
int key;
|
||||
int is_break;
|
||||
|
||||
key = fetch_key (&is_break);
|
||||
if (key == -1)
|
||||
return -1;
|
||||
|
||||
if (grub_keyboard_isr (key, is_break))
|
||||
return -1;
|
||||
if (is_break)
|
||||
return -1;
|
||||
return key;
|
||||
}
|
||||
|
||||
/* If there is a character pending, return it; otherwise return -1. */
|
||||
static int
|
||||
@@ -156,7 +410,7 @@ grub_at_keyboard_getkey_noblock (void)
|
||||
#endif
|
||||
switch (code)
|
||||
{
|
||||
case CAPS_LOCK:
|
||||
case GRUB_KEYBOARD_KEY_CAPS_LOCK:
|
||||
at_keyboard_status ^= GRUB_TERM_STATUS_CAPS;
|
||||
led_status ^= KEYBOARD_LED_CAPS;
|
||||
keyboard_controller_led (led_status);
|
||||
@@ -165,7 +419,7 @@ grub_at_keyboard_getkey_noblock (void)
|
||||
grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK));
|
||||
#endif
|
||||
return -1;
|
||||
case NUM_LOCK:
|
||||
case GRUB_KEYBOARD_KEY_NUM_LOCK:
|
||||
at_keyboard_status ^= GRUB_TERM_STATUS_NUM;
|
||||
led_status ^= KEYBOARD_LED_NUM;
|
||||
keyboard_controller_led (led_status);
|
||||
@@ -174,14 +428,13 @@ grub_at_keyboard_getkey_noblock (void)
|
||||
grub_dprintf ("atkeyb", "num_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_NUM_LOCK));
|
||||
#endif
|
||||
return -1;
|
||||
case SCROLL_LOCK:
|
||||
case GRUB_KEYBOARD_KEY_SCROLL_LOCK:
|
||||
at_keyboard_status ^= GRUB_TERM_STATUS_SCROLL;
|
||||
led_status ^= KEYBOARD_LED_SCROLL;
|
||||
keyboard_controller_led (led_status);
|
||||
return -1;
|
||||
default:
|
||||
return grub_term_map_key (grub_at_map_to_usb (code),
|
||||
at_keyboard_status);
|
||||
return grub_term_map_key (code, at_keyboard_status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +475,7 @@ grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unus
|
||||
pending_key = -1;
|
||||
at_keyboard_status = 0;
|
||||
grub_keyboard_controller_orig = grub_keyboard_controller_read ();
|
||||
grub_keyboard_controller_write (grub_keyboard_controller_orig | KEYBOARD_SCANCODE_SET1);
|
||||
set_scancodes ();
|
||||
keyboard_controller_led (led_status);
|
||||
/* Drain input buffer. */
|
||||
while (KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
|
||||
@@ -234,6 +487,7 @@ grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unus
|
||||
static grub_err_t
|
||||
grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
query_mode (grub_keyboard_orig_set);
|
||||
grub_keyboard_controller_write (grub_keyboard_controller_orig);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user