From cdd491ef4af8baf94cb85b6906f6ba7c7da8d4f5 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 6 Mar 2003 14:25:27 +0000 Subject: let fix #2244, #2245, #2730 --- perl-install/harddrake/sound.pm | 25 ++++++++++++------------- perl-install/install_steps_interactive.pm | 5 ++++- perl-install/standalone/draksound | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 6e3904a9c..edbed5e01 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -141,13 +141,13 @@ sub get_alternative { } sub do_switch { - my ($old_driver, $new_driver) = @_; + my ($old_driver, $new_driver, $index) = @_; log::explanations("removing old $old_driver\n"); rooted("service sound stop") unless $blacklisted; rooted("service alsa stop") if $old_driver =~ /^snd-/ && !$blacklisted; unload($old_driver); # run_program("/sbin/modprobe -r $driver"); # just in case ... modules::remove_module($old_driver); # completed by the next add_alias() - modules::add_alias("sound-slot-$::i", $new_driver); + modules::add_alias("sound-slot-$index", $new_driver); modules::write_conf(); if ($new_driver =~ /^snd-/) { rooted("service alsa start") unless $blacklisted; @@ -160,7 +160,7 @@ sub do_switch { } sub switch { - my ($in, $device) = @_; + my ($in, $device, $index) = @_; my $driver = $device->{current_driver}; $driver ||= $device->{driver}; @@ -173,7 +173,7 @@ sub switch { N("There's no known OSS/ALSA alternative driver for your sound card (%s) which currently uses \"%s\"", $device->{description}, $driver), [ - &get_any_driver_entry($in, $driver, $device), + &get_any_driver_entry($in, $driver, $device, $index), ] ); } elsif ($in->ask_from_({ title => N("Sound configuration"), @@ -207,7 +207,7 @@ To use alsa, one can either use: val => N("Trouble shooting"), disabled => sub {}, clicked => sub { &trouble($in) } }, - &get_any_driver_entry($in, $driver, $device), + &get_any_driver_entry($in, $driver, $device, $index), ])) { return if $new_driver eq $driver; @@ -216,7 +216,7 @@ To use alsa, one can either use: It has been reported to oops the kernel on unloading.\n The new \"%s\" driver'll only be used on next bootstrap.", $driver, $new_driver)) if $blacklisted; my $wait = $in->wait_message(N("Please wait"), N("Please Wait... Applying the configuration")); - do_switch($driver, $new_driver); + do_switch($driver, $new_driver, $index); undef $wait; } } elsif ($driver =~ /^Bad:/) { @@ -228,7 +228,7 @@ The new \"%s\" driver'll only be used on next bootstrap.", $driver, $new_driver) $in->ask_from(N("No known driver"), N("There's no known driver for your sound card (%s)", $device->{description}), - [ &get_any_driver_entry($in, $driver, $device) ]); + [ &get_any_driver_entry($in, $driver, $device, $index) ]); } else { $in->ask_warn(N("Unkown driver"), N("Error: The \"%s\" driver for your sound card is unlisted"), @@ -238,8 +238,7 @@ The new \"%s\" driver'll only be used on next bootstrap.", $driver, $new_driver) } sub config { - my ($in, $device) = @_; - switch($in, $device); + switch(@_); } @@ -269,7 +268,7 @@ initlevel 3 } sub choose_any_driver { - my ($in, $driver, $card) = @_; + my ($in, $driver, $card, $index) = @_; my $old_driver = $driver; if ($in->ask_from(N("Choosing an arbitratry driver"), formatAlaTeX(N("If you really think that you know which driver is the right one for your card @@ -281,15 +280,15 @@ The current driver for your \"%s\" sound card is \"%s\" ", $card, $driver)), ] )) { - do_switch($old_driver, $driver); + do_switch($old_driver, $driver, $index); } } sub get_any_driver_entry { - my ($in, $driver, $device) = @_; + my ($in, $driver, $device, $index) = @_; { val => N("Let me pick any driver"), disabled => sub {}, - clicked => sub { &choose_any_driver($in, $driver, $device->{description}); goto end } + clicked => sub { &choose_any_driver($in, $driver, $device->{description}, $index); goto end } } } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index af387c92d..10e340b0b 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -935,7 +935,9 @@ sub summary { my @sound_cards = detect_devices::getSoundDevices(); + my $sound_index = 0; foreach my $device (@sound_cards) { + my $own_sound_index = $sound_index; push @l, { group => N("Hardware"), label => N("Sound card"), @@ -944,9 +946,10 @@ sub summary { }, clicked => sub { require harddrake::sound; - harddrake::sound::config($o, $device) + harddrake::sound::config($o, $device, $own_sound_index) }, }; + $sound_index++; } if (!@sound_cards && ($o->{compssUsersChoice}{GAMES} || $o->{compssUsersChoice}{AUDIO})) { diff --git a/perl-install/standalone/draksound b/perl-install/standalone/draksound index 5f27779fb..7e71af88d 100755 --- a/perl-install/standalone/draksound +++ b/perl-install/standalone/draksound @@ -40,7 +40,7 @@ if (@devices) { my $driver = modules::get_alias("sound-slot-$::i"); $driver = modules::get_alias($driver) if $driver =~ /sound-card/; # alsaconf ... $_->{current_driver} = $driver if $driver; - harddrake::sound::config($in, $_); + harddrake::sound::config($in, $_, $::i); } modules::probe_category('multimedia/sound'); } else { $in->ask_warn(N("No Sound Card detected!"), -- cgit v1.2.1