first commit

This commit is contained in:
Qubot 2025-04-07 17:28:13 +08:00
commit d58385d0bc
36 changed files with 2217 additions and 0 deletions

View File

@ -0,0 +1,265 @@
#/bin/bash
### GPIO 18 - LED high, light on ###
### GPIO 17 - LED high, light on ###
### GPIO 62 - LED high, light on ###
### GPIO 81 - LED high, light on ###
### GPIO 80 - LED high, light on ###
### GPIO 50 - LED high, light on ###
### GPIO 30 - LED high, light on ###
### GPIO 29 - LED high, light on ###
### GPIO 31 - LED high, light on ###
### GPIO 59 - LED high, light on ###
### GPIO 58 - LED high, light on ###
### GPIO 51 - LED high, light on ###
### GPIO 61 - LED high, light on ###
### GPIO 60 - LED high, light on ###
### GPIO 53 - LED high, light on ###
### GPIO 28 - LED high, light on ###
### GPIO 52 - LED high, light on ###
RET=0
EXP_GPIO18=18
EXP_GPIO17=17
EXP_GPIO62=62
EXP_GPIO81=81
EXP_GPIO80=80
EXP_GPIO50=50
EXP_GPIO30=30
EXP_GPIO29=29
EXP_GPIO31=31
EXP_GPIO59=59
EXP_GPIO58=58
EXP_GPIO51=51
EXP_GPIO61=61
EXP_GPIO60=60
EXP_GPIO53=53
EXP_GPIO28=28
EXP_GPIO52=52
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
source `pwd`/mt_gpio.sh
####################################################################################################
if [ ! -f /sys/class/gpio/gpio446/direction ]; then
mt_gpio_export ${EXP_GPIO18} ### EXP_GPIO18 428 + 18 = 446
fi
if [ ! -f /sys/class/gpio/gpio445/direction ]; then
mt_gpio_export ${EXP_GPIO17} ### EXP_GPIO17 428 + 17 = 445
fi
if [ ! -f /sys/class/gpio/gpio490/direction ]; then
mt_gpio_export ${EXP_GPIO62} ### EXP_GPIO62 428 + 62 = 490
fi
if [ ! -f /sys/class/gpio/gpio509/direction ]; then
mt_gpio_export ${EXP_GPIO81} ### EXP_GPIO81 428 + 81 = 509
fi
if [ ! -f /sys/class/gpio/gpio508/direction ]; then
mt_gpio_export ${EXP_GPIO80} ### EXP_GPIO80 428 + 80 = 508
fi
if [ ! -f /sys/class/gpio/gpio478/direction ]; then
mt_gpio_export ${EXP_GPIO50} ### EXP_GPIO50 428 + 50 = 478
fi
if [ ! -f /sys/class/gpio/gpio458/direction ]; then
mt_gpio_export ${EXP_GPIO30} ### EXP_GPIO30 428 + 30 = 458
fi
if [ ! -f /sys/class/gpio/gpio457/direction ]; then
mt_gpio_export ${EXP_GPIO29} ### EXP_GPIO29 428 + 29 = 457
fi
if [ ! -f /sys/class/gpio/gpio459/direction ]; then
mt_gpio_export ${EXP_GPIO31} ### EXP_GPIO31 428 + 31 = 459
fi
if [ ! -f /sys/class/gpio/gpio487/direction ]; then
mt_gpio_export ${EXP_GPIO59} ### EXP_GPIO59 428 + 59 = 487
fi
if [ ! -f /sys/class/gpio/gpio486/direction ]; then
mt_gpio_export ${EXP_GPIO58} ### EXP_GPIO58 428 + 58 = 486
fi
if [ ! -f /sys/class/gpio/gpio479/direction ]; then
mt_gpio_export ${EXP_GPIO51} ### EXP_GPIO51 428 + 51 = 479
fi
if [ ! -f /sys/class/gpio/gpio489/direction ]; then
mt_gpio_export ${EXP_GPIO61} ### EXP_GPIO61 428 + 61 = 489
fi
if [ ! -f /sys/class/gpio/gpio488/direction ]; then
mt_gpio_export ${EXP_GPIO60} ### EXP_GPIO60 428 + 60 = 488
fi
if [ ! -f /sys/class/gpio/gpio481/direction ]; then
mt_gpio_export ${EXP_GPIO53} ### EXP_GPIO53 428 + 53 = 481
fi
if [ ! -f /sys/class/gpio/gpio456/direction ]; then
mt_gpio_export ${EXP_GPIO28} ### EXP_GPIO28 428 + 28 = 456
fi
if [ ! -f /sys/class/gpio/gpio480/direction ]; then
mt_gpio_export ${EXP_GPIO52} ### EXP_GPIO52 428 + 52 = 480
fi
####################################################################################################
mt_gpio_dir ${EXP_GPIO18} out
mt_gpio_dir ${EXP_GPIO17} out
mt_gpio_dir ${EXP_GPIO62} out
mt_gpio_dir ${EXP_GPIO81} out
mt_gpio_dir ${EXP_GPIO80} out
mt_gpio_dir ${EXP_GPIO50} out
mt_gpio_dir ${EXP_GPIO30} out
mt_gpio_dir ${EXP_GPIO29} out
mt_gpio_dir ${EXP_GPIO31} out
mt_gpio_dir ${EXP_GPIO59} out
mt_gpio_dir ${EXP_GPIO58} out
mt_gpio_dir ${EXP_GPIO51} out
mt_gpio_dir ${EXP_GPIO61} out
mt_gpio_dir ${EXP_GPIO60} out
mt_gpio_dir ${EXP_GPIO53} out
mt_gpio_dir ${EXP_GPIO28} out
mt_gpio_dir ${EXP_GPIO52} out
####################################################################################################
echo "########################## 26PIN GPIO Expand Board Testing Start ##########################"
echo "### 26PIN Expand Board's all LED turn on about 10s ###"
mt_gpio_out ${EXP_GPIO18} 1
mt_gpio_out ${EXP_GPIO17} 1
mt_gpio_out ${EXP_GPIO62} 1
mt_gpio_out ${EXP_GPIO81} 1
mt_gpio_out ${EXP_GPIO80} 1
mt_gpio_out ${EXP_GPIO50} 1
mt_gpio_out ${EXP_GPIO30} 1
mt_gpio_out ${EXP_GPIO29} 1
mt_gpio_out ${EXP_GPIO31} 1
mt_gpio_out ${EXP_GPIO59} 1
mt_gpio_out ${EXP_GPIO58} 1
mt_gpio_out ${EXP_GPIO51} 1
mt_gpio_out ${EXP_GPIO61} 1
mt_gpio_out ${EXP_GPIO60} 1
mt_gpio_out ${EXP_GPIO53} 1
mt_gpio_out ${EXP_GPIO28} 1
mt_gpio_out ${EXP_GPIO52} 1
sleep 10
echo "### 26PIN Expand Board's all LED turn off about 5s ###"
mt_gpio_out ${EXP_GPIO18} 0
mt_gpio_out ${EXP_GPIO17} 0
mt_gpio_out ${EXP_GPIO62} 0
mt_gpio_out ${EXP_GPIO81} 0
mt_gpio_out ${EXP_GPIO80} 0
mt_gpio_out ${EXP_GPIO50} 0
mt_gpio_out ${EXP_GPIO30} 0
mt_gpio_out ${EXP_GPIO29} 0
mt_gpio_out ${EXP_GPIO31} 0
mt_gpio_out ${EXP_GPIO59} 0
mt_gpio_out ${EXP_GPIO58} 0
mt_gpio_out ${EXP_GPIO51} 0
mt_gpio_out ${EXP_GPIO61} 0
mt_gpio_out ${EXP_GPIO60} 0
mt_gpio_out ${EXP_GPIO53} 0
mt_gpio_out ${EXP_GPIO28} 0
mt_gpio_out ${EXP_GPIO52} 0
sleep 5
echo "### 26PIN Expand Board's all LED turn on ###"
mt_gpio_out ${EXP_GPIO18} 1
mt_gpio_out ${EXP_GPIO17} 1
mt_gpio_out ${EXP_GPIO62} 1
mt_gpio_out ${EXP_GPIO81} 1
mt_gpio_out ${EXP_GPIO80} 1
mt_gpio_out ${EXP_GPIO50} 1
mt_gpio_out ${EXP_GPIO30} 1
mt_gpio_out ${EXP_GPIO29} 1
mt_gpio_out ${EXP_GPIO31} 1
mt_gpio_out ${EXP_GPIO59} 1
mt_gpio_out ${EXP_GPIO58} 1
mt_gpio_out ${EXP_GPIO51} 1
mt_gpio_out ${EXP_GPIO61} 1
mt_gpio_out ${EXP_GPIO60} 1
mt_gpio_out ${EXP_GPIO53} 1
mt_gpio_out ${EXP_GPIO28} 1
mt_gpio_out ${EXP_GPIO52} 1
sleep 2
while true
do
read -t20 -s -n1 -p "### Please confirm if Expand Board's LED can work fine, enter y or n. "y" is good, "n" is for bad. ###" keypress
if [ $? -eq 0 ]; then
if [ ${keypress} == 'y' ]; then
echo " "
echo " "
echo "### Expand Board's LED can work fine, 26PIN GPIO feature is good ### "
break
fi
if [ ${keypress} == 'n' ]; then
RET=1
echo " "
echo " "
echo "Error Notice: Expand Board'sLED can not work fine, 26PIN GPIO feature is bad"
break
fi
fi
echo " "
done
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,67 @@
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
}

