From 148e16f87474bad2e4a128d985780a4bdb4c1e2c Mon Sep 17 00:00:00 2001 From: "marcinlei@outlook.com" <1750818448@qq.com> Date: Sat, 12 Apr 2025 00:36:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(master=20:=20nicsensor)=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0Disable=20Detect=E5=8A=9F=E8=83=BD=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E8=AF=B4=E6=98=8E=EF=BC=9A=20=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=9C=A8=E5=88=87=E6=8D=A29641=E5=92=8C9548?= =?UTF-8?q?=E6=97=B6=E6=89=A7=E8=A1=8Ci2cdetect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor.sh | 20 +++++++++++++++----- readme.md | 30 +++++++++++++++++------------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/nicsensor.sh b/nicsensor.sh index 31b4cc1..4dceefe 100755 --- a/nicsensor.sh +++ b/nicsensor.sh @@ -108,6 +108,10 @@ REG_tmp468="0x80" # --------------------------------------------------------- # Global Varible (Don't Change) # --------------------------------------------------------- +# DISABLE_DETECT=0 :do i2cdetect when i2c status changed +# =1 : don't do i2cdetect when i2c status changed +DISABLE_DETECT=0 + # DEBUG MODE=0 : Disable debug mode # =1 : Enable debug mode DEBUG_MODE=0 @@ -134,7 +138,7 @@ ina3221_ch2_volt="0" ina3221_ch0_current="0" ina3221_ch1_current="0" ina3221_ch2_current="0" -SCRIPT_VERSION="1.5 Rev2 Intest" +SCRIPT_VERSION="1.5 Rev3 Intest" fru_file_name=$option_data2 fru_write_size=0 @@ -581,8 +585,10 @@ record_config_info(){ format_log_print $INFO "PCA9548 channel: $pca9548_channel" # Record i2c device info to log - format_log_print $INFO "At the beginning, I2C bus status:" - i2cdetect -y $i2c_bus >> $log + if [ ${DISABLE_DETECT} -eq 0 ];then + format_log_print $INFO "At the beginning, I2C bus status:" + i2cdetect -y $i2c_bus >> $log + fi } get_pca9641_control(){ @@ -596,7 +602,9 @@ 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 - i2cdetect -y $i2c_bus >> $log + if [ ${DISABLE_DETECT} -eq 0 ];then + i2cdetect -y $i2c_bus >> $log + fi if [ "$res_build" != "0x87" ];then format_print $ERROR "Cannot establish connection with pca9641 !!!" @@ -611,7 +619,9 @@ switch_pca9548_channel(){ format_log_print $INFO "After switch channel" # After set 9548 channel , record i2c device info - i2cdetect -y $i2c_bus >> $log + if [ ${DISABLE_DETECT} -eq 0 ];then + i2cdetect -y $i2c_bus >> $log + fi } diff --git a/readme.md b/readme.md index 539cf65..3d151f3 100644 --- a/readme.md +++ b/readme.md @@ -4,19 +4,21 @@ ## 目录 -- [1_简介](#1_简介) -- [2_使用方法](#2_使用方法) - - [2_1_传感器读取](#2_1_传感器读取) - - [2_2_fru相关操作](#2_2_fru相关操作) - - [2_3_命令透传](#2_3_命令透传) - - [2_4_插槽i2c信息遍历](#2_4_插槽i2c信息遍历) - - [2_5_调试模式使用](#2_5_调试模式使用) -- [3_常见问题](#3_常见问题) - - [3_1_adc128传感器读值为0](#3_1_adc128传感器读值为0) - - [3_2_脚本执行时出现大批量语法错误](#3_2_脚本执行时出现大批量语法错误) -- [4_附属工具](#4_附属工具) - - [4_1_fruparse](#4_1_fruparse) -- [5_关于nicsensor_v2](#5_关于nicsensor_v2) +- [nicsensor工具使用说明](#nicsensor工具使用说明) + - [目录](#目录) + - [1\_简介](#1_简介) + - [2\_使用方法](#2_使用方法) + - [2\_1\_传感器读取](#2_1_传感器读取) + - [2\_2\_FRU相关操作](#2_2_fru相关操作) + - [2\_3\_命令透传](#2_3_命令透传) + - [2\_4\_插槽I2C信息遍历](#2_4_插槽i2c信息遍历) + - [2\_5\_调试模式使用](#2_5_调试模式使用) + - [3\_常见问题](#3_常见问题) + - [3\_1\_ADC128传感器读值为0](#3_1_adc128传感器读值为0) + - [3\_2\_脚本执行时出现大批量语法错误](#3_2_脚本执行时出现大批量语法错误) + - [4\_附属工具](#4_附属工具) + - [4\_1\_FruParse](#4_1_fruparse) + - [5\_关于nicsensor\_v2](#5_关于nicsensor_v2) ## 1_简介 @@ -130,6 +132,8 @@ nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于 - `DEBUG_MODE` - `i2c_bus` +> 关联变量 `DISABLE_DETECT`, 启用时配置为1, 将不会在切换PCA9641和PCA9548时进行i2cdetect + ## 3_常见问题 ### 3_1_ADC128传感器读值为0