Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/scripts/ci-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@
# standard camera that did. It stays in the tree because ~97 builder devices and
# the FPV variants still select it -- wifibroadcast-ng parses `@.video0.size`
# with it -- so this is a package that left the matrix, not one that left the tree.
#
# waybeam is unbuildable by construction here rather than merely unselected: it
# depends on !BR2_PACKAGE_MAJESTIC, and every sigmastar defconfig in ALL_BOARDS
# sets BR2_PACKAGE_MAJESTIC=y, because both drive the same sensor and encoder.
# It is selected by the FPV variants in OpenIPC/builder. A mainline defconfig
# with Majestic off would take it off this list.
NOT_BUILT = {
"adaptive-link", "aic8800-openipc", "allwinner-osdrv-v83x", "atbm-wifi",
"aura-httpd", "baresip-openipc", "comgt", "f2fs-tools-openipc", "faceter-agent",
Expand All @@ -255,7 +261,8 @@
"osd-openipc", "rtl8188eus-openipc", "rtl8192eu-openipc", "rtl8811cu-openipc",
"rtl8812au", "rtl8812au-openipc", "rtl88x2eu-openipc", "rtw-hostapd", "rubyfpv",
"siproxd-openipc", "ssv615x-openipc", "ssv635x-openipc", "txw8301-openipc",
"uqmi-openipc", "vdec-openipc", "venc-openipc", "w1-ds18b20", "webface",
"uqmi-openipc", "vdec-openipc", "venc-openipc", "w1-ds18b20", "waybeam",
Comment thread
openipc-ai marked this conversation as resolved.
"webface",
"webrtc-audio-processing-openipc", "wifibroadcast-ng", "wq9001", "yaml-cli-multi",
}

Expand Down
1 change: 1 addition & 0 deletions general/package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/vdec-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/venc-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/vtund-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/w1-ds18b20/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/waybeam/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/webface/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/webrtc-audio-processing-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/wifibroadcast-ng/Config.in"
Expand Down
31 changes: 31 additions & 0 deletions general/package/waybeam/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
config BR2_PACKAGE_WAYBEAM
bool "waybeam"
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E
depends on !BR2_PACKAGE_MAJESTIC
Comment thread
openipc-ai marked this conversation as resolved.
help
Standalone H.265 video encoder and streamer for SigmaStar
Infinity6E (SSC338Q/SSC30KQ). Provides a dual encoder
backend, sensor unlock and an HTTP configuration API.

Infinity6C (SSC378QE) is not offered here even though the
encoder has a backend for it: waybeam's I6C backend targets
the 2024-06-18 SigmaStar MI libraries and
sigmastar-osdrv-infinity6c ships 2022-09-07. The pipeline
streams against those, but AE never actuates and the image
is black. I6C returns once the two agree.

It is an alternative to the Majestic streamer and cannot be
built alongside it: both drive the same sensor and encoder
hardware, and both rely on the SigmaStar OSDRV MI libraries,
which OSDRV installs only when Majestic is not selected.

Installs:
- /usr/bin/waybeam
- /usr/bin/json_cli
- /etc/waybeam.json
- /etc/init.d/S95waybeam
- unlocked imx335/imx415 sensor modules, compiled here
against this board's kernel

https://github.com/OpenIPC/waybeam
73 changes: 73 additions & 0 deletions general/package/waybeam/files/S95waybeam
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh

DAEMON="waybeam"
RESPAWN="waybeam-resp"
WATCHDOG="waybeam-wd"
DAEMON_PATH="/usr/bin/waybeam"
LOG_PATH="/tmp/waybeam.log"

# waybeam forks a respawn child (comm "waybeam-resp") on an API restart and a
# watchdog ("waybeam-wd"). pidof and killall match by comm, so every restart
# path must cover all three names, otherwise stop() returns while a helper is
# still alive and the next start() trips the duplicate-instance check.
still_running() {
pidof "$DAEMON" "$RESPAWN" "$WATCHDOG" >/dev/null 2>&1
}

wait_exit() {
i=0
while [ $i -lt 30 ]; do
still_running || return 0
sleep 0.5
i=$((i + 1))
done
return 1
}
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.

start() {
if still_running; then
echo "$DAEMON already running"
return 0
fi
echo -n "Starting $DAEMON: "
# waybeam reads /etc/waybeam.json from a fixed path; it has no -c flag.
"$DAEMON_PATH" > "$LOG_PATH" 2>&1 &
i=0
while [ $i -lt 10 ]; do
sleep 0.3
still_running && { echo "OK"; return 0; }
i=$((i + 1))
done
echo "FAILED (crashed at init or lost the duplicate-instance check, see $LOG_PATH)"
return 1
}

