diff options
author | Olivier Blin <oblin@mandriva.org> | 2006-03-03 17:41:49 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2006-03-03 17:41:49 +0000 |
commit | bc8b97aec2a8ee2823abcb171b635fa9db21087f (patch) | |
tree | 97fd5ffb3b9b9e7ae5fd722eae5bb73b073bb0fe | |
parent | 42ca53c6e4ec502c035d324a62475e8ba5aad165 (diff) | |
download | drakx-bc8b97aec2a8ee2823abcb171b635fa9db21087f.tar drakx-bc8b97aec2a8ee2823abcb171b635fa9db21087f.tar.gz drakx-bc8b97aec2a8ee2823abcb171b635fa9db21087f.tar.bz2 drakx-bc8b97aec2a8ee2823abcb171b635fa9db21087f.tar.xz drakx-bc8b97aec2a8ee2823abcb171b635fa9db21087f.zip |
backport laptop/bluetooth/firewire autoconf fixes/features from HEAD
-rw-r--r-- | perl-install/harddrake/autoconf.pm | 30 | ||||
-rw-r--r-- | perl-install/harddrake/data.pm | 2 | ||||
-rwxr-xr-x | perl-install/standalone/service_harddrake | 26 |
3 files changed, 51 insertions, 7 deletions
diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm index b451286df..09ab89e55 100644 --- a/perl-install/harddrake/autoconf.pm +++ b/perl-install/harddrake/autoconf.pm @@ -43,4 +43,34 @@ sub pcmcia { }); } +sub bluetooth { + my ($enable) = @_; +# if ($enable) { +# require do_pkgs; +# my $do_pkgs = do_pkgs_standalone->new; +# $do_pkgs->ensure_is_installed("bluez-utils", "/usr/bin/rfcomm"); +# } + require services; + services::set_status("bluetooth", $enable); +} + +sub laptop { + my ($on_laptop) = @_; +# require do_pkgs; +# my $do_pkgs = do_pkgs_standalone->new; +# if ($on_laptop) { +# $do_pkgs->ensure_is_installed("cpufreq", "/etc/rc.d/init.d/cpufreq"); +# $do_pkgs->ensure_is_installed("apmd", "/usr/bin/apm"); +# $do_pkgs->ensure_is_installed("hotkeys", "/usr/bin/hotkeys"); +# $do_pkgs->ensure_is_installed("laptop-mode-tools", "/usr/sbin/laptop_mode"); +# } else { +# $do_pkgs->ensure_is_installed("numlock", "/etc/rc.d/init.d/numlock"); +# } + require services; + services::set_status("cpufreq", $on_laptop); + services::set_status("apmd", $on_laptop); + services::set_status("laptop-mode", $on_laptop); + services::set_status("numlock", !$on_laptop); +} + 1; diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm index d9b83195a..274856822 100644 --- a/perl-install/harddrake/data.pm +++ b/perl-install/harddrake/data.pm @@ -257,7 +257,7 @@ our @tree = icon => "hw_network.png", configurator => "", detector => sub { f(modules::probe_category('bus/bluetooth')) }, - checked_on_boot => 0, + checked_on_boot => 1, }, { diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index 6c24699ef..725c8062a 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -34,15 +34,23 @@ $last_boot_config .= '_X11' if $invert_do_it; my $modules_conf = modules::any_conf->read; -# autoreconfigure the mouse on major kernel change: -my $prev_kernel = { getVarsFromSh("$hw_sysconfdir/kernel") }->{KERNEL}; +my $isLaptop = detect_devices::isLaptop(); my $curr_kernel = c::kernel_version(); $curr_kernel =~ s/(^\d+\.\d+).*/$1/; -setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $curr_kernel }); -if ($curr_kernel ne $prev_kernel) { + +my %previous_kernel_config = getVarsFromSh("$hw_sysconfdir/kernel"); +setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $curr_kernel, IS_LAPTOP => bool2text($isLaptop) }); + +# autoreconfigure the mouse on major kernel change: +if ($curr_kernel ne $previous_kernel_config{KERNEL}) { log::explanations("Autoconfiguring mouse since we switched between 2.4.x and 2.6.x kernels"); harddrake::autoconf::mouse_conf($modules_conf); } +# autoreconfigure laptop-dependent services when switching from laptop to desktop, and vice versa +if (!exists $previous_kernel_config{IS_LAPTOP} || $force || $isLaptop ne to_bool($previous_kernel_config{IS_LAPTOP})) { + log::explanations("Autoconfiguring laptop tools since we switched between laptop and desktop systems"); + harddrake::autoconf::laptop($isLaptop); +} if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) { if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") } map { ("video/$_", "char/$_", "char/drm/$_") } qw(NVdriver nvidia.o nvidia.o.gz nvidia.ko nvidia.ko.gz)) { @@ -111,10 +119,14 @@ foreach my $hw_class (@harddrake::data::tree) { log::explanations("removed $Ident: " . harddrake::data::custom_id($oldconfig->{$_}, $item)) foreach @was_removed; log::explanations("added $Ident: " . harddrake::data::custom_id($ID{$_}, $item)) foreach @added; - modules::load_and_configure($modules_conf, 'ohci1394') if $Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @added; + if ($Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @ID{@added}) { + modules::load_and_configure($modules_conf, 'ohci1394'); + $modules_conf->write; + } + @added || @was_removed or next; - next if $Ident eq 'MOUSE' && $curr_kernel ne $prev_kernel; + next if $Ident eq 'MOUSE' && $curr_kernel ne $previous_kernel_config{KERNEL}; my @configurator_pool; if (harddrake::data::is_removable($Ident)) { @@ -160,6 +172,8 @@ foreach my $hw_class (@harddrake::data::tree) { $modules_conf->write; modules::load(difference2(\@new_drivers, \@old_drivers)); next; + } elsif ($Ident eq "BLUETOOTH") { + harddrake::autoconf::bluetooth(scalar keys %ID); } elsif ($Ident eq "PCMCIA_CONTROLLER") { harddrake::autoconf::pcmcia(keys %ID ? first(values(%ID))->{driver} : ''); } elsif ($Ident eq "USB_CONTROLLER") { |