All of lore.kernel.org
 help / color / mirror / Atom feed
From: fgndevelop <fgndevelop@posteo.org>
To: grub-devel@gnu.org
Subject: Patch for German keyboard layout for the at_keyboard input
Date: Sun, 15 May 2016 20:19:29 +0200	[thread overview]
Message-ID: <5738BDB1.2070005@posteo.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]


 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: keylayouts.c.diff --]
[-- Type: text/x-patch; name="keylayouts.c.diff", Size: 5910 bytes --]

--- 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)

[-- Attachment #3: at_keyboard.c.diff --]
[-- Type: text/x-patch, Size: 692 bytes --]

--- 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,

             reply	other threads:[~2016-05-16 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-15 18:19 fgndevelop [this message]
2016-07-27  5:09 ` Patch for German keyboard layout for the at_keyboard input Andrei Borzenkov
2016-07-27  5:37 ` Andrei Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5738BDB1.2070005@posteo.org \
    --to=fgndevelop@posteo.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.