feat(master : nicsensor) 添加Disable Detect功能

功能说明:
启用时不在切换9641和9548时执行i2cdetect
This commit is contained in:
marcinlei@outlook.com 2025-04-12 00:36:49 +08:00
parent 3db9c092e0
commit 148e16f874
2 changed files with 32 additions and 18 deletions

@ -108,6 +108,10 @@ REG_tmp468="0x80"
# --------------------------------------------------------- # ---------------------------------------------------------
# Global Varible (Don't Change) # 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 # DEBUG MODE=0 : Disable debug mode
# =1 : Enable debug mode # =1 : Enable debug mode
DEBUG_MODE=0 DEBUG_MODE=0
@ -134,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 Rev2 Intest" SCRIPT_VERSION="1.5 Rev3 Intest"
fru_file_name=$option_data2 fru_file_name=$option_data2
fru_write_size=0 fru_write_size=0
@ -581,8 +585,10 @@ record_config_info(){
format_log_print $INFO "PCA9548 channel: $pca9548_channel" format_log_print $INFO "PCA9548 channel: $pca9548_channel"
# Record i2c device info to log # Record i2c device info to log
format_log_print $INFO "At the beginning, I2C bus status:" if [ ${DISABLE_DETECT} -eq 0 ];then
i2cdetect -y $i2c_bus >> $log format_log_print $INFO "At the beginning, I2C bus status:"
i2cdetect -y $i2c_bus >> $log
fi
} }
get_pca9641_control(){ get_pca9641_control(){
@ -596,7 +602,9 @@ get_pca9641_control(){
format_log_print $INFO "After Build 9641 connection, The REG value is $res_build" format_log_print $INFO "After Build 9641 connection, The REG value is $res_build"
# After get 9641 controll, Record i2c device info to log # 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 if [ "$res_build" != "0x87" ];then
format_print $ERROR "Cannot establish connection with pca9641 !!!" format_print $ERROR "Cannot establish connection with pca9641 !!!"
@ -611,7 +619,9 @@ switch_pca9548_channel(){
format_log_print $INFO "After switch channel" format_log_print $INFO "After switch channel"
# After set 9548 channel , record i2c device info # 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
} }

@ -4,19 +4,21 @@
## 目录 ## 目录
- [1_简介](#1_简介) - [nicsensor工具使用说明](#nicsensor工具使用说明)
- [2_使用方法](#2_使用方法) - [目录](#目录)
- [2_1_传感器读取](#2_1_传感器读取) - [1\_简介](#1_简介)
- [2_2_fru相关操作](#2_2_fru相关操作) - [2\_使用方法](#2_使用方法)
- [2_3_命令透传](#2_3_命令透传) - [2\_1\_传感器读取](#2_1_传感器读取)
- [2_4_插槽i2c信息遍历](#2_4_插槽i2c信息遍历) - [2\_2\_FRU相关操作](#2_2_fru相关操作)
- [2_5_调试模式使用](#2_5_调试模式使用) - [2\_3\_命令透传](#2_3_命令透传)
- [3_常见问题](#3_常见问题) - [2\_4\_插槽I2C信息遍历](#2_4_插槽i2c信息遍历)
- [3_1_adc128传感器读值为0](#3_1_adc128传感器读值为0) - [2\_5\_调试模式使用](#2_5_调试模式使用)
- [3_2_脚本执行时出现大批量语法错误](#3_2_脚本执行时出现大批量语法错误) - [3\_常见问题](#3_常见问题)
- [4_附属工具](#4_附属工具) - [3\_1\_ADC128传感器读值为0](#3_1_adc128传感器读值为0)
- [4_1_fruparse](#4_1_fruparse) - [3\_2\_脚本执行时出现大批量语法错误](#3_2_脚本执行时出现大批量语法错误)
- [5_关于nicsensor_v2](#5_关于nicsensor_v2) - [4\_附属工具](#4_附属工具)
- [4\_1\_FruParse](#4_1_fruparse)
- [5\_关于nicsensor\_v2](#5_关于nicsensor_v2)
## 1_简介 ## 1_简介
@ -130,6 +132,8 @@ nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于
- `DEBUG_MODE` - `DEBUG_MODE`
- `i2c_bus` - `i2c_bus`
> 关联变量 `DISABLE_DETECT`, 启用时配置为1, 将不会在切换PCA9641和PCA9548时进行i2cdetect
## 3_常见问题 ## 3_常见问题
### 3_1_ADC128传感器读值为0 ### 3_1_ADC128传感器读值为0