270
app_ft-script.sh Normal file
View File

@ -0,0 +1,270 @@
#/bin/bash
### This tool is for BPI-R4 function test in manufacturer ###
RET=0
PREFIX=`pwd`/
DEUBGFILE=/var/run/r4-ft-script.log
AUTOMATIC_CASE_NUM=0
MANUAL_CASE_NUM=0
CASE_NUM=0
QUIT=0
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "######################## BPI-R4 Function Testing Start ########################"
### Sets QUIT variable so script will finish. ###
quit()
{
QUIT=$1
}
### Sets ALL variable so script will run all test cases. ###
run_all_cases()
{
ALL="1"
}
### Run Function Test Case Script ###
run_script()
{
eval script_name=$1
eval script_file="${script_name}.sh"
eval args=$2
if [ ${script_name} == "run_all_cases" ]; then
${script_name} ${args}
return 0
fi
if [ ${script_name} == "quit" ]; then
${script_name} ${args}
return 0;
fi
cd ${script_name} > /dev/null
if [ -x ${script_file} ]; then
if [ "$ALL" == 1 ]; then
#./${script_file} >> ${DEUBGFILE} 2>&1
set -o pipefail
./${script_file} | tee -a ${DEUBGFILE}
SRET=$?
else
./${script_file}
SRET=$?
fi
if [ ${SRET} == 0 ] ; then
cd - > /dev/null
return 0
else
cd - > /dev/null
return 1
fi
else
cd - > /dev/null
echo "${script_file} is not available, please install ${script_file} scripts"
exit 1
fi
cd - > /dev/null
return 1
}
### Options for automaic test cases ###
step_automatic_func()
{
TITLE="Automatic Test Cases"
AUTOMATIC_CASE_NUM=9
CASE_NUM=9
TEXT_1="Memory_Test_Case"
FUNC_1="memory-script"
TEXT_2="WIFI_Test_Case"
FUNC_2="wifi-script"
TEXT_3="miniPCIeX2_Test_Case"
FUNC_3="minipciex2-script"
TEXT_4="miniPCIeUSB_Test_Case"
FUNC_4="minipcieusb-script"
TEXT_5="NVME_Test_Case"
FUNC_5="nvme-script"
TEXT_6="NAND_Test_sase"
FUNC_6="nand-script"
TEXT_7="EMMC_Test_sase"
FUNC_7="emmc-script"
TEXT_8="RTC_Test_sase"
FUNC_8="rtc-script"
TEXT_9="EEPROM_Test_sase"
FUNC_9="eeprom-script"
}
### Options for manual test cases ###
step_manual_func()
{
TITLE="Manual Test Cases"
MANUAL_CASE_NUM=10
CASE_NUM=10
TEXT_1="FAN_Test_Case"
FUNC_1="fan-script"
TEXT_2="LED_Test_Case"
FUNC_2="led-script"
TEXT_3="KEY_Test_Case"
FUNC_3="key-script"
TEXT_4="USB30_Test_Case"
FUNC_4="usb30-script"
TEXT_5="USB20_Test_Case"
FUNC_5="usb20-script"
TEXT_6="Ethernet_Test_Case"
FUNC_6="ethernet-script"
TEXT_7="26PINGPIO_Test_Case"
FUNC_7="26pingpio-script"
TEXT_8="M2KeyB_PCIE_Test_Case"
FUNC_8="m2keybpcie-script"
TEXT_9="M2KeyB_USB2_Test_Case"
FUNC_9="m2keybusb2-script"
TEXT_10="M2KeyB_USB3_Test_Case"
FUNC_10="m2keybusb3-script"
}
STEPS_1="step_automatic_func"
STEPS_2="step_manual_func"
rm -rf ${DEUBGFILE}
touch ${DEUBGFILE}
echo 0 > /proc/sys/kernel/printk
while [ "$QUIT" == "0" ]; do
OPTION_NUM=1
ALL="0"
echo "[$OPTION_NUM] run all cases"
eval OPTIONS_${OPTION_NUM}="run_all_cases"
eval OPTIONS_TXT_${OPTION_NUM}="All_Test_Cases"
let OPTION_NUM+=1
for s in `seq 2`
do
STEPS_VAR="STEPS_${s}"
eval STEPS_VAR=\$${STEPS_VAR}
${STEPS_VAR}
for i in `seq ${CASE_NUM}`
do
TEXT_VAR="TEXT_${i}"
FUNC_VAR="FUNC_${i}"
eval TEXT_VAR=\$${TEXT_VAR}
eval FUNC_VAR=\$${FUNC_VAR}
echo "[$OPTION_NUM] ${TEXT_VAR}"
eval OPTIONS_${OPTION_NUM}=${FUNC_VAR}
eval OPTIONS_TXT_${OPTION_NUM}=${TEXT_VAR}
let OPTION_NUM+=1
done
#echo ""
done
echo "[$OPTION_NUM] Exit Script"
eval OPTIONS_${OPTION_NUM}="quit"
eval OPTIONS_TXT_${OPTION_NUM}="Quit"
echo ""
echo -n "Option: "
read our_entry
echo ""
if [ ${our_entry} -lt 1 ]; then
echo "Wrong Selecttion Number"
continue
else
if [ ${our_entry} -gt ${OPTION_NUM} ]; then
echo "Wrong Selecttion Number"
continue
fi
fi
OPTIONS_VAR="OPTIONS_${our_entry}"
eval OPTIONS_VAR=\$${OPTIONS_VAR}
run_script ${OPTIONS_VAR} ${our_entry}
index=1
if [ "$ALL" == "1" ] ; then
for case_n in `seq ${OPTION_NUM}`
do
echo "---------------------------------------"
OPTIONS_VAR="OPTIONS_${case_n}"
OPTIONS_TXT_VAR="OPTIONS_TXT_${case_n}"
eval OPTIONS_VAR=\$${OPTIONS_VAR}
eval OPTIONS_TXT_VAR=\$${OPTIONS_TXT_VAR}
if [ ${OPTIONS_VAR} == "quit" ]; then
quit
break
fi
if [ ${OPTIONS_VAR} == "run_all_cases" ]; then
continue
fi
eval TEST_ITEM_${index}=${OPTIONS_TXT_VAR}
run_script ${OPTIONS_VAR} ${case_n}
eval TEST_RESULT_${index}=$?
let index+=1
done
let index-=1
echo "============================================"
echo "Test Result"
echo "--------------------------------------------"
echo " Item Result "
echo "--------------------------------------------"
for i in `seq ${index}`
do
TEST_ITEM_VAR="TEST_ITEM_${i}"
TEST_RESULT_VAR="TEST_RESULT_${i}"
eval TEST_ITEM_VAR=\$${TEST_ITEM_VAR}
eval TEST_RESULT_VAR=\$${TEST_RESULT_VAR}
echo -n "${TEST_ITEM_VAR} " | awk -F ',' '{printf("%-36s", $1)}'
if [ ${TEST_RESULT_VAR} == 0 ]; then
echo "Pass"
else
echo "Fail"
fi
done
fi
if [ "$QUIT" == "0" ] ; then
echo
fi
done
echo "######################################################################################"
echo " "
echo " "
echo " "
return ${RET}

