From a9f2123ad590dd81326b3ce9825a4d3ed80b665d Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Tue, 4 Mar 2025 19:02:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(master=20:=20nicsensor.sh)Update=20to=20ver?= =?UTF-8?q?sion=201.4Rev3=201.=E4=BF=AE=E6=AD=A35688m7=E7=9A=84I2C=20bus?= =?UTF-8?q?=E5=8F=8A9641=20slave=E5=9C=B0=E5=9D=80=202.=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E6=94=AF=E6=8C=81=E6=B5=8B=E8=AF=95OCP=E7=9A=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor.sh | 78 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 11 deletions(-) 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