summaryrefslogtreecommitdiffstats
path: root/src/util/genkeymap.pl
diff options
context:
space:
mode:
authorMichael Brown2011-03-16 22:31:16 +0100
committerMichael Brown2011-03-16 22:43:56 +0100
commit48624cf94ab6ece5759ab71ad40c7e69f6430c23 (patch)
tree16eef504fdb3dda83177873b3227142e3438dec0 /src/util/genkeymap.pl
parent[uri] Avoid unused variable warning in gcc 4.6 (diff)
downloadipxe-48624cf94ab6ece5759ab71ad40c7e69f6430c23.tar.gz
ipxe-48624cf94ab6ece5759ab71ad40c7e69f6430c23.tar.xz
ipxe-48624cf94ab6ece5759ab71ad40c7e69f6430c23.zip
[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>
Diffstat (limited to 'src/util/genkeymap.pl')
-rwxr-xr-xsrc/util/genkeymap.pl19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/util/genkeymap.pl b/src/util/genkeymap.pl
index 89f14695..d556df27 100755
--- a/src/util/genkeymap.pl
+++ b/src/util/genkeymap.pl
@@ -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