fix: 保留eno3,服务之间不再相互依赖

This commit is contained in:
2026-04-11 19:10:31 +08:00
parent 8b6a243a0d
commit f00d6661c0
6 changed files with 18 additions and 37 deletions

View File

@@ -7,38 +7,23 @@ source "${SCRIPT_DIR}/common.sh"
STEP="5g-dial"
disable_interfaces() {
local raw_list="$1"
local iface
local nmcli_available=0
run_dial() {
local rc
if [[ -z "${raw_list}" ]]; then
export TERM="${TERM:-xterm}"
export LANG="${LANG:-C.UTF-8}"
export LC_ALL="${LC_ALL:-C.UTF-8}"
blitz_log "${STEP}" "dial-env" "start" "TERM=${TERM} LANG=${LANG} LC_ALL=${LC_ALL} interface=${BLITZ_5G_INTERFACE}" 0
if blitz_run "${STEP}" "dial" python3 rndis_dial.py --serial-port "${BLITZ_5G_SERIAL_PORT}" --interface "${BLITZ_5G_INTERFACE}"; then
return 0
fi
if command -v nmcli >/dev/null 2>&1; then
nmcli_available=1
fi
for iface in ${raw_list//,/ }; do
if [[ -z "${iface}" ]]; then
continue
fi
blitz_log "${STEP}" "disable-interface" "start" "iface=${iface}" 0
if [[ "${nmcli_available}" -eq 1 ]]; then
nmcli device disconnect "${iface}" >/dev/null 2>&1 || true
fi
if ip link show dev "${iface}" >/dev/null 2>&1; then
if ip link set dev "${iface}" down; then
blitz_log "${STEP}" "disable-interface" "success" "iface=${iface}" 0
else
rc=$?
blitz_log "${STEP}" "disable-interface" "failure" "iface=${iface}" "${rc}"
return "${rc}"
fi
else
blitz_log "${STEP}" "disable-interface" "success" "iface=${iface} not present, skipping" 0
fi
done
blitz_log "${STEP}" "dial-retry" "start" "first dial attempt failed rc=${rc}; retrying after 3s" "${rc}"
sleep 3
blitz_run "${STEP}" "dial-retry" python3 rndis_dial.py --serial-port "${BLITZ_5G_SERIAL_PORT}" --interface "${BLITZ_5G_INTERFACE}"
}
wait_for_serial() {
@@ -101,8 +86,6 @@ if [[ -z "${BLITZ_5G_INTERFACE:-}" ]]; then
exit 1
fi
disable_interfaces "${BLITZ_5G_DISABLE_INTERFACES:-}"
route_output="$(blitz_route_ready "${BLITZ_TIME_SERVER_IP}" "${BLITZ_5G_INTERFACE}" || true)"
if [[ -n "${route_output}" ]]; then
blitz_log "${STEP}" "dial" "already_up" "target_ip=${BLITZ_TIME_SERVER_IP} interface=${BLITZ_5G_INTERFACE} route=${route_output}" 0
@@ -112,7 +95,7 @@ fi
wait_for_serial "${BLITZ_5G_SERIAL_PORT}" "${BLITZ_5G_SERIAL_WAIT_SEC}"
pushd "${BLITZ_5G_DIAL_DIR}" >/dev/null
blitz_run "${STEP}" "dial" python3 rndis_dial.py --serial-port "${BLITZ_5G_SERIAL_PORT}" --interface "${BLITZ_5G_INTERFACE}"
run_dial
popd >/dev/null
wait_for_route "${BLITZ_TIME_SERVER_IP}" "${BLITZ_5G_ROUTE_WAIT_SEC}" "${BLITZ_5G_INTERFACE}"

View File

@@ -55,7 +55,6 @@ blitz_load_boot_env() {
export BLITZ_5G_DIAL_DIR="${BLITZ_5G_DIAL_DIR:-/home/nvidia/5g-test/5G}"
export BLITZ_5G_SERIAL_PORT="${BLITZ_5G_SERIAL_PORT:-/dev/ttyUSB7}"
export BLITZ_5G_INTERFACE="${BLITZ_5G_INTERFACE:-eth0}"
export BLITZ_5G_DISABLE_INTERFACES="${BLITZ_5G_DISABLE_INTERFACES:-}"
export BLITZ_5G_SERIAL_WAIT_SEC="${BLITZ_5G_SERIAL_WAIT_SEC:-60}"
export BLITZ_5G_ROUTE_WAIT_SEC="${BLITZ_5G_ROUTE_WAIT_SEC:-30}"
export BLITZ_TIME_SERVER_IP="${BLITZ_TIME_SERVER_IP:-${default_time_server}}"

View File

@@ -1,13 +1,12 @@
# Boot-time settings for the robot-side autostart chain.
# Override machine-specific values in robot-boot.env.local.
BLITZ_BOOT_DELAY_SEC="30"
BLITZ_BOOT_DELAY_SEC="60"
BLITZ_LOG_FILE="/var/log/blitz-robot/startup.log"
BLITZ_5G_DIAL_DIR="/home/nvidia/5g-test/5G"
BLITZ_5G_SERIAL_PORT="/dev/ttyUSB7"
BLITZ_5G_INTERFACE="eth0"
BLITZ_5G_DISABLE_INTERFACES="eno3"
BLITZ_5G_SERIAL_WAIT_SEC="60"
BLITZ_5G_ROUTE_WAIT_SEC="30"

View File

@@ -1,7 +1,7 @@
[Unit]
Description=Blitz robot b-side omnid
After=blitz-time-sync.service blitz-ros-receiver.service
Requires=blitz-time-sync.service blitz-ros-receiver.service
Wants=blitz-time-sync.service blitz-ros-receiver.service
[Service]
Type=simple

View File

@@ -1,7 +1,7 @@
[Unit]
Description=Blitz robot ROS receiver
After=blitz-time-sync.service
Requires=blitz-time-sync.service
Wants=blitz-time-sync.service
[Service]
Type=simple

View File

@@ -1,7 +1,7 @@
[Unit]
Description=Blitz robot private chrony sync
After=blitz-5g-dial.service
Requires=blitz-5g-dial.service
Wants=blitz-5g-dial.service
[Service]
Type=oneshot