stop() {
echo -n "Stopping $DAEMON: "
killall "$DAEMON" "$RESPAWN" "$WATCHDOG" 2>/dev/null
if wait_exit; then
echo "OK"
return 0
fi
# 15s of SIGTERM was not enough. Escalate rather than report a stop that
# did not happen: restart would then run start() against a survivor, which
# trips the duplicate-instance check and returns 0 having done nothing --
# the requested restart silently never happens.
killall -9 "$DAEMON" "$RESPAWN" "$WATCHDOG" 2>/dev/null
if wait_exit; then
echo "OK (forced)"
return 0
fi
echo "FAILED ($DAEMON survived SIGKILL)"
return 1
}

case "$1" in
start) start ;;
stop) stop ;;
restart) stop && start ;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
114 changes: 114 additions & 0 deletions general/package/waybeam/files/waybeam.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"system": {
"webPort": 80,
"overclockLevel": 1,
"verbose": false
},
"sensor": {
"index": -1,
"mode": -1
},
"isp": {
"sensorBin": "",
"aeEngine": "sdk",
"aeFps": 15,
"gainMax": 0,
"awbMode": "auto",
"awbCt": 5500,
"keepAspect": true
},
"image": {
"mirror": false,
"flip": false,
"rotate": 0
},
"video0": {
"rcMode": "cbr",
"fps": 90,
"size": "auto",
"bitrate": 2580,
"gopSize": 5.0,
"qpDelta": -12,
"sceneThreshold": 0,
"sceneHoldoff": 2,
"resilience": "off",
"zoomX": 0.5,
"zoomY": 0.5,
"framing": "off",
"stabCropPct": 0,
"stabRecenterSpeed": 0,
"stabKalmanQ": 0.0,
"stabKalmanR": 0.0
},
"outgoing": {
"enabled": true,
"server": "udp://192.168.1.10:5600",
Comment thread
openipc-ai marked this conversation as resolved.
"streamMode": "rtp",
"maxPayloadSize": 1400,
"connectedUdp": true,
"audioPort": 5601,
"sidecarPort": 5602
},
"discovery": {
"enabled": true,
"serviceType": "_waybeam-venc._tcp",
"name": "",
"bareAlias": true
},
"fpv": {
"roiEnabled": false,
"roiQp": 0,
"roiSteps": 2,
"roiCenter": 0.4,
"noiseLevel": 0
},
"audio": {
"enabled": false,
"sampleRate": 48000,
"channels": 1,
"codec": "opus",
"volume": 80,
"mute": false
},
"imu": {
"enabled": false,
"i2cDevice": "/dev/i2c-1",
"i2cAddr": "0x68",
"sampleRateHz": 200,
"gyroRangeDps": 1000,
"calFile": "/etc/imu.cal",
"calSamples": 400
},
"record": {
"enabled": false,
"dir": "/mnt/mmcblk0p1",
"format": "ts",
"mode": "mirror",
"maxSeconds": 300,
"maxMB": 500,
"bitrate": 0,
"fps": 0,
"gopSize": 0.0,
"server": ""
},
"snapshot": {
"enabled": true,
"quality": 80,
"channel": 7,
"width": 0,
"height": 0
},
"debug": {
"showOsd": false
},
"attitude": {
"enabled": false,
"mountDeg": 0,
"invertRoll": false,
"invertPitch": false,
"axisFwd": "+x",
"axisDown": "+z",
"trimRollDeg": 0.0,
"trimPitchDeg": 0.0
}
}
92 changes: 92 additions & 0 deletions general/package/waybeam/waybeam.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
################################################################################
#
# waybeam
#
################################################################################

WAYBEAM_VERSION = HEAD
Comment thread
openipc-ai marked this conversation as resolved.
WAYBEAM_SITE = https://github.com/OpenIPC/waybeam.git
WAYBEAM_SITE_METHOD = git
# The sensor drivers include SigmaStar headers that are not in the waybeam
# tree itself — they come from the OpenIPC/sensors submodule at sensors-src/,
# so the checkout has to bring it along or drivers/ will not compile.
WAYBEAM_GIT_SUBMODULES = YES
WAYBEAM_LICENSE = MIT
WAYBEAM_LICENSE_FILES = LICENSE

