feat(master) update to 1.10 base dev 2
1.[新增功能]解耦脚本参数配置功能, 脚本配置全部放到project.config中 2.[新增功能]增加对pmbus set命令的支持 3.[新增功能]增加setup.sh, 用于一键部署脚本 4.[功能优化]代码结构目录重新归档
This commit is contained in:
parent
efb7017a53
commit
88f871c880
@ -1,3 +1,10 @@
|
|||||||
|
# Script Version 1.11
|
||||||
|
#Release Note
|
||||||
|
1.[新增功能]解耦脚本参数配置功能, 脚本配置全部放到project.config中
|
||||||
|
2.[新增功能]增加对pmbus set命令的支持
|
||||||
|
3.[新增功能]增加setup.sh, 用于一键部署脚本
|
||||||
|
4.[功能优化]代码结构目录重新归档
|
||||||
|
|
||||||
# Script Verison 1.10
|
# Script Verison 1.10
|
||||||
Release Note
|
Release Note
|
||||||
1.[新增功能]新增适配传感器 ina226, lm95241
|
1.[新增功能]新增适配传感器 ina226, lm95241
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Desc : This script used to find pmbus code and read size
|
# Desc : This script used to find pmbus code and read size
|
||||||
# Todo : Support PMBUS Setting Function
|
|
||||||
# Version : 0.1
|
|
||||||
# Date : 2025-12-25
|
|
||||||
# Changelist : 2025-12-25|v0.1 Create this file
|
# Changelist : 2025-12-25|v0.1 Create this file
|
||||||
|
# 2026-04-17|v1.1 Add PAGE command support
|
||||||
|
|
||||||
# How to use this pmbus plugin?
|
# How to use this pmbus plugin?
|
||||||
# Copy this file to the dir as same as nicsensor.sh
|
# Follow readme.md file to use this plugin or use setup.sh to install this plugin
|
||||||
EXTENSION_VERSION="v1.0"
|
EXTENSION_VERSION="v1.1"
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Varible Define
|
# Varible Define
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
@ -28,15 +26,18 @@ PMBUS_RAW=4
|
|||||||
pmbus_command_help(){
|
pmbus_command_help(){
|
||||||
echo " Extend Function - PMBUS command test"
|
echo " Extend Function - PMBUS command test"
|
||||||
echo " Version : $EXTENSION_VERSION"
|
echo " Version : $EXTENSION_VERSION"
|
||||||
echo " 1) Command Format : ./nicsensor.sh [slot] pmbus [slave] [command]"
|
echo " 1) Command Format : ./nicsensor.sh [slot] pmbus [slave] [command] <data>"
|
||||||
echo " 2) Option Detail"
|
echo " 2) Option Detail"
|
||||||
echo " - [slot] : 0 1 2 3 4 5 ..."
|
echo " - [slot] : 0 1 2 3 4 5 ..."
|
||||||
echo " - [slave] : power manage chip slave address , please provide 7 bit address"
|
echo " - [slave] : power manage chip slave address , please provide 7 bit address"
|
||||||
echo " - [command] : The pmbus command which will set to the power manage chip"
|
echo " - [command] : The pmbus command which will set to the power manage chip"
|
||||||
|
echo " - <data> : The data which will set to the power manage chip, only set operation type is set"
|
||||||
echo " 3) E.G. : ./nicsensor.sh pcie1 pmbus 0x60 READ_TEMPERATURE_1"
|
echo " 3) E.G. : ./nicsensor.sh pcie1 pmbus 0x60 READ_TEMPERATURE_1"
|
||||||
|
echo " : ./nicsensor.sh pcie1 pmbus 0x60 PAGE 0x00"
|
||||||
echo ""
|
echo ""
|
||||||
echo " *****************Pmbus Support Command List********************"
|
echo " *****************Pmbus Support Command List********************"
|
||||||
echo " Command Name Code op_type Read Size "
|
echo " Command Name Code op_type Read Size "
|
||||||
|
echo " PAGE 0x00 set Byte "
|
||||||
echo " READ_VIN 0x88 get Word "
|
echo " READ_VIN 0x88 get Word "
|
||||||
echo " READ_IIN 0x89 get Word "
|
echo " READ_IIN 0x89 get Word "
|
||||||
echo " READ_VOUT 0x8b get Word "
|
echo " READ_VOUT 0x8b get Word "
|
||||||
@ -52,6 +53,9 @@ pmbus_command_help(){
|
|||||||
|
|
||||||
find_pmbus_hex_code(){
|
find_pmbus_hex_code(){
|
||||||
case ${str_cmd} in
|
case ${str_cmd} in
|
||||||
|
"PAGE")
|
||||||
|
hex_cmd=0x00
|
||||||
|
;;
|
||||||
"READ_VIN")
|
"READ_VIN")
|
||||||
hex_cmd=0x88
|
hex_cmd=0x88
|
||||||
;;
|
;;
|
||||||
@ -88,6 +92,9 @@ find_pmbus_hex_code(){
|
|||||||
|
|
||||||
find_pmbus_operation_type(){
|
find_pmbus_operation_type(){
|
||||||
case ${str_cmd} in
|
case ${str_cmd} in
|
||||||
|
"PAGE")
|
||||||
|
op_type="set"
|
||||||
|
;;
|
||||||
"READ_VIN")
|
"READ_VIN")
|
||||||
op_type="get"
|
op_type="get"
|
||||||
;;
|
;;
|
||||||
@ -124,6 +131,9 @@ find_pmbus_operation_type(){
|
|||||||
|
|
||||||
find_pmbus_read_size(){
|
find_pmbus_read_size(){
|
||||||
case ${str_cmd} in
|
case ${str_cmd} in
|
||||||
|
"PAGE")
|
||||||
|
read_size=$PMBUS_BYTE
|
||||||
|
;;
|
||||||
"READ_VIN")
|
"READ_VIN")
|
||||||
read_size=$PMBUS_WORD
|
read_size=$PMBUS_WORD
|
||||||
;;
|
;;
|
||||||
@ -4,7 +4,7 @@
|
|||||||
# Detail: This script will stress test the nicsensor by reading the sensor data
|
# Detail: This script will stress test the nicsensor by reading the sensor data
|
||||||
# and print the result to the console.
|
# and print the result to the console.
|
||||||
|
|
||||||
EXTENSION_VERSION="v1.0"
|
EXTENSION_VERSION="v1.0 Base Dev 1"
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Varible Define
|
# Varible Define
|
||||||
@ -120,9 +120,9 @@ start_stress_test(){
|
|||||||
if [ -f ${CONFIG_NICSENSOR} ]; then
|
if [ -f ${CONFIG_NICSENSOR} ]; then
|
||||||
config_tool=$(cat ${CONFIG_NICSENSOR})
|
config_tool=$(cat ${CONFIG_NICSENSOR})
|
||||||
else
|
else
|
||||||
config_tool="nicsensor.sh"
|
config_tool="/extlog/nicsensor/nicsensor.sh"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "./${config_tool}" ]; then
|
if [ ! -f "${config_tool}" ]; then
|
||||||
echo "Error: ${config_tool} tool not found"
|
echo "Error: ${config_tool} tool not found"
|
||||||
echo "Info : Please check the nicsensor tool path and name"
|
echo "Info : Please check the nicsensor tool path and name"
|
||||||
return 1
|
return 1
|
||||||
@ -131,27 +131,27 @@ start_stress_test(){
|
|||||||
# option check
|
# option check
|
||||||
if [ ! -f ${CONFIG_ROUND} ]; then
|
if [ ! -f ${CONFIG_ROUND} ]; then
|
||||||
echo "Error: Round is not set"
|
echo "Error: Round is not set"
|
||||||
echo "Info : Please set the stress test round first, use command: ./nicsensor.sh [slot] stress round [data]"
|
echo "Info : Please set the stress test round first, use command: ${config_tool} [slot] stress round [data]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -f ${CONFIG_INTERVAL} ]; then
|
if [ ! -f ${CONFIG_INTERVAL} ]; then
|
||||||
echo "Error: Interval is not set"
|
echo "Error: Interval is not set"
|
||||||
echo "Info : Please set the stress test interval first, use command: ./nicsensor.sh [slot] stress interval [data]"
|
echo "Info : Please set the stress test interval first, use command: ${config_tool} [slot] stress interval [data]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -f ${CONFIG_SLOT} ]; then
|
if [ ! -f ${CONFIG_SLOT} ]; then
|
||||||
echo "Error: Slot is not set"
|
echo "Error: Slot is not set"
|
||||||
echo "Info : Please set the stress test slot first, use command: ./nicsensor.sh [slot] stress slot [data]"
|
echo "Info : Please set the stress test slot first, use command: ${config_tool} [slot] stress slot [data]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -f ${CONFIG_SENSOR} ]; then
|
if [ ! -f ${CONFIG_SENSOR} ]; then
|
||||||
echo "Error: Sensor is not set"
|
echo "Error: Sensor is not set"
|
||||||
echo "Info : Please set the stress test sensor first, use command: ./nicsensor.sh [slot] stress sensor [data]"
|
echo "Info : Please set the stress test sensor first, use command: ${config_tool} [slot] stress sensor [data]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -f ${CONFIG_SLAVE} ]; then
|
if [ ! -f ${CONFIG_SLAVE} ]; then
|
||||||
echo "Error: Slave is not set"
|
echo "Error: Slave is not set"
|
||||||
echo "Info : Please set the stress test slave first, use command: ./nicsensor.sh [slot] stress slave [data]"
|
echo "Info : Please set the stress test slave first, use command: ${config_tool} [slot] stress slave [data]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -170,9 +170,10 @@ start_stress_test(){
|
|||||||
|
|
||||||
run_count=1
|
run_count=1
|
||||||
while [ ${run_count} -le ${config_round} ]; do
|
while [ ${run_count} -le ${config_round} ]; do
|
||||||
|
echo ""
|
||||||
timestamp=$(date +"%Y-%m-%dT%H:%M:%S")
|
timestamp=$(date +"%Y-%m-%dT%H:%M:%S")
|
||||||
echo "====== ${timestamp}, Run Count: ${run_count}"
|
echo "====== ${timestamp}, Run Count: ${run_count}"
|
||||||
exec_cmd="./${config_tool} ${config_slot} ${config_sensor} ${config_slave}"
|
exec_cmd="${config_tool} ${config_slot} ${config_sensor} ${config_slave}"
|
||||||
${exec_cmd}
|
${exec_cmd}
|
||||||
sleep ${config_interval}
|
sleep ${config_interval}
|
||||||
run_count=$((run_count+1))
|
run_count=$((run_count+1))
|
||||||
129
nicsensor.sh
129
nicsensor.sh
@ -1,65 +1,75 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
SCRIPT_VERSION="1.10"
|
SCRIPT_VERSION="1.10 Base Dev 2"
|
||||||
|
|
||||||
|
# Load project config file
|
||||||
|
PROJECT_VARIBLE_CONFIG="/extlog/nicsensor/project.config"
|
||||||
|
PROJECT_CONFIG_STATUS=0
|
||||||
|
|
||||||
|
if [ -f $PROJECT_VARIBLE_CONFIG ]; then
|
||||||
|
. $PROJECT_VARIBLE_CONFIG
|
||||||
|
PROJECT_CONFIG_STATUS=1
|
||||||
|
fi
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Project Feature Varible (Change if need)
|
# Project Feature Varible
|
||||||
|
# Use default value if not set
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# ADC128 Division factor
|
# ADC128 Division factor
|
||||||
votage_division_factor_0="1"
|
votage_division_factor_0="${votage_division_factor_0:-1}"
|
||||||
votage_division_factor_1="1"
|
votage_division_factor_1="${votage_division_factor_1:-1}"
|
||||||
votage_division_factor_2="1"
|
votage_division_factor_2="${votage_division_factor_2:-1}"
|
||||||
votage_division_factor_3="0.8"
|
votage_division_factor_3="${votage_division_factor_3:-0.8}"
|
||||||
votage_division_factor_4="0.6"
|
votage_division_factor_4="${votage_division_factor_4:-0.6}"
|
||||||
votage_division_factor_5="0.6"
|
votage_division_factor_5="${votage_division_factor_5:-0.6}"
|
||||||
votage_division_factor_6="0.2326"
|
votage_division_factor_6="${votage_division_factor_6:-0.2326}"
|
||||||
votage_division_factor_7="1"
|
votage_division_factor_7="${votage_division_factor_7:-1}"
|
||||||
|
|
||||||
# ADC128 channel name
|
# ADC128 channel name
|
||||||
ADC128_Channel0_name="Channel0"
|
ADC128_Channel0_name="${ADC128_Channel0_name:-Channel0}"
|
||||||
ADC128_Channel1_name="Channel1"
|
ADC128_Channel1_name="${ADC128_Channel1_name:-Channel1}"
|
||||||
ADC128_Channel2_name="Channel2"
|
ADC128_Channel2_name="${ADC128_Channel2_name:-Channel2}"
|
||||||
ADC128_Channel3_name="Channel3"
|
ADC128_Channel3_name="${ADC128_Channel3_name:-Channel3}"
|
||||||
ADC128_Channel4_name="Channel4"
|
ADC128_Channel4_name="${ADC128_Channel4_name:-Channel4}"
|
||||||
ADC128_Channel5_name="Channel5"
|
ADC128_Channel5_name="${ADC128_Channel5_name:-Channel5}"
|
||||||
ADC128_Channel6_name="Channel6"
|
ADC128_Channel6_name="${ADC128_Channel6_name:-Channel6}"
|
||||||
ADC128_Channel7_name="Channel7"
|
ADC128_Channel7_name="${ADC128_Channel7_name:-Channel7}"
|
||||||
|
|
||||||
# INA3221 shunt resistor(unit: mohm)
|
# INA3221 shunt resistor(unit: mohm)
|
||||||
shunt_resistor_0="2"
|
shunt_resistor_0="${shunt_resistor_0:-2}"
|
||||||
shunt_resistor_1="2"
|
shunt_resistor_1="${shunt_resistor_1:-2}"
|
||||||
shunt_resistor_2="5"
|
shunt_resistor_2="${shunt_resistor_2:-5}"
|
||||||
|
|
||||||
# INA3221 channel name
|
# INA3221 channel name
|
||||||
INA3221_Channel0_name="Channel0"
|
INA3221_Channel0_name="${INA3221_Channel0_name:-Channel0}"
|
||||||
INA3221_Channel1_name="Channel1"
|
INA3221_Channel1_name="${INA3221_Channel1_name:-Channel1}"
|
||||||
INA3221_Channel2_name="Channel2"
|
INA3221_Channel2_name="${INA3221_Channel2_name:-Channel2}"
|
||||||
|
|
||||||
# EMC1413 channel name
|
# EMC1413 channel name
|
||||||
EMC1413_Channel0_name="Channel0"
|
EMC1413_Channel0_name="${EMC1413_Channel0_name:-Channel0}"
|
||||||
EMC1413_Channel1_name="Channel1"
|
EMC1413_Channel1_name="${EMC1413_Channel1_name:-Channel1}"
|
||||||
EMC1413_Channel2_name="Channel2"
|
EMC1413_Channel2_name="${EMC1413_Channel2_name:-Channel2}"
|
||||||
|
|
||||||
# TMP468 channel name
|
# TMP468 channel name
|
||||||
TMP468_Channel0_name="Local"
|
TMP468_Channel0_name="${TMP468_Channel0_name:-Local}"
|
||||||
TMP468_Channel1_name="Remote1"
|
TMP468_Channel1_name="${TMP468_Channel1_name:-Remote1}"
|
||||||
TMP468_Channel2_name="Remote2"
|
TMP468_Channel2_name="${TMP468_Channel2_name:-Remote2}"
|
||||||
TMP468_Channel3_name="Remote3"
|
TMP468_Channel3_name="${TMP468_Channel3_name:-Remote3}"
|
||||||
TMP468_Channel4_name="Remote4"
|
TMP468_Channel4_name="${TMP468_Channel4_name:-Remote4}"
|
||||||
TMP468_Channel5_name="Remote5"
|
TMP468_Channel5_name="${TMP468_Channel5_name:-Remote5}"
|
||||||
TMP468_Channel6_name="Remote6"
|
TMP468_Channel6_name="${TMP468_Channel6_name:-Remote6}"
|
||||||
TMP468_Channel7_name="Remote7"
|
TMP468_Channel7_name="${TMP468_Channel7_name:-Remote7}"
|
||||||
TMP468_Channel8_name="Remote8"
|
TMP468_Channel8_name="${TMP468_Channel8_name:-Remote8}"
|
||||||
|
|
||||||
# TMP112 sensor name
|
# TMP112 sensor name
|
||||||
TMP112_Sensor_name="Temperature"
|
TMP112_Sensor_name="${TMP112_Sensor_name:-Temperature}"
|
||||||
|
|
||||||
# INA226 channel name
|
# INA226 channel name
|
||||||
INA226_Channel0_name="Channel0"
|
INA226_Channel0_name="${INA226_Channel0_name:-Channel0}"
|
||||||
|
|
||||||
# LM95241 channel name
|
# LM95241 channel name
|
||||||
LM95241_Local_name="Local"
|
LM95241_Local_name="${LM95241_Local_name:-Local}"
|
||||||
LM95241_Remote1_name="Remote1"
|
LM95241_Remote1_name="${LM95241_Remote1_name:-Remote1}"
|
||||||
LM95241_Remote2_name="Remote2"
|
LM95241_Remote2_name="${LM95241_Remote2_name:-Remote2}"
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Global Settings
|
# Global Settings
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
@ -161,12 +171,15 @@ pmbus_op="get"
|
|||||||
hex_pmbus_cmd=0xff
|
hex_pmbus_cmd=0xff
|
||||||
hex_pmbus_size=0
|
hex_pmbus_size=0
|
||||||
CONFIG_DIR="/tmp/nicsensor_config/"
|
CONFIG_DIR="/tmp/nicsensor_config/"
|
||||||
|
|
||||||
|
# Extension Plugin Path
|
||||||
|
extension_dir="/extlog/nicsensor/extension"
|
||||||
|
PMBUS_PLUGIN="${extension_dir}/pmbus_cmd_list.sh"
|
||||||
|
STRESS_PLUGIN="${extension_dir}/stress_test.sh"
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Script Function Defination
|
# Script Function Defination
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
search_plugin_help(){
|
search_plugin_help(){
|
||||||
PMBUS_PLUGIN="./pmbus_cmd_list.sh"
|
|
||||||
STRESS_PLUGIN="./stress_test.sh"
|
|
||||||
plugin_flag=0
|
plugin_flag=0
|
||||||
if [ -e ${PMBUS_PLUGIN} ];then
|
if [ -e ${PMBUS_PLUGIN} ];then
|
||||||
$PMBUS_PLUGIN "help"
|
$PMBUS_PLUGIN "help"
|
||||||
@ -558,7 +571,6 @@ extension_preprocess(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Pmbus Command need pre-process
|
# Pmbus Command need pre-process
|
||||||
PMBUS_PLUGIN="./pmbus_cmd_list.sh"
|
|
||||||
if [ -e ${PMBUS_PLUGIN} ];then
|
if [ -e ${PMBUS_PLUGIN} ];then
|
||||||
str_pmbus_cmd=$option_data
|
str_pmbus_cmd=$option_data
|
||||||
hex_pmbus_cmd=`$PMBUS_PLUGIN "code" $str_pmbus_cmd`
|
hex_pmbus_cmd=`$PMBUS_PLUGIN "code" $str_pmbus_cmd`
|
||||||
@ -571,18 +583,17 @@ extension_preprocess(){
|
|||||||
hex_pmbus_size=`$PMBUS_PLUGIN "size" $str_pmbus_cmd`
|
hex_pmbus_size=`$PMBUS_PLUGIN "size" $str_pmbus_cmd`
|
||||||
pmbus_op=`$PMBUS_PLUGIN "operation" $str_pmbus_cmd`
|
pmbus_op=`$PMBUS_PLUGIN "operation" $str_pmbus_cmd`
|
||||||
else
|
else
|
||||||
fmt_print "console" $ERROR "Can't find pmbus plugin file, please copy pmbus_cmd_list.sh to here!"
|
fmt_print "console" $ERROR "Can't find pmbus plugin file, please copy pmbus_cmd_list.sh to ${PMBUS_PLUGIN}!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$Param2" = "stress" ];then
|
if [ "$Param2" = "stress" ];then
|
||||||
STRESS_PLUGIN="./stress_test.sh"
|
|
||||||
if [ -e ${STRESS_PLUGIN} ];then
|
if [ -e ${STRESS_PLUGIN} ];then
|
||||||
${STRESS_PLUGIN} $Param3 $option_data
|
${STRESS_PLUGIN} $Param3 $option_data
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
fmt_print "console" $ERROR "Can't find stress plugin file, please copy stress_test.sh to here!"
|
fmt_print "console" $ERROR "Can't find stress plugin file, please copy stress_test.sh to ${STRESS_PLUGIN}!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -597,6 +608,10 @@ pre_exec_hook(){
|
|||||||
init_debuglog
|
init_debuglog
|
||||||
systemtool_check
|
systemtool_check
|
||||||
|
|
||||||
|
if [ $PROJECT_CONFIG_STATUS -eq 0 ];then
|
||||||
|
fmt_print "console" $WARNING "Project config file not found, Will use default config."
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$Param1" = "help" ] && [ $param_num -eq 2 ];then
|
if [ "$Param1" = "help" ] && [ $param_num -eq 2 ];then
|
||||||
print_usage $Param2
|
print_usage $Param2
|
||||||
exit 0
|
exit 0
|
||||||
@ -1495,7 +1510,7 @@ process_fru(){
|
|||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
#@Param1 : Operation Type, get|set
|
#@Param1 : Operation Type, get|set
|
||||||
#@Param2 : Pmbus Command, hex data
|
#@Param2 : Pmbus Command, hex data
|
||||||
#@Param3 : Pmbus reading size, BYTE(1)|WORD(2)|BLOCK(3)|RAW(4)
|
#@Param3 : Pmbus reading/write size, BYTE(1)|WORD(2)|BLOCK(3)|RAW(4)
|
||||||
transfer_pmbus_command(){
|
transfer_pmbus_command(){
|
||||||
if [ "$1" = "get" ];then
|
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 $2 r$3`
|
||||||
@ -1503,8 +1518,15 @@ transfer_pmbus_command(){
|
|||||||
fmt_print "console" $INFO "$option_data ,Command Code:$2"
|
fmt_print "console" $INFO "$option_data ,Command Code:$2"
|
||||||
fmt_print "console" $INFO "Result: $pmbus_res"
|
fmt_print "console" $INFO "Result: $pmbus_res"
|
||||||
else
|
else
|
||||||
fmt_print "console" $WARNING "Not Support Set function in this version : $SCRIPT_VERSION"
|
# pmbus set command
|
||||||
fi
|
write_byte=$(($3+1))
|
||||||
|
# ./nicsensor.sh pcie1 pmbus 0x60 PAGE 0x00
|
||||||
|
# so, option_data2 = 0x00, is the data which will set to the power manage chip
|
||||||
|
exec_cmd="i2ctransfer -y $i2c_bus w${write_byte}@${chip_slave} $2 ${option_data2}"
|
||||||
|
pmbus_res=`$exec_cmd`
|
||||||
|
reset_pca9548 $i2c_bus $pca9548_slave
|
||||||
|
fmt_print "console" $INFO "$option_data ,Command Code:$2, Setting Data:${option_data2}"
|
||||||
|
fmt_print "log" $INFO "[PMBUS] Set Command : $exec_cmd"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Do pmbus test if plugin avalible
|
# Do pmbus test if plugin avalible
|
||||||
@ -1568,9 +1590,10 @@ start_get_sensor(){
|
|||||||
"pmbus")
|
"pmbus")
|
||||||
process_pmbus
|
process_pmbus
|
||||||
;;
|
;;
|
||||||
"reserve")
|
# reserve function is temporarily retained for future functional expansion
|
||||||
handle_reserve
|
# "reserve")
|
||||||
;;
|
# handle_reserve
|
||||||
|
# ;;
|
||||||
*)
|
*)
|
||||||
fmt_print "console" $ERROR "Unsupport Sensor Type !!! - $sensor_type"
|
fmt_print "console" $ERROR "Unsupport Sensor Type !!! - $sensor_type"
|
||||||
fmt_print "console" $INFO "Support list: $Support_Sensor_List"
|
fmt_print "console" $INFO "Support list: $Support_Sensor_List"
|
||||||
|
|||||||
56
project.config
Normal file
56
project.config
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# ADC128 Division factor
|
||||||
|
votage_division_factor_0="1"
|
||||||
|
votage_division_factor_1="1"
|
||||||
|
votage_division_factor_2="1"
|
||||||
|
votage_division_factor_3="0.8"
|
||||||
|
votage_division_factor_4="0.6"
|
||||||
|
votage_division_factor_5="0.6"
|
||||||
|
votage_division_factor_6="0.2326"
|
||||||
|
votage_division_factor_7="1"
|
||||||
|
|
||||||
|
# ADC128 channel name
|
||||||
|
ADC128_Channel0_name="Channel0"
|
||||||
|
ADC128_Channel1_name="Channel1"
|
||||||
|
ADC128_Channel2_name="Channel2"
|
||||||
|
ADC128_Channel3_name="Channel3"
|
||||||
|
ADC128_Channel4_name="Channel4"
|
||||||
|
ADC128_Channel5_name="Channel5"
|
||||||
|
ADC128_Channel6_name="Channel6"
|
||||||
|
ADC128_Channel7_name="Channel7"
|
||||||
|
|
||||||
|
# INA3221 shunt resistor(unit: mohm)
|
||||||
|
shunt_resistor_0="2"
|
||||||
|
shunt_resistor_1="2"
|
||||||
|
shunt_resistor_2="5"
|
||||||
|
|
||||||
|
# INA3221 channel name
|
||||||
|
INA3221_Channel0_name="Channel0"
|
||||||
|
INA3221_Channel1_name="Channel1"
|
||||||
|
INA3221_Channel2_name="Channel2"
|
||||||
|
|
||||||
|
# EMC1413 channel name
|
||||||
|
EMC1413_Channel0_name="Channel0"
|
||||||
|
EMC1413_Channel1_name="Channel1"
|
||||||
|
EMC1413_Channel2_name="Channel2"
|
||||||
|
|
||||||
|
# TMP468 channel name
|
||||||
|
TMP468_Channel0_name="Local"
|
||||||
|
TMP468_Channel1_name="Remote1"
|
||||||
|
TMP468_Channel2_name="Remote2"
|
||||||
|
TMP468_Channel3_name="Remote3"
|
||||||
|
TMP468_Channel4_name="Remote4"
|
||||||
|
TMP468_Channel5_name="Remote5"
|
||||||
|
TMP468_Channel6_name="Remote6"
|
||||||
|
TMP468_Channel7_name="Remote7"
|
||||||
|
TMP468_Channel8_name="Remote8"
|
||||||
|
|
||||||
|
# TMP112 sensor name
|
||||||
|
TMP112_Sensor_name="Temperature"
|
||||||
|
|
||||||
|
# INA226 channel name
|
||||||
|
INA226_Channel0_name="Channel0"
|
||||||
|
|
||||||
|
# LM95241 channel name
|
||||||
|
LM95241_Local_name="Local"
|
||||||
|
LM95241_Remote1_name="Remote1"
|
||||||
|
LM95241_Remote2_name="Remote2"
|
||||||
57
setup.sh
Normal file
57
setup.sh
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Script Description:
|
||||||
|
# This script is used to auto setup the nicsensor tool and its extensions.
|
||||||
|
|
||||||
|
SCRIPT_VERSION="1.0.0"
|
||||||
|
SUPPORT_TOOL_VERSION="1.11"
|
||||||
|
|
||||||
|
# Default values
|
||||||
|
source_extension_dir="./extension"
|
||||||
|
destination_tool_dir="/extlog/nicsensor"
|
||||||
|
destination_extension_dir="/extlog/nicsensor/extension"
|
||||||
|
exec_path="/extlog/nicsensor/nicsensor.sh"
|
||||||
|
|
||||||
|
# PRINT SCRIPT INFO
|
||||||
|
echo "=== Nicsensor Quick Setup Script! ==="
|
||||||
|
echo "Setup Tool Version : $SCRIPT_VERSION"
|
||||||
|
echo "Support nicsensor tool Version : $SUPPORT_TOOL_VERSION"
|
||||||
|
|
||||||
|
# Check if the destination extension directory exists, if not, create it
|
||||||
|
if [ ! -d "$destination_extension_dir" ]; then
|
||||||
|
echo "Step 0 : Create directory $destination_extension_dir"
|
||||||
|
mkdir -p "$destination_extension_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get script Path
|
||||||
|
script_dir=$(pwd)
|
||||||
|
source_extension_dir="$script_dir/extension"
|
||||||
|
|
||||||
|
# check if the source extension directory exists, if not, exit
|
||||||
|
if [ ! -d "$source_extension_dir" ]; then
|
||||||
|
echo "Error : Source extension directory $source_extension_dir does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# copy the extension files to the destination directory
|
||||||
|
echo "Step 1 : Copy extension files to $destination_extension_dir"
|
||||||
|
cp -rf "$source_extension_dir"/* "$destination_extension_dir"
|
||||||
|
|
||||||
|
# Add execute permission for extension files
|
||||||
|
echo "Step 2 : Add execute permission for extension files"
|
||||||
|
chmod +x "$destination_extension_dir"/*
|
||||||
|
|
||||||
|
# copy the project config to the destination directory
|
||||||
|
echo "Step 3 : Copy project.config to $destination_tool_dir"
|
||||||
|
cp -f "./project.config" "$destination_tool_dir"
|
||||||
|
|
||||||
|
# copy the exec file to the destination directory
|
||||||
|
echo "Step 4 : Copy nicsensor to $exec_path"
|
||||||
|
cp -f "./nicsensor.sh" "$exec_path"
|
||||||
|
|
||||||
|
# Add execute permission for exec file
|
||||||
|
echo "Step 5 : Add execute permission for nicsensor"
|
||||||
|
chmod +x "$exec_path"
|
||||||
|
|
||||||
|
|
||||||
|
echo "Complete auto setup nicsensor tool and its extensions."
|
||||||
Loading…
Reference in New Issue
Block a user