commit 8dcf8dda2a7da4f22e29769f7958f42827504e56 Author: Qubot <1445788683@qq.com> Date: Thu Nov 6 08:07:59 2025 +0800 Initial commit for bpi-r4pro branch diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ad04ddc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "idf.pythonInstallPath": "C:\\Users\\Qubot\\.espressif\\tools\\idf-python\\3.11.2\\python.exe" +} \ No newline at end of file diff --git a/26pin-script/26pin-script.sh b/26pin-script/26pin-script.sh new file mode 100644 index 0000000..3c68359 --- /dev/null +++ b/26pin-script/26pin-script.sh @@ -0,0 +1,186 @@ +#/bin/bash + +PIN26_PIN03=18 +PIN26_PIN05=17 +PIN26_PIN07=62 +PIN26_PIN11=81 +PIN26_PIN13=80 +PIN26_PIN15=50 +PIN26_PIN19=30 +PIN26_PIN21=29 +PIN26_PIN23=31 + +PIN26_PIN08=59 ## invalid ## +PIN26_PIN10=58 ## invalid ## +PIN26_PIN12=51 +PIN26_PIN16=61 ## invalid ## +PIN26_PIN18=60 ## invalid ## +PIN26_PIN22=53 +PIN26_PIN24=28 +PIN26_PIN26=52 + +RET=0 +sleep 2 + +echo " " +echo " " +echo " " +echo "#########################################################################" +echo "########################## 26PIN Testing Start ##########################" + +source `pwd`/mt_gpio.sh + +############################################################################# +if [ ! -f /sys/class/gpio/gpio530/direction ]; then + mt_gpio_export ${PIN26_PIN03} #Enable PIN26_PIN03 512 + 18 = 530 +fi + +if [ ! -f /sys/class/gpio/gpio529/direction ]; then + mt_gpio_export ${PIN26_PIN05} #Enable PIN26_PIN05 512 + 17 = 529 +fi + +if [ ! -f /sys/class/gpio/gpio574/direction ]; then + mt_gpio_export ${PIN26_PIN07} #Enable PIN26_PIN07 512 + 62 = 574 +fi + +if [ ! -f /sys/class/gpio/gpio593/direction ]; then + mt_gpio_export ${PIN26_PIN11} #Enable PIN26_PIN11 512 + 81 = 593 +fi + +if [ ! -f /sys/class/gpio/gpio592/direction ]; then + mt_gpio_export ${PIN26_PIN13} #Enable PIN26_PIN13 512 + 80 = 592 +fi + +if [ ! -f /sys/class/gpio/gpio562/direction ]; then + mt_gpio_export ${PIN26_PIN15} #Enable PIN26_PIN15 512 + 50 = 562 +fi + +if [ ! -f /sys/class/gpio/gpio542/direction ]; then + mt_gpio_export ${PIN26_PIN19} #Enable PIN26_PIN19 512 + 30 = 542 +fi + +if [ ! -f /sys/class/gpio/gpio541/direction ]; then + mt_gpio_export ${PIN26_PIN21} #Enable PIN26_PIN21 512 + 29 = 541 +fi + +if [ ! -f /sys/class/gpio/gpio543/direction ]; then + mt_gpio_export ${PIN26_PIN23} #Enable PIN26_PIN23 512 + 31 = 543 +fi + +################################################################################ +if [ ! -f /sys/class/gpio/gpio563/direction ]; then + mt_gpio_export ${PIN26_PIN12} #Enable PIN26_PIN12 512 + 51 = 563 +fi + +if [ ! -f /sys/class/gpio/gpio565/direction ]; then + mt_gpio_export ${PIN26_PIN22} #Enable PIN26_PIN22 512 + 53 = 565 +fi + +if [ ! -f /sys/class/gpio/gpio540/direction ]; then + mt_gpio_export ${PIN26_PIN24} #Enable PIN26_PIN24 512 + 28 = 540 +fi + +if [ ! -f /sys/class/gpio/gpio564/direction ]; then + mt_gpio_export ${PIN26_PIN26} #Enable PIN26_PIN26 512 + 52 = 564 +fi + +################################################################################ +mt_gpio_dir ${PIN26_PIN03} out +mt_gpio_dir ${PIN26_PIN05} out +mt_gpio_dir ${PIN26_PIN07} out +mt_gpio_dir ${PIN26_PIN11} out +mt_gpio_dir ${PIN26_PIN13} out +mt_gpio_dir ${PIN26_PIN15} out +mt_gpio_dir ${PIN26_PIN19} out +mt_gpio_dir ${PIN26_PIN21} out +mt_gpio_dir ${PIN26_PIN23} out + +mt_gpio_dir ${PIN26_PIN12} out +mt_gpio_dir ${PIN26_PIN22} out +mt_gpio_dir ${PIN26_PIN24} out +mt_gpio_dir ${PIN26_PIN26} out + +sleep 1 + +echo "### All 26PIN LED turn on about 10s ###" +mt_gpio_out ${PIN26_PIN03} 1 +mt_gpio_out ${PIN26_PIN05} 1 +mt_gpio_out ${PIN26_PIN07} 1 +mt_gpio_out ${PIN26_PIN11} 1 +mt_gpio_out ${PIN26_PIN13} 1 +mt_gpio_out ${PIN26_PIN15} 1 +mt_gpio_out ${PIN26_PIN19} 1 +mt_gpio_out ${PIN26_PIN21} 1 +mt_gpio_out ${PIN26_PIN23} 1 + +mt_gpio_out ${PIN26_PIN12} 1 +mt_gpio_out ${PIN26_PIN22} 1 +mt_gpio_out ${PIN26_PIN24} 1 +mt_gpio_out ${PIN26_PIN26} 1 +sleep 10 + +echo "### All 26PIN LED turn off about 5s ###" +mt_gpio_out ${PIN26_PIN03} 0 +mt_gpio_out ${PIN26_PIN05} 0 +mt_gpio_out ${PIN26_PIN07} 0 +mt_gpio_out ${PIN26_PIN11} 0 +mt_gpio_out ${PIN26_PIN13} 0 +mt_gpio_out ${PIN26_PIN15} 0 +mt_gpio_out ${PIN26_PIN19} 0 +mt_gpio_out ${PIN26_PIN21} 0 +mt_gpio_out ${PIN26_PIN23} 0 + +mt_gpio_out ${PIN26_PIN12} 0 +mt_gpio_out ${PIN26_PIN22} 0 +mt_gpio_out ${PIN26_PIN24} 0 +mt_gpio_out ${PIN26_PIN26} 0 +sleep 5 + +echo "### All 26PIN lED turn on ###" +mt_gpio_out ${PIN26_PIN03} 1 +mt_gpio_out ${PIN26_PIN05} 1 +mt_gpio_out ${PIN26_PIN07} 1 +mt_gpio_out ${PIN26_PIN11} 1 +mt_gpio_out ${PIN26_PIN13} 1 +mt_gpio_out ${PIN26_PIN15} 1 +mt_gpio_out ${PIN26_PIN19} 1 +mt_gpio_out ${PIN26_PIN21} 1 +mt_gpio_out ${PIN26_PIN23} 1 + +mt_gpio_out ${PIN26_PIN12} 1 +mt_gpio_out ${PIN26_PIN22} 1 +mt_gpio_out ${PIN26_PIN24} 1 +mt_gpio_out ${PIN26_PIN26} 1 + +while true +do + read -t20 -s -n1 -p "### Please confirm if All 26PIN 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 "### All 26PIN LED can work fine, All 26PIN LED feature is good ### " + break + fi + + if [ ${keypress} == 'n' ]; then + RET=1 + echo " " + echo " " + echo "Error Notice: All 26PIN LED can not work fine, All 26PIN LED feature is bad" + break + fi + fi + + echo " " +done + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/26pin-script/mt_gpio.sh b/26pin-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/26pin-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/R4Pro产测增加功能.docx b/R4Pro产测增加功能.docx new file mode 100644 index 0000000..e6862b5 Binary files /dev/null and b/R4Pro产测增加功能.docx differ diff --git a/app_ft-script.sh b/app_ft-script.sh new file mode 100644 index 0000000..eca673f --- /dev/null +++ b/app_ft-script.sh @@ -0,0 +1,270 @@ +#/bin/bash + +### This tool is for BPI-R4PRO 8X function test in manufacturer ### +RET=0 +PREFIX=`pwd`/ +DEUBGFILE=/var/run/r4pro-8x-ft-script.log + +AUTOMATIC_CASE_NUM=0 +MANUAL_CASE_NUM=0 +CASE_NUM=0 +QUIT=0 + +echo " " +echo " " +echo " " +echo "######################################################################################" + +echo "####################### BPI-R4PRO-8X 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=10 + CASE_NUM=10 + + 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="NAND_Test_Case" + FUNC_5="nand-script" + + TEXT_6="NVME_Test_Case" + FUNC_6="nvme-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" + + TEXT_10="USIM_Test_sase" + FUNC_10="usim-script" +} + +### Options for manual test cases ### +step_manual_func() +{ + TITLE="Manual Test Cases" + MANUAL_CASE_NUM=9 + CASE_NUM=9 + + 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="USB20_Test_Case" + FUNC_4="usb20-script" + + TEXT_5="USB30_Test_Case" + FUNC_5="usb30-script" + + TEXT_6="Ethernet_Test_Case" + FUNC_6="ethernet-script" + + TEXT_7="M2KeyB_USB2_Test_Case" + FUNC_7="m2keybusb2-script" + + TEXT_8="M2KeyB_USB3_Test_Case" + FUNC_8="m2keybusb3-script" + + TEXT_9="26PIN_Test_Case" + FUNC_9="26pin-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} + diff --git a/eeprom-script/eeprom-script.sh b/eeprom-script/eeprom-script.sh new file mode 100644 index 0000000..7eff399 --- /dev/null +++ b/eeprom-script/eeprom-script.sh @@ -0,0 +1,23 @@ +#/bin/bash + +SYS_FILE=/sys/bus/i2c/devices +RET=0 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "################### BPI-R4PRO EEPROM 0x57 Testing Start ###########################" + +if [ ! -f ${SYS_FILE}/i2c-3/3-0057/eeprom ]; then + echo "### BPI-R4PRO eeprom 0x57 can't work fine ###" + RET=1 +else + echo "### BPI-R4PROe eeprom 0x57 can work fine ###" +fi + +echo "######################################################################################" +sleep 1 + +return ${RET} + diff --git a/emmc-script/emmc-script.sh b/emmc-script/emmc-script.sh new file mode 100644 index 0000000..9e3eb77 --- /dev/null +++ b/emmc-script/emmc-script.sh @@ -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} + diff --git a/ethernet-script/ethernet-script.sh b/ethernet-script/ethernet-script.sh new file mode 100644 index 0000000..523c6a9 --- /dev/null +++ b/ethernet-script/ethernet-script.sh @@ -0,0 +1,128 @@ +#/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, 2.5G 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 WAN Testing ####" +udhcpc -t 5 -n -i eth1 +if [ $? == 0 ]; then + echo "### Ethernet 10G WAN DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 10G WAN DHCP can not got ip address failure" +fi + +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 10G LAN ETH6 Testing ####" +udhcpc -t 5 -n -i mxl_lan5 +if [ $? == 0 ]; then + echo "### Ethernet 10G LAN ETH6 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 10G LAN ETH6 DHCP can not got ip address failure" +fi + +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 2.5G RJ45 LAN ETH1 Testing ####" +udhcpc -t 5 -n -i mxl_lan0 +if [ $? == 0 ]; then + echo "### Ethernet 2.5G RJ45 LAN ETH1 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 2.5G RJ45 LAN ETH1 DHCP can not got ip address failure" +fi + +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 2.5G RJ45 LAN ETH2 Testing ####" +udhcpc -t 5 -n -i mxl_lan1 +if [ $? == 0 ]; then + echo "### Ethernet 2.%G RJ45 LAN ETH2 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 2.5G RJ45 LAN ETH2 DHCP can not got ip address failure" +fi + +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 2.5G RJ45 LAN ETH3 Testing ####" +udhcpc -t 5 -n -i mxl_lan2 +if [ $? == 0 ]; then + echo "### Ethernet 2.5G RJ45 LAN ETH3 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 2.5G RJ45 LAN ETH3 DHCP can not got ip address failure" +fi + +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 2.5G RJ45 LAN ETH4 Testing ####" +udhcpc -t 5 -n -i mxl_lan3 +if [ $? == 0 ]; then + echo "### Ethernet 2.5G RJ45 LAN ETH4 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 2.5G RJ45 LAN ETH4 DHCP can not got ip address failure" +fi +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 1G RJ45 LAN0 ETH5 Testing ####" +udhcpc -t 5 -n -i lan0 +if [ $? == 0 ]; then + echo "### Ethernet 1G RJ45 LAN ETH5 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 1G RJ45 LAN ETH5 DHCP can not got ip address failure" +fi +echo "----------------------------------------------------------------------------------------" +sleep 3 +echo "### Ethernet 1G FPC LAN3 Testing ####" +udhcpc -t 5 -n -i lan3 +if [ $? == 0 ]; then + echo "### Ethernet 1G FPC LAN3 DHCP got ip address successfully ###" +else + RET=1 + echo "Error Notice: Ethernet 1G FPC LAN3 DHCP can not got ip address failure" +fi + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/fan-script/fan-script.sh b/fan-script/fan-script.sh new file mode 100644 index 0000000..b509be8 --- /dev/null +++ b/fan-script/fan-script.sh @@ -0,0 +1,54 @@ +#/bin/bash + +RET=0 +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "######################## BPI-R4PRO FAN PWM Testing Start ########################" + +echo "### Speed down the FAN slow about 5s by PWM0 ###" +echo 0 > /sys/devices/platform/pwm-fan/hwmon/hwmon4/pwm1 2> /dev/null +sleep 5 + +echo "### Speed up the FAN fast about 10s by PWM0 ###" +echo 255 > /sys/devices/platform/pwm-fan/hwmon/hwmon4/pwm1 2> /dev/null +sleep 10 + +echo "### Speed down the FAN slow by PWM0 completely ###" +echo 0 > /sys/devices/platform/pwm-fan/hwmon/hwmon4/pwm1 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 "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +exit ${RET} + diff --git a/key-script/key-script.sh b/key-script/key-script.sh new file mode 100644 index 0000000..a6ee2f4 --- /dev/null +++ b/key-script/key-script.sh @@ -0,0 +1,77 @@ +#/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} + diff --git a/key-script/mt_gpio.sh b/key-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/key-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/led-script/led-script.sh b/led-script/led-script.sh new file mode 100644 index 0000000..1e672bb --- /dev/null +++ b/led-script/led-script.sh @@ -0,0 +1,58 @@ +#/bin/bash + +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "#######################################################################" +echo "######################## LED Testing Start ##########################" + +echo "### RED,BLUE LED turn on about 10s ###" +echo 1 > /sys/class/leds/red:/brightness +echo 1 > /sys/class/leds/blue:/brightness +sleep 10 + +echo "### RED,BLUE LED turn off about 5s ###" +echo 0 > /sys/class/leds/red:/brightness +echo 0 > /sys/class/leds/blue:/brightness +sleep 5 + +echo "### RED,BLUE LED turn on ###" +echo 1 > /sys/class/leds/red:/brightness +echo 1 > /sys/class/leds/blue:/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} + diff --git a/led-script/mt_gpio.sh b/led-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/led-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/m2keybusb2-script/m2keybusb2-script.sh b/m2keybusb2-script/m2keybusb2-script.sh new file mode 100644 index 0000000..833caa3 --- /dev/null +++ b/m2keybusb2-script/m2keybusb2-script.sh @@ -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 3 ]; then + echo "### Find three EM05 4G Modules from three M.2 KeyB slots ###" +else + echo "Error Notice: Can not Find three EM05 4G Modules from three M.2 KeyB slots" + RET=1 +fi + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/m2keybusb2-script/mt_gpio.sh b/m2keybusb2-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/m2keybusb2-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/m2keybusb3-script/m2keybusb3-script.sh b/m2keybusb3-script/m2keybusb3-script.sh new file mode 100644 index 0000000..bdff046 --- /dev/null +++ b/m2keybusb3-script/m2keybusb3-script.sh @@ -0,0 +1,29 @@ +#/bin/bash + +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "###################### Three M.2 KeyB USB3.0 Slots Testing Start #####################" + +result=`lsusb | grep "2c7c:0900" | wc -l` +if [ ${result} -eq 3 ]; then + echo "### Find three RM500U-CN 5G Modules from three M.2 KeyB slots ###" +else + echo "Error Notice: Can not Find three RM500U-CN 5G Modules from three M.2 KeyB slots" + RET=1 +fi + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/m2keybusb3-script/mt_gpio.sh b/m2keybusb3-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/m2keybusb3-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/memory-script/led-offall.sh b/memory-script/led-offall.sh new file mode 100644 index 0000000..0557c61 --- /dev/null +++ b/memory-script/led-offall.sh @@ -0,0 +1,4 @@ +#/bin/bash + +echo 0 > /sys/class/leds/red:/brightness +echo 0 > /sys/class/leds/blue:/brightness diff --git a/memory-script/led-onall.sh b/memory-script/led-onall.sh new file mode 100644 index 0000000..caf5707 --- /dev/null +++ b/memory-script/led-onall.sh @@ -0,0 +1,4 @@ +#/bin/bash + +echo 1 > /sys/class/leds/red:/brightness +echo 1 > /sys/class/leds/blue:/brightness diff --git a/memory-script/memory-ageing-script.sh b/memory-script/memory-ageing-script.sh new file mode 100644 index 0000000..ce0da02 --- /dev/null +++ b/memory-script/memory-ageing-script.sh @@ -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 + + diff --git a/memory-script/memory-script.sh b/memory-script/memory-script.sh new file mode 100644 index 0000000..fdab6dd --- /dev/null +++ b/memory-script/memory-script.sh @@ -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} + diff --git a/memory-script/memsuck b/memory-script/memsuck new file mode 100644 index 0000000..3227fa9 Binary files /dev/null and b/memory-script/memsuck differ diff --git a/memory-script/mt_gpio.sh b/memory-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/memory-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/minipcieusb-script/minipcieusb-script.sh b/minipcieusb-script/minipcieusb-script.sh new file mode 100644 index 0000000..6139339 --- /dev/null +++ b/minipcieusb-script/minipcieusb-script.sh @@ -0,0 +1,29 @@ +#/bin/bash + +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "####################### Two minipcie 4G Modules 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} + diff --git a/minipcieusb-script/mt_gpio.sh b/minipcieusb-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/minipcieusb-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/minipciex2-script/minipciex2-script.sh b/minipciex2-script/minipciex2-script.sh new file mode 100644 index 0000000..dbaab4f --- /dev/null +++ b/minipciex2-script/minipciex2-script.sh @@ -0,0 +1,48 @@ +#/bin/bash + +SYS_FILE=/sys/devices/platform/soc/11005000.i2c/i2c-2 +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "######################## minipcie wifi7 be14 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-6/6-0051/eeprom ]; then + echo "### BPI-R4PRO 8X wifi7 BE14 eeprom 0x51 can't work fine ###" + RET=1 +else + echo "### BPI-R4PRO 8X wifi7 BE14 eeprom 0x51 can work fine ###" +fi + +echo " " +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/minipciex2-script/mt_gpio.sh b/minipciex2-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/minipciex2-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/nand-script/nand-script.sh b/nand-script/nand-script.sh new file mode 100644 index 0000000..f10cf08 --- /dev/null +++ b/nand-script/nand-script.sh @@ -0,0 +1,29 @@ +#/bin/bash + +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "########################## SPIM NAND Deivce Testing Start ##########################" + +dd if=/dev/mtdblock1 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} + diff --git a/nvme-script/mt_gpio.sh b/nvme-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/nvme-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/nvme-script/nvme-script.sh b/nvme-script/nvme-script.sh new file mode 100644 index 0000000..37ab437 --- /dev/null +++ b/nvme-script/nvme-script.sh @@ -0,0 +1,37 @@ +#/bin/bash + +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "####################### Two 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-A can be detected successfully. ###" +else + RET=1 + echo "Error Notice: NVMe SSD M.2 KeyM-A can not be detected, failure." +fi + +result=`fdisk -l /dev/nvme1n1 | grep "bytes" | grep "sectors" | wc -l` +if [ ${result} -gt 0 ]; then + echo "### NVMe SSD M.2 KeyM-B can be detected successfully. ###" +else + RET=1 + echo "Error Notice: NVMe SSD M.2 KeyM-B can not be detected, failure." +fi + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/rtc-script/rtc-script.sh b/rtc-script/rtc-script.sh new file mode 100644 index 0000000..9d26ab5 --- /dev/null +++ b/rtc-script/rtc-script.sh @@ -0,0 +1,36 @@ +#/bin/bash + +RET=0 + +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "########################## BPI-R4-PRO 8X RTC Testing Start ###########################" + +date -s 2028-08-08 +hwclock -w +date -s 2021-01-01 +line=`hwclock -r | grep "2028" | grep "Aug 8" | wc -l` +if [ $line -eq 1 ]; then + echo " " + echo "### BPI-R4-PRO 8X RTC can work fine ### " + echo " " +else + echo " " + echo "Error Notice: BPI-R4-PRO 8X RTC can not work fine." + echo " " + RET=1 +fi + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/usb20-script/mt_gpio.sh b/usb20-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/usb20-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/usb20-script/usb20-script.sh b/usb20-script/usb20-script.sh new file mode 100644 index 0000000..b4f297c --- /dev/null +++ b/usb20-script/usb20-script.sh @@ -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} + diff --git a/usb30-script/mt_gpio.sh b/usb30-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/usb30-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/usb30-script/usb30-script.sh b/usb30-script/usb30-script.sh new file mode 100644 index 0000000..e641d58 --- /dev/null +++ b/usb30-script/usb30-script.sh @@ -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} + diff --git a/usim-script/mt_gpio.sh b/usim-script/mt_gpio.sh new file mode 100644 index 0000000..7ddf73e --- /dev/null +++ b/usim-script/mt_gpio.sh @@ -0,0 +1,67 @@ + +SYS_FILE=/sys/class/gpio + +mt_gpio_export() +{ + pin=$1 + let pin=pin+512 ### gpio base 512 ### + + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + 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+512 ### gpio base 512 ### + + 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 +} diff --git a/usim-script/usim-script.sh b/usim-script/usim-script.sh new file mode 100644 index 0000000..2f93194 --- /dev/null +++ b/usim-script/usim-script.sh @@ -0,0 +1,92 @@ +#/bin/bash + +RET=0 + +SLOT1_TTYUSB2_FILE=/dev/ttyUSB2 +SLOT2_TTYUSB7_FILE=/dev/ttyUSB7 +SLOT3_TTYUSB12_FILE=/dev/ttyUSB12 +sleep 2 + +echo " " +echo " " +echo " " +echo "######################################################################################" +echo "###################### Three RM500U-CN USIM Slots Testing Start #####################" +set +m > /dev/null +rm -rf /tmp/ft_data +echo " " + +if [ -c ${SLOT1_TTYUSB2_FILE} ]; then + echo "### Find RM500U-CN 5G Modules ttyUSB2 AT Moden Serial ###" + rm -rf /tmp/ft_data + cat ${SLOT1_TTYUSB2_FILE} > /tmp/ft_data 2& + echo -e "AT+CPIN?\r" > ${SLOT1_TTYUSB2_FILE} + sleep 2 + killall cat > /dev/null + result=`cat /tmp/ft_data | grep "+CPIN: READY" | wc -l` + if [ ${result} -ne 1 ]; then + echo "### Error Notice: RM500U-CN 5G Modules ttyUSB2 USIM is not present ###" + RET=1 + else + echo "### RM500U-CN 5G Modules ttyUSB2 USIM is present ###" + fi +else + echo "### Error Notice: Can not Find RM500U-CN 5G Modules ttyUSB2 AT Moden Serial ###" + RET=1 +fi + +echo " " + +if [ -c ${SLOT2_TTYUSB7_FILE} ]; then + echo "### Find RM500U-CN 5G Modules ttyUSB7 AT Moden Serial ###" + rm -rf /tmp/ft_data + cat ${SLOT2_TTYUSB7_FILE} > /tmp/ft_data 2& + echo -e "AT+CPIN?\r" > ${SLOT2_TTYUSB7_FILE} + sleep 2 + killall cat > /dev/null + result=`cat /tmp/ft_data | grep "+CPIN: READY" | wc -l` + if [ ${result} -ne 1 ]; then + echo "### Error Notice: RM500U-CN 5G Modules ttyUSB7 USIM is not present ###" + RET=1 + else + echo "### RM500U-CN 5G Modules ttyUSB7 USIM is present ###" + fi +else + echo "### Error Notice: Can not Find RM500U-CN 5G Modules ttyUSB7 AT Moden Serial ###" + RET=1 +fi + +echo " " + +if [ -c ${SLOT3_TTYUSB12_FILE} ]; then + echo "### Find RM500U-CN 5G Modules ttyUSB12 AT Moden Serial ###" + rm -rf /tmp/ft_data + cat ${SLOT3_TTYUSB12_FILE} > /tmp/ft_data 2& + echo -e "AT+CPIN?\r" > ${SLOT3_TTYUSB12_FILE} + sleep 2 + killall cat > /dev/null + result=`cat /tmp/ft_data | grep "+CPIN: READY" | wc -l` + if [ ${result} -ne 1 ]; then + echo "### Error Notice: RM500U-CN 5G Modules ttyUSB12 USIM is not present ###" + RET=1 + else + echo "### RM500U-CN 5G Modules ttyUSB12 USIM is present ###" + fi +else + echo "### Error Notice: Can not Find RM500U-CN 5G Modules ttyUSB12 AT Moden Serial ###" + RET=1 +fi + +echo " " +set -m 2> /dev/null +rm -rf /tmp/ft_data + +echo "######################################################################################" +echo " " +echo " " +echo " " + +sleep 2 + +return ${RET} + diff --git a/wifi-script/wifi-script.sh b/wifi-script/wifi-script.sh new file mode 100644 index 0000000..13a063f --- /dev/null +++ b/wifi-script/wifi-script.sh @@ -0,0 +1,62 @@ +#/bin/bash + +RET=0 + +echo " " +echo " " +echo " " +echo "###############################################################################################" +echo "#################### BPI-R4PRO 8X BE14 Chip 2.4G, 5G, 6G AP Testing Start #####################" + +ifconfig phy0.0-ap0 up > /dev/null +ifconfig phy0.1-ap0 up > /dev/null +ifconfig phy0.2-ap0 up > /dev/null + +sleep 5 + +result=`ifconfig -a | grep phy0.0-ap0 | wc -l` +if [ ${result} -ne 1 ]; then + echo "### mt_wifi driver 2.4G AP can't run up ###" + RET=1 +else + result=`iwinfo phy0.0-ap0 info | grep 2.412 | 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 phy0.1-ap0 | wc -l` +if [ ${result} -ne 1 ]; then + echo "### mt_wifi driver 5G AP can't run up ###" + RET=1 +else + result=`iwinfo phy0.1-ap0 info | grep 5.180 | 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 phy0.2-ap0 | wc -l` +if [ ${result} -ne 1 ]; then + echo "### mt_wifi driver 6G AP can't run up ###" + RET=1 +else + result=`iwinfo phy0.2-ap0 info | grep 6.135 | 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} +