X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=833e6d58633c9458650c710c68ef5cff66dc2dae;hp=e1330040b7a3629b93343918be2c1a260c16034e;hb=f2fca92216478dbc551d753952a300c7c434ce8d;hpb=97400bdad03aed28ce75f670ed7e145fadd336db diff --git a/autoconfig.functions b/autoconfig.functions index e133004..833e6d5 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -399,6 +399,23 @@ config_userfstab(){ } # }}} +# {{{ mount configfs +config_configfs() { + einfo "Mounting configfs" + CONFIGFS_DIR=/sys/kernel/config/ + modprobe configfs 2>/dev/null 1>&2 + if ! [ -d "$CONFIGFS_DIR" ] ; then + eindent + einfo "$CONFIGFS_DIR does not exist, can't mount directory" + eend 1 + eoutdent + else + mount -t configfs configfs "$CONFIGFS_DIR" 2>/dev/null 1>&2 + eend $? + fi +} +# }}} + # {{{ Set clock (Local time is more often used than GMT, so it is default) config_time(){ # don't touch the files if running from harddisk: @@ -1149,23 +1166,34 @@ config_mixer () { if checkbootparam 'micvol' ; then MICVOL="$(getbootparam 'micvol' 2>>$DEBUG)" + einfo "Setting microphone to ${WHITE}${MICVOL}${NORMAL}." else MICVOL=0 fi - for CONTROL in Master PCM Front ; do - if amixer -q | grep -q "Simple mixer control '$CONTROL'" ; then - amixer -q set "${CONTROL}" unmute 1>/dev/null 2>&1 - amixer -q set "${CONTROL}" "${VOL}"% + CONTROLS=$(amixer -c $card scontrols | awk -F"Simple mixer control " '{print $2}') + IFSOLD=${IFS:-} + IFS=' +' + for CONTROL in ${=CONTROLS} ; do + 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 + + 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 - - if [ ${MICVOL} -ne 0 ] ; then - einfo "Setting microphone to ${WHITE}${MICVOL}${NORMAL}." - amixer -q set "Mic" $MICVOL &> /dev/null - eend $? - fi + IFS=$IFSOLD fi # checkbootparam 'nosound' eoutdent done