#!/bin/sh server_type="5280m7" server_platform="m7" slot_name=$1 sensor_type=$2 chip_slave=$3 nic_type="" slot_id="" server_script="platform_${server_type}.sh" sensor_script="plugin_${sensor_type}.sh" i2c_script="i2c_${server_platform}.sh" fmt_print="format_print.sh" conf_pre_check(){ # init debug log if [ -e "/tmp/nicsensor_debug.log" ];then rm /tmp/nicsensor_debug.log fi if [ ! -e $fmt_print ];then echo "Missing file $fmt_print !!!" exit 1 fi if [ ! -e $server_script ];then $fmt_print "console" "Error" "$server_script not exist!" exit 1 fi if [ ! -e $sensor_script ];then $fmt_print "console" "Error" "$sensor_script not exist!" exit 1 fi if [ ! -e $i2c_script ];then $fmt_print "console" "Error" "$i2c_script not exist!" exit 1 fi } parse_slot_name(){ # Get nic type and slot id from slot name case "{$slot_name}" in ocp*) nic_type="ocp" slot_id=`echo $slot_name | cut -c 4` ;; pcie*) nic_type="pcie" slot_id=`echo $slot_name | cut -c 5-` ;; *) $fmt_print "log" "Warning" "Undetermined nic type, default set to pcie" nic_type="pcie" slot_id=$slot_name ;; esac } connect_i2c(){ $server_script "connect" "$nic_type" "$slot_id" if [ $? -ne 0 ];then $fmt_print "console" "Error" "Can't build i2c connection" exit 1 fi } start_sensor_reading(){ } # --------------------------------------------------------- # Start Execute Script # --------------------------------------------------------- conf_pre_check parse_slot_name connect_i2c start_sensor_reading