delete key-script

This commit is contained in:
Qubot 2025-04-08 10:46:51 +08:00
parent 7a6064d84c
commit 3d85197536
2 changed files with 0 additions and 119 deletions

View File

@ -1,52 +0,0 @@
#/bin/bash
RET=0
KEY_GPIO_WPS=14
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
source `pwd`/mt_gpio.sh
echo "########################## KEY Testing Start ##########################"
if [ ! -f /sys/class/gpio/gpio442/direction ]; then
mt_gpio_export ${KEY_GPIO_WPS} #Enable WPS 428 + 14 = 442
fi
mt_gpio_dir ${KEY_GPIO_WPS} in
echo -n "Please Press one Key about WPS Key of GPIO_WPS GPIO14 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 "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -1,67 +0,0 @@
SYS_FILE=/sys/class/gpio
mt_gpio_export()
{
pin=$1
let pin=pin+428 ### gpio base 428 ###
if [ ! -f ${SYS_FILE}/export ]; then
echo "${SYS_FILE}/export file is not present"
exit 1
fi
echo "${pin}" > ${SYS_FILE}/export
return 0
}
mt_gpio_dir()
{
pin=$1
let pin=pin+428 ### gpio base 428 ###
dir=$2
if [ ! -f ${SYS_FILE}/gpio${pin}/direction ]; then
echo "${SYS_FILE}/gpio${pin}/direction is not present"
exit 1
fi
echo "${dir}" > ${SYS_FILE}/gpio${pin}/direction
return 0
}
mt_gpio_out()
{
pin=$1
let pin=pin+428 ### gpio base 428 ###
out=$2
if [ ! -f ${SYS_FILE}/gpio${pin}/value ]; then
echo "${SYS_FILE}/gpio${pin}/value is not present"
exit 1
fi
echo "${out}" > ${SYS_FILE}/gpio${pin}/value
return 0
}
mt_gpio_in()
{
pin=$1
let pin=pin+428 ### gpio base 428 ###
if [ ! -f ${SYS_FILE}/gpio${pin}/value ]; then
echo "${SYS_FILE}/gpio${pin}/value is not present"
exit 1
fi
result=`cat ${SYS_FILE}/gpio${pin}/value`
if [ ${result} == "0" ] ; then
return 0
else
return 1
fi
}