View File

@ -0,0 +1,23 @@
#/bin/bash
SYS_FILE=/sys/devices/platform/11005000.i2c/i2c-1
RET=0
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "###################### BPI-R4 EEPROM 0x57 Testing Start ############################"
if [ ! -f ${SYS_FILE}/i2c-2/2-0057/eeprom ]; then
echo "### BPI-R4 eeprom 0x57 can't work fine ###"
RET=1
else
echo "### BPI-R4 eeprom 0x57 can work fine ###"
fi
echo "######################################################################################"
sleep 1
return ${RET}

View File

@ -0,0 +1,30 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## EMMC Deivce Testing Start ##########################"
dd if=/dev/mmcblk0boot0 of=/tmp/.emmc_test.img bs=1M count=1
if [ $? == 0 ]; then
echo "### Access the EMMC Device Successfully ###"
else
RET=1
echo "Error Notice: Access the EMMC Device failure ###"
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,108 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
ifconfig eth0 up
ifconfig eth1 up
ifconfig eth2 up
ifconfig br-lan down
ifconfig br-wan down
brctl delbr br-lan
brctl delbr br-wan
sleep 2
echo "########################## Network ethernet Testing Start ##########################"
echo "----------------------------------------------------------------------------------------"
while true
do
read -t20 -s -n1 -p "### Please confirm if all 1G and 10G RJ45 cable insert one right position, then enter any key to continue. ###" keypress
if [ $? -eq 0 ]; then
echo " "
break
fi
echo " "
done
echo "----------------------------------------------------------------------------------------"
sleep 3
echo "### Ethernet 10G SFP+ WAN Testing ####"
udhcpc -t 5 -n -i eth2
if [ $? == 0 ]; then
echo "### Ethernet 10G SFP+ WAN DHCP got ip address successfully ###"
else
RET=1
echo "Error Notice: Ethernet 10G SFP+ WAN DHCP can not got ip address failure"
fi
echo "----------------------------------------------------------------------------------------"
sleep 3
echo "### Ethernet 10G SFP+ LAN Testing ####"
udhcpc -t 5 -n -i eth1
if [ $? == 0 ]; then
echo "### Ethernet 10G SFP+ LAN DHCP got ip address successfully ###"
else
RET=1
echo "Error Notice: Ethernet 10G SFP+ LAN DHCP can not got ip address failure"
fi
echo "----------------------------------------------------------------------------------------"
sleep 3
echo "### Ethernet 1G RJ45 LAN 0 Testing ####"
udhcpc -t 5 -n -i lan0
if [ $? == 0 ]; then
echo "### Ethernet 1G RJ45 LAN 0 DHCP got ip address successfully ###"
else
RET=1
echo "Error Notice: Ethernet 1G RJ45 LAN 0 DHCP can not got ip address failure"
fi
echo "----------------------------------------------------------------------------------------"
sleep 3
echo "### Ethernet 1G RJ45 LAN 1 Testing ####"
udhcpc -t 5 -n -i lan1
if [ $? == 0 ]; then
echo "### Ethernet 1G RJ45 LAN 1 DHCP got ip address successfully ###"
else
RET=1
echo "Error Notice: Ethernet 1G RJ45 LAN 1 DHCP can not got ip address failure"
fi
echo "----------------------------------------------------------------------------------------"
sleep 3
echo "### Ethernet 1G RJ45 LAN 2 Testing ####"
udhcpc -t 5 -n -i lan2
if [ $? == 0 ]; then
echo "### Ethernet 1G RJ45 LAN 2 DHCP got ip address successfully ###"
else
RET=1
echo "Error Notice: Ethernet 1G RJ45 LAN 2 DHCP can not got ip address failure"
fi
echo "----------------------------------------------------------------------------------------"
sleep 3
echo "### Ethernet 1G RJ45 LAN 3 Testing ####"
udhcpc -t 5 -n -i lan3
if [ $? == 0 ]; then
echo "### Ethernet 1G RJ45 LAN 3 DHCP got ip address successfully ###"
else
RET=1
echo "Error Notice: Ethernet 1G RJ45 LAN 3 DHCP can not got ip address failure"
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

