Compare commits

..

No commits in common. "b7671e12e128c600442e9e054fd0e83529ffedd7" and "3301d9fdf750ceeade6a5ffe4c5a48c29f872007" have entirely different histories.

@ -74,8 +74,6 @@ chip_slave=$3
option_data=$4 option_data=$4
option_data2=$5 option_data2=$5
param_num=$#
# CHIP REGISTER # CHIP REGISTER
REG_pca9641_controll="0x01" REG_pca9641_controll="0x01"
@ -140,7 +138,7 @@ ina3221_ch2_volt="0"
ina3221_ch0_current="0" ina3221_ch0_current="0"
ina3221_ch1_current="0" ina3221_ch1_current="0"
ina3221_ch2_current="0" ina3221_ch2_current="0"
SCRIPT_VERSION="1.6.1" SCRIPT_VERSION="1.6"
fru_file_name=$option_data2 fru_file_name=$option_data2
fru_write_size=0 fru_write_size=0
@ -234,6 +232,15 @@ reset_pca9548(){
i2ctransfer -y $1 w1@$2 0x00 i2ctransfer -y $1 w1@$2 0x00
} }
# script self test
conf_pre_check(){
# check DEBUG_MODE value
if [ $DEBUG_MODE -ne 0 ] && [ $DEBUG_MODE -ne 1 ];then
format_print $ERROR "Invalid conf value, DEBUG_MODE: $DEBUG_MODE"
exit 1
fi
}
set_configuration_5280m7(){ set_configuration_5280m7(){
# set pca9641 address && I2C BUS # set pca9641 address && I2C BUS
@ -551,15 +558,9 @@ init_debuglog(){
res_date=`date +%Y-%m-%dT%H:%M:%S` res_date=`date +%Y-%m-%dT%H:%M:%S`
format_log_print $INFO "Start Time : $res_date" format_log_print $INFO "Start Time : $res_date"
format_log_print $INFO "Script Version : $SCRIPT_VERSION" format_log_print $INFO "Script Version : $SCRIPT_VERSION"
format_log_print $INFO "Debug Mode : $DEBUG_MODE"
format_log_print $INFO "Disable Detect : $DISABLE_DETECT"
if [ "$nic_slot" == "detect" ];then if [ $DEBUG_MODE -ne 0 ];then
format_log_print $INFO "Operation Tpye : i2c detect" format_log_print $WARNING "Enable debug mode : $DEBUG_MODE"
elif [ "$nic_slot" == "version" ];then
format_log_print $INFO "Operation Tpye : get version"
else
format_log_print $INFO "Operation Tpye : read sensor"
fi fi
} }
@ -614,35 +615,6 @@ switch_pca9548_channel(){
fi fi
} }
# pre execute hook function
pre_exec_hook(){
init_debuglog
# is param legel?
if [ "$sensor_type" == "chip" ];then
if [ $param_num -le 3 ];then
format_print $ERROR "Command Format illegal"
print_chip_command_format
exit 1
fi
fi
# if the action is fru write, need pre-process fru data
if [ "$sensor_type" == "fru" ];then
if [ "$option_data" == "write" ];then
format_log_print $INFO "Opreation FRU Write"
# is option_data(fru file name) valid?
if [ "$option_data2" == "" ];then
format_print $ERROR "Please provide fru file name"
print_fru_command_format
exit 1
fi
parse_fru_write_data
fi
fi
}
# --------------------------------------------------------- # ---------------------------------------------------------
# Chip EMC1413 # Chip EMC1413
@ -1465,7 +1437,7 @@ start_detect_device(){
# Start Execute Script # Start Execute Script
# --------------------------------------------------------- # ---------------------------------------------------------
pre_exec_hook conf_pre_check
if [ "$1" == "version" ];then if [ "$1" == "version" ];then
echo "Script Version : $SCRIPT_VERSION" echo "Script Version : $SCRIPT_VERSION"
@ -1474,6 +1446,15 @@ if [ "$1" == "version" ];then
exit 0 exit 0
fi fi
# is param legel?
if [ "$sensor_type" == "chip" ];then
if [ $# -le 3 ];then
format_print $ERROR "Command Format illegal"
print_chip_command_format
exit 1
fi
fi
if [ "$1" == "detect" ];then if [ "$1" == "detect" ];then
if [ "$2" == "ocp" ];then if [ "$2" == "ocp" ];then
nic_type="ocp" nic_type="ocp"
@ -1488,7 +1469,25 @@ if [ "$1" == "detect" ];then
exit 0 exit 0
fi fi
if [ $param_num -le 2 ];then init_debuglog
# if the action is fru write, need pre-process fru data
if [ "$sensor_type" == "fru" ];then
if [ "$option_data" == "write" ];then
format_log_print $INFO "Opreation FRU Write"
# is option_data(fru file name) valid?
if [ "$option_data2" == "" ];then
format_print $ERROR "Please provide fru file name"
print_fru_command_format
exit 1
fi
parse_fru_write_data
fi
fi
if [ $# -le 2 ];then
print_usage print_usage
else else
start_get_sensor start_get_sensor