diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-04-01 13:16:25 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-04-01 13:16:25 +0000 |
commit | 33431ad9a921d8f2fd04d66a4a36175a1816ffb9 (patch) | |
tree | 14cec80341b9032326b3efa638b574ecaf83c0a4 | |
parent | 54b42f3a18dc280468a846de79dc750887dc34eb (diff) | |
download | drakx-backup-do-not-use-33431ad9a921d8f2fd04d66a4a36175a1816ffb9.tar drakx-backup-do-not-use-33431ad9a921d8f2fd04d66a4a36175a1816ffb9.tar.gz drakx-backup-do-not-use-33431ad9a921d8f2fd04d66a4a36175a1816ffb9.tar.bz2 drakx-backup-do-not-use-33431ad9a921d8f2fd04d66a4a36175a1816ffb9.tar.xz drakx-backup-do-not-use-33431ad9a921d8f2fd04d66a4a36175a1816ffb9.zip |
move harddrake::sound $index param in hash and pass only the hash ref around
functions
-rw-r--r-- | perl-install/harddrake/sound.pm | 59 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 4 | ||||
-rwxr-xr-x | perl-install/standalone/draksound | 1 |
3 files changed, 30 insertions, 34 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 237599ae3..eabccd62b 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -142,17 +142,18 @@ sub get_alternative { sub do_switch { my ($old_driver, $new_driver, $index) = @_; + my $wait = $in->wait_message(N("Please wait"), N("Please Wait... Applying the configuration")); 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 ... + 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-$index", $new_driver); modules::write_conf(); - if ($new_driver =~ /^snd-/) { + if ($new_driver =~ /^snd-/) { # new driver is an alsa one rooted("service alsa start") unless $blacklisted; rooted("/sbin/chkconfig --add alsa"); - load($new_driver); # service alsa is buggy + load($new_driver); # service alsa is buggy } else { rooted("/sbin/chkconfig --del alsa") } log::explanations("loading new $new_driver\n"); rooted("/sbin/chkconfig --add sound"); # just in case ... @@ -160,9 +161,8 @@ sub do_switch { } sub switch { - my ($in, $device, $index) = @_; - my $driver = $device->{current_driver}; - $driver ||= $device->{driver}; + my ($in, $device) = @_; + my $driver = $device->{current_driver} || $device->{driver}; foreach (@blacklist) { $blacklisted = 1 if $driver eq $_ } my $alternative = get_alternative($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, $index), + &get_any_driver_entry($in, $driver, $device), ] ); } 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, $index), + &get_any_driver_entry($in, $driver, $device), ])) { return if $new_driver eq $driver; @@ -215,9 +215,7 @@ To use alsa, one can either use: $in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n 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, $index); - undef $wait; + do_switch($driver, $new_driver, $device->{sound_slot_index}); } } elsif ($driver =~ /^Bad:/) { $driver =~ s/^Bad://; @@ -228,7 +226,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, $index) ]); + [ &get_any_driver_entry($in, $driver, $device) ]); } else { $in->ask_warn(N("Unkown driver"), N("Error: The \"%s\" driver for your sound card is unlisted"), @@ -267,28 +265,25 @@ initlevel 3 "))); } -sub choose_any_driver { - 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 -you can pick one in the above list. - -The current driver for your \"%s\" sound card is \"%s\" ", $card, $driver)), - [ - { label => N("Driver:"), val => \$driver, list => [ category2modules("multimedia/sound") ], type => 'combo', default => $driver, sort =>1, separator => '|' }, - ] - )) { - do_switch($old_driver, $driver, $index); - goto end; - } -} - sub get_any_driver_entry { - my ($in, $driver, $device, $index) = @_; - { + my ($in, $driver, $device) = @_; + +{ val => N("Let me pick any driver"), disabled => sub {}, - clicked => sub { &choose_any_driver($in, $driver, $device->{description}, $index) } + clicked => sub { + 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 +you can pick one in the above list. + +The current driver for your \"%s\" sound card is \"%s\" ", $device->{description}, $driver)), + [ + { label => N("Driver:"), val => \$driver, list => [ category2modules("multimedia/sound") ], type => 'combo', default => $driver, sort =>1, separator => '|' }, + ] + )) { + do_switch($old_driver, $driver, $device->{sound_slot_index}); + goto end; + } + } } } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index aa2869585..e11105d25 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -946,7 +946,6 @@ sub summary { my $sound_index = 0; foreach my $device (@sound_cards) { - my $own_sound_index = $sound_index; push @l, { group => N("Hardware"), label => N("Sound card"), @@ -955,7 +954,8 @@ sub summary { }, clicked => sub { require harddrake::sound; - harddrake::sound::config($o, $device, $own_sound_index) + $device->{sound_slot_index} = $sound_index; + harddrake::sound::config($o, $device); }, }; $sound_index++; diff --git a/perl-install/standalone/draksound b/perl-install/standalone/draksound index 7e71af88d..1e4f299f6 100755 --- a/perl-install/standalone/draksound +++ b/perl-install/standalone/draksound @@ -40,6 +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; + $_->{sound_slot_index} = $::i; harddrake::sound::config($in, $_, $::i); } modules::probe_category('multimedia/sound'); } else { |