adjust usb_keyboard for keylayouts
This commit is contained in:
parent
176194068f
commit
9fbfb64abe
1 changed files with 23 additions and 4 deletions
|
@ -150,10 +150,16 @@ grub_usb_keyboard_checkkey (void)
|
||||||
data[0], data[1], data[2], data[3],
|
data[0], data[1], data[2], data[3],
|
||||||
data[4], data[5], data[6], data[7]);
|
data[4], data[5], data[6], data[7]);
|
||||||
|
|
||||||
/* Check if the Control or Shift key was pressed. */
|
#define GRUB_USB_KEYBOARD_LEFT_CTRL 0x01
|
||||||
if (data[0] & 0x01 || data[0] & 0x10)
|
#define GRUB_USB_KEYBOARD_LEFT_SHIFT 0x02
|
||||||
key = keyboard_map[data[2]] - 'a' + 1;
|
#define GRUB_USB_KEYBOARD_LEFT_ALT 0x04
|
||||||
else if (data[0] & 0x02 || data[0] & 0x20)
|
#define GRUB_USB_KEYBOARD_RIGHT_CTRL 0x10
|
||||||
|
#define GRUB_USB_KEYBOARD_RIGHT_SHIFT 0x20
|
||||||
|
#define GRUB_USB_KEYBOARD_RIGHT_ALT 0x40
|
||||||
|
|
||||||
|
/* Check if the Shift key was pressed. */
|
||||||
|
if (data[0] & GRUB_USB_KEYBOARD_LEFT_SHIFT
|
||||||
|
|| data[0] & GRUB_USB_KEYBOARD_RIGHT_SHIFT)
|
||||||
key = keyboard_map_shift[data[2]];
|
key = keyboard_map_shift[data[2]];
|
||||||
else
|
else
|
||||||
key = keyboard_map[data[2]];
|
key = keyboard_map[data[2]];
|
||||||
|
@ -161,6 +167,18 @@ grub_usb_keyboard_checkkey (void)
|
||||||
if (key == 0)
|
if (key == 0)
|
||||||
grub_printf ("Unknown key 0x%x detected\n", data[2]);
|
grub_printf ("Unknown key 0x%x detected\n", data[2]);
|
||||||
|
|
||||||
|
/* Check if the Ctrl key was pressed. */
|
||||||
|
if (data[0] & GRUB_USB_KEYBOARD_LEFT_CTRL
|
||||||
|
|| data[0] & GRUB_USB_KEYBOARD_RIGHT_CTRL)
|
||||||
|
key |= GRUB_TERM_CTRL;
|
||||||
|
|
||||||
|
/* Check if the Alt key was pressed. */
|
||||||
|
if (data[0] & GRUB_USB_KEYBOARD_LEFT_ALT)
|
||||||
|
key |= GRUB_TERM_ALT;
|
||||||
|
|
||||||
|
if (data[0] & GRUB_USB_KEYBOARD_RIGHT_ALT)
|
||||||
|
key |= GRUB_TERM_ALT_GR;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Wait until the key is released. */
|
/* Wait until the key is released. */
|
||||||
while (!err && data[2])
|
while (!err && data[2])
|
||||||
|
@ -314,6 +332,7 @@ static struct grub_term_input grub_usb_keyboard_term =
|
||||||
.checkkey = grub_usb_keyboard_checkkey,
|
.checkkey = grub_usb_keyboard_checkkey,
|
||||||
.getkey = grub_usb_keyboard_getkey,
|
.getkey = grub_usb_keyboard_getkey,
|
||||||
.getkeystatus = grub_usb_keyboard_getkeystatus,
|
.getkeystatus = grub_usb_keyboard_getkeystatus,
|
||||||
|
.flags = GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES,
|
||||||
.next = 0
|
.next = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue