From 6eacac1f1a2abbe09ddda436ad11524b16137d02 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Fri, 20 Jun 2025 15:39:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(master=20:=20nicsensor)=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD:=20=E6=A0=B9=E6=8D=AEboardid=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=B9=E9=85=8D=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor.sh | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/nicsensor.sh b/nicsensor.sh index d7070c2..bc68386 100755 --- a/nicsensor.sh +++ b/nicsensor.sh @@ -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) @@ -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