feat(plugin : platform_%.sh)在platform函数下新增透传i2c命令的功能

This commit is contained in:
leimingsheng 2025-06-20 14:01:43 +08:00
parent 0bc98aa5cd
commit 1e2f32dce3
2 changed files with 36 additions and 0 deletions

@ -4,6 +4,9 @@ action=$1
nic_type=$2 nic_type=$2
slot_id=$3 slot_id=$3
# Param: i2c_command only valid for function 'send'
i2c_command=$4
path=`pwd` path=`pwd`
i2c_script="${path}/i2c_m7.sh" i2c_script="${path}/i2c_m7.sh"
fmt_print="${path}/format_print.sh" fmt_print="${path}/format_print.sh"
@ -167,6 +170,18 @@ reset_all_pca9548(){
$fmt_print "log" "Info" "[platform_5280m7] Bypass reset 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 # Start Execute Script
# --------------------------------------------------- # ---------------------------------------------------
@ -180,6 +195,9 @@ case "${action}" in
"reset") "reset")
reset_all_pca9548 reset_all_pca9548
;; ;;
"send")
send_i2c_command
;;
*) *)
$fmt_print "console" "Error" "[platform_5280m7] Unspecified Operation : $action" $fmt_print "console" "Error" "[platform_5280m7] Unspecified Operation : $action"
exit 1 exit 1

@ -4,6 +4,9 @@ action=$1
nic_type=$2 nic_type=$2
slot_id=$3 slot_id=$3
# Param: i2c_command only valid for function 'send'
i2c_command=$4
path=`pwd` path=`pwd`
i2c_script="${path}/i2c_m7.sh" i2c_script="${path}/i2c_m7.sh"
fmt_print="${path}/format_print.sh" fmt_print="${path}/format_print.sh"
@ -156,6 +159,18 @@ reset_all_pca9548(){
i2ctransfer -y 12 w1@0x72 0x00 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 # Start Execute Script
# --------------------------------------------------- # ---------------------------------------------------
@ -169,6 +184,9 @@ case "${action}" in
"reset") "reset")
reset_all_pca9548 reset_all_pca9548
;; ;;
"send")
send_i2c_command
;;
*) *)
$fmt_print "console" "Error" "[platform_5688m7] Unspecified Operation : $action" $fmt_print "console" "Error" "[platform_5688m7] Unspecified Operation : $action"
exit 1 exit 1