diff options
Diffstat (limited to 'perl-install/harddrake/sound.pm')
| -rw-r--r-- | perl-install/harddrake/sound.pm | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 94f3ac5f9..5cf58593f 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -8,6 +8,7 @@ package harddrake::sound; # o pci cards: snd-als4000, snd-es968, snd-hdsp # o isa cards: snd-azt2320, snd-cs4231, snd-cs4236, # snd-dt0197h, snd-korg1212, snd-rme32 +# o pcmcia cards: snd-vxp440 snd-vxpocket # TODO: # o ensure sound isn't user (either dsp/midi/sequencer/mixer) @@ -26,14 +27,20 @@ my $has_nvaudio = -x '/lib/modules/' . c::kernel_version() . '/'; our %alsa2oss = ( + if_(arch() =~ /ppc/, "snd-powermac" => [ "dmasound_pmac" ]), + if_(arch() =~ /sparc/, + "snd-sun-amd7930" => [ "unknown" ], + "snd-sun-cs4231" => [ "unknown" ], + ), "snd-ad1816a" => [ "ad1816" ], # isa "snd-ad1848" => [ "ad1848", "pss" ], # isa "snd-ali5451" => [ "trident" ], "snd-als100" => [ "sb" ], # isa "snd-als4000" => [ "unknown" ], - "snd-au8810" => [ "unknown" ], - "snd-au8820" => [ "unknown" ], - "snd-au8830" => [ "unknown" ], + "snd-atiixp" => [ "unknown" ], + "snd-au8810" => [ "unknown" ], + "snd-au8820" => [ "unknown" ], + "snd-au8830" => [ "unknown" ], "snd-azt2320" => [ "unknown" ], # isa "snd-azt3328" => [ "unknown" ], # isa "snd-bt87x" => [ "btaudio" ], @@ -45,6 +52,7 @@ our %alsa2oss = "snd-cs4281" => [ "cs4281" ], "snd-cs46xx" => [ "cs46xx" ], "snd-dt0197h" => [ "unknown" ], # isa + "snd-dt019x" => [ "unknown" ], # isa "snd-emu10k1" => [ "audigy", "emu10k1" ], "snd-ens1370" => [ "es1370" ], "snd-ens1371" => [ "es1371" ], @@ -57,16 +65,20 @@ our %alsa2oss = "snd-gusclassic" => [ "gus" ], # isa "snd-gusextreme" => [ "gus" ], # isa "snd-gusmax" => [ "gus" ], # isa - "snd-hdsp" => [ "unknown" ], + "snd-hdsp" => [ "unknown" ], "snd-ice1712" => [ "unknown" ], # isa "snd-ice1724" => [ "unknown" ], # isa "snd-intel8x0" => [ "ali5455", "i810_audio", "nvaudio" ], "snd-interwave" => [ "gus" ], # isa + "snd-interwave-stb" => [ "unknown" ], # isa "snd-korg1212" => [ "unknown" ], # isa "snd-maestro3" => [ "maestro3" ], + "snd-mixart" => [ "unknown" ], "snd-mpu401" => [ "mpu401" ], "snd-nm256" => [ "nm256_audio" ], "snd-opl3sa2" => [ "opl3", "opl3sa", "opl3sa2" ], # isa + "snd-opti92x-ad1848" => [ "unknown" ], # isa + "snd-opti92x-cs4231" => [ "unknown" ], # isa "snd-opti93x" => [ "mad16" ], "snd-rme32" => [ "unknown" ], # isa "snd-rme96" => [ "rme96xx" ], # pci @@ -76,22 +88,27 @@ our %alsa2oss = "snd-sbawe" => [ "awe_wave" ], "snd-sgalaxy" => [ "sgalaxy" ], # isa "snd-sonicvibes" => [ "sonicvibes" ], + "snd-sscape" => [ "sscape" ], # isa "snd-trident" => [ "trident" ], "snd-usb-audio" => [ "audio" ], # usb "snd-via82xx" => [ "via82cxxx_audio" ], + "snd-vx222" => [ "unknown" ], + "snd-vxp440" => [ "unknown" ], # pcmcia + "snd-vxpocket" => [ "unknown" ], # pcmcia "snd-wavefront" => [ "wavefront" ], # isa - "snd-ymfpci" => [ "ymfpci" ] + "snd-ymfpci" => [ "ymfpci" ], ); our %oss2alsa = ( + if_(arch() =~ /ppc/, "dmasound_pmac" => [ "snd-powermac" ]), "ad1816" => [ "snd-ad1816a" ], "ad1848" => [ "snd-ad1848", "snd-cs4236" ], "ad1889" => [ "unknown" ], "ali5455" => [ "snd-intel8x0" ], "audigy" => [ "snd-emu10k1" ], - "audio" => [ "snd-usb-audio" ], # usb + "audio" => [ "snd-usb-audio" ], # usb "awe_wave" => [ "snd-sbawe" ], "btaudio" => [ "snd-bt87x" ], "cmpci" => [ "snd-cmipci" ], @@ -117,17 +134,17 @@ our %oss2alsa = "opl3sa" => [ "snd-opl3sa2" ], "opl3sa2" => [ "snd-opl3sa2" ], "pas2" => [ "unknown" ], - "pss" => [ "snd-ad1848" ], + "pss" => [ "snd-ad1848" ], "rme96xx" => [ "snd-rme96", "snd-rme9652" ], "sam9407" => [ "unknown" ], "sb" => [ "snd-als100", "snd-cmi8330", "snd-es1688", "snd-es18xx", "snd-es968", "snd-sb8", "snd-sb16" ], "sgalaxy" => [ "snd-sgalaxy" ], "sonicvibes" => [ "snd-sonicvibes" ], - "sscape" => [ "snd-sb16" ], + "sscape" => [ "snd-sb16", "snd-sscape" ], "trident" => [ "snd-ali5451", "snd-trident" ], "via82cxxx_audio" => [ "snd-via82xx" ], "wavefront" => [ "snd-wavefront" ], - "ymfpci" => [ "snd-ymfpci" ] + "ymfpci" => [ "snd-ymfpci" ], ); my @blacklist = qw(cs46xx cs4281); @@ -137,7 +154,10 @@ sub rooted { run_program::rooted($::prefix, @_) } sub unload { modules::unload(@_) if $::isStandalone || $blacklisted } -sub load { modules::load(@_) if $::isStandalone || $blacklisted } +sub load { + my ($modules_conf, $name) = @_; + modules::load_and_configure($modules_conf, $name) if $::isStandalone || $blacklisted; +} sub get_alternative { my ($driver) = @_; @@ -145,7 +165,7 @@ sub get_alternative { } sub do_switch { - my ($in, $old_driver, $new_driver, $index) = @_; + my ($in, $modules_conf, $old_driver, $new_driver, $index) = @_; return if $old_driver eq $new_driver; my $_wait = $in->wait_message(N("Please wait"), N("Please Wait... Applying the configuration")); log::explanations("removing old $old_driver\n"); @@ -154,14 +174,14 @@ sub do_switch { 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); - modules::set_sound_slot("sound-slot-$index", $new_driver); - modules::write_conf(); + $modules_conf->remove_module($old_driver); + $modules_conf->set_sound_slot("sound-slot-$index", $new_driver); + $modules_conf->write; if ($new_driver =~ /^snd-/) { # new driver is an alsa one - $in->do_pkgs->ensure_is_installed('alsa-utils', '/usr/sbin/alsactl'); + $in->do_pkgs->ensure_binary_is_installed('alsa-utils', 'alsactl'); rooted("service alsa start") if $::isStandalone && !$blacklisted; rooted("/sbin/chkconfig --add alsa") if $::isStandalone; - load($new_driver) if $::isStandalone; # service alsa is buggy + load($modules_conf, $new_driver) if $::isStandalone; # 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 ... @@ -169,7 +189,7 @@ sub do_switch { } sub switch { - my ($in, $device) = @_; + my ($in, $modules_conf, $device) = @_; my $driver = $device->{current_driver} || $device->{driver}; foreach (@blacklist) { $blacklisted = 1 if $driver eq $_ } @@ -187,7 +207,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, $modules_conf, $driver, $device), ] ); } elsif ($in->ask_from_({ title => N("Sound configuration"), @@ -218,15 +238,15 @@ 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, $modules_conf, $driver, $device), ])) { return if $new_driver eq $device->{current_driver}; log::explanations("switching audio driver from '" . $device->{current_driver} . "' to '$new_driver'\n"); $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.", $device->{current_driver}, $new_driver)) if $blacklisted; - do_switch($in, $device->{current_driver}, $new_driver, $device->{sound_slot_index}); +The new \"%s\" driver will only be used on next bootstrap.", $device->{current_driver}, $new_driver)) if $blacklisted; + do_switch($in, $modules_conf, $device->{current_driver}, $new_driver, $device->{sound_slot_index}); $device->{current_driver} = $new_driver; } } elsif ($driver =~ /^Bad:/) { @@ -238,7 +258,7 @@ The new \"%s\" driver'll only be used on next bootstrap.", $device->{current_dri $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, $modules_conf, $driver, $device) ]); } else { $in->ask_warn(N("Unknown driver"), N("Error: The \"%s\" driver for your sound card is unlisted", @@ -248,14 +268,17 @@ The new \"%s\" driver'll only be used on next bootstrap.", $device->{current_dri } sub config { - switch(@_); + my ($in, $modules_conf, $device) = @_; + switch($in, $modules_conf, $device); } sub trouble { my ($in) = @_; $in->ask_warn(N("Sound trouble shooting"), - formatAlaTeX(N("The classic bug sound tester is to run the following commands: + formatAlaTeX( + #-PO: keep the double empty lines between sections, this is formatted a la LaTeX + N("The classic bug sound tester is to run the following commands: - \"lspcidrake -v | fgrep AUDIO\" will tell you which driver your card uses @@ -278,14 +301,16 @@ initlevel 3 } sub get_any_driver_entry { - my ($in, $driver, $device) = @_; + my ($in, $modules_conf, $driver, $device) = @_; return () if $::isInstall; +{ val => N("Let me pick any driver"), disabled => sub {}, clicked => sub { my $old_driver = $driver; if ($in->ask_from(N("Choosing an arbitrary driver"), - formatAlaTeX(N("If you really think that you know which driver is the right one for your card + formatAlaTeX( + #-PO: keep the double empty lines between sections, this is formatted a la LaTeX + 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)), @@ -293,7 +318,7 @@ The current driver for your \"%s\" sound card is \"%s\" ", $device->{description { label => N("Driver:"), val => \$driver, list => [ category2modules("multimedia/sound") ], type => 'combo', default => $driver, sort =>1, separator => '|' }, ] )) { - do_switch($in, $old_driver, $driver, $device->{sound_slot_index}); + do_switch($in, $modules_conf, $old_driver, $driver, $device->{sound_slot_index}); goto end; } } @@ -301,16 +326,17 @@ The current driver for your \"%s\" sound card is \"%s\" ", $device->{description } -sub configure_sound_slots() { +sub configure_sound_slots { + my ($modules_conf) = @_; my $altered = 0; each_index { - my $default_driver = modules::get_alias("sound-slot-$::i"); + my $default_driver = $modules_conf->get_alias("sound-slot-$::i"); if (!member($default_driver, @{get_alternative($_->{driver})}, $_->{driver})) { $altered ||= $default_driver; - modules::set_sound_slot("sound-slot-$::i", $_->{driver}); + $modules_conf->set_sound_slot("sound-slot-$::i", $_->{driver}); } } detect_devices::getSoundDevices(); - modules::write_conf() if $altered && $::isStandalone; + $modules_conf->write if $altered && $::isStandalone; } |