64
fan-script/fan-script.sh Normal file
View File

@ -0,0 +1,64 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## FAN PWM Testing Start ##########################"
echo 0 > /sys/class/pwm/pwmchip0/export 2> /dev/null
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period 2> /dev/null
echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle 2> /dev/null
echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity 2> /dev/null
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable 2> /dev/null
sleep 1
echo "### Turn off the FAN about 5s by PWM0 ###"
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle 2> /dev/null
sleep 5
echo "### Turn on the FAN about 10s by PWM0 ###"
#echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle 2> /dev/null
echo 0 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle 2> /dev/null
sleep 10
echo "### Turn off the FAN completely ###"
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle 2> /dev/null
while true
do
read -t20 -s -n1 -p "### Please confirm if the FAN can work fine, enter y or n. "y" is good, "n" is for bad. ###" keypress
if [ $? -eq 0 ]; then
if [ ${keypress} == 'y' ]; then
echo " "
echo " "
echo "### FAN can work fine, FAN feature is good ### "
break
fi
if [ ${keypress} == 'n' ]; then
RET=1
echo " "
echo " "
echo "Error Notice: FAN can not work fine, FAN feature is bad"
break
fi
fi
echo " "
done
echo 0 > /sys/class/pwm/pwmchip0/unexport 2> /dev/null
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
exit ${RET}

