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 }