Compare commits

...

3 Commits

Author SHA1 Message Date
leimingsheng
ccce95117a feat(master : nicsensor) version change to intest 1.7.1 2025-06-20 15:42:48 +08:00
leimingsheng
55600bd77e doc(master : readme) 更新server_type的描述 2025-06-20 15:41:30 +08:00
leimingsheng
6eacac1f1a feat(master : nicsensor)添加功能: 根据boardid自动匹配服务器型号 2025-06-20 15:39:03 +08:00
2 changed files with 32 additions and 3 deletions

@ -59,7 +59,7 @@ fru_offset="0x00 0x00"
Support_Sensor_List="emc1413, adc128, ina3221, tmp468, tmp112"
Support_Server_List="5280m7, 5468m7, 5688m7, donghu, yichun, qiandaohu"
# Which server will use this script
server_type="5280m7"
server_type="default"
# ---------------------------------------------------------
# Common Varible (Don't Change)
@ -140,7 +140,7 @@ ina3221_ch2_volt="0"
ina3221_ch0_current="0"
ina3221_ch1_current="0"
ina3221_ch2_current="0"
SCRIPT_VERSION="1.7"
SCRIPT_VERSION="1.7.1"
fru_file_name=$option_data2
fru_write_size=0
@ -264,6 +264,30 @@ parse_nic_slot(){
format_log_print $INFO "Slot Num : $slot_number"
}
# According to boardid, parse server_type
try_get_server_type(){
if [ -e "/tmp/ns_servertype" ];then
server_type=`cat /tmp/ns_servertype`
else
boardid=`cat /proc/cmdline | awk -F'=' '/boardid=/{print $8; exit}'`
if [ $boardid -eq 130 ];then
server_type="5280m7"
elif [ $boardid -eq 150 ];then
server_type="5468m7"
elif [ $boardid -eq 152 ];then
server_type="5688m7"
else
format_print $ERROR "Invalid boardid value: $boardid"
format_print $ERROR "Can't specify server type by general method"
format_print $INFO "Please modify server_type in script manually!"
exit 1
fi
echo $server_type > /tmp/ns_servertype
fi
}
init_debuglog(){
# only save one running log
if [ -e $log ];then
@ -343,6 +367,11 @@ switch_pca9548_channel(){
pre_exec_hook(){
init_debuglog
# check server_type if is default
if [ "$server_type" = "default" ];then
try_get_server_type
fi
# is param legel?
if [ "$sensor_type" = "chip" ];then
if [ $param_num -le 3 ];then

@ -220,4 +220,4 @@ nicsensor_v2将服务器选通channel和读取传感器数值的功能解耦
- `fru_offset`: 网卡FRU所在eeprom的偏移量。默认值为 0x00 0x00
**所用服务器**
- `server_type`: 脚本将工作在哪个服务器上?支持的服务器列表见`Support_Server_List`
- `server_type`: 脚本将工作在哪个服务器上?支持的服务器列表见`Support_Server_List`, 默认值为`default`,支持自动识别受支持的型号。