From d584304e10a36e74e18fd6c4f82cca33c43951b0 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Fri, 26 Dec 2025 09:42:17 +0800 Subject: [PATCH] =?UTF-8?q?perf(master=20:=20nicsensor)=20update=20to=201.?= =?UTF-8?q?8.5=20=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86pmbus=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=9B=B8=E5=85=B3=E7=9A=84=E6=8F=90=E7=A4=BA=E6=80=A7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nicsensor.sh b/nicsensor.sh index 5c758aa..4818d73 100755 --- a/nicsensor.sh +++ b/nicsensor.sh @@ -1,5 +1,5 @@ #!/bin/sh -SCRIPT_VERSION="1.8.4" +SCRIPT_VERSION="1.8.5" # --------------------------------------------------------- # Project Feature Varible (Change if need) # --------------------------------------------------------- @@ -151,7 +151,7 @@ search_plugin_help(){ print_usage(){ echo "" - echo "================>>> nicsensor script usage <<<==================" + echo "=====================>>> nicsensor script usage <<<======================" echo " Function 1 - Read Sensor Value" echo " 1) Command Format : ./nicsensor.sh [slot] [sensor tpye] [slave]" echo " 2) Option Detail" @@ -437,6 +437,14 @@ pre_exec_hook(){ fi fi + if [ "$Param2" = "pmbus" ];then + if [ $param_num -le 3 ];then + fmt_print "console" $ERROR "Command Format illegal" + echo "Command Format : ./nicsensor.sh [slot] pmbus [slave] [pmbus_command]" + exit 1 + fi + fi + # if the action is fru write, need pre-process fru data if [ "$Param2" = "fru" ];then if [ "$option_data" = "write" ];then @@ -1236,12 +1244,16 @@ process_fru(){ fi } +# --------------------------------------------------------- +# PMBUS Function +# --------------------------------------------------------- #@Param1 : Pmbus Command, hex data #@Param2 : Pmbus reading size, BYTE(1)|WORD(2)|BLOCK(3)|RAW(4) transfer_pmbus_command(){ pmbus_res=`i2ctransfer -y $i2c_bus w1@$chip_slave $1 r$2` reset_pca9548 $i2c_bus $pca9548_slave - fmt_print "console" $INFO "$option_data Result: $pmbus_res" + fmt_print "console" $INFO "$option_data ,Command Code:$pmbus_res" + fmt_print "console" $INFO "Result: $pmbus_res" } # Do pmbus test if plugin avalible