#!/bin/sh # Check number of args if [ ${#} -ne 1 ]; then echo "Usage: $(basename ${0}) [1 for on, 0 for off]" exit 1 fi # Check enable arg enable=${1} if [ ${enable} -eq 1 ]; then # Turn ON only if volume is not null if [ "$(volume_get)" -ne "0" ]; then echo "Turning audio amplifier ON" else exit 0 fi elif [ ${enable} -eq 0 ]; then echo "Turning audio amplifier OFF" else echo "Usage: $(basename ${0}) [1 for on, 0 for off]" exit 1 fi # PA enable GPIO GPIO_PF6=166 # Export GPIO if [ ! -d /sys/class/gpio/gpio${GPIO_PF6} ]; then echo ${GPIO_PF6} > /sys/class/gpio/export fi # Enable/disable cmd echo "out" > /sys/class/gpio/gpio${GPIO_PF6}/direction echo ${enable} > /sys/class/gpio/gpio${GPIO_PF6}/value exit 0