refactor(master : nicsensor) update to 1.5.6

1.update print_usage fuction
2.add feature : nicsensor.sh version
This commit is contained in:
leimingsheng 2025-04-22 14:24:38 +08:00
parent a3f5e1a151
commit 2a2ee7fc99

@ -138,7 +138,7 @@ ina3221_ch2_volt="0"
ina3221_ch0_current="0" ina3221_ch0_current="0"
ina3221_ch1_current="0" ina3221_ch1_current="0"
ina3221_ch2_current="0" ina3221_ch2_current="0"
SCRIPT_VERSION="1.5 Rev5 Intest" SCRIPT_VERSION="1.5 Rev6 Intest"
fru_file_name=$option_data2 fru_file_name=$option_data2
fru_write_size=0 fru_write_size=0
@ -150,50 +150,41 @@ res_tmp468=""
# --------------------------------------------------------- # ---------------------------------------------------------
# Script Function Defination # Script Function Defination
# --------------------------------------------------------- # ---------------------------------------------------------
print_ocp_usage(){
echo "----------------------------------------------------------------"
echo " To test OCP Nic on server, support command as:"
echo " 1.detect function"
echo " ./nicsensor.sh detect ocp"
echo " 2.Reading sensors"
echo " ./nicsensor.sh ocp0 emc1413 0x4c"
echo ""
echo " Now only 5280m7 support to test ocp card"
echo ""
}
# script usage
print_usage(){ print_usage(){
echo "" echo ""
echo "================>>> nicsensor script usage <<<==================" echo "================>>> nicsensor script usage <<<=================="
echo " Command Format : ./nicsensor.sh [slot] [sensor tpye] [slave]" echo " Function 1 - Read Sensor Value"
echo " Option Detail" echo " 1) Command Format : ./nicsensor.sh [slot] [sensor tpye] [slave]"
echo " [slot] : 0 1 2 3 4 5 ..." echo " 2) Option Detail"
echo " [sensor type] : $Support_Sensor_List" echo " - [slot] : 0 1 2 3 4 5 ..."
echo " [slave] : chip slave address , please provide 7 bit address" echo " - [sensor type] : $Support_Sensor_List"
echo " E.G. : ./nicsensor.sh 1 adc128 0x1f" echo " - [slave] : chip slave address , please provide 7 bit address"
echo " 3) E.G. : ./nicsensor.sh 1 adc128 0x1f"
echo " ./nicsensor.sh pcie1 ina3221 0x42" echo " ./nicsensor.sh pcie1 ina3221 0x42"
echo " ./nicsensor.sh ocp0 emc1413 0x4c" echo " ./nicsensor.sh ocp0 emc1413 0x4c"
echo "" echo ""
if [ $DEBUG_MODE -eq 1 ];then echo " Function 2 - Detect I2C for each slot"
echo " Server Type : Debug Mode" echo " 1) Command Format : ./nicsensor.sh detect [pcie/ocp]"
else echo " 2) E.G. : ./nicsensor.sh detect pcie"
echo " Server Type : $server_type"
fi
echo ""
echo " To Auto detect i2c slave on server, please use:"
echo " ./nicsensor.sh detect"
echo " ./nicsensor.sh detect pcie"
echo " ./nicsensor.sh detect ocp [some server don't support]" echo " ./nicsensor.sh detect ocp [some server don't support]"
echo " This function now only support on server:" echo " 3) Note : This function now only support on server:"
echo " $Support_Server_List" echo " $Support_Server_List"
echo "" echo ""
echo " If want to read/write chip register, use the below format" echo " Function 3 - Set i2c command to chip on Nic"
echo " ./nicsensor.sh [slot] chip [slave] [i2c_command]" echo " 1) Command Format : ./nicsensor.sh [slot] chip [slave] [command]"
echo " i2c_command : such as [i2ctransfer -y 13 w1@0x10 0x00 r2]" echo " 2) Option Detail"
echo " - [slot] : 0 1 2 3 4 5 ..."
echo " - [slave] : chip slave address , please provide 7 bit address"
echo " - [command] : The i2c command which will set to the chip"
echo ""
echo " Function 4 - FRU Read and Wirte"
echo " 1) Command Format : ./nicsensor.sh [slot] fru [slave] [option] [frudata]"
echo " 2) Option Detail"
echo " - [slot] : 0 1 2 3 4 5 ..."
echo " - [slave] : chip slave address , please provide 7 bit address"
echo " - [option] : read/write, default to read"
echo " - [frudata] : fru bin file which will write to eeprom, only for write option"
echo "" echo ""
print_ocp_usage
} }
print_chip_command_format(){ print_chip_command_format(){
@ -1448,6 +1439,13 @@ start_detect_device(){
conf_pre_check conf_pre_check
if [ "$1" == "version" ];then
echo "Script Version : $SCRIPT_VERSION"
echo "Debug Mode : $DEBUG_MODE"
echo "Disable Detect : $DISABLE_DETECT"
exit 0
fi
# is param legel? # is param legel?
if [ "$sensor_type" == "chip" ];then if [ "$sensor_type" == "chip" ];then
if [ $# -le 3 ];then if [ $# -le 3 ];then