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