# The encoder ships one source tree with a backend per SoC, picked by
# SOC_BUILD. Only the Infinity6E (star6e) backend is built here. The tree also
# has a maruko backend for Infinity6C, but it targets the 2024-06-18 SigmaStar
# MI libraries while sigmastar-osdrv-infinity6c ships 2022-09-07: measured on
# an SSC378QE, the pipeline streams against those but AE never actuates and
# the frame comes out black (mean luma 2.05/255, against 153.91 on the 2024
# set). Config.in therefore does not offer I6C, and it returns here once the
# two revisions agree.
#
# CC_BIN points the tree's own toolchain check at Buildroot's compiler so it
# does not fetch one of its own.
WAYBEAM_SOC = star6e
WAYBEAM_MAKE_OPTS = SOC_BUILD=star6e STAR6E_CC="$(TARGET_CC)" CC_BIN="$(TARGET_CC)"
# Built after the stock sensor and MI-library packages so the modified sensor
# modules install over the stock sensor_imx*_mipi.ko names.
WAYBEAM_DEPENDENCIES += sigmastar-osdrv-sensors sigmastar-osdrv-infinity6e

# The sensor modules are compiled here against the kernel this build just
# produced, so linux must be built first.
WAYBEAM_DEPENDENCIES += linux

# `build` rather than the tree's `stage` target: stage exists to assemble a
# release tarball, and its extra work is unwanted here. It copies the vendor
# MI .so files into the bundle, which OSDRV already installs to /usr/lib, and
# it stages sensor modules vendored into the source tree as prebuilt
# binaries. The modules below are compiled from drivers/*.c instead.
define WAYBEAM_BUILD_CMDS
$(MAKE) -C $(@D) build json_cli $(WAYBEAM_MAKE_OPTS)
$(MAKE) -C $(@D)/drivers sensor SOC=$(WAYBEAM_SOC) \
KSRC="$(LINUX_DIR)" CROSS="$(TARGET_CROSS)"
endef

define WAYBEAM_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/out/$(WAYBEAM_SOC)/waybeam \
$(TARGET_DIR)/usr/bin/waybeam
$(INSTALL) -m 0755 -D $(@D)/out/$(WAYBEAM_SOC)/json_cli \
$(TARGET_DIR)/usr/bin/json_cli
$(INSTALL) -m 0644 -D $(WAYBEAM_PKGDIR)/files/waybeam.json \
$(TARGET_DIR)/etc/waybeam.json
endef

# The encoder dlopens the SigmaStar MI libraries at runtime. They are
# installed to /usr/lib by sigmastar-osdrv-infinity6e, which does so only when
# Majestic is not selected; waybeam depends on !MAJESTIC, so that path always
# applies and the package ships no libraries itself. That the shipped MI
# revision is one the backend targets is a real constraint, not a formality --
# it is what rules out Infinity6C above.

# Waybeam drives its own imx335/imx415 drivers rather than the stock ones:
# they unlock higher-FPS sensor modes, up to 144 fps IMX335 / 100 fps IMX415.
# Install them over the stock _mipi.ko names the SigmaStar module loader looks
# for. LINUX_VERSION_PROBED rather than a literal 4.9.84 so the path follows
# whatever kernel the board actually built -- verified to resolve to the same
# directory the stock package writes to, which is what makes it an overwrite.
define WAYBEAM_INSTALL_SENSOR_MODULES
$(INSTALL) -m 0644 -D $(@D)/drivers/sensor_imx335_$(WAYBEAM_SOC).ko \
$(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/sigmastar/sensor_imx335_mipi.ko
$(INSTALL) -m 0644 -D $(@D)/drivers/sensor_imx415_$(WAYBEAM_SOC).ko \
$(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/sigmastar/sensor_imx415_mipi.ko
Comment thread
openipc-ai marked this conversation as resolved.
endef
WAYBEAM_POST_INSTALL_TARGET_HOOKS += WAYBEAM_INSTALL_SENSOR_MODULES

# No ISP tuning bins are installed. waybeam.json ships isp.sensorBin empty,
# and the encoder then resolves /etc/sensors/<sensor>.bin itself
# (src/pipeline_common.c) -- the same stock tuning Majestic loads, installed
# by sigmastar-osdrv-infinity6e and filtered on OPENIPC_SNS_MODEL. The bins
# vendored in the source tree under iq-profiles/ are not used: they were
# pulled off a running camera, which is the binary-without-source this tree
# refuses, and they are byte-identical to our own copies anyway.

define WAYBEAM_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D $(WAYBEAM_PKGDIR)/files/S95waybeam \
$(TARGET_DIR)/etc/init.d/S95waybeam
endef

$(eval $(generic-package))
Loading