52
key-script/key-script.sh Normal file
View File

@ -0,0 +1,52 @@
#/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}

67
key-script/mt_gpio.sh Normal file
View File

@ -0,0 +1,67 @@
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
}

58
led-script/led-script.sh Normal file
View File

@ -0,0 +1,58 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## LED Testing Start ##########################"
echo "### all GREEN-LED BLUE-LED turn on about 10s ###"
echo 1 > /sys/class/leds/bpi-r4\:pio\:blue/brightness
echo 1 > /sys/class/leds/bpi-r4\:pio\:green/brightness
sleep 10
echo "### all GREEN-LED BLUE-LED turn off about 5s ###"
echo 0 > /sys/class/leds/bpi-r4\:pio\:blue/brightness
echo 0 > /sys/class/leds/bpi-r4\:pio\:green/brightness
sleep 5
echo "### all GREEN-LED BLUE-LED1 turn on ###"
echo 1 > /sys/class/leds/bpi-r4\:pio\:blue/brightness
echo 1 > /sys/class/leds/bpi-r4\:pio\:green/brightness
while true
do
read -t20 -s -n1 -p "### Please confirm if the LED can work fine, enter y or n. "y" is good, "n" is for bad. ###" keypress
if [ $? -eq 0 ]; then
if [ ${keypress} == 'y' ]; then
echo " "
echo " "
echo "### LED can work fine, LED feature is good ### "
break
fi
if [ ${keypress} == 'n' ]; then
RET=1
echo " "
echo " "
echo "Error Notice: LED can not work fine, LED feature is bad"
break
fi
fi
echo " "
done
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

