From 838fe688fe806e4d96cad5c7a3a7489ed6281fc6 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 13 Nov 2015 20:22:37 +0000
Subject: LinHES-config: soundconfig.sh: select card for iecset to enable audio
 to play on non default cards.

Unmute IEC958 devices so that test will actually make sound.
---
 abs/core/LinHES-config/PKGBUILD       |  4 ++--
 abs/core/LinHES-config/soundconfig.sh | 24 +++++++++++++++++++++---
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 54b6a83..ac9cce9 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=8.3
-pkgrel=22
+pkgrel=23
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -151,7 +151,7 @@ md5sums=('17d9dd5a097fbbd4dae75dff8e2677ff'
          '6e5639fff82fa2ba76113ac1ab8f2016'
          'f0376c98a7986897406d393186c0365e'
          '157e73d0f90d7b306aba8f5921aeedd3'
-         'db9b625332493d5a7d12f3fa3ffae0ff'
+         '1f58c0393a131f4a8f9a84b3fe08a7e4'
          'eef9b882ecb70648a8f253f85b73a274'
          '5f890ea9bda6aef652d2560ca19dac07'
          'ab2aa42c2947148c2b1cac0ade6d1d55'
diff --git a/abs/core/LinHES-config/soundconfig.sh b/abs/core/LinHES-config/soundconfig.sh
index 2f30306..e6aaa41 100755
--- a/abs/core/LinHES-config/soundconfig.sh
+++ b/abs/core/LinHES-config/soundconfig.sh
@@ -143,8 +143,6 @@ function write_asound {
     pcm "hw:'"$mixAUDIODEVICE"'"
     period_size 512
     buffer_size 4096
-#    rate 48000
-#    format S16_LE
   }
 }
 
@@ -241,8 +239,28 @@ case $SOUNDOPTYPE in
     ;;
     test|TEST)
         echo $@ > /tmp/audio.test
+
         #set iec958 audio bit
-        iecset audio 1
+        if [[ $AUDIODEVICE == plughw:* ]]
+        then
+            cardName=`echo $AUDIODEVICE | sed 's/plughw:\(.*\),.*/\1/g'`
+            #cardDevice=`echo $AUDIODEVICE | sed 's/.*,\(.*\)/\1/g'`
+            iecset -c "$cardName" audio 1
+        else
+            cardName="0"
+            iecset audio 1
+        fi
+
+        #unmute IEC958
+        amixerControls=`amixer -c "$cardName" scontrols`
+        while read -r line; do
+            if [[ $line == *IEC958* ]]
+            then
+                amixCard=`echo "$line" | sed "s/.*\ \('.*\)/\1/g"`
+                amixer -c "$cardName" sset "$amixCard" unmute
+            fi
+        done <<< "$amixerControls"
+
         #loadsound
         if [  x$AUDIOTYPE = xOSS  -o   x$AUDIOTYPE = xoss ]
         then
-- 
cgit v0.12

