- CONTROLS=$(amixer -c $card scontrols | awk -F"Simple mixer control " '{print $2}')
- IFSOLD=${IFS:-}
- IFS='
-'
- for CONTROL in ${=CONTROLS} ; do
- # such devices can not be controlled with amixer ... unmute
- [[ "$CONTROL" == *Console* ]] && continue
-
- if ! echo "${CONTROL}" | grep -q -i "mic" ; then
- if amixer -c $card sget "${CONTROL}" | grep -q 'Capabilities:.*pswitch' ; then
- amixer -c $card -q set "${CONTROL}" unmute
- fi
- if amixer -c $card sget "${CONTROL}" | grep -q -P 'Capabilities:.*(pvolume| volume)' ; then
- amixer -c $card -q set "${CONTROL}" "${VOL}"%
- fi
- fi
-
- if [ ${MICVOL} -ne 0 ] ; then
- if amixer -c $card sget "${CONTROL}" | grep -q 'Capabilities:.*cswitch' ; then
- amixer -c $card -q set "${CONTROL}" unmute
- fi
- if amixer -c $card sget "${CONTROL}" | grep -q 'Capabilities:.*cvolume' ; then
- amixer -c $card -q set "${CONTROL}" $MICVOL%
- fi
- eend $?
- fi
- done
- IFS=$IFSOLD
- fi # checkbootparam 'nosound'
- eoutdent
+ if [ ${MICVOL} -ne 0 ] ; then
+ if amixer -c $card sget "${CONTROL}" | grep -q 'Capabilities:.*cswitch' ; then
+ amixer -c $card -q set "${CONTROL}" unmute
+ fi
+ if amixer -c $card sget "${CONTROL}" | grep -q 'Capabilities:.*cvolume' ; then
+ amixer -c $card -q set "${CONTROL}" $MICVOL%
+ fi
+ eend $?
+ fi