From 2f1ec13de279702c16f116e3b86ab1336c386801 Mon Sep 17 00:00:00 2001 From: moro161 <146227214+moro161@users.noreply.github.com> Date: Fri, 11 Sep 2026 12:20:41 +0300 Subject: [PATCH] fix: msposd OSD lost on Star6E boot (missing -d, waybeam respawn race) msposd's start_telemetry() invocation was missing -d/--osd, so it never called MI_RGN_Init and drew nothing even though it ran fine and parsed FC telemetry correctly. Separately, on Star6E SoCs (e.g. RunCam WiFiLink/ssc338q) waybeam does an internal cold-restart shortly after its own startup to lock in a cold-boot FPS re-kick, which destroys and recreates its venc channel. msposd binds its OSD region to whatever channel exists at its own startup, once, and this script always starts msposd before that respawn fires -- so the OSD region was silently destroyed with the old channel and never came back, even with -d. Symptom: OSD shows for a few seconds after boot, then vanishes for good. Added a background watcher that detects the waybeam respawn (by content, not a fixed delay, since the respawn can complete before we start watching) and restarts msposd once the respawned channel is actually up. No-op on SoCs/builds where waybeam doesn't do this respawn, or majestic is in use instead. --- .../wifibroadcast-ng/files/wifibroadcast | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/general/package/wifibroadcast-ng/files/wifibroadcast b/general/package/wifibroadcast-ng/files/wifibroadcast index 67b68816b..1aa50d235 100755 --- a/general/package/wifibroadcast-ng/files/wifibroadcast +++ b/general/package/wifibroadcast-ng/files/wifibroadcast @@ -129,13 +129,65 @@ start_telemetry() { size=$(curl -s localhost/api/v1/config.json | jsonfilter -qe "@.video0.size") fi msposd -b 115200 -c 8 -r "$osd_fps" -m /dev/"$serial" \ - -o 127.0.0.1:"$port_tx" -z "$size" > /dev/null & + -o 127.0.0.1:"$port_tx" -z "$size" -d > /dev/null & + + [ "$router" = "msposd" ] && watch_waybeam_respawn "$osd_fps" "$serial" "$port_tx" "$size" sleep 5 echo "&L70&F28&G8CPU:&C TEMP:&T\n&B" >/tmp/MSPOSD.msg fi } +# msposd needs -d/--osd to actually draw the OSD overlay (MI_RGN_Init) — +# without it, it runs and parses FC telemetry fine but never renders +# anything. See github.com/OpenIPC/msposd for the flag. +# +# waybeam (the venc/encoder daemon on Star6E SoCs) does an internal +# cold-restart shortly after its own startup (fork+exec, to lock in a +# cold-boot FPS re-kick — see src/star6e_pipeline.c in OpenIPC/waybeam), +# which destroys and recreates its venc channel. msposd binds its OSD +# region to whatever venc channel exists at its own startup, once, via +# MI_RGN_Init, and never reattaches — so if msposd starts before this +# happens (which it always does: this script starts msposd right after +# S95waybeam returns, which is before waybeam's internal respawn fires), +# the OSD region is silently destroyed along with the old channel and +# never comes back. Re-scan /tmp/waybeam.log (whole file each check, +# since the respawn can complete before we start watching) for the +# respawn, then wait for its "ISP channel ready" to appear a second time +# (the real signal the new channel is up, not a guessed delay — it also +# appears once during the normal pre-respawn boot), then restart msposd +# so it reattaches. The bounded loops below are a safety net, not the +# wait mechanism. No-op on SoCs/builds where waybeam doesn't do this +# respawn (or majestic is in use instead) — /tmp/waybeam.log never gets +# the marker and this just exits after the timeout. +watch_waybeam_respawn() { + osd_fps="$1"; serial="$2"; port_tx="$3"; size="$4" + ( + elapsed=0 + while [ "$elapsed" -lt 30 ]; do + grep -q "Respawning:" /tmp/waybeam.log 2>/dev/null && break + sleep 0.5 + elapsed=$((elapsed + 1)) + done + grep -q "Respawning:" /tmp/waybeam.log 2>/dev/null || exit 0 + + elapsed=0 + while [ "$elapsed" -lt 20 ]; do + [ "$(grep -c "ISP channel ready" /tmp/waybeam.log 2>/dev/null)" -ge 2 ] && break + sleep 0.3 + elapsed=$((elapsed + 1)) + done + + echo_log "waybeam respawned post-boot, restarting msposd to reattach OSD" + killall -q msposd + while pidof msposd >/dev/null 2>&1; do + sleep 0.2 + done + msposd -b 115200 -c 8 -r "$osd_fps" -m /dev/"$serial" \ + -o 127.0.0.1:"$port_tx" -z "$size" -d > /dev/null & + ) & +} + video_settings() { for card in $(lsusb | awk '{print $6}' | uniq); do case "$card" in