summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake/sound.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-11 15:12:37 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-11 15:12:37 +0000
commit62e2b00cfa8aa15068216cd980b7bd5e2904b44d (patch)
tree34a1ede9b8434f460733059130951b27536760c9 /perl-install/harddrake/sound.pm
parent76bb7bf3df26d548691a946ec08cdc1dca8ceab2 (diff)
downloaddrakx-backup-do-not-use-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar
drakx-backup-do-not-use-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar.gz
drakx-backup-do-not-use-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar.bz2
drakx-backup-do-not-use-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.tar.xz
drakx-backup-do-not-use-62e2b00cfa8aa15068216cd980b7bd5e2904b44d.zip
(is_pulseaudio_enabled,set_pulseaudio,switch) add support to enable/disable PulseAudio (#37826)
Diffstat (limited to 'perl-install/harddrake/sound.pm')
-rw-r--r--perl-install/harddrake/sound.pm33
1 files changed, 31 insertions, 2 deletions
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