67
led-script/mt_gpio.sh Normal file
View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,31 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "#################### M.2 KeyB PCIe SATA card Module Testing Start ##################"
echo " "
result=`lspci | grep "SATA controller: JMicron Technology Corp. JMB58x AHCI SATA controller" | wc -l`
if [ ${result} -eq 1 ]; then
echo "### Find one M.2 KeyB PCIe SATA card Module from M.2 KeyB slots ###"
else
echo "Error Notice: Can not Find one M.2 KeyB PCIe SATA card Module from M.2 KeyB slots"
RET=1
fi
echo " "
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,29 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################### M.2 KeyB USB2.0 Testing Start ##########################"
result=`lsusb | grep "2c7c:0125" | wc -l`
if [ ${result} -eq 1 ]; then
echo "### Find one EM05 4G Module from M.2 KeyB slots ###"
else
echo "Error Notice: Can not Find one EM05 4G Module from M.2 KeyB slots"
RET=1
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,29 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################### M.2 KeyB USB3.0 Testing Start ##########################"
result=`lsusb | grep "2c7c:0900" | wc -l`
if [ ${result} -eq 1 ]; then
echo "### Find one RM500U-CN 5G Module from M.2 KeyB slots ###"
else
echo "Error Notice: Can not Find one RM500U-CN 5G Module from M.2 KeyB slots"
RET=1
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,4 @@
#/bin/bash
echo 0 > /sys/class/leds/bpi-r4\:pio\:blue/brightness
echo 0 > /sys/class/leds/bpi-r4\:pio\:green/brightness

View File

@ -0,0 +1,4 @@
#/bin/bash
echo 1 > /sys/class/leds/bpi-r4\:pio\:blue/brightness
echo 1 > /sys/class/leds/bpi-r4\:pio\:green/brightness

View File

@ -0,0 +1,25 @@
#/bin/bash
echo " "
echo " "
echo " "
echo "#################################################################################################"
echo "############################ DDR Memory Manufactory Ageing Start #############################"
count=0
while true
do
./led-onall.sh
result=`./memsuck -arzo -p 1 50 | grep "Result: PASS (1 passes)" | wc -l`
./led-offall.sh
if [ ${result} -gt 0 ]; then
echo "### DDR Memory test passed in loop $count ###"
sleep 2
else
echo "Error Notice: DDR Memory stress failure in loop $count"
break
fi
let count=count+1
done

View File

@ -0,0 +1,39 @@
#/bin/bash
RET=0
LOOP=3 ### memory stress loop count ###
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "############################ DDR Memory Testing Start #############################"
count=0
while true
do
result=`./memsuck -arzo -p 5 50 | grep "Result: PASS (5 passes)" | wc -l`
if [ ${result} -gt 0 ]; then
echo "### DDR Memory test passed in loop $count ###"
else
echo "Error Notice: DDR Memory stress failure in loop $count"
RET=1
fi
let count=count+1
if [ $count -ge ${LOOP} ]; then
break
fi
done
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

BIN
memory-script/memsuck Normal file

