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