Compare commits
No commits in common. "988d217008048d0dd08fcc93ea78759ee71fbc28" and "6423cc73a3bf9914e0a310b15e8b26e804d8c063" have entirely different histories.
988d217008
...
6423cc73a3
63
nicsensor.sh
63
nicsensor.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
SCRIPT_VERSION="1.8.6"
|
||||
SCRIPT_VERSION="1.8.4"
|
||||
# ---------------------------------------------------------
|
||||
# Project Feature Varible (Change if need)
|
||||
# ---------------------------------------------------------
|
||||
@ -139,9 +139,6 @@ INFO="Info"
|
||||
WARNING="Warning"
|
||||
ERROR="Error"
|
||||
log="/tmp/nicsensor_debug.log"
|
||||
pmbus_op="get"
|
||||
hex_pmbus_cmd=0xff
|
||||
hex_pmbus_size=0
|
||||
# ---------------------------------------------------------
|
||||
# Script Function Defination
|
||||
# ---------------------------------------------------------
|
||||
@ -154,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"
|
||||
@ -440,31 +437,6 @@ 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
|
||||
|
||||
# Pmbus Command need pre-process
|
||||
PMBUS_PLUGIN="./pmbus_cmd_list.sh"
|
||||
if [ -e ${PMBUS_PLUGIN} ];then
|
||||
str_pmbus_cmd=$option_data
|
||||
hex_pmbus_cmd=`$PMBUS_PLUGIN "code" $str_pmbus_cmd`
|
||||
|
||||
if [ "$hex_pmbus_cmd" = "0xff" ];then
|
||||
fmt_print "console" $ERROR "Unsupport PMBUS Command : $str_pmbus_cmd"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hex_pmbus_size=`$PMBUS_PLUGIN "size" $str_pmbus_cmd`
|
||||
pmbus_op=`$PMBUS_PLUGIN "operation" $str_pmbus_cmd`
|
||||
else
|
||||
fmt_print "console" $ERROR "Can't find pmbus plugin file, please copy pmbus_cmd_list.sh to here!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# if the action is fru write, need pre-process fru data
|
||||
if [ "$Param2" = "fru" ];then
|
||||
if [ "$option_data" = "write" ];then
|
||||
@ -1264,24 +1236,31 @@ process_fru(){
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# PMBUS Function
|
||||
# ---------------------------------------------------------
|
||||
#@Param1 : Operation Type, get|set
|
||||
#@Param2 : Pmbus Command, hex data
|
||||
#@Param3 : Pmbus reading size, BYTE(1)|WORD(2)|BLOCK(3)|RAW(4)
|
||||
#@Param1 : Pmbus Command, hex data
|
||||
#@Param2 : Pmbus reading size, BYTE(1)|WORD(2)|BLOCK(3)|RAW(4)
|
||||
transfer_pmbus_command(){
|
||||
if [ "$1" = "get" ];then
|
||||
pmbus_res=`i2ctransfer -y $i2c_bus w1@$chip_slave $2 r$3`
|
||||
pmbus_res=`i2ctransfer -y $i2c_bus w1@$chip_slave $1 r$2`
|
||||
reset_pca9548 $i2c_bus $pca9548_slave
|
||||
fmt_print "console" $INFO "$option_data ,Command Code:$pmbus_res"
|
||||
fmt_print "console" $INFO "Result: $pmbus_res"
|
||||
fi
|
||||
fmt_print "console" $INFO "$option_data Result: $pmbus_res"
|
||||
}
|
||||
|
||||
# Do pmbus test if plugin avalible
|
||||
process_pmbus(){
|
||||
transfer_pmbus_command $pmbus_op $hex_pmbus_cmd $hex_pmbus_size
|
||||
PMBUS_PLUGIN="./pmbus_cmd_list.sh"
|
||||
if [ -e ${PMBUS_PLUGIN} ];then
|
||||
str_pmbus_cmd=$option_data
|
||||
hex_pmbus_cmd=`$PMBUS_PLUGIN "code" $str_pmbus_cmd`
|
||||
|
||||
if [ "$hex_pmbus_cmd" = "0xff" ];then
|
||||
fmt_print "console" $ERROR "Unsupport PMBUS Command : $str_pmbus_cmd"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hex_pmbus_size=`$PMBUS_PLUGIN "size" $str_pmbus_cmd`
|
||||
transfer_pmbus_command $hex_pmbus_cmd $hex_pmbus_size
|
||||
else
|
||||
fmt_print "console" $ERROR "Can't find pmbus plugin file, please copy pmbus_cmd_list.sh to here!"
|
||||
fi
|
||||
}
|
||||
|
||||
# This function is temporarily retained for future functional expansion
|
||||
|
||||
@ -35,16 +35,16 @@ pmbus_command_help(){
|
||||
echo " 3) E.G. : ./nicsensor.sh pcie1 pmbus 0x60 READ_TEMPERATURE_1"
|
||||
echo ""
|
||||
echo " *****************Pmbus Support Command List********************"
|
||||
echo " Command Name Code op_type Read Size "
|
||||
echo " READ_VIN 0x88 get Word "
|
||||
echo " READ_IIN 0x89 get Word "
|
||||
echo " READ_VOUT 0x8b get Word "
|
||||
echo " READ_IOUT 0x8c get Word "
|
||||
echo " READ_TEMPERATURE_1 0x8d get Word "
|
||||
echo " READ_TEMPERATURE_2 0x8e get Word "
|
||||
echo " READ_TEMPERATURE_3 0x8f get Word "
|
||||
echo " READ_POUT 0x96 get Word "
|
||||
echo " READ_PIN 0x97 get Word "
|
||||
echo " Command Name Code Read Size "
|
||||
echo " READ_VIN 0x88 Word "
|
||||
echo " READ_IIN 0x89 Word "
|
||||
echo " READ_VOUT 0x8b Word "
|
||||
echo " READ_IOUT 0x8c Word "
|
||||
echo " READ_TEMPERATURE_1 0x8d Word "
|
||||
echo " READ_TEMPERATURE_2 0x8e Word "
|
||||
echo " READ_TEMPERATURE_3 0x8f Word "
|
||||
echo " READ_POUT 0x96 Word "
|
||||
echo " READ_PIN 0x97 Word "
|
||||
echo " ***************************************************************"
|
||||
echo ""
|
||||
}
|
||||
@ -85,42 +85,6 @@ find_pmbus_hex_code(){
|
||||
echo $hex_cmd
|
||||
}
|
||||
|
||||
find_pmbus_operation_type(){
|
||||
case ${str_cmd} in
|
||||
"READ_VIN")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_IIN")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_VOUT")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_IOUT")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_TEMPERATURE_1")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_TEMPERATURE_2")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_TEMPERATURE_3")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_POUT")
|
||||
op_type="get"
|
||||
;;
|
||||
"READ_PIN")
|
||||
op_type="get"
|
||||
;;
|
||||
*)
|
||||
op_type=""
|
||||
;;
|
||||
esac
|
||||
echo $op_type
|
||||
}
|
||||
|
||||
find_pmbus_read_size(){
|
||||
case ${str_cmd} in
|
||||
"READ_VIN")
|
||||
@ -163,9 +127,6 @@ main(){
|
||||
"code")
|
||||
find_pmbus_hex_code
|
||||
;;
|
||||
"operation")
|
||||
find_pmbus_operation_type
|
||||
;;
|
||||
"size")
|
||||
find_pmbus_read_size
|
||||
;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user