Binary file not shown.

67
memory-script/mt_gpio.sh Normal file
View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,29 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "######################### minipcie 4G Module Testing Start #########################"
result=`lsusb | grep "2c7c:0125" | wc -l`
if [ ${result} -eq 2 ]; then
echo "### Find two EC25 4G Modules from two minipcie slots ###"
else
echo "Error Notice: Can not Find two EC25 4G Modules from two minipcie slots"
RET=1
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,54 @@
#/bin/bash
SYS_FILE=/sys/devices/platform/11005000.i2c/i2c-1
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "######################## minipcie wifi7 card Module Testing Start ##################"
echo " "
result=`lspci | grep "Device 7990" | wc -l`
if [ ${result} -eq 1 ]; then
echo "### Find one MEDIATEK Corp MT7990 Module from minipcie slots ###"
else
echo "Error Notice: Can not Find one EDIATEK Corp MT7990 Module from minipcie slot"
RET=1
fi
result=`lspci | grep "Device 7991" | wc -l`
if [ ${result} -eq 1 ]; then
echo "### Find one MEDIATEK Corp MT7991 Module from minipcie slots ###"
else
echo "Error Notice: Can not Find one EDIATEK Corp MT7991 Module from minipcie slot"
RET=1
fi
if [ ! -f ${SYS_FILE}/i2c-5/5-0051/eeprom ]; then
echo "### BPI-R4 wifi7 eeprom 0x51 can't work fine ###"
RET=1
else
echo "### BPI-R4 wifi7 eeprom 0x51 can work fine ###"
fi
if [ ! -f ${SYS_FILE}/i2c-5/5-0052/eeprom ]; then
echo "### BPI-R4 wifi7 eeprom 0x52 can't work fine ###"
RET=1
else
echo "### BPI-R4 wifi7 eeprom 0x52 can work fine ###"
fi
echo " "
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,29 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## SPIM NAND Deivce Testing Start ##########################"
dd if=/dev/mtdblock2 of=/tmp/.nand_test.img
if [ $? == 0 ]; then
echo "### Access the SPIM NAND Device Successfully ###"
else
RET=1
echo "Error Notice: Access the SPIM NAND Device failure ###"
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

67
nvme-script/mt_gpio.sh Normal file
View File

@ -0,0 +1,67 @@
SYS_FILE=/sys/class/gpio
mt_gpio_export()
{
pin=$1
let pin=pin+411 ### gpio base 411 ###
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+411 ### gpio base 411 ###
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+411 ### gpio base 411 ###
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+411 ### gpio base 411 ###
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
}

View File

@ -0,0 +1,29 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## NVMe SSD M.2 KeyM Testing Start # ##########################"
result=`fdisk -l /dev/nvme0n1 | grep "bytes" | grep "sectors" | wc -l`
if [ ${result} -gt 0 ]; then
echo "### NVMe SSD M.2 KeyM can be detected successfully. ###"
else
RET=1
echo "Error Notice: NVMe SSD M.2 KeyM can not be detected, failure."
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

36
rtc-script/rtc-script.sh Normal file
View File

@ -0,0 +1,36 @@
#/bin/bash
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "############################### MT7988a RTC Testing Start ##########################"
date -s 2028-08-08
hwclock -w
date -s 2021-01-01
line=`hwclock -r | grep "2028-08-08" | wc -l`
if [ $line -eq 1 ]; then
echo " "
echo "### MT7988a RTC can work fine ### "
echo " "
else
echo " "
echo "Error Notice: MT7988a RTC can not work fine."
echo " "
RET=1
fi
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

67
usb20-script/mt_gpio.sh Normal file
View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,72 @@
#/bin/bash
### This script is to check if Expand USB2.0 ports are working fine ###
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## Expand USB2.0 Deivce Testing Start ##########################"
dmesg -c > /dev/null
while true
do
read -t20 -s -n1 -p "### Please Insert one USB2.0 Device U-DISK into Expand USB2.0 Port right now , then enter any key to continue. ###" keypress
if [ $? -eq 0 ]; then
echo " "
break
fi
echo " "
done
sleep 3
result=`dmesg | grep "new high-speed USB device" | wc -l`
if [ ${result} -eq 0 ]; then
RET=1
echo "Error Notice: USB2.0 Device U-DISK can not detect at first time from Expand USB2.0 Port."
else
result=`dmesg | grep "Attached SCSI removable disk" | wc -l`
if [ ${result} -eq 0 ]; then
RET=1
echo "Error Notice: USB2.0 Device U-DISK can not detect at second time from Expand USB2.0 Port."
else
echo "### USB2.0 Device U-DISK can detect successfully from Expand USB2.0 Port ###"
result=`fdisk -l /dev/sda | grep "bytes" | grep "sectors" | wc -l`
if [ ${result} -gt 0 ]; then
echo "### USB2.0 Device U-DISK partition info is good from Expand USB2.0 Port ###"
else
RET=1
echo "Error Notice: USB2.0 Device U-DISK partition info is bad from Expand USB2.0 Port"
fi
fi
fi
sleep 1
while true
do
read -t20 -s -n1 -p "### Please Remove one USB2.0 Device U-DISK from Expand USB2.0 Port right now , then enter any key to continue. ###" keypress
if [ $? -eq 0 ]; then
echo " "
break
fi
echo " "
done
dmesg -c > /dev/null
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

