diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-03-11 15:12:37 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-03-11 15:12:37 +0000 |
commit | 62e2b00cfa8aa15068216cd980b7bd5e2904b44d (patch) | |
tree | 34a1ede9b8434f460733059130951b27536760c9 /perl-install | |
parent | 76bb7bf3df26d548691a946ec08cdc1dca8ceab2 (diff) | |
download | drakx-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar drakx-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar.gz drakx-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar.bz2 drakx-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar.xz drakx-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.zip |
(is_pulseaudio_enabled,set_pulseaudio,switch) add support to enable/disable PulseAudio (#37826)
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 2 | ||||
-rw-r--r-- | perl-install/harddrake/sound.pm | 33 |
2 files changed, 33 insertions, 2 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index 108ccc1bf..357dd05bb 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,7 @@ - diskdrake: o really fix partition device name for some dmraid (missing "p", cf #38363) +- draksound (#37826): + o add support to enable/disable PulseAudio - cpufreq: fix gsx-suspmod probe - scannerdrake: fix to open usbtable.gz instead of usbtable diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 8cd3d5283..c210f76ae 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -181,6 +181,26 @@ our %oss2alsa = my @blacklist = qw(cs46xx cs4281); my $blacklisted = 0; +my $config_file = '/etc/sysconfig/pulseaudio'; + +sub is_pulseaudio_enabled() { + my %h = getVarsFromSh($config_file); + $h{PULSE_SERVER_TYPE} eq 'personal'; +} + +sub set_pulseaudio { + my ($val) = @_; + $val = 'PULSE_SERVER_TYPE=' . ($val ? 'personal' : 'none') . "\n"; + my $done; + substInFile { + if (/^PULSE_SERVER_TYPE=/) { + $_ = $val; + $done = 1; + } + } $config_file; + append_to_file($config_file, $val) if !$done; +} + sub rooted { run_program::rooted($::prefix, @_) } sub unload { modules::unload(@_) if $::isStandalone || $blacklisted } @@ -234,19 +254,27 @@ sub switch { my $new_driver = $driver; push @alternative, $driver; my %des = modules::category2modules_and_description('multimedia/sound'); + + my $is_pulseaudio_enabled = is_pulseaudio_enabled(); my @common = ( get_any_driver_entry($in, $modules_conf, $driver, $device), + { + text => N("Enable PulseAudio"), + type => 'bool', val => \$is_pulseaudio_enabled, + }, ); if ($new_driver eq 'unknown') { - $in->ask_from_({ + if ($in->ask_from_({ title => N("No alternative driver"), messages => N("There's no known OSS/ALSA alternative driver for your sound card (%s) which currently uses \"%s\"", $device->{description}, $driver), }, \@common, - ); + )) { + set_pulseaudio($is_pulseaudio_enabled); + } } elsif ($in->ask_from_({ title => N("Sound configuration"), messages => N("Here you can select an alternative driver (either OSS or ALSA) for your sound card (%s).", @@ -286,6 +314,7 @@ To use alsa, one can either use: @common, ])) { + set_pulseaudio($is_pulseaudio_enabled); 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 |