add menu for switching audio output

This commit is contained in:
Alex Bradbury 2013-12-16 21:29:14 +00:00
parent 46aacb3003
commit be25afb612

View File

@ -582,6 +582,17 @@ do_update() {
exec raspi-config
}
do_audio() {
AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \
"0" "Auto" \
"1" "Force 3.5mm ('headphone') jack" \
"2" "Force HDMI" \
3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
amixer cset numid=3 "$AUDIO_OUT"
fi
}
do_finish() {
disable_raspi_config_at_boot
if [ $ASK_TO_REBOOT -eq 1 ]; then
@ -758,7 +769,8 @@ do_advanced_menu() {
"A3 Memory Split" "Change the amount of memory made available to the GPU" \
"A4 SSH" "Enable/Disable remote command line access to your Pi using SSH" \
"A5 SPI" "Enable/Disable automatic loading of SPI kernel module (needed for e.g. PiFace)" \
"A6 Update" "Update this tool to the latest version" \
"A6 Audio" "Force audio out through HDMI or 3.5mm jack" \
"A7 Update" "Update this tool to the latest version" \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
@ -770,7 +782,8 @@ do_advanced_menu() {
A3\ *) do_memory_split ;;
A4\ *) do_ssh ;;
A5\ *) do_spi ;;
A6\ *) do_update ;;
A6\ *) do_audio ;;
A7\ *) do_update ;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
fi