67
usb30-script/mt_gpio.sh Normal file
View File

@ -0,0 +1,67 @@
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
}

View File

@ -0,0 +1,70 @@
#/bin/bash
### This script is to check if USB3.0 USB2.0 ports are working fine ###
RET=0
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "########################## USB3.0 Deivce Testing Start ##########################"
dmesg -c > /dev/null
while true
do
read -t20 -s -n1 -p "### Please Insert one USB3.0 Device U-DISK right now , then enter any key to continue. ###" keypress
if [ $? -eq 0 ]; then
echo " "
break
fi
echo " "
done
sleep 3
result=`dmesg | grep "new SuperSpeed" | wc -l`
if [ ${result} -eq 0 ]; then
RET=1
echo "Error Notice: USB3.0 Device U-DISK can not detect at first time."
else
result=`dmesg | grep "Attached SCSI removable disk" | wc -l`
if [ ${result} -eq 0 ]; then
RET=1
echo "Error Notice: USB3.0 Device U-DISK can not detect at second time."
else
echo "### USB3.0 Device U-DISK can detect successfully ###"
result=`fdisk -l /dev/sda | grep "bytes" | grep "sectors" | wc -l`
if [ ${result} -gt 0 ]; then
echo "### USB3.0 Device U-DISK partition info is good ###"
else
RET=1
echo "Error Notice: USB3.0 Device U-DISK partition info is bad"
fi
fi
fi
sleep 1
while true
do
read -t20 -s -n1 -p "### Please Remove one USB3.0 Device U-DISK right now , then enter any key to continue. ###" keypress
if [ $? -eq 0 ]; then
echo " "
break
fi
echo " "
done
sleep 3
dmesg -c > /dev/null
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}

View File

@ -0,0 +1,63 @@
#/bin/bash
RET=0
echo " "
echo " "
echo " "
echo "######################################################################################"
echo "####################### MT7988a Chip 2.4G, 5G, 6G AP Testing Start #######################"
ifconfig ra0 up > /dev/null
ifconfig ra1 up > /dev/null
ifconfig rai0 up > /dev/null
ifconfig rax0 up > /dev/null
sleep 5
result=`ifconfig -a | grep ra0 | wc -l`
if [ ${result} -ne 1 ]; then
echo "### mt_wifi driver 2.4G AP can't run up ###"
RET=1
else
result=`iwlist ra0 rate | grep "Current Bit Rate" | wc -l`
if [ ${result} -ne 1 ]; then
echo "### mt_wifi driver 2.4G AP can't work fine ###"
RET=1
else
echo "### mt_wifi driver 2.4G AP can work fine ###"
fi
fi
result=`ifconfig -a | grep rai0 | wc -l`
if [ ${result} -ne 1 ]; then
echo "### mt_wifi driver 5G AP can't run up ###"
RET=1
else
result=`iwlist rai0 rate | grep "Current Bit Rate" | wc -l`
if [ ${result} -ne 1 ]; then
echo "### mt_wifi driver 5G AP can't work fine ###"
RET=1
else
echo "### mt_wifi driver 5G AP can work fine ###"
fi
fi
result=`ifconfig -a | grep rax0 | wc -l`
if [ ${result} -ne 1 ]; then
echo "### mt_wifi driver 6G AP can't run up ###"
RET=1
else
result=`iwlist rax0 rate | grep "Current Bit Rate" | wc -l`
if [ ${result} -ne 1 ]; then
echo "### mt_wifi driver 6G AP can't work fine ###"
RET=1
else
echo "### mt_wifi driver 6G AP can work fine ###"
fi
fi
echo "######################################################################################"
return ${RET}