Browse Source

[console] Try to avoid problems caused by keycode 86

The "us" keyboard layout contains a mapping for keycode 86 (which
seems not to correspond to any physical key on many US keyboards) to
the ASCII character '<'.  This mapping causes conflicts with the
mapping for keycode 51, which also maps (with shift) to '<'.

Change the keyboard mapping generator to choose the lowest keycode for
each ASCII character as indicating the relevant mapping to use, on the
basis that a lower keycode roughly indicates a "more normal" key.  On
a German keyboard, which has keys for both keycode 51 and keycode 86
present, this causes '<' to be remapped to ';', which is a closer
match to typical user expectations.

Reported-by: Sven Dreyer <sven@dreyer-net.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
48624cf94a

+ 1
- 0
src/hci/keymap/keymap_al.c View File

@@ -16,6 +16,7 @@ struct key_mapping al_mapping[] __keymap = {
16 16
 	{ 0x1a, 0x19 },	/* Ctrl-Z => Ctrl-Y */
17 17
 	{ 0x22, 0x7b },	/* '"' => '{' */
18 18
 	{ 0x27, 0x5b },	/* '\'' => '[' */
19
+	{ 0x3c, 0x3b },	/* '<' => ';' */
19 20
 	{ 0x3e, 0x3a },	/* '>' => ':' */
20 21
 	{ 0x40, 0x22 },	/* '@' => '"' */
21 22
 	{ 0x59, 0x5a },	/* 'Y' => 'Z' */

+ 1
- 1
src/hci/keymap/keymap_cz.c View File

@@ -16,7 +16,7 @@ struct key_mapping cz_mapping[] __keymap = {
16 16
 	{ 0x2d, 0x3d },	/* '-' => '=' */
17 17
 	{ 0x2f, 0x2d },	/* '/' => '-' */
18 18
 	{ 0x31, 0x2b },	/* '1' => '+' */
19
-	{ 0x3c, 0x5c },	/* '<' => '\\' */
19
+	{ 0x3c, 0x2c },	/* '<' => ',' */
20 20
 	{ 0x3e, 0x2e },	/* '>' => '.' */
21 21
 	{ 0x3f, 0x2d },	/* '?' => '-' */
22 22
 	{ 0x5d, 0x29 },	/* ']' => ')' */

+ 1
- 0
src/hci/keymap/keymap_de.c View File

@@ -25,6 +25,7 @@ struct key_mapping de_mapping[] __keymap = {
25 25
 	{ 0x2f, 0x2d },	/* '/' => '-' */
26 26
 	{ 0x3a, 0x7b },	/* ':' => '{' */
27 27
 	{ 0x3b, 0x5b },	/* ';' => '[' */
28
+	{ 0x3c, 0x3b },	/* '<' => ';' */
28 29
 	{ 0x3d, 0x27 },	/* '=' => '\'' */
29 30
 	{ 0x3e, 0x3a },	/* '>' => ':' */
30 31
 	{ 0x3f, 0x5f },	/* '?' => '_' */

+ 1
- 0
src/hci/keymap/keymap_dk.c View File

@@ -19,6 +19,7 @@ struct key_mapping dk_mapping[] __keymap = {
19 19
 	{ 0x2b, 0x60 },	/* '+' => '`' */
20 20
 	{ 0x2d, 0x2b },	/* '-' => '+' */
21 21
 	{ 0x2f, 0x2d },	/* '/' => '-' */
22
+	{ 0x3c, 0x3b },	/* '<' => ';' */
22 23
 	{ 0x3e, 0x3a },	/* '>' => ':' */
23 24
 	{ 0x3f, 0x5f },	/* '?' => '_' */
24 25
 	{ 0x40, 0x22 },	/* '@' => '"' */

+ 1
- 0
src/hci/keymap/keymap_es.c View File

@@ -18,6 +18,7 @@ struct key_mapping es_mapping[] __keymap = {
18 18
 	{ 0x2a, 0x28 },	/* '*' => '(' */
19 19
 	{ 0x2d, 0x27 },	/* '-' => '\'' */
20 20
 	{ 0x2f, 0x2d },	/* '/' => '-' */
21
+	{ 0x3c, 0x3b },	/* '<' => ';' */
21 22
 	{ 0x3e, 0x3a },	/* '>' => ':' */
22 23
 	{ 0x3f, 0x5f },	/* '?' => '_' */
23 24
 	{ 0x40, 0x22 },	/* '@' => '"' */

+ 2
- 0
src/hci/keymap/keymap_et.c View File

@@ -18,6 +18,7 @@ struct key_mapping et_mapping[] __keymap = {
18 18
 	{ 0x2a, 0x28 },	/* '*' => '(' */
19 19
 	{ 0x2d, 0x2b },	/* '-' => '+' */
20 20
 	{ 0x2f, 0x2d },	/* '/' => '-' */
21
+	{ 0x3c, 0x3b },	/* '<' => ';' */
21 22
 	{ 0x3e, 0x3a },	/* '>' => ':' */
22 23
 	{ 0x3f, 0x5f },	/* '?' => '_' */
23 24
 	{ 0x40, 0x22 },	/* '@' => '"' */
@@ -25,4 +26,5 @@ struct key_mapping et_mapping[] __keymap = {
25 26
 	{ 0x5e, 0x26 },	/* '^' => '&' */
26 27
 	{ 0x5f, 0x3f },	/* '_' => '?' */
27 28
 	{ 0x7c, 0x2a },	/* '|' => '*' */
29
+	{ 0x7f, 0x1b },	/* 0x7f => 0x1b */
28 30
 };

+ 1
- 0
src/hci/keymap/keymap_fi.c View File

@@ -23,6 +23,7 @@ struct key_mapping fi_mapping[] __keymap = {
23 23
 	{ 0x2f, 0x2d },	/* '/' => '-' */
24 24
 	{ 0x3a, 0x5c },	/* ':' => '\\' */
25 25
 	{ 0x3b, 0x7c },	/* ';' => '|' */
26
+	{ 0x3c, 0x3b },	/* '<' => ';' */
26 27
 	{ 0x3d, 0x27 },	/* '=' => '\'' */
27 28
 	{ 0x3e, 0x3a },	/* '>' => ':' */
28 29
 	{ 0x3f, 0x5f },	/* '?' => '_' */

+ 1
- 0
src/hci/keymap/keymap_fr.c View File

@@ -42,6 +42,7 @@ struct key_mapping fr_mapping[] __keymap = {
42 42
 	{ 0x39, 0x2f },	/* '9' => '/' */
43 43
 	{ 0x3a, 0x4d },	/* ':' => 'M' */
44 44
 	{ 0x3b, 0x6d },	/* ';' => 'm' */
45
+	{ 0x3c, 0x2e },	/* '<' => '.' */
45 46
 	{ 0x3e, 0x2f },	/* '>' => '/' */
46 47
 	{ 0x3f, 0x5c },	/* '?' => '\\' */
47 48
 	{ 0x40, 0x32 },	/* '@' => '2' */

+ 1
- 0
src/hci/keymap/keymap_it.c View File

@@ -19,6 +19,7 @@ struct key_mapping it_mapping[] __keymap = {
19 19
 	{ 0x2b, 0x5e },	/* '+' => '^' */
20 20
 	{ 0x2d, 0x27 },	/* '-' => '\'' */
21 21
 	{ 0x2f, 0x2d },	/* '/' => '-' */
22
+	{ 0x3c, 0x3b },	/* '<' => ';' */
22 23
 	{ 0x3e, 0x3a },	/* '>' => ':' */
23 24
 	{ 0x3f, 0x5f },	/* '?' => '_' */
24 25
 	{ 0x40, 0x22 },	/* '@' => '"' */

+ 0
- 1
src/hci/keymap/keymap_lt.c View File

@@ -12,5 +12,4 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
12 12
 
13 13
 /** "lt" keyboard mapping */
14 14
 struct key_mapping lt_mapping[] __keymap = {
15
-	{ 0x7f, 0x08 },	/* 0x7f => Ctrl-H */
16 15
 };

+ 0
- 1
src/hci/keymap/keymap_mt.c View File

@@ -17,5 +17,4 @@ struct key_mapping mt_mapping[] __keymap = {
17 17
 	{ 0x40, 0x22 },	/* '@' => '"' */
18 18
 	{ 0x5c, 0x23 },	/* '\\' => '#' */
19 19
 	{ 0x7c, 0x7e },	/* '|' => '~' */
20
-	{ 0x7f, 0x08 },	/* 0x7f => Ctrl-H */
21 20
 };

+ 1
- 1
src/hci/keymap/keymap_nl.c View File

@@ -20,7 +20,7 @@ struct key_mapping nl_mapping[] __keymap = {
20 20
 	{ 0x2d, 0x2f },	/* '-' => '/' */
21 21
 	{ 0x2f, 0x2d },	/* '/' => '-' */
22 22
 	{ 0x3b, 0x2b },	/* ';' => '+' */
23
-	{ 0x3c, 0x5d },	/* '<' => ']' */
23
+	{ 0x3c, 0x3b },	/* '<' => ';' */
24 24
 	{ 0x3e, 0x3a },	/* '>' => ':' */
25 25
 	{ 0x3f, 0x3d },	/* '?' => '=' */
26 26
 	{ 0x40, 0x22 },	/* '@' => '"' */

+ 1
- 0
src/hci/keymap/keymap_sg.c View File

@@ -24,6 +24,7 @@ struct key_mapping sg_mapping[] __keymap = {
24 24
 	{ 0x2b, 0x60 },	/* '+' => '`' */
25 25
 	{ 0x2d, 0x27 },	/* '-' => '\'' */
26 26
 	{ 0x2f, 0x2d },	/* '/' => '-' */
27
+	{ 0x3c, 0x3b },	/* '<' => ';' */
27 28
 	{ 0x3d, 0x5e },	/* '=' => '^' */
28 29
 	{ 0x3e, 0x3a },	/* '>' => ':' */
29 30
 	{ 0x3f, 0x5f },	/* '?' => '_' */

+ 1
- 0
src/hci/keymap/keymap_sr.c View File

@@ -21,6 +21,7 @@ struct key_mapping sr_mapping[] __keymap = {
21 21
 	{ 0x2b, 0x2a },	/* '+' => '*' */
22 22
 	{ 0x2d, 0x27 },	/* '-' => '\'' */
23 23
 	{ 0x2f, 0x2d },	/* '/' => '-' */
24
+	{ 0x3c, 0x3b },	/* '<' => ';' */
24 25
 	{ 0x3d, 0x2b },	/* '=' => '+' */
25 26
 	{ 0x3e, 0x3a },	/* '>' => ':' */
26 27
 	{ 0x3f, 0x5f },	/* '?' => '_' */

+ 0
- 1
src/hci/keymap/keymap_th.c View File

@@ -12,5 +12,4 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
12 12
 
13 13
 /** "th" keyboard mapping */
14 14
 struct key_mapping th_mapping[] __keymap = {
15
-	{ 0x7f, 0x08 },	/* 0x7f => Ctrl-H */
16 15
 };

+ 0
- 1
src/hci/keymap/keymap_ua.c View File

@@ -12,5 +12,4 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
12 12
 
13 13
 /** "ua" keyboard mapping */
14 14
 struct key_mapping ua_mapping[] __keymap = {
15
-	{ 0x7f, 0x08 },	/* 0x7f => Ctrl-H */
16 15
 };

+ 0
- 1
src/hci/keymap/keymap_uk.c View File

@@ -13,7 +13,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
13 13
 /** "uk" keyboard mapping */
14 14
 struct key_mapping uk_mapping[] __keymap = {
15 15
 	{ 0x22, 0x40 },	/* '"' => '@' */
16
-	{ 0x3c, 0x5c },	/* '<' => '\\' */
17 16
 	{ 0x40, 0x22 },	/* '@' => '"' */
18 17
 	{ 0x5c, 0x23 },	/* '\\' => '#' */
19 18
 	{ 0x7c, 0x7e },	/* '|' => '~' */

+ 1
- 0
src/hci/keymap/keymap_wo.c View File

@@ -36,6 +36,7 @@ struct key_mapping wo_mapping[] __keymap = {
36 36
 	{ 0x38, 0x5f },	/* '8' => '_' */
37 37
 	{ 0x3a, 0x4d },	/* ':' => 'M' */
38 38
 	{ 0x3b, 0x6d },	/* ';' => 'm' */
39
+	{ 0x3c, 0x2e },	/* '<' => '.' */
39 40
 	{ 0x3e, 0x2f },	/* '>' => '/' */
40 41
 	{ 0x40, 0x32 },	/* '@' => '2' */
41 42
 	{ 0x41, 0x51 },	/* 'A' => 'Q' */

+ 15
- 4
src/util/genkeymap.pl View File

@@ -172,15 +172,26 @@ sub translate_keymaps {
172 172
 	  or next;
173 173
       my $to_ascii = keysym_to_ascii ( $to->[$keymap]->[$keycode] )
174 174
 	  or next;
175
-      if ( ( $from_ascii != $to_ascii ) && $verbosity > 1 ) {
175
+      my $new_map = ( ! exists $map->{$from_ascii} );
176
+      my $update_map =
177
+	  ( $new_map || ( $keycode < $map->{$from_ascii}->{keycode} ) );
178
+      if ( ( $verbosity > 1 ) &&
179
+	   ( ( $from_ascii != $to_ascii ) ||
180
+	     ( $update_map && ! $new_map ) ) ) {
176 181
 	printf STDERR "In keymap %d: %s => %s%s\n", $keymap,
177 182
 	       ascii_to_name ( $from_ascii ), ascii_to_name ( $to_ascii ),
178
-	       ( $map->{$from_ascii} ? " (ignored)" : "" );
183
+	       ( $update_map ? ( $new_map ? "" : " (override)" )
184
+			     : " (ignored)" );
185
+      }
186
+      if ( $update_map ) {
187
+	$map->{$from_ascii} = {
188
+	  to_ascii => $to_ascii,
189
+	  keycode => $keycode,
190
+	};
179 191
       }
180
-      $map->{$from_ascii} ||= $to_ascii;
181 192
     }
182 193
   }
183
-  return $map;
194
+  return { map { $_ => $map->{$_}->{to_ascii} } keys %$map };
184 195
 }
185 196
 
186 197
 # Parse command-line options

Loading…
Cancel
Save