From a316ea37cae3eda1bd0aecfaafbfe334f1a84600 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Mon, 24 Nov 2025 14:15:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(master=20:=20nicsensor)=20update=20to=20ve?= =?UTF-8?q?rsion=201.8.1=201.fru=E5=86=99=E6=93=8D=E4=BD=9C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=86=99=E5=85=A5=E5=A4=A7=E4=BA=8E256=E5=AD=97?= =?UTF-8?q?=E8=8A=82=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nicsensor.sh b/nicsensor.sh index 5563afd..de06c7b 100755 --- a/nicsensor.sh +++ b/nicsensor.sh @@ -1,5 +1,5 @@ #!/bin/sh -SCRIPT_VERSION="1.8" +SCRIPT_VERSION="1.8.1" # --------------------------------------------------------- # Project Feature Varible (Change as need) # --------------------------------------------------------- @@ -1173,7 +1173,10 @@ read_fru(){ write_fru(){ start_offset=1 write_offset=0 + base_offset=0 hex_offset="0x00" + hex_base_offset="0x00" + bitshift_cnt=0 while true do if [ $fru_write_size -eq 0 ];then @@ -1195,7 +1198,9 @@ write_fru(){ # do once write hex_num=$(echo "obase=16; $write_offset" | bc) hex_offset=$(echo $hex_num | awk '{printf("0x%s", $0)}') - write_command="i2ctransfer -y $i2c_bus w10@$chip_slave 0x00 $hex_offset $once_data" + base_num=$(echo "obase=16; $base_offset" | bc) + hex_base_offset=$(echo $base_num | awk '{printf("0x%s", $0)}') + write_command="i2ctransfer -y $i2c_bus w10@$chip_slave $hex_base_offset $hex_offset $once_data" fmt_print "log" $INFO "FRU write command : $write_command" write_res=`$write_command` @@ -1203,6 +1208,12 @@ write_fru(){ write_offset=$(($write_offset+8)) start_offset=$(($start_offset+8)) fru_write_size=$(($fru_write_size-8)) + bitshift_cnt=$(($bitshift_cnt+1)) + if [ $bitshift_cnt -eq 32 ];then + base_offset=$(($base_offset+1)) + write_offset=0 + bitshift_cnt=0 + fi done reset_pca9548 $i2c_bus $pca9548_slave }