#/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}