diff --git a/nicsensor.sh b/nicsensor.sh index 28740cd..b52c574 100755 --- a/nicsensor.sh +++ b/nicsensor.sh @@ -134,7 +134,7 @@ ina3221_ch2_volt="0" ina3221_ch0_current="0" ina3221_ch1_current="0" ina3221_ch2_current="0" -SCRIPT_VERSION="1.4 Rev1" +SCRIPT_VERSION="1.4 Rev3" fru_file_name=$option_data2 fru_write_size=0 @@ -286,6 +286,11 @@ set_configuration_5280m7(){ } set_configuration_5468m7(){ + 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 + fi is_have_pca9641=1 @@ -329,6 +334,12 @@ set_configuration_5468m7(){ } set_configuration_donghu(){ + 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 + fi + is_have_pca9641=0 i2c_bus=3 @@ -357,6 +368,12 @@ set_configuration_donghu(){ } set_configuration_yichun(){ + 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 + fi + is_have_pca9641=0 pca9548_slave="0x74" @@ -376,6 +393,12 @@ set_configuration_yichun(){ } set_configuration_qiandaohu(){ + 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 + fi + is_have_pca9641=0 if [ $slot_number -le 7 ];then @@ -417,9 +440,15 @@ set_configuration_qiandaohu(){ } set_configuration_5688m7(){ + 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 + fi + is_have_pca9641=1 - pca9641_slave="0x41" - i2c_bus=13 + pca9641_slave="0x31" + i2c_bus=12 if [ $slot_number -le 3 ];then pca9548_slave=0x71 @@ -542,8 +571,7 @@ record_config_info(){ # Record i2c device info to log format_log_print $INFO "At the beginning, I2C bus status:" - res_info=`i2cdetect -y $i2c_bus` - echo $res_info >> $log + i2cdetect -y $i2c_bus >> $log } get_pca9641_control(){ @@ -557,8 +585,7 @@ get_pca9641_control(){ format_log_print $INFO "After Build 9641 connection, The REG value is $res_build" # After get 9641 controll, Record i2c device info to log - res_after=`i2cdetect -y $i2c_bus` - echo $res_after >> $log + i2cdetect -y $i2c_bus >> $log if [ "$res_build" != "0x87" ];then format_print $ERROR "Cannot establish connection with pca9641 !!!" @@ -573,8 +600,7 @@ switch_pca9548_channel(){ format_log_print $INFO "After switch channel" # After set 9548 channel , record i2c device info - res_after=`i2cdetect -y $i2c_bus` - echo $res_after >> $log + i2cdetect -y $i2c_bus >> $log } @@ -1221,6 +1247,12 @@ detect_on_5280m7(){ } detect_on_5468m7(){ + 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 + fi + i2c_bus=13 pca9641_slave="0x31" get_pca9641_control @@ -1244,6 +1276,12 @@ detect_on_5468m7(){ } detect_on_donghu(){ + 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 + fi + i2c_bus=3 do_i2c_detect $i2c_bus 0x70 0x80 7 0 do_i2c_detect $i2c_bus 0x70 0x40 6 1 @@ -1256,6 +1294,12 @@ detect_on_donghu(){ } detect_on_yichun(){ + 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 + fi + i2c_bus=12 do_i2c_detect $i2c_bus 0x74 0x02 2 0 @@ -1267,6 +1311,12 @@ detect_on_yichun(){ } detect_on_qiandaohu(){ + 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 + fi + i2c_bus=3 do_i2c_detect $i2c_bus 0x70 0x08 3 0 do_i2c_detect $i2c_bus 0x70 0x04 2 1 @@ -1285,8 +1335,14 @@ detect_on_qiandaohu(){ } detect_on_5688m7(){ - i2c_bus=13 - pca9641_slave="0x41" + 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 + fi + + i2c_bus=12 + pca9641_slave="0x31" get_pca9641_control do_i2c_detect $i2c_bus 0x71 0x01 0 0