summaryrefslogtreecommitdiffstats
path: root/data/sysrom/kbd/keymap.pl
diff options
context:
space:
mode:
Diffstat (limited to 'data/sysrom/kbd/keymap.pl')
-rwxr-xr-xdata/sysrom/kbd/keymap.pl14
1 files changed, 10 insertions, 4 deletions
diff --git a/data/sysrom/kbd/keymap.pl b/data/sysrom/kbd/keymap.pl
index a5f50af..69c5887 100755
--- a/data/sysrom/kbd/keymap.pl
+++ b/data/sysrom/kbd/keymap.pl
@@ -1,5 +1,7 @@
#!/usr/bin/perl
+use Encode;
+
for ($i = 0; $i < 256; $i++) {
$keytype[$i] = "KEY_IGNORE";
$keydata[$i] = [];
@@ -8,12 +10,15 @@ for ($i = 0; $i < 256; $i++) {
$max_nontriv_key = -1;
while (defined($line = <>)) {
- $line =~ s/^(|.*[^\+])\#.*$/\1/;
+ chomp $line;
+ $line =~ s/^(|.*?[^\+])\#.*$/\1/;
+
+ $line = Encode::decode_utf8($line);
- if ($line =~ /^([0-9a-f]+)\s+(\S+)\s+(.*)$/i) {
+ if ($line =~ /^([0-9a-f]+)\s+(\S+)(|\s+(.*))$/i) {
$key = hex $1;
$type = $2;
- $data = $3;
+ $data = $4;
$keytype[$key] = "KEY_\U$type";
@@ -28,7 +33,8 @@ while (defined($line = <>)) {
} elsif ($d =~ /^([0-9]+)$/) {
$d = $1 + 0;
} else {
- $d = ord $d;
+ printf STDERR "Key %02x: unknown string: $d\n", $key;
+ $d = 0;
}
push(@datan, $d);
}