[no ci] Package: initial tunnel support for wifibroadcast (#1571)

pull/1573/head
viktorxda 2024-10-09 11:57:26 +02:00 committed by GitHub
parent e5300615c2
commit 688aaaa828
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 65 additions and 40 deletions

View File

@ -6,6 +6,29 @@ if [ -e /etc/datalink.conf ]; then
. /etc/datalink.conf . /etc/datalink.conf
fi fi
start_lte() {
echo "Starting fpv datalink..."
if [ "$usb_modem" = "true" ]; then
echo "Starting lte modem configuration..."
fi
if [ "$use_zt" = "true" ]; then
echo "Starting ZeroTier-One daemon..."
zerotier-one -d &
if [ ! -f "/var/lib/zerotier-one/networks.d/$zt_netid.conf" ]; then
sleep 8
zerotier-cli join "$zt_netid" > /dev/null
echo "Don't forget to authorize my.zerotier.com!"
fi
fi
if [ "$telemetry" = "true" ]; then
telemetry start
fi
exit 0
}
case "$1" in case "$1" in
start) start)
if [ -n "$(fw_printenv -n wlandev)" ]; then if [ -n "$(fw_printenv -n wlandev)" ]; then
@ -16,39 +39,17 @@ case "$1" in
tweaksys "$chip" tweaksys "$chip"
fi fi
echo "Starting fpv datalink..."
if [ "$fw" = "lte" ]; then if [ "$fw" = "lte" ]; then
if [ "$usb_modem" = "true" ]; then start_lte
echo "Starting lte modem configuration..."
fi fi
if [ "$use_zt" = "true" ]; then
echo "Starting ZeroTier-One daemon..."
/usr/sbin/zerotier-one -d &
if [ ! -f "/var/lib/zerotier-one/networks.d/$zt_netid.conf" ]; then
sleep 8
zerotier-cli join "$zt_netid" > /dev/null
echo "Don't forget to authorize my.zerotier.com!"
fi
fi
if [ "$telemetry" = "true" ]; then
telemetry start
fi
else
echo "Starting wifibroadcast service..." echo "Starting wifibroadcast service..."
wifibroadcast start wifibroadcast start
fi
;; ;;
stop) stop)
echo "Stopping fpv datalink service..." echo "Stopping wifibroadcast service..."
killall -q wfb_tx wifibroadcast stop
killall -q wfb_rx
killall -q telemetry_rx
killall -q telemetry_tx
killall -q mavlink-routerd
killall -q mavfwd
;; ;;
*) *)

View File

@ -1,5 +1,6 @@
daemon=1 daemon=1
telemetry=true telemetry=true
tunnel=false
### only for lte firmware ### only for lte firmware
usb_modem=false usb_modem=false

View File

@ -10,9 +10,9 @@ if [ -e /etc/telemetry.conf ]; then
. /etc/telemetry.conf . /etc/telemetry.conf
fi fi
if [ ! -f /usr/bin/telemetry_rx ] && [ ! -f /usr/bin/telemetry_tx ]; then if [ ! -e /usr/bin/telemetry_rx ] || [ ! -e /usr/bin/telemetry_tx ]; then
ln -s /usr/bin/wfb_rx /usr/bin/telemetry_rx ln -fs /usr/bin/wfb_rx /usr/bin/telemetry_rx
ln -s /usr/bin/wfb_tx /usr/bin/telemetry_tx ln -fs /usr/bin/wfb_tx /usr/bin/telemetry_tx
fi fi
start_drone_telemetry() { start_drone_telemetry() {
@ -47,6 +47,7 @@ case "$1" in
--out 127.0.0.1:$port_tx --in 127.0.0.1:$port_rx > /dev/null & --out 127.0.0.1:$port_tx --in 127.0.0.1:$port_rx > /dev/null &
fi fi
fi fi
if [ "$fw" = "fpv" ] || [ "$fw" = "venc" ]; then if [ "$fw" = "fpv" ] || [ "$fw" = "venc" ]; then
start_${unit}_telemetry start_${unit}_telemetry
fi fi

View File

@ -116,6 +116,18 @@ start_gs_wfb() {
wfb_rx -c "$udp_addr" -u "$udp_port" -p "$stream" -K "$keydir/$unit.key" -i "$link_id" "$wlan" > /dev/null & wfb_rx -c "$udp_addr" -u "$udp_port" -p "$stream" -K "$keydir/$unit.key" -i "$link_id" "$wlan" > /dev/null &
} }
start_tunnel_wfb() {
if [ ! -e /usr/bin/tunnel_rx ] || [ ! -e /usr/bin/tunnel_tx ]; then
ln -fs /usr/bin/wfb_rx /usr/bin/tunnel_rx
ln -fs /usr/bin/wfb_tx /usr/bin/tunnel_tx
fi
tunnel_rx -p 160 -u 5800 -K "$keydir/$unit.key" -i "$link_id" "$wlan" > /dev/null &
tunnel_tx -p 32 -u 5801 -K "$keydir/$unit.key" -M "$mcs_index" -S "$stbc" -L "$ldpc" \
-k "$fec_k" -n "$fec_n" -i "$link_id" "$wlan" > /dev/null &
wfb_tun -a 10.5.0.10/24 > /dev/null &
}
case "$1" in case "$1" in
start) start)
if [ "$daemon" -eq 1 ]; then if [ "$daemon" -eq 1 ]; then
@ -132,14 +144,18 @@ case "$1" in
if [ "$telemetry" = "true" ]; then if [ "$telemetry" = "true" ]; then
if [ "$chip" = "gk7205v200" ]; then if [ "$chip" = "gk7205v200" ]; then
devmem 0x120c0010 32 0x1e04 devmem 0x120C0010 32 0x1E04
elif [ "$chip" = "ssc33x" ]; then elif [ "$chip" = "ssc33x" ]; then
devmem 0x1F207890 16 0x8 devmem 0x1F207890 16 0x8
fi fi
telemetry start telemetry start
fi fi
if [ "$tunnel" = "true" ]; then
start_tunnel_wfb
fi
else else
echo "Wifibroadcast service disabled in wfb.conf." echo "Wifibroadcast service disabled in wfb.conf"
fi fi
;; ;;
@ -147,10 +163,16 @@ case "$1" in
echo "Stopping wifibroadcast service..." echo "Stopping wifibroadcast service..."
killall -q wfb_tx killall -q wfb_tx
killall -q wfb_rx killall -q wfb_rx
killall -q telemetry_rx
killall -q telemetry_tx if [ "$telemetry" = "true" ]; then
killall -q mavlink-routerd telemetry stop
killall -q mavfwd fi
if [ "$tunnel" = "true" ]; then
killall -q tunnel_rx
killall -q tunnel_tx
killall -q wfb_tun
fi
;; ;;
*) *)

View File

@ -4,7 +4,7 @@
# #
################################################################################ ################################################################################
WIFIBROADCAST_VERSION = d7b3737677d6b0bfbb2697acf2b7e8ab9bda9e89 WIFIBROADCAST_VERSION = 3a053040442174e6c1ce76866c6da4b12c19dbb4
WIFIBROADCAST_SITE = $(call github,svpcom,wfb-ng,$(WIFIBROADCAST_VERSION)) WIFIBROADCAST_SITE = $(call github,svpcom,wfb-ng,$(WIFIBROADCAST_VERSION))
WIFIBROADCAST_LICENSE = GPL-2.0 WIFIBROADCAST_LICENSE = GPL-2.0