diff --git a/tool/plugin/autoauth.sh b/tool/plugin/autoauth.sh
new file mode 100644
index 0000000..33cd4db
--- /dev/null
+++ b/tool/plugin/autoauth.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Get file conut first
+file_num=`ls -l | wc -l`
+
+i=2
+
+while true
+do
+ i=$(($i+1))
+
+ # Get filename by ls and awk
+ file=`ls -l | awk -v cnt=$i 'NR==cnt{print $9}'`
+ cmd="chmod +x $file"
+ echo "File ID: $i , $cmd"
+ # perform chmod
+ $cmd
+
+ if [ $i -eq $file_num ];then
+ echo "Done to add exec auth for every file"
+ break
+ fi
+done
\ No newline at end of file
diff --git a/tool/plugin/format_print.sh b/tool/plugin/format_print.sh
new file mode 100644
index 0000000..27c095e
--- /dev/null
+++ b/tool/plugin/format_print.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+logfile="/tmp/nicsensor_debug.log"
+
+direction=$1
+level=$2
+content=$3
+
+case "${direction}" in
+ "console")
+ echo ">>> [$level] : $content"
+ ;;
+ "log")
+ echo "[$level] : $content" >> $logfile
+ ;;
+ *)
+ echo "Error In format_print.sh! Param : $direction"
+ ;;
+esac
diff --git a/tool/plugin/i2c_m6.sh b/tool/plugin/i2c_m6.sh
new file mode 100644
index 0000000..890ccc7
--- /dev/null
+++ b/tool/plugin/i2c_m6.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+i2c_bus=$1
+wc=$2
+slave=$3
+data=$4
+rc=$5
+
+path=`pwd`
+fmt_print="${path}/format_print.sh"
+
+if [ $rc -eq 0 ];then
+ cmd=`i2c-test -b $i2c_bus -s $slave -w -d $data`
+else
+ cmd=`i2c-test -b $i2c_bus -s $slave -m 1 -rc $rc -d $data | awk 'NR==2{for(i=1;i<=NF;i++){printf("0x%s ",$i)}}'`
+fi
+
+$fmt_print "log" "Info" "[M6 i2c Command]: $cmd"
+$cmd
+
diff --git a/tool/plugin/i2c_m7.sh b/tool/plugin/i2c_m7.sh
new file mode 100644
index 0000000..1896119
--- /dev/null
+++ b/tool/plugin/i2c_m7.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+i2c_bus=$1
+wc=$2
+slave=$3
+data=$4
+rc=$5
+
+path=`pwd`
+fmt_print="${path}/format_print.sh"
+
+if [ $rc -eq 0 ];then
+ cmd="i2ctransfer -y $i2c_bus w$wc@$slave $data"
+else
+ cmd="i2ctransfer -y $i2c_bus w$wc@$slave $data r$5"
+fi
+
+$fmt_print "log" "Info" "[M7 i2c Command]: $cmd"
+$cmd
\ No newline at end of file
diff --git a/tool/plugin/nicsensor.sh b/tool/plugin/nicsensor.sh
new file mode 100644
index 0000000..df45386
--- /dev/null
+++ b/tool/plugin/nicsensor.sh
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+script_version="v2.0"
+server_type="5688m7"
+server_platform="m7"
+
+slot_name=$1
+sensor_type=$2
+chip_slave=$3
+param_num=$#
+
+nic_type=""
+slot_id=""
+
+path=`pwd`
+server_script="${path}/platform_${server_type}.sh"
+sensor_script="${path}/plugin_${sensor_type}.sh"
+i2c_script="${path}/i2c_${server_platform}.sh"
+fmt_print="${path}/format_print.sh"
+
+print_helper(){
+ echo "======>>> nicsensor Scirpt Usage <<<======"
+ echo "Genenral Usage : ./nicsensor.sh [slot] [sensor] [i2c slave]"
+ echo "For Detect : ./nicsensor.sh detect [ocp/pcie]"
+ echo "Current Server : $server_type"
+ echo "Script Version : $script_version"
+}
+
+perform_detect(){
+ if [ ! -e $server_script ];then
+ $fmt_print "console" "Error" "Server Script $server_script not exist! Maybe unsupport for now!"
+ exit 1
+ fi
+
+ $server_script "detect"
+}
+
+conf_pre_check(){
+
+ if [ $param_num -lt 1 ];then
+ print_helper
+ exit 0
+ 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 $server_script not exist! Maybe unsupport for now!"
+ exit 1
+ fi
+
+ if [ ! -e $sensor_script ];then
+ $fmt_print "console" "Error" "Sensor Script $sensor_script not exist! Maybe unsupport for now!"
+ exit 1
+ fi
+
+ if [ ! -e $i2c_script ];then
+ $fmt_print "console" "Error" "$i2c_script not exist!"
+ exit 1
+ fi
+
+ res_date=`date +%Y-%m-%dT%H:%M:%S`
+ $fmt_print "log" "Info" "Start Time : $res_date"
+ $fmt_print "log" "Info" "Script Version : $script_version"
+ $fmt_print "log" "Info" "Server Type : $server_type"
+ $fmt_print "log" "Info" "Slot Name : $slot_name"
+}
+
+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(){
+ $fmt_print "log" "Info" "start sensor reading"
+
+ $sensor_script "read" "${i2c_bus}" "${chip_slave}" "${server_platform}"
+}
+# ---------------------------------------------------------
+# Start Execute Script
+# ---------------------------------------------------------
+# init debug log
+if [ -e "/tmp/nicsensor_debug.log" ];then
+ rm /tmp/nicsensor_debug.log
+fi
+
+# check if is detect option
+if [ "$1" = "detect" ];then
+ perform_detect
+ exit 0
+fi
+
+conf_pre_check
+
+parse_slot_name
+
+i2c_bus=`connect_i2c`
+if [ $? -ne 0 ];then
+ $fmt_print "console" "Error" "An Error occured when build i2c connection with ${nic_type} ${slot_id}"
+ exit 1
+fi
+
+start_sensor_reading
\ No newline at end of file
diff --git a/tool/plugin/platform_5280m7.sh b/tool/plugin/platform_5280m7.sh
new file mode 100644
index 0000000..a933c59
--- /dev/null
+++ b/tool/plugin/platform_5280m7.sh
@@ -0,0 +1,173 @@
+#!/bin/sh
+
+action=$1
+nic_type=$2
+slot_id=$3
+
+path=`pwd`
+i2c_script="${path}/i2c_m7.sh"
+fmt_print="${path}/format_print.sh"
+
+pca9548_slave=""
+pca9641_slave=""
+i2c_bus=""
+pca9548_channel=""
+
+is_have_pca9641=0
+
+record_i2c_status(){
+ $fmt_print "log" "Info" "[platform_5280m7] Start record i2c configuration"
+ $fmt_print "log" "Info" "Nic Type: $nic_type"
+ $fmt_print "log" "Info" "Nic slot: $slot_id"
+ $fmt_print "log" "Info" "i2c bus: $i2c_bus"
+ $fmt_print "log" "Info" "is have pca9641: $is_have_pca9641"
+ $fmt_print "log" "Info" "pca9641 slave: $is_have_pca9641"
+ $fmt_print "log" "Info" "pca9548 slave: $pca9548_slave"
+ $fmt_print "log" "Info" "pca9548 channel: $pca9548_channel"
+}
+
+set_i2c_config(){
+ # set pca9641 address && I2C BUS
+ if [ "${nic_type}" == "ocp" ];then
+ is_have_pca9641=0
+ pca9548_slave="0x70"
+ i2c_bus=3
+ else
+ is_have_pca9641=1
+ if [ $slot_id -le 2 ];then
+ pca9641_slave="0x41"
+ pca9548_slave="0x72"
+ i2c_bus=12
+ else
+ pca9641_slave="0x42"
+ pca9548_slave="0x72"
+ i2c_bus=13
+ fi
+ fi
+
+ # set pca9548 switch channel
+ if [ "${nic_type}" == "ocp" ];then
+ if [ $slot_id -eq 0 ];then
+ pca9548_channel="0x01"
+ elif [ $slot_id -eq 1 ];then
+ pca9548_channel="0x02"
+ elif [ $slot_id -eq 2 ];then
+ pca9548_channel="0x04"
+ else
+ $fmt_print "console" "Warning" "Unspecified card slot!"
+ fi
+ else
+ if [ $slot_id -eq 0 ];then
+ pca9548_channel="0x02"
+ elif [ $slot_id -eq 1 ];then
+ pca9548_channel="0x04"
+ elif [ $slot_id -eq 2 ];then
+ pca9548_channel="0x08"
+ elif [ $slot_id -eq 3 ];then
+ pca9548_channel="0x02"
+ elif [ $slot_id -eq 4 ];then
+ pca9548_channel="0x04"
+ elif [ $slot_id -eq 5 ];then
+ pca9548_channel="0x08"
+ else
+ $fmt_print "console" "Warning" "Unspecified card slot!"
+ fi
+ fi
+ record_i2c_status
+}
+
+get_pca9641_control(){
+ $fmt_print "log" "Info" "[platform_5280m7] Start Get pca9641 control"
+
+ # Request 9641 lock
+ res_lock=`i2ctransfer -y $i2c_bus w2@$pca9641_slave 0x01 0x81 r1`
+ $fmt_print "log" "Info" "[platform_5280m7] After request 9641 lock, The REG value is $res_lock"
+
+ # Build 9641 Connection
+ res_build=`i2ctransfer -y $i2c_bus w2@$pca9641_slave 0x01 0x85 r1`
+ $fmt_print "log" "Info" "[platform_5280m7] After Build 9641 connection, The REG value is $res_build"
+
+ if [ "$res_build" != "0x87" ];then
+ $fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!"
+ exit 1
+ fi
+}
+
+select_pca9548_channel(){
+ $fmt_print "log" "Info" "[platform_5280m7] Start Switch PCA9548"
+ $i2c_script "$i2c_bus" 1 "$pca9548_slave" "$pca9548_channel" 0
+}
+
+build_i2c_connect(){
+ $fmt_print "log" "Info" "[platform_5280m7] Start build i2c connect"
+ set_i2c_config
+
+ if [ $is_have_pca9641 -eq 1 ];then
+ get_pca9641_control
+ fi
+
+ select_pca9548_channel
+ echo "$i2c_bus"
+}
+
+# switch pca9548 channels then do i2cdetect one times
+# @Param1 i2c bus number
+# @Param2 pca9548 slave address
+# @Param3 pca9548 channel hex value
+# @Param4 pca9548 channel
+# @Param5 pcie slot number
+do_i2c_detect(){
+ if [ "${nic_type}" == "ocp" ];then
+ $fmt_print "log" "Info" "OCP slot $5 : bus$1 9548channel$4"
+ else
+ $fmt_print "log" "Info" "PCIe slot $5 : bus$1 9548channel$4"
+ fi
+ i2ctransfer -y $1 w1@$2 $3
+ i2cdetect -y $1
+}
+
+detect_on_server(){
+ $fmt_print "console" "Info" "[platform_5280m7] Start i2c detect"
+
+ if [ "${nic_type}" == "ocp" ];then
+ i2c_bus=3
+ do_i2c_detect 3 0x70 0x01 0 0
+ do_i2c_detect 3 0x70 0x02 1 1
+ do_i2c_detect 3 0x70 0x04 2 2
+ else
+ i2c_bus=12
+ pca9641_slave="0x41"
+ get_pca9641_control
+
+ do_i2c_detect 12 0x72 0x02 1 0
+ do_i2c_detect 12 0x72 0x04 2 1
+ do_i2c_detect 12 0x72 0x08 3 2
+
+ i2c_bus=13
+ pca9641_slave="0x42"
+ get_pca9641_control
+
+ do_i2c_detect 13 0x72 0x02 1 3
+ do_i2c_detect 13 0x72 0x04 2 4
+ do_i2c_detect 13 0x72 0x08 3 5
+ fi
+}
+
+# ---------------------------------------------------
+# Start Execute Script
+# ---------------------------------------------------
+case "${action}" in
+ "connect")
+ build_i2c_connect
+ ;;
+ "detect")
+ detect_on_server
+ ;;
+ *)
+ $fmt_print "console" "Error" "[platform_5280m7] Unspecified Operation : $action"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/tool/plugin/platform_5688m7.sh b/tool/plugin/platform_5688m7.sh
new file mode 100644
index 0000000..d3be9d9
--- /dev/null
+++ b/tool/plugin/platform_5688m7.sh
@@ -0,0 +1,161 @@
+#!/bin/sh
+
+action=$1
+nic_type=$2
+slot_id=$3
+
+path=`pwd`
+i2c_script="${path}/i2c_m7.sh"
+fmt_print="${path}/format_print.sh"
+
+pca9548_slave=""
+pca9641_slave=""
+i2c_bus=""
+pca9548_channel=""
+
+is_have_pca9641=0
+
+record_i2c_status(){
+ $fmt_print "log" "Info" "[platform_5688m7] Start record i2c configuration"
+ $fmt_print "log" "Info" "Nic Type: $nic_type"
+ $fmt_print "log" "Info" "Nic slot: $slot_id"
+ $fmt_print "log" "Info" "i2c bus: $i2c_bus"
+ $fmt_print "log" "Info" "is have pca9641: $is_have_pca9641"
+ $fmt_print "log" "Info" "pca9641 slave: $is_have_pca9641"
+ $fmt_print "log" "Info" "pca9548 slave: $pca9548_slave"
+ $fmt_print "log" "Info" "pca9548 channel: $pca9548_channel"
+}
+
+set_i2c_config(){
+ # set pca9641 address && I2C BUS
+ if [ "${nic_type}" == "ocp" ];then
+ $fmt_print "console" "Error" "[platform_5688m7] Unsupport OCP Nic"
+ exit 1
+ else
+ is_have_pca9641=1
+ i2c_bus=12
+ pca9641_slave="0x31"
+ if [ $slot_id -le 3 ];then
+ pca9548_slave="0x71"
+ else
+ pca9548_slave="0x72"
+ fi
+ fi
+
+ # set pca9548 switch channel
+ if [ "${nic_type}" == "ocp" ];then
+ $fmt_print "console" "Error" "[platform_5688m7] Unsupport OCP Nic"
+ exit 1
+ else
+ if [ $slot_id -eq 0 ];then
+ pca9548_channel="0x01"
+ elif [ $slot_id -eq 1 ];then
+ pca9548_channel="0x02"
+ elif [ $slot_id -eq 2 ];then
+ pca9548_channel="0x04"
+ elif [ $slot_id -eq 3 ];then
+ pca9548_channel="0x08"
+ elif [ $slot_id -eq 4 ];then
+ pca9548_channel="0x01"
+ elif [ $slot_id -eq 5 ];then
+ pca9548_channel="0x02"
+ elif [ $slot_id -eq 6 ];then
+ pca9548_channel="0x04"
+ elif [ $slot_id -eq 7 ];then
+ pca9548_channel="0x08"
+ else
+ $fmt_print "console" "Warning" "Unspecified card slot!"
+ fi
+ fi
+ record_i2c_status
+}
+
+get_pca9641_control(){
+ $fmt_print "log" "Info" "[platform_5688m7] Start Get pca9641 control"
+
+ # Request 9641 lock
+ res_lock=`i2ctransfer -y $i2c_bus w2@$pca9641_slave 0x01 0x81 r1`
+ $fmt_print "log" "Info" "[platform_5688m7] After request 9641 lock, The REG value is $res_lock"
+
+ # Build 9641 Connection
+ res_build=`i2ctransfer -y $i2c_bus w2@$pca9641_slave 0x01 0x85 r1`
+ $fmt_print "log" "Info" "[platform_5688m7] After Build 9641 connection, The REG value is $res_build"
+
+ if [ "$res_build" != "0x87" ];then
+ $fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!"
+ exit 1
+ fi
+}
+
+select_pca9548_channel(){
+ $fmt_print "log" "Info" "[platform_5688m7] Start Switch PCA9548"
+ $i2c_script "$i2c_bus" 1 "$pca9548_slave" "$pca9548_channel" 0
+}
+
+build_i2c_connect(){
+ $fmt_print "log" "Info" "[platform_5688m7] Start build i2c connect"
+ set_i2c_config
+
+ if [ $is_have_pca9641 -eq 1 ];then
+ get_pca9641_control
+ fi
+
+ select_pca9548_channel
+ echo "$i2c_bus"
+}
+
+# switch pca9548 channels then do i2cdetect one times
+# @Param1 i2c bus number
+# @Param2 pca9548 slave address
+# @Param3 pca9548 channel hex value
+# @Param4 pca9548 channel
+# @Param5 pcie slot number
+do_i2c_detect(){
+ if [ "${nic_type}" == "ocp" ];then
+ $fmt_print "console" "Info" "OCP slot $5 : bus$1 9548channel$4"
+ else
+ $fmt_print "console" "Info" "PCIe slot $5 : bus$1 9548channel$4"
+ fi
+ i2ctransfer -y $1 w1@$2 $3
+ i2cdetect -y $1
+}
+
+detect_on_server(){
+ $fmt_print "console" "Info" "[platform_5688m7] Start i2c detect"
+
+ if [ "${nic_type}" == "ocp" ];then
+ $fmt_print "console" "Error" "[platform_5688m7] Unsupport OCP Nic I2C Detect"
+ else
+ i2c_bus=12
+ pca9641_slave="0x31"
+ get_pca9641_control
+
+ do_i2c_detect $i2c_bus 0x71 0x01 0 0
+ do_i2c_detect $i2c_bus 0x71 0x02 1 1
+ do_i2c_detect $i2c_bus 0x71 0x04 2 2
+ do_i2c_detect $i2c_bus 0x71 0x08 3 3
+ do_i2c_detect $i2c_bus 0x72 0x01 0 4
+ do_i2c_detect $i2c_bus 0x72 0x02 1 5
+ do_i2c_detect $i2c_bus 0x72 0x04 2 6
+ do_i2c_detect $i2c_bus 0x72 0x08 3 7
+ fi
+}
+
+# ---------------------------------------------------
+# Start Execute Script
+# ---------------------------------------------------
+case "${action}" in
+ "connect")
+ build_i2c_connect
+ ;;
+ "detect")
+ detect_on_server
+ ;;
+ *)
+ $fmt_print "console" "Error" "[platform_5688m7] Unspecified Operation : $action"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/tool/plugin/plugin_adc128.sh b/tool/plugin/plugin_adc128.sh
index 6eb936b..e6f5d8d 100644
--- a/tool/plugin/plugin_adc128.sh
+++ b/tool/plugin/plugin_adc128.sh
@@ -1,5 +1,86 @@
#!/bin/sh
+# ADC128 Division factor
+votage_division_factor_0="1"
+votage_division_factor_1="1"
+votage_division_factor_2="1"
+votage_division_factor_3="0.8"
+votage_division_factor_4="0.6"
+votage_division_factor_5="0.6"
+votage_division_factor_6="0.2326"
+votage_division_factor_7="1"
+
+# ADC128 channel name
+ADC128_Channel0_name="Channel0"
+ADC128_Channel1_name="Channel1"
+ADC128_Channel2_name="Channel2"
+ADC128_Channel3_name="Channel3"
+ADC128_Channel4_name="Channel4"
+ADC128_Channel5_name="Channel5"
+ADC128_Channel6_name="Channel6"
+ADC128_Channel7_name="Channel7"
+
+mode=$1
+i2c_bus=$2
+chip_slave=$3
+server_platform=$4
+
+# Only for test purpose
+test_data1=$2
+test_data2=$3
+test_factor=$4
+
+path=`pwd`
+fmt_print="${path}/format_print.sh"
+i2c_script="${path}/i2c_${server_platform}.sh"
+
+REG_adc128_config="0x00"
+REG_adc128_advance="0x0b"
+REG_adc128_status="0x0c"
+REG_adc128_ch0="0x20"
+REG_adc128_ch1="0x21"
+REG_adc128_ch2="0x22"
+REG_adc128_ch3="0x23"
+REG_adc128_ch4="0x24"
+REG_adc128_ch5="0x25"
+REG_adc128_ch6="0x26"
+REG_adc128_ch7="0x27"
+
+print_help(){
+ echo "---------------------------------------------------------"
+ echo "