summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/tweaker/bin/twk_audio_RP.pl
diff options
context:
space:
mode:
authorBob Igo <bob@stormlogic.com>2009-02-17 18:04:51 (GMT)
committerBob Igo <bob@stormlogic.com>2009-02-17 18:04:51 (GMT)
commit2eaa5abe1f850dd66728fd669d74d4c978d1607c (patch)
tree222009c4aebbe6f2576a8c474152c41fb5d285c8 /abs/core-testing/tweaker/bin/twk_audio_RP.pl
parent2815d871501d795c826fe3fccc98999b0f3f0872 (diff)
downloadlinhes_pkgbuild-2eaa5abe1f850dd66728fd669d74d4c978d1607c.zip
linhes_pkgbuild-2eaa5abe1f850dd66728fd669d74d4c978d1607c.tar.gz
linhes_pkgbuild-2eaa5abe1f850dd66728fd669d74d4c978d1607c.tar.bz2
Adapted Tweaker scripts for R6.
Diffstat (limited to 'abs/core-testing/tweaker/bin/twk_audio_RP.pl')
-rwxr-xr-xabs/core-testing/tweaker/bin/twk_audio_RP.pl27
1 files changed, 16 insertions, 11 deletions
diff --git a/abs/core-testing/tweaker/bin/twk_audio_RP.pl b/abs/core-testing/tweaker/bin/twk_audio_RP.pl
index 5b30bd8..9d06493 100755
--- a/abs/core-testing/tweaker/bin/twk_audio_RP.pl
+++ b/abs/core-testing/tweaker/bin/twk_audio_RP.pl
@@ -30,11 +30,16 @@ sub poll_for_digital_output_device {
my @digital_matches = ( "digital", "IEC958" );
my $results = execute_shell_command($poll_command);
- foreach my $digital_match (@digital_matches) {
- if ($results =~ /card (\d):.*device (\d).*$digital_match.*/i) {
- $card = $1;
- $device = $2;
+ if ($results) {
+ foreach my $digital_match (@digital_matches) {
+ if ($results =~ /card (\d):.*device (\d).*$digital_match.*/i) {
+ $card = $1;
+ $device = $2;
+ }
}
+ } else {
+ recommendation_level("not available", "No audio devices detected.");
+ exit(-1);
}
return ($card, $device);
}
@@ -64,9 +69,9 @@ sub implement_option {
$command1 = "[ -e $asound_conf ] && /bin/cp $asound_conf $asound_conf-TWEAKERBACKUP";
# Assumption: The proper analog device is always device 0.
if ($card >= 0) {
- $command2 = "sed -i 's/hw:.,./hw:$card,0/g' $asound_conf";
+ $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:$card,0/g' $asound_conf";
} else {
- $command2 = "sed -i 's/hw:.,./hw:0,0/g' $asound_conf";
+ $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:0,0/g' $asound_conf";
}
}
case "analogsurround" {
@@ -78,7 +83,7 @@ sub implement_option {
# output.
$command1 = "/bin/cp \$TWEAKER_ROOT/fs$asound_conf /etc/";
if (($card >= 0) && ($device >= 0)) {
- $command2 = "sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf";
+ $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf";
} else {
my $logger = get_logger('tweaker.script');
$logger->error("ERROR: Unable to poll for digital sound output device.");
@@ -105,9 +110,9 @@ sub implement_option {
sub edit_mplayer_conf {
my($option) = @_;
# delete any old entries that Tweaker made, relevant to this particular edit
- my $delete_old_tweaker_edits = "sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf";
+ my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf";
# comment out old entries that some other process may have made
- my $comment_out_external_edits = "sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf";
+ my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf";
my $command1;
my $command2="";
my $logger = get_logger('tweaker.script');
@@ -141,9 +146,9 @@ sub implement_option {
sub edit_xine_conf {
my($option)=@_;
# delete any old entries that Tweaker made, relevant to this particular edit
- my $delete_old_tweaker_edits = "sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf";
+ my $delete_old_tweaker_edits = "[ -e $xine_conf ] && sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf";
# comment out entries that some other process may have made
- my $comment_out_external_edits = "sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf";
+ my $comment_out_external_edits = "[ -e $xine_conf ] && sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf";
my $logger = get_logger('tweaker.script');
if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) {