summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-02-10 12:35:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-02-10 12:35:14 +0000
commitfc2ade7c796e8cf29c19fce5815a28e01f1fd199 (patch)
tree46742f82e0b2d0571237c246d2e5b82f07b44ae4 /perl-install
parent2182b99b2a4c2382389a6847cc47cde07864301c (diff)
downloaddrakx-fc2ade7c796e8cf29c19fce5815a28e01f1fd199.tar
drakx-fc2ade7c796e8cf29c19fce5815a28e01f1fd199.tar.gz
drakx-fc2ade7c796e8cf29c19fce5815a28e01f1fd199.tar.bz2
drakx-fc2ade7c796e8cf29c19fce5815a28e01f1fd199.tar.xz
drakx-fc2ade7c796e8cf29c19fce5815a28e01f1fd199.zip
rewrite & cleanup. Now works with kernel 2.6, don't know exactly why...
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/keyboard.pm37
1 files changed, 17 insertions, 20 deletions
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm
index e53e57ae5..aa1ca9234 100644
--- a/perl-install/keyboard.pm
+++ b/perl-install/keyboard.pm
@@ -384,31 +384,28 @@ sub from_usb() {
sub load {
my ($keymap) = @_;
- return if $::testing || c::kernel_version() =~ /^\Q2.6/;
-
- my ($magic, @keymaps) = unpack "I i" . c::MAX_NR_KEYMAPS() . "a*", $keymap;
- $keymap = pop @keymaps;
+ return if $::testing;
+ my ($magic, $tables_given, @tables) = common::unpack_with_refs('I' .
+ 'i' . c::MAX_NR_KEYMAPS() .
+ 's' . c::NR_KEYS() . '*',
+ $keymap);
$magic != $KMAP_MAGIC and die "failed to read kmap magic";
sysopen(my $F, "/dev/console", 2) or die "failed to open /dev/console: $!";
- my $count = 0;
- foreach (0 .. c::MAX_NR_KEYMAPS() - 1) {
- $keymaps[$_] or next;
-
- my @keymap = unpack "s" . c::NR_KEYS() . "a*", $keymap;
- $keymap = pop @keymap;
-
- my $key = -1;
- foreach my $value (@keymap) {
- $key++;
- c::KTYP($value) != c::KT_SPEC() or next;
- ioctl($F, c::KDSKBENT(), pack("CCS", $_, $key, $value)) or die "keymap ioctl failed ($_ $key $value): $!";
- }
- $count++;
- }
- #- log::l("loaded $count keymap tables");
+ my $i_tables = 0;
+ each_index {
+ my $table_index = $::i;
+ if (!$_) {
+ #- deallocate table
+ ioctl($F, c::KDSKBENT(), pack("CCS", $table_index, 0, c::K_NOSUCHMAP())) or die "removing table $table_index failed: $!";
+ } else {
+ each_index {
+ ioctl($F, c::KDSKBENT(), pack("CCS", $table_index, $::i, $_)) or die "keymap ioctl failed ($table_index $::i $_): $!";
+ } @{$tables[$i_tables++]};
+ }
+ } @$tables_given;
}
sub keyboard2full_xkb {