mirror of https://github.com/ipxe/ipxe.git
[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>pull/1/head
parent
dbb27c9c3b
commit
48624cf94a
|
@ -16,6 +16,7 @@ struct key_mapping al_mapping[] __keymap = {
|
|||
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
|
||||
{ 0x22, 0x7b }, /* '"' => '{' */
|
||||
{ 0x27, 0x5b }, /* '\'' => '[' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
|
||||
|
|
|
@ -16,7 +16,7 @@ struct key_mapping cz_mapping[] __keymap = {
|
|||
{ 0x2d, 0x3d }, /* '-' => '=' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x31, 0x2b }, /* '1' => '+' */
|
||||
{ 0x3c, 0x5c }, /* '<' => '\\' */
|
||||
{ 0x3c, 0x2c }, /* '<' => ',' */
|
||||
{ 0x3e, 0x2e }, /* '>' => '.' */
|
||||
{ 0x3f, 0x2d }, /* '?' => '-' */
|
||||
{ 0x5d, 0x29 }, /* ']' => ')' */
|
||||
|
|
|
@ -25,6 +25,7 @@ struct key_mapping de_mapping[] __keymap = {
|
|||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3a, 0x7b }, /* ':' => '{' */
|
||||
{ 0x3b, 0x5b }, /* ';' => '[' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3d, 0x27 }, /* '=' => '\'' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
|
|
|
@ -19,6 +19,7 @@ struct key_mapping dk_mapping[] __keymap = {
|
|||
{ 0x2b, 0x60 }, /* '+' => '`' */
|
||||
{ 0x2d, 0x2b }, /* '-' => '+' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
|
|
|
@ -18,6 +18,7 @@ struct key_mapping es_mapping[] __keymap = {
|
|||
{ 0x2a, 0x28 }, /* '*' => '(' */
|
||||
{ 0x2d, 0x27 }, /* '-' => '\'' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
|
|
|
@ -18,6 +18,7 @@ struct key_mapping et_mapping[] __keymap = {
|
|||
{ 0x2a, 0x28 }, /* '*' => '(' */
|
||||
{ 0x2d, 0x2b }, /* '-' => '+' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
|
@ -25,4 +26,5 @@ struct key_mapping et_mapping[] __keymap = {
|
|||
{ 0x5e, 0x26 }, /* '^' => '&' */
|
||||
{ 0x5f, 0x3f }, /* '_' => '?' */
|
||||
{ 0x7c, 0x2a }, /* '|' => '*' */
|
||||
{ 0x7f, 0x1b }, /* 0x7f => 0x1b */
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@ struct key_mapping fi_mapping[] __keymap = {
|
|||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3a, 0x5c }, /* ':' => '\\' */
|
||||
{ 0x3b, 0x7c }, /* ';' => '|' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3d, 0x27 }, /* '=' => '\'' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
|
|
|
@ -42,6 +42,7 @@ struct key_mapping fr_mapping[] __keymap = {
|
|||
{ 0x39, 0x2f }, /* '9' => '/' */
|
||||
{ 0x3a, 0x4d }, /* ':' => 'M' */
|
||||
{ 0x3b, 0x6d }, /* ';' => 'm' */
|
||||
{ 0x3c, 0x2e }, /* '<' => '.' */
|
||||
{ 0x3e, 0x2f }, /* '>' => '/' */
|
||||
{ 0x3f, 0x5c }, /* '?' => '\\' */
|
||||
{ 0x40, 0x32 }, /* '@' => '2' */
|
||||
|
|
|
@ -19,6 +19,7 @@ struct key_mapping it_mapping[] __keymap = {
|
|||
{ 0x2b, 0x5e }, /* '+' => '^' */
|
||||
{ 0x2d, 0x27 }, /* '-' => '\'' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
|
|
|
@ -12,5 +12,4 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
|
|||
|
||||
/** "lt" keyboard mapping */
|
||||
struct key_mapping lt_mapping[] __keymap = {
|
||||
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
|
||||
};
|
||||
|
|
|
@ -17,5 +17,4 @@ struct key_mapping mt_mapping[] __keymap = {
|
|||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
{ 0x5c, 0x23 }, /* '\\' => '#' */
|
||||
{ 0x7c, 0x7e }, /* '|' => '~' */
|
||||
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ struct key_mapping nl_mapping[] __keymap = {
|
|||
{ 0x2d, 0x2f }, /* '-' => '/' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3b, 0x2b }, /* ';' => '+' */
|
||||
{ 0x3c, 0x5d }, /* '<' => ']' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x3d }, /* '?' => '=' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
|
|
|
@ -24,6 +24,7 @@ struct key_mapping sg_mapping[] __keymap = {
|
|||
{ 0x2b, 0x60 }, /* '+' => '`' */
|
||||
{ 0x2d, 0x27 }, /* '-' => '\'' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3d, 0x5e }, /* '=' => '^' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
|
|
|
@ -21,6 +21,7 @@ struct key_mapping sr_mapping[] __keymap = {
|
|||
{ 0x2b, 0x2a }, /* '+' => '*' */
|
||||
{ 0x2d, 0x27 }, /* '-' => '\'' */
|
||||
{ 0x2f, 0x2d }, /* '/' => '-' */
|
||||
{ 0x3c, 0x3b }, /* '<' => ';' */
|
||||
{ 0x3d, 0x2b }, /* '=' => '+' */
|
||||
{ 0x3e, 0x3a }, /* '>' => ':' */
|
||||
{ 0x3f, 0x5f }, /* '?' => '_' */
|
||||
|
|
|
@ -12,5 +12,4 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
|
|||
|
||||
/** "th" keyboard mapping */
|
||||
struct key_mapping th_mapping[] __keymap = {
|
||||
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
|
||||
};
|
||||
|
|
|
@ -12,5 +12,4 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
|
|||
|
||||
/** "ua" keyboard mapping */
|
||||
struct key_mapping ua_mapping[] __keymap = {
|
||||
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
|
||||
};
|
||||
|
|
|
@ -13,7 +13,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
|
|||
/** "uk" keyboard mapping */
|
||||
struct key_mapping uk_mapping[] __keymap = {
|
||||
{ 0x22, 0x40 }, /* '"' => '@' */
|
||||
{ 0x3c, 0x5c }, /* '<' => '\\' */
|
||||
{ 0x40, 0x22 }, /* '@' => '"' */
|
||||
{ 0x5c, 0x23 }, /* '\\' => '#' */
|
||||
{ 0x7c, 0x7e }, /* '|' => '~' */
|
||||
|
|
|
@ -36,6 +36,7 @@ struct key_mapping wo_mapping[] __keymap = {
|
|||
{ 0x38, 0x5f }, /* '8' => '_' */
|
||||
{ 0x3a, 0x4d }, /* ':' => 'M' */
|
||||
{ 0x3b, 0x6d }, /* ';' => 'm' */
|
||||
{ 0x3c, 0x2e }, /* '<' => '.' */
|
||||
{ 0x3e, 0x2f }, /* '>' => '/' */
|
||||
{ 0x40, 0x32 }, /* '@' => '2' */
|
||||
{ 0x41, 0x51 }, /* 'A' => 'Q' */
|
||||
|
|
|
@ -172,15 +172,26 @@ sub translate_keymaps {
|
|||
or next;
|
||||
my $to_ascii = keysym_to_ascii ( $to->[$keymap]->[$keycode] )
|
||||
or next;
|
||||
if ( ( $from_ascii != $to_ascii ) && $verbosity > 1 ) {
|
||||
my $new_map = ( ! exists $map->{$from_ascii} );
|
||||
my $update_map =
|
||||
( $new_map || ( $keycode < $map->{$from_ascii}->{keycode} ) );
|
||||
if ( ( $verbosity > 1 ) &&
|
||||
( ( $from_ascii != $to_ascii ) ||
|
||||
( $update_map && ! $new_map ) ) ) {
|
||||
printf STDERR "In keymap %d: %s => %s%s\n", $keymap,
|
||||
ascii_to_name ( $from_ascii ), ascii_to_name ( $to_ascii ),
|
||||
( $map->{$from_ascii} ? " (ignored)" : "" );
|
||||
( $update_map ? ( $new_map ? "" : " (override)" )
|
||||
: " (ignored)" );
|
||||
}
|
||||
if ( $update_map ) {
|
||||
$map->{$from_ascii} = {
|
||||
to_ascii => $to_ascii,
|
||||
keycode => $keycode,
|
||||
};
|
||||
}
|
||||
$map->{$from_ascii} ||= $to_ascii;
|
||||
}
|
||||
}
|
||||
return $map;
|
||||
return { map { $_ => $map->{$_}->{to_ascii} } keys %$map };
|
||||
}
|
||||
|
||||
# Parse command-line options
|
||||
|
|
Loading…
Reference in New Issue