From 914889f21f4b78c4afc92a5f718bf4376fb20549 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Fri, 10 Jan 2025 14:14:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(master=20:=20nicsensor.sh)Update=20to=201.?= =?UTF-8?q?4=20Standard=201.=E4=BF=AE=E6=AD=A3fru=20write=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E9=80=BB=E8=BE=91,=E5=B9=B6=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- change_list.txt | 6 ++++++ code_structure.txt | 2 +- nicsensor.sh | 40 +++++++++++++++++++++++++++++++++------- readme.txt | 8 ++++++-- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/change_list.txt b/change_list.txt index 2a2c2aa..2d2bd61 100644 --- a/change_list.txt +++ b/change_list.txt @@ -1,3 +1,9 @@ +# Script Version 1.4 20250110 + Release Note + 1.[问题修复]修正tmp112传感器读取的逻辑问题 + 2.[新增功能]添加fru解析工具,位置 /tool/fru_parse/fru_parse.py + 3.[功能优化]完善fru write操作逻辑(验证PASS) + # Script Version 1.3 20241229 Release Note 1.[新增功能]支持5280m7的OCP卡的使用 diff --git a/code_structure.txt b/code_structure.txt index 3e9daf7..48a54e1 100644 --- a/code_structure.txt +++ b/code_structure.txt @@ -1,4 +1,4 @@ -On Version V1.2 +On Version V1.x start_get_sensor //启动读取Sensor的流程 |--->set_configuration | |--->set_configuration_5280m7/5468m7/donghu/yichun //根据服务器类型设置具体I2C相关参数 diff --git a/nicsensor.sh b/nicsensor.sh index cd0fe44..3f4df95 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.3 Standard Rev1" +SCRIPT_VERSION="1.4 Standard" fru_file_name=$option_data2 fru_write_size=0 @@ -1023,6 +1023,7 @@ parse_fru_write_data(){ printf "0x%s ",$i } }'` + format_print $INFO "Success to get FRU data" } read_fru(){ @@ -1059,15 +1060,40 @@ read_fru(){ } -# !!! untest function !!! write_fru(){ - - i2c_write_byte=$(($fru_write_size+2)) + start_offset=1 + write_offset=0 + hex_offset="0x00" + while true + do + if [ $fru_write_size -eq 0 ];then + format_print $INFO "Complete write Fru action!!!" + break + fi - write_command="i2ctransfer -y $i2c_bus w$i2c_write_byte@$chip_slave $fru_offset $fru_write_data" - write_res=`$write_command` - format_log_print $INFO "Exec Command: $write_command" + once_data=`echo $fru_write_data | awk -v start=$start_offset '{ + for(i=1;i<=NF;i++) + { + if(i>=start && i fru read - 举例说明:读取Ravel板卡的EEPROM中的FRU(0x57) + 举例说明:读取板卡的EEPROM中的FRU(0x57) - ./nicsensor.sh 5 fru 0x57 read + + 命令: ./nicsensor.sh fru write + 举例说明:写入板卡的EEPROM中的FRU(0x57) + - ./nicsensor.sh 5 fru 0x57 write fru.bin 1.4.3 读取芯片寄存器