Compare commits

..

No commits in common. "7bb15f6de81befe13109bb31651b07106d145dc8" and "559263cc2d19e5fa73bd9446871d404d2d8ede71" have entirely different histories.

@ -1,5 +1,5 @@
#!/bin/sh
SCRIPT_VERSION="1.9.3"
SCRIPT_VERSION="1.9.1"
# ---------------------------------------------------------
# Project Feature Varible (Change if need)
# ---------------------------------------------------------
@ -55,18 +55,13 @@ 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"
# fru basic offset
fru_offset="0x00 0x00"
fru_size=256
# ---------------------------------------------------------
# Global Settings
# ---------------------------------------------------------
Support_Sensor_List="emc1413, adc128, ina3221, ina226, tmp468, tmp112, lm95241"
Support_Sensor_List="emc1413, adc128, ina3221, ina226, tmp468, tmp112"
Support_Server_List="5280m7, 5468m7, 5688m7, donghu, yichun, qiandaohu"
# Which server will use this script
server_type="auto"
@ -124,12 +119,6 @@ REG_ina226_ch0_current="0x01"
REG_ina226_ch0_voltage="0x02"
REG_tmp112="0x00"
REG_tmp468="0x80"
REG_lm95241_local_H="0x10"
REG_lm95241_remote1_H="0x11"
REG_lm95241_remote2_H="0x12"
REG_lm95241_local_L="0x20"
REG_lm95241_remote1_L="0x21"
REG_lm95241_remote2_L="0x22"
# Global Param
pca9641_slave=0x41
@ -493,9 +482,6 @@ pre_exec_hook(){
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
@ -507,7 +493,6 @@ pre_exec_hook(){
# if in debug mode, skip this check
if [ "$server_type" = "auto" ] && [ $DEBUG_MODE -eq 0 ];then
try_get_server_type
exit 0
fi
# is param legel?
@ -541,7 +526,6 @@ pre_exec_hook(){
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!"
exit 1
fi
fi
@ -1271,70 +1255,6 @@ process_ina226(){
read_ina226_value
}
# ---------------------------------------------------------
# Chip LM95241
# ---------------------------------------------------------
# @Param1 lm95241 data high 8bit
# @Param2 lm95241 data low 8bit
# @Param3 customization sensor name
convert_lms95241_data(){
if [ "$3" = "disable" ];then
return
fi
hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}')
hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}')
upper_hex_value1=$(echo "$hex_value1" | awk '{
for(i=1; i<=length($0); i++){
if(tolower(substr($0,i,1)) ~ /^[a-f]$/)
printf toupper(substr($0,i,1));
else
printf substr($0,i,1);
}
print ""
}')
dec_val1=$(echo "ibase=16; $upper_hex_value1" | bc)
upper_hex_value2=$(echo "$hex_value2" | awk '{
for(i=1; i<=length($0); i++){
if(tolower(substr($0,i,1)) ~ /^[a-f]$/)
printf toupper(substr($0,i,1));
else
printf substr($0,i,1);
}
print ""
}')
dec_val2=$(echo "ibase=16; $upper_hex_value2" | bc)
temp=$(echo "scale=4; $dec_val1 + $dec_val2 / 32 * 0.125 " | bc)
echo "$3 : $temp"
}
read_lm95241_value(){
fmt_print "log" $INFO "Start Read LM95241 channel data ..."
res_lm95241_local_h=`i2ctransfer -y $i2c_bus w1@$chip_slave $REG_lm95241_local_H r1`
res_lm95241_remote1_h=`i2ctransfer -y $i2c_bus w1@$chip_slave $REG_lm95241_remote1_H r1`
res_lm95241_remote2_h=`i2ctransfer -y $i2c_bus w1@$chip_slave $REG_lm95241_remote2_H r1`
res_lm95241_local_l=`i2ctransfer -y $i2c_bus w1@$chip_slave $REG_lm95241_local_L r1`
res_lm95241_remote1_l=`i2ctransfer -y $i2c_bus w1@$chip_slave $REG_lm95241_remote1_L r1`
res_lm95241_remote2_l=`i2ctransfer -y $i2c_bus w1@$chip_slave $REG_lm95241_remote2_L r1`
reset_pca9548 $i2c_bus $pca9548_slave
fmt_print "log" $INFO "LM95241 local data: $res_lm95241_local_h $res_lm95241_local_l"
fmt_print "log" $INFO "LM95241 remote1 data: $res_lm95241_remote1_h $res_lm95241_remote1_l"
fmt_print "log" $INFO "LM95241 remote2 data: $res_lm95241_remote2_h $res_lm95241_remote2_l"
fmt_print "console" $INFO "LM95241 read result:"
convert_lms95241_data $res_lm95241_local_h $res_lm95241_local_l "$LM95241_Local_name"
convert_lms95241_data $res_lm95241_remote1_h $res_lm95241_remote1_l "$LM95241_Remote1_name"
convert_lms95241_data $res_lm95241_remote2_h $res_lm95241_remote2_l "$LM95241_Remote2_name"
}
process_lm95241(){
read_lm95241_value
}
# ---------------------------------------------------------
# CHIP
# ---------------------------------------------------------
# do a customization command
@ -1543,9 +1463,6 @@ start_get_sensor(){
"tmp112")
process_tmp112
;;
"lm95241")
process_lm95241
;;
"chip")
process_chip
;;
@ -1763,7 +1680,7 @@ if [ "$1" = "detect" ];then
exit 0
fi
if [ $param_num -le 2 ];then
print_usage "all"
print_usage_guide
else
start_get_sensor
fi