update code
This commit is contained in:
parent
5095763b6b
commit
938adf43be
82
nicsensor.sh
82
nicsensor.sh
@ -65,6 +65,7 @@ LM95241_Remote2_name="Remote2"
|
|||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
Support_Sensor_List="emc1413, adc128, ina3221, ina226, tmp468, tmp112, lm95241"
|
Support_Sensor_List="emc1413, adc128, ina3221, ina226, tmp468, tmp112, lm95241"
|
||||||
Support_Server_List="5280m7, 5468m7, 5688m7, donghu, yichun, qiandaohu"
|
Support_Server_List="5280m7, 5468m7, 5688m7, donghu, yichun, qiandaohu"
|
||||||
|
Support_Property_List="debug|n_detect|server|fru_size|fru_offset|i2cbus"
|
||||||
# Which server will use this script
|
# Which server will use this script
|
||||||
server_type="auto"
|
server_type="auto"
|
||||||
|
|
||||||
@ -249,7 +250,7 @@ print_usage(){
|
|||||||
echo " Function 5 - Properties Settings"
|
echo " Function 5 - Properties Settings"
|
||||||
echo " 1) Command Format : ./nicsensor.sh [get/set] [property] [value]"
|
echo " 1) Command Format : ./nicsensor.sh [get/set] [property] [value]"
|
||||||
echo " 2) Option Detail"
|
echo " 2) Option Detail"
|
||||||
echo " - [property] : debug|n_detect|server|fru_size|fru_offset|i2cbus"
|
echo " - [property] : $Support_Property_List"
|
||||||
echo " - [value] : property's value"
|
echo " - [value] : property's value"
|
||||||
echo " 3) E.G. : ./nicsensor.sh set server 5280m7"
|
echo " 3) E.G. : ./nicsensor.sh set server 5280m7"
|
||||||
echo " : ./nicsensor.sh set debug 1"
|
echo " : ./nicsensor.sh set debug 1"
|
||||||
@ -390,6 +391,7 @@ get_set_properties(){
|
|||||||
default_data=$i2c_bus
|
default_data=$i2c_bus
|
||||||
else
|
else
|
||||||
fmt_print "console" $ERROR "Invalid Property : $Param2"
|
fmt_print "console" $ERROR "Invalid Property : $Param2"
|
||||||
|
fmt_print "console" $INFO "Support Property List : $Support_Property_List"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -547,43 +549,7 @@ switch_pca9548_channel(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Desc : Pre-execute hook function
|
extension_preprocess(){
|
||||||
# Function 1 : Parameter Integrity Check
|
|
||||||
# Function 2 : Partial Data Preprocessing
|
|
||||||
# Function 3 : Runtime Environment Initialization
|
|
||||||
# Function 4 : Implementation of Parameter Setting Function
|
|
||||||
pre_exec_hook(){
|
|
||||||
init_debuglog
|
|
||||||
systemtool_check
|
|
||||||
|
|
||||||
if [ "$Param1" = "help" ] && [ $param_num -eq 2 ];then
|
|
||||||
print_usage $Param2
|
|
||||||
exit 0
|
|
||||||
elif [ "$Param1" = "help" ] && [ $param_num -gt 2 ];then
|
|
||||||
print_usage_guide
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$Param1" = "get" ] || [ "$Param1" = "set" ];then
|
|
||||||
get_set_properties
|
|
||||||
fi
|
|
||||||
|
|
||||||
load_properties_from_cache
|
|
||||||
# check server_type if is auto
|
|
||||||
# if in debug mode, skip this check
|
|
||||||
if [ "$server_type" = "auto" ] && [ $DEBUG_MODE -eq 0 ];then
|
|
||||||
try_get_server_type
|
|
||||||
fi
|
|
||||||
|
|
||||||
# is param legel?
|
|
||||||
if [ "$Param2" = "chip" ];then
|
|
||||||
if [ $param_num -le 3 ];then
|
|
||||||
fmt_print "console" $ERROR "Command Format illegal"
|
|
||||||
echo "Command Format : ./nicsensor.sh [slot] chip [slave] [i2c_command]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$Param2" = "pmbus" ];then
|
if [ "$Param2" = "pmbus" ];then
|
||||||
if [ $param_num -le 3 ];then
|
if [ $param_num -le 3 ];then
|
||||||
fmt_print "console" $ERROR "Command Format illegal"
|
fmt_print "console" $ERROR "Command Format illegal"
|
||||||
@ -620,6 +586,46 @@ pre_exec_hook(){
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Desc : Pre-execute hook function
|
||||||
|
# Function 1 : Parameter Integrity Check
|
||||||
|
# Function 2 : Partial Data Preprocessing
|
||||||
|
# Function 3 : Runtime Environment Initialization
|
||||||
|
# Function 4 : Implementation of Parameter Setting Function
|
||||||
|
pre_exec_hook(){
|
||||||
|
init_debuglog
|
||||||
|
systemtool_check
|
||||||
|
|
||||||
|
if [ "$Param1" = "help" ] && [ $param_num -eq 2 ];then
|
||||||
|
print_usage $Param2
|
||||||
|
exit 0
|
||||||
|
elif [ "$Param1" = "help" ] && [ $param_num -gt 2 ];then
|
||||||
|
print_usage_guide
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$Param1" = "get" ] || [ "$Param1" = "set" ];then
|
||||||
|
get_set_properties
|
||||||
|
fi
|
||||||
|
|
||||||
|
load_properties_from_cache
|
||||||
|
# check server_type if is auto
|
||||||
|
# if in debug mode, skip this check
|
||||||
|
if [ "$server_type" = "auto" ] && [ $DEBUG_MODE -eq 0 ];then
|
||||||
|
try_get_server_type
|
||||||
|
fi
|
||||||
|
|
||||||
|
extension_preprocess
|
||||||
|
|
||||||
|
# is param legel?
|
||||||
|
if [ "$Param2" = "chip" ];then
|
||||||
|
if [ $param_num -le 3 ];then
|
||||||
|
fmt_print "console" $ERROR "Command Format illegal"
|
||||||
|
echo "Command Format : ./nicsensor.sh [slot] chip [slave] [i2c_command]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# if the action is fru write, need pre-process fru data
|
# if the action is fru write, need pre-process fru data
|
||||||
if [ "$Param2" = "fru" ];then
|
if [ "$Param2" = "fru" ];then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user