From 936cb5ab9c046321ff654fb6a16dc35be7622594 Mon Sep 17 00:00:00 2001 From: Christophe Branchereau Date: Mon, 9 Nov 2020 15:45:50 +0100 Subject: [PATCH] S90volume.sh : also store headphones volume This is useful, because the minimum volume is very loud when only PCM is adjustable. Signed-off-by: Christophe Branchereau --- .../gcw0/overlay/etc/init.d/S90volume.sh | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/board/opendingux/gcw0/overlay/etc/init.d/S90volume.sh b/board/opendingux/gcw0/overlay/etc/init.d/S90volume.sh index b6bd9c9108f3..ccb37ca514ce 100755 --- a/board/opendingux/gcw0/overlay/etc/init.d/S90volume.sh +++ b/board/opendingux/gcw0/overlay/etc/init.d/S90volume.sh @@ -4,22 +4,24 @@ # VOLUME_STATEFILE=/usr/local/etc/volume.state -CONTROL=PCM case "$1" in - start) - echo "Loading sound volume..." - if [ -f $VOLUME_STATEFILE ]; then - /usr/bin/amixer set $CONTROL `cat $VOLUME_STATEFILE` - fi - ;; - stop) - echo "Storing sound volume..." - amixer get $CONTROL | sed -n 's/.*Front .*: Playback \([0-9]*\).*$/\1/p' | paste -d "," - - > $VOLUME_STATEFILE - ;; - *) - echo "Usage: $0 {start|stop}" - exit 1 + start) + echo "Loading sound volume..." + if [ -f $VOLUME_STATEFILE ]; then + /usr/bin/amixer set PCM `head -1 $VOLUME_STATEFILE` + /usr/bin/amixer set Headphones `head -2 $VOLUME_STATEFILE` + fi + ;; + stop) + echo "Storing sound volume..." + PCM_VOL=`amixer get PCM | sed -n 's/.*Front .*: Playback \([0-9]*\).*$/\1/p' | paste -d "," - -` + HP_VOL=`amixer get Headphones | sed -n 's/.*Front .*: Playback \([0-9]*\).*$/\1/p' | paste -d "," - -` + printf "$PCM_VOL\n$HP_VOL\n" > $VOLUME_STATEFILE + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 esac exit $?