feat(master : nicsensor) update to version 1.8.1

1.fru写操作支持写入大于256字节的数据
This commit is contained in:
leimingsheng 2025-11-24 14:15:25 +08:00
parent 580de7fa6f
commit a316ea37ca

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
SCRIPT_VERSION="1.8" SCRIPT_VERSION="1.8.1"
# --------------------------------------------------------- # ---------------------------------------------------------
# Project Feature Varible (Change as need) # Project Feature Varible (Change as need)
# --------------------------------------------------------- # ---------------------------------------------------------
@ -1173,7 +1173,10 @@ read_fru(){
write_fru(){ write_fru(){
start_offset=1 start_offset=1
write_offset=0 write_offset=0
base_offset=0
hex_offset="0x00" hex_offset="0x00"
hex_base_offset="0x00"
bitshift_cnt=0
while true while true
do do
if [ $fru_write_size -eq 0 ];then if [ $fru_write_size -eq 0 ];then
@ -1195,7 +1198,9 @@ write_fru(){
# do once write # do once write
hex_num=$(echo "obase=16; $write_offset" | bc) hex_num=$(echo "obase=16; $write_offset" | bc)
hex_offset=$(echo $hex_num | awk '{printf("0x%s", $0)}') 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" fmt_print "log" $INFO "FRU write command : $write_command"
write_res=`$write_command` write_res=`$write_command`
@ -1203,6 +1208,12 @@ write_fru(){
write_offset=$(($write_offset+8)) write_offset=$(($write_offset+8))
start_offset=$(($start_offset+8)) start_offset=$(($start_offset+8))
fru_write_size=$(($fru_write_size-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 done
reset_pca9548 $i2c_bus $pca9548_slave reset_pca9548 $i2c_bus $pca9548_slave
} }