fix issue #24
Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
parent
ffa35c0983
commit
547c1fe5b9
|
@ -28,12 +28,12 @@ case "${1}" in
|
|||
else
|
||||
exit 0
|
||||
fi
|
||||
enable=1
|
||||
new_state=1
|
||||
;;
|
||||
|
||||
0|off|OFF|Off)
|
||||
echo "Turning audio amplifier OFF"
|
||||
enable=0
|
||||
new_state=0
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -46,7 +46,14 @@ if [ ! -d "${SYSTEM_GPIO}/gpio${GPIO_PF6}" ]; then
|
|||
echo ${GPIO_PF6} > "${SYSTEM_GPIO}/export"
|
||||
fi
|
||||
|
||||
# Enable/disable the pwoer audio amplifier
|
||||
# Set the power audio amplifier GPIO as output
|
||||
echo "out" > "${SYSTEM_GPIO}/gpio${GPIO_PF6}/direction"
|
||||
echo ${enable} > "${SYSTEM_GPIO}/gpio${GPIO_PF6}/value"
|
||||
|
||||
# Read the current power audio amplifier state
|
||||
current_state=$(cat "${SYSTEM_GPIO}/gpio${GPIO_PF6}/value")
|
||||
|
||||
# Enable/disable the power audio amplifier if necessary
|
||||
if [ ${current_state} -ne ${new_state} ]; then
|
||||
echo ${new_state} > "${SYSTEM_GPIO}/gpio${GPIO_PF6}/value"
|
||||
fi
|
||||
exit 0
|
||||
|
|
|
@ -26,7 +26,6 @@ case ${1} in
|
|||
|
||||
# Launch Previous Game if any
|
||||
if [ -f "${INSTANT_PLAY_FILE}" ]; then
|
||||
audio_amp on
|
||||
keymap resume
|
||||
echo -n "Found Instant Play file, restarting previous game with command: "
|
||||
echo $(head -n 1 "${INSTANT_PLAY_FILE}")
|
||||
|
|
|
@ -81,10 +81,10 @@ set_volume() {
|
|||
fi
|
||||
|
||||
# Turn on/off audio amplifier if necessary
|
||||
if [ ${current_volume} -eq 0 -a ${new_volume} -ne 0 ]; then
|
||||
audio_amp on
|
||||
elif [ ${current_volume} -ne 0 -a ${new_volume} -eq 0 ]; then
|
||||
if [ ${new_volume} -eq 0 ]; then
|
||||
audio_amp off
|
||||
else
|
||||
audio_amp on
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue