From 1e2f32dce31a42ec56fafd04cf09a18f987bd3a5 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Fri, 20 Jun 2025 14:01:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugin=20:=20platform=5F%.sh)=E5=9C=A8plat?= =?UTF-8?q?form=E5=87=BD=E6=95=B0=E4=B8=8B=E6=96=B0=E5=A2=9E=E9=80=8F?= =?UTF-8?q?=E4=BC=A0i2c=E5=91=BD=E4=BB=A4=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor_v2/platform_5280m7.sh | 18 ++++++++++++++++++ nicsensor_v2/platform_5688m7.sh | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/nicsensor_v2/platform_5280m7.sh b/nicsensor_v2/platform_5280m7.sh index d956b4f..047f5ea 100644 --- a/nicsensor_v2/platform_5280m7.sh +++ b/nicsensor_v2/platform_5280m7.sh @@ -4,6 +4,9 @@ action=$1 nic_type=$2 slot_id=$3 +# Param: i2c_command only valid for function 'send' +i2c_command=$4 + path=`pwd` i2c_script="${path}/i2c_m7.sh" fmt_print="${path}/format_print.sh" @@ -167,6 +170,18 @@ reset_all_pca9548(){ $fmt_print "log" "Info" "[platform_5280m7] Bypass reset pca9548" } +send_i2c_command(){ + $fmt_print "log" "Info" "[platform_5280m7] Send an i2c command" + + set_i2c_config + if [ $is_have_pca9641 -eq 1 ];then + get_pca9641_control + fi + select_pca9548_channel + + $i2c_command +} + # --------------------------------------------------- # Start Execute Script # --------------------------------------------------- @@ -180,6 +195,9 @@ case "${action}" in "reset") reset_all_pca9548 ;; + "send") + send_i2c_command + ;; *) $fmt_print "console" "Error" "[platform_5280m7] Unspecified Operation : $action" exit 1 diff --git a/nicsensor_v2/platform_5688m7.sh b/nicsensor_v2/platform_5688m7.sh index 1a607ea..f61f69b 100644 --- a/nicsensor_v2/platform_5688m7.sh +++ b/nicsensor_v2/platform_5688m7.sh @@ -4,6 +4,9 @@ action=$1 nic_type=$2 slot_id=$3 +# Param: i2c_command only valid for function 'send' +i2c_command=$4 + path=`pwd` i2c_script="${path}/i2c_m7.sh" fmt_print="${path}/format_print.sh" @@ -156,6 +159,18 @@ reset_all_pca9548(){ i2ctransfer -y 12 w1@0x72 0x00 } +send_i2c_command(){ + $fmt_print "log" "Info" "[platform_5280m7] Send an i2c command" + + set_i2c_config + if [ $is_have_pca9641 -eq 1 ];then + get_pca9641_control + fi + select_pca9548_channel + + $i2c_command +} + # --------------------------------------------------- # Start Execute Script # --------------------------------------------------- @@ -169,6 +184,9 @@ case "${action}" in "reset") reset_all_pca9548 ;; + "send") + send_i2c_command + ;; *) $fmt_print "console" "Error" "[platform_5688m7] Unspecified Operation : $action" exit 1