svc

Simple service scripts and examples, to be used everywhere.
git clone git://r-36.net/svc
Log | Files | Refs | LICENSE

alsa (629B)


      1 #!/bin/sh
      2 
      3 SERVICE="alsa"
      4 
      5 [ -e "/bin/svc.d/default/$SERVICE" ] && . "/bin/svc.d/default/$SERVICE"
      6 
      7 PID=$(pidof -o %PPID $BIN)
      8 
      9 case $1 in
     10 	-s)
     11 		[ -e "$STATEFILE" ] || alsactl $PARAMS store
     12 		alsactl $PARAMS restore
     13 
     14 		dfiles="/sys/module/snd_ac97_codec/parameters/power_save
     15 			/sys/module/snd_hda_intel/parameters/power_save"
     16 		for f in $dfiles;
     17 		do
     18 			if [ -e $f ];
     19 			then
     20 				echo $POWERSAVE > $f
     21 				[ -c /dev/dsp ] && echo 1 > /dev/dsp
     22 			fi
     23 		done
     24 		;;
     25 	-k)
     26 		[ "$SAVEVOLUME" = "yes" ] && alsactl $PARAMS store
     27 		[ "$MUTEVOLUME" = "yes" ] && amixer -q set Master 0 mute
     28 		;;
     29 	*)
     30 		echo "usage: $0 -s|-k"
     31 		exit 1
     32 esac
     33