Dear team at grub-devel, First of all I would like to thank you for the Grand boot loader, your work is very much appreciated.
Recently I downloaded the current grub-2.02-beta3 and started experimenting with it. I am am making use of the luks module in GRUB to provide my clients with fully encrypted harddrives. Since my clients are German, and I keep telling them that strong passwords should contain special characters, I ended up modifying the default keyboard layout for the at_keyboard.c input driver. I provided the diff in keylayouts.c.diff, if you want to make use of it. The support for German keys is only partial, since some of the German keys are non-ASCII. Also I patched at_keyboard.c. It has a minor typo, in line 91 both scancode 0x52 and 0x53 are mapped to the same GRUB_KEYBOARD_KEY_NUMDOT. This is wrong, scancode 0x52 has to be mapped to GRUB_KEYBOARD_KEY_NUM0 (as that's what it is). Last but not least, parsing through include/grub/keyboard_layouts.h, I realized that the enumeration of GRUB_KEYBOARD_KEY_* is skipping value 0x31: > GRUB_KEYBOARD_KEY_RBRACKET = 0x30, > GRUB_KEYBOARD_KEY_BACKSLASH = 0x32, I do not know why this is the case, but from my point of view this probably lead to the following comment ( in grub-core/commands/keylayouts.c ): > /* According to usage table 0x31 should be mapped to '/' > but testing with real keyboard shows that 0x32 is remapped to '/'. > Map 0x31 to 0. Cleaning up the enumeration would do some good, I guess. Find attached both aformentioned patches. I'll be glad help out if you deem it appropriate to, e.g. make the support for German at_keyboard layout a configurable option. Regards, Frank
--- keylayouts.c.orig 2016-05-15 18:37:53.748056892 +0200 +++ keylayouts.c 2016-05-15 19:41:45.187943685 +0200 @@ -30,7 +30,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); -static struct grub_keyboard_layout layout_us = { +static struct grub_keyboard_layout layout_de = { .keyboard_map = { /* Keyboard errors. Handled by driver. */ /* 0x00 */ 0, 0, 0, 0, @@ -38,16 +38,16 @@ /* 0x04 */ 'a', 'b', 'c', 'd', /* 0x08 */ 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', /* 0x10 */ 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - /* 0x18 */ 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', + /* 0x18 */ 'u', 'v', 'w', 'x', 'z', 'y', '1', '2', /* 0x20 */ '3', '4', '5', '6', '7', '8', '9', '0', - /* 0x28 */ '\n', '\e', '\b', '\t', ' ', '-', '=', '[', + /* 0x28 */ '\n', '\e', '\b', '\t', ' ', 's', '\'', 'u', /* s = Ã, ' = ´, u = ü */ /* According to usage table 0x31 should be mapped to '/' but testing with real keyboard shows that 0x32 is remapped to '/'. Map 0x31 to 0. */ - /* 0x30 */ ']', 0, '\\', ';', '\'', '`', ',', '.', + /* 0x30 */ '+', 0, '#', 'o', 'a', '^', ',', '.', /* o = ö, a = ä */ /* 0x39 is CapsLock. Handled by driver. */ - /* 0x38 */ '/', 0, GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, + /* 0x38 */ '-', 0, GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, /* 0x3c */ GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4, /* 0x3e */ GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6, /* 0x40 */ GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, @@ -71,7 +71,7 @@ /* 0x5e */ GRUB_TERM_KEY_RIGHT, GRUB_TERM_KEY_HOME, /* 0x60 */ GRUB_TERM_KEY_UP, GRUB_TERM_KEY_PPAGE, /* 0x62 */ GRUB_TERM_KEY_INSERT, GRUB_TERM_KEY_DC, - /* 0x64 */ '\\' + /* 0x64 */ '<' }, .keyboard_map_shift = { /* Keyboard errors. Handled by driver. */ @@ -80,18 +80,18 @@ /* 0x04 */ 'A', 'B', 'C', 'D', /* 0x08 */ 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', /* 0x10 */ 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - /* 0x18 */ 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', - /* 0x20 */ '#', '$', '%', '^', '&', '*', '(', ')', + /* 0x18 */ 'U', 'V', 'W', 'X', 'Z', 'Y', '!', '\"', + /* 0x20 */ 'P', '$', '%', '&', '/', '(', ')', '=', /* P = § */ /* 0x28 */ '\n' | GRUB_TERM_SHIFT, '\e' | GRUB_TERM_SHIFT, /* 0x2a */ '\b' | GRUB_TERM_SHIFT, '\t' | GRUB_TERM_SHIFT, - /* 0x2c */ ' ' | GRUB_TERM_SHIFT, '_', '+', '{', + /* 0x2c */ ' ' | GRUB_TERM_SHIFT, '?', '`', 'U', /* U = à */ /* According to usage table 0x31 should be mapped to '/' but testing with real keyboard shows that 0x32 is remapped to '/'. Map 0x31 to 0. */ - /* 0x30 */ '}', 0, '|', ':', '"', '~', '<', '>', + /* 0x30 */ '*', 0, '\'', 'O', 'A', '^', ';', ':', /* O = Ã, ^ = ° */ /* 0x39 is CapsLock. Handled by driver. */ - /* 0x38 */ '?', 0, + /* 0x38 */ '_', 0, /* 0x3a */ GRUB_TERM_KEY_F1 | GRUB_TERM_SHIFT, /* 0x3b */ GRUB_TERM_KEY_F2 | GRUB_TERM_SHIFT, /* 0x3c */ GRUB_TERM_KEY_F3 | GRUB_TERM_SHIFT, @@ -121,11 +121,59 @@ /* 0x54 */ '/', '*', /* 0x56 */ '-', '+', /* 0x58 */ '\n' | GRUB_TERM_SHIFT, '1', '2', '3', '4', '5','6', '7', - /* 0x60 */ '8', '9', '0', '.', '|' + /* 0x60 */ '8', '9', '0', ',', '>' + }, + .keyboard_map_l3 = { + /* Keyboard errors. Handled by driver. */ + /* 0x00 */ 0, 0, 0, 0, + + /* 0x04 */ 0, 0, 0, 0, + /* 0x08 */ 'e', 0, 0, 0, 0, 0, 0, 0, /* e = ⬠*/ + /* 0x10 */ 0, 0, 0, 0, '@', 0, 0, 0, + /* 0x18 */ 0, 0, 0, 0, 0, 0, 0, '2', /* 2 = ² */ + /* 0x20 */ 3, 0, 0, 0, '{', '[', ']', '}', /* 3 = ³ */ + /* 0x28 */ 0, 0, 0, 0, 0, '\\', + /* 0x2e */ 0, 0, + /* According to usage table 0x31 should be mapped to '/' + but testing with real keyboard shows that 0x32 is remapped to '/'. + Map 0x31 to 0. + */ + /* 0x30 */ '~', 0, 0, 0, 0, 0, 0, 0, + /* 0x39 is CapsLock. Handled by driver. */ + /* 0x38 */ 0, 0, + /* 0x3a */ GRUB_TERM_KEY_F1 | GRUB_TERM_ALT, + /* 0x3b */ GRUB_TERM_KEY_F2 | GRUB_TERM_ALT, + /* 0x3c */ GRUB_TERM_KEY_F3 | GRUB_TERM_ALT, + /* 0x3d */ GRUB_TERM_KEY_F4 | GRUB_TERM_ALT, + /* 0x3e */ GRUB_TERM_KEY_F5 | GRUB_TERM_ALT, + /* 0x3f */ GRUB_TERM_KEY_F6 | GRUB_TERM_ALT, + /* 0x40 */ GRUB_TERM_KEY_F7 | GRUB_TERM_ALT, + /* 0x41 */ GRUB_TERM_KEY_F8 | GRUB_TERM_ALT, + /* 0x42 */ GRUB_TERM_KEY_F9 | GRUB_TERM_ALT, + /* 0x43 */ GRUB_TERM_KEY_F10 | GRUB_TERM_ALT, + /* 0x44 */ GRUB_TERM_KEY_F11 | GRUB_TERM_ALT, + /* 0x45 */ GRUB_TERM_KEY_F12 | GRUB_TERM_ALT, + /* PrtScr and ScrollLock. Not handled yet. */ + /* 0x46 */ 0, 0, + /* 0x48 is Pause. Not handled yet. */ + /* 0x48 */ 0, GRUB_TERM_KEY_INSERT | GRUB_TERM_ALT, + /* 0x4a */ GRUB_TERM_KEY_HOME | GRUB_TERM_ALT, + /* 0x4b */ GRUB_TERM_KEY_PPAGE | GRUB_TERM_ALT, + /* 0x4c */ GRUB_TERM_KEY_DC | GRUB_TERM_ALT, + /* 0x4d */ GRUB_TERM_KEY_END | GRUB_TERM_ALT, + /* 0x4e */ GRUB_TERM_KEY_NPAGE | GRUB_TERM_ALT, + /* 0x4f */ GRUB_TERM_KEY_RIGHT | GRUB_TERM_ALT, + /* 0x50 */ GRUB_TERM_KEY_LEFT | GRUB_TERM_ALT, + /* 0x51 */ GRUB_TERM_KEY_DOWN | GRUB_TERM_ALT, + /* 0x53 is NumLock. Handled by driver. */ + /* 0x52 */ GRUB_TERM_KEY_UP | GRUB_TERM_ALT, 0, + /* 0x54 */ 0, 0, 0, 0, + /* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x60 */ 0, 0, 0, 0, '|' } }; -static struct grub_keyboard_layout *grub_current_layout = &layout_us; +static struct grub_keyboard_layout *grub_current_layout = &layout_de; static int map_key_core (int code, int status, int *alt_gr_consumed)
--- at_keyboard.c 2016-02-28 03:07:41.000000000 +0100 +++ grub-2.02-beta3/grub-core/term/at_keyboard.c 2016-05-14 23:34:50.635451129 +0200 @@ -88,7 +88,7 @@ /* 0x4c */ GRUB_KEYBOARD_KEY_NUM5, GRUB_KEYBOARD_KEY_NUM6, /* 0x4e */ GRUB_KEYBOARD_KEY_NUMPLUS, GRUB_KEYBOARD_KEY_NUM1, /* 0x50 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM3, - /* 0x52 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUMDOT, + /* 0x52 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, /* 0x54 */ 0, 0, /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0,
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel