Compare commits

...

3 Commits

Author SHA1 Message Date
leimingsheng
bba1d037d5 feat(master : nicsensor)version change to intest 1.6.3 2025-05-08 16:57:56 +08:00
leimingsheng
2d663d4ec8 refactor(master : nicsensor)调整init debug log函数 2025-05-08 14:59:33 +08:00
leimingsheng
abd632d4f2 refactor(master : nicsensor) 将所有的‘==’替换为‘=’ 2025-05-08 14:49:01 +08:00

@ -140,7 +140,7 @@ ina3221_ch2_volt="0"
ina3221_ch0_current="0"
ina3221_ch1_current="0"
ina3221_ch2_current="0"
SCRIPT_VERSION="1.6.2"
SCRIPT_VERSION="1.6.3"
fru_file_name=$option_data2
fru_write_size=0
@ -218,7 +218,7 @@ format_log_print(){
# @Param4 pca9548 channel
# @Param5 pcie slot number
do_i2c_detect(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $INFO "OCP slot $5 : bus$1 9548channel$4"
else
format_print $INFO "PCIe slot $5 : bus$1 9548channel$4"
@ -237,7 +237,7 @@ reset_pca9548(){
set_configuration_5280m7(){
# set pca9641 address && I2C BUS
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
is_have_pca9641=0
pca9548_slave="0x70"
i2c_bus=3
@ -255,7 +255,7 @@ set_configuration_5280m7(){
fi
# set pca9548 switch channel
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
if [ $slot_number -eq 0 ];then
pca9548_channel="0x01"
elif [ $slot_number -eq 1 ];then
@ -285,7 +285,7 @@ set_configuration_5280m7(){
}
set_configuration_5468m7(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -333,7 +333,7 @@ set_configuration_5468m7(){
}
set_configuration_donghu(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -367,7 +367,7 @@ set_configuration_donghu(){
}
set_configuration_yichun(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -392,7 +392,7 @@ set_configuration_yichun(){
}
set_configuration_qiandaohu(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -439,7 +439,7 @@ set_configuration_qiandaohu(){
}
set_configuration_5688m7(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -494,7 +494,7 @@ parse_nic_slot(){
;;
esac
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
slot_number=$(echo $nic_slot | cut -c 4)
else
if [ $fullname -eq 1 ];then
@ -554,12 +554,14 @@ init_debuglog(){
format_log_print $INFO "Debug Mode : $DEBUG_MODE"
format_log_print $INFO "Disable Detect : $DISABLE_DETECT"
if [ "$nic_slot" == "detect" ];then
format_log_print $INFO "Operation Tpye : i2c detect"
elif [ "$nic_slot" == "version" ];then
format_log_print $INFO "Operation Tpye : get version"
if [ "$nic_slot" = "detect" ];then
format_log_print $INFO "Operation Type : i2c detect"
elif [ "$nic_slot" = "version" ];then
format_log_print $INFO "Operation Type : get version"
elif [ $param_num -lt 2 ];then
format_log_print $INFO "Operation Type : help info"
else
format_log_print $INFO "Operation Tpye : read sensor"
format_log_print $INFO "Operation Type : read sensor"
fi
}
@ -619,7 +621,7 @@ pre_exec_hook(){
init_debuglog
# is param legel?
if [ "$sensor_type" == "chip" ];then
if [ "$sensor_type" = "chip" ];then
if [ $param_num -le 3 ];then
format_print $ERROR "Command Format illegal"
print_chip_command_format
@ -628,12 +630,12 @@ pre_exec_hook(){
fi
# if the action is fru write, need pre-process fru data
if [ "$sensor_type" == "fru" ];then
if [ "$option_data" == "write" ];then
if [ "$sensor_type" = "fru" ];then
if [ "$option_data" = "write" ];then
format_log_print $INFO "Opreation FRU Write"
# is option_data(fru file name) valid?
if [ "$option_data2" == "" ];then
if [ "$option_data2" = "" ];then
format_print $ERROR "Please provide fru file name"
print_fru_command_format
exit 1
@ -1210,7 +1212,7 @@ process_fru(){
# fru no need to init first
# write and read fru
if [ "$option_data" == "write" ];then
if [ "$option_data" = "write" ];then
write_fru
else
# default action is read
@ -1270,7 +1272,7 @@ start_get_sensor(){
}
detect_on_5280m7(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
i2c_bus=3
do_i2c_detect $i2c_bus 0x70 0x01 0 0
do_i2c_detect $i2c_bus 0x70 0x02 1 1
@ -1298,7 +1300,7 @@ detect_on_5280m7(){
}
detect_on_5468m7(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -1329,7 +1331,7 @@ detect_on_5468m7(){
}
detect_on_donghu(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -1348,7 +1350,7 @@ detect_on_donghu(){
}
detect_on_yichun(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -1368,7 +1370,7 @@ detect_on_yichun(){
}
detect_on_qiandaohu(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -1394,7 +1396,7 @@ detect_on_qiandaohu(){
}
detect_on_5688m7(){
if [ $nic_type == "ocp" ];then
if [ $nic_type = "ocp" ];then
format_print $ERROR "Unsupport OCP Nic on $server_type"
format_print $INFO "Please check if script has update version"
exit 1
@ -1467,17 +1469,17 @@ start_detect_device(){
pre_exec_hook
if [ "$1" == "version" ];then
if [ "$1" = "version" ];then
echo "Script Version : $SCRIPT_VERSION"
echo "Debug Mode : $DEBUG_MODE"
echo "Disable Detect : $DISABLE_DETECT"
exit 0
fi
if [ "$1" == "detect" ];then
if [ "$2" == "ocp" ];then
if [ "$1" = "detect" ];then
if [ "$2" = "ocp" ];then
nic_type="ocp"
elif [ "$2" == "pcie" ];then
elif [ "$2" = "pcie" ];then
nic_type="pcie"
else
format_print $WARNING "Please provide valid nic type, default to pcie"