diff --git a/include/grub/term.h b/include/grub/term.h index fa813d1b5..1f64bebc7 100644 --- a/include/grub/term.h +++ b/include/grub/term.h @@ -20,6 +20,8 @@ #define GRUB_TERM_HEADER 1 /* Internal codes used by GRUB to represent terminal input. */ +/* Only for keys otherwise not having shifted modification. */ +#define GRUB_TERM_SHIFT 0x01000000 #define GRUB_TERM_CTRL 0x02000000 #define GRUB_TERM_ALT 0x04000000 /* Used by keylayouts code. Never returned in grub_getkey. */ @@ -27,8 +29,8 @@ #define GRUB_TERM_CAPS 0x10000000 /* Keys without associated character. */ -#define GRUB_TERM_EXTENDED 0x1000000 -#define GRUB_TERM_KEY_MASK 0x1ffffff +#define GRUB_TERM_EXTENDED 0x00800000 +#define GRUB_TERM_KEY_MASK 0x00ffffff #define GRUB_TERM_KEY_LEFT (GRUB_TERM_EXTENDED | 1) #define GRUB_TERM_KEY_RIGHT (GRUB_TERM_EXTENDED | 2) #define GRUB_TERM_KEY_UP (GRUB_TERM_EXTENDED | 3) diff --git a/term/at_keyboard.c b/term/at_keyboard.c index 4c9c2a23a..cc0c69e22 100644 --- a/term/at_keyboard.c +++ b/term/at_keyboard.c @@ -187,10 +187,14 @@ grub_at_keyboard_getkey_noblock (void) key = -1; break; default: - if ((at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L - | KEYBOARD_STATUS_SHIFT_R)) - && keyboard_map_shift[code]) - key = keyboard_map_shift[code]; + if (at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L + | KEYBOARD_STATUS_SHIFT_R)) + { + if (keyboard_map_shift[code]) + key = keyboard_map_shift[code]; + else + key = keyboard_map[code] | GRUB_TERM_SHIFT; + } else key = keyboard_map[code]; diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index e18f205e8..9e1ce5e60 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -162,10 +162,14 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused) #define GRUB_USB_KEYBOARD_RIGHT_ALT 0x40 /* Check if the Shift key was pressed. */ - if ((data[0] & GRUB_USB_KEYBOARD_LEFT_SHIFT + if (data[0] & GRUB_USB_KEYBOARD_LEFT_SHIFT || data[0] & GRUB_USB_KEYBOARD_RIGHT_SHIFT) - && keyboard_map_shift[data[2]]) - key = keyboard_map_shift[data[2]]; + { + if (keyboard_map_shift[data[2]]) + key = keyboard_map_shift[data[2]]; + else + key = keyboard_map[data[2]] | GRUB_TERM_SHIFT; + } else key = keyboard_map[data[2]];