78 lines
1.8 KiB
Bash
78 lines
1.8 KiB
Bash
#/bin/bash
|
|
|
|
RET=0
|
|
KEY_GPIO_WPS=14
|
|
KEY_GPIO_RST=13
|
|
|
|
sleep 2
|
|
|
|
echo " "
|
|
echo " "
|
|
echo " "
|
|
echo "######################################################################################"
|
|
|
|
source `pwd`/mt_gpio.sh
|
|
|
|
echo "########################## KEY Testing Start ##########################"
|
|
|
|
if [ ! -f /sys/class/gpio/gpio526/direction ]; then
|
|
mt_gpio_export ${KEY_GPIO_WPS} #Enable WPS 512 + 14 = 526
|
|
fi
|
|
|
|
if [ ! -f /sys/class/gpio/gpio525/direction ]; then
|
|
mt_gpio_export ${KEY_GPIO_RST} #Enable RESET 512 + 13 = 525
|
|
fi
|
|
|
|
mt_gpio_dir ${KEY_GPIO_WPS} in
|
|
mt_gpio_dir ${KEY_GPIO_RST} in
|
|
|
|
echo -n "Please Press one Key about WPS Key of GPIO_WPS GPIO0 about 20s ......"
|
|
i=0
|
|
while true; do
|
|
mt_gpio_in ${KEY_GPIO_WPS}
|
|
if [ $? == 0 ]; then
|
|
echo "### GPIO_WPS GPIO14 Key is in low level, Key is available ###"
|
|
break
|
|
else
|
|
echo "waiting 1 second......"
|
|
sleep 1
|
|
fi
|
|
|
|
let i=i+1
|
|
if [ $i -ge 20 ]; then
|
|
echo " ### 20s Wait time is over, it can not detect the key ###"
|
|
RET=1
|
|
break
|
|
fi
|
|
done
|
|
|
|
echo -n "Please Press one Key about RESET Key of GPIO_RST GPIO13 about 20s ......"
|
|
i=0
|
|
while true; do
|
|
mt_gpio_in ${KEY_GPIO_RST}
|
|
if [ $? == 0 ]; then
|
|
echo "### GPIO_RST GPIO13 Key is in low level, Key is available ###"
|
|
break
|
|
else
|
|
echo "waiting 1 second......"
|
|
sleep 1
|
|
fi
|
|
|
|
let i=i+1
|
|
if [ $i -ge 20 ]; then
|
|
echo " ### 20s Wait time is over, it can not detect the key ###"
|
|
RET=1
|
|
break
|
|
fi
|
|
done
|
|
|
|
echo "######################################################################################"
|
|
echo " "
|
|
echo " "
|
|
echo " "
|
|
|
|
sleep 2
|
|
|
|
return ${RET}
|
|
|