[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
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
start)
if [ -n "$(fw_printenv -n wlandev)" ]; then
@ -16,39 +39,17 @@ case "$1" in
tweaksys "$chip"
fi
echo "Starting fpv datalink..."
if [ "$fw" = "lte" ]; then
if [ "$usb_modem" = "true" ]; then
echo "Starting lte modem configuration..."
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..."
wifibroadcast start
start_lte
fi
echo "Starting wifibroadcast service..."
wifibroadcast start
;;
stop)
echo "Stopping fpv datalink service..."
killall -q wfb_tx
killall -q wfb_rx
killall -q telemetry_rx
killall -q telemetry_tx
killall -q mavlink-routerd
killall -q mavfwd
echo "Stopping wifibroadcast service..."
wifibroadcast stop
;;
*)

View File

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

View File

@ -10,9 +10,9 @@ if [ -e /etc/telemetry.conf ]; then
. /etc/telemetry.conf
fi
if [ ! -f /usr/bin/telemetry_rx ] && [ ! -f /usr/bin/telemetry_tx ]; then
ln -s /usr/bin/wfb_rx /usr/bin/telemetry_rx
ln -s /usr/bin/wfb_tx /usr/bin/telemetry_tx
if [ ! -e /usr/bin/telemetry_rx ] || [ ! -e /usr/bin/telemetry_tx ]; then
ln -fs /usr/bin/wfb_rx /usr/bin/telemetry_rx
ln -fs /usr/bin/wfb_tx /usr/bin/telemetry_tx
fi
start_drone_telemetry() {
@ -41,12 +41,13 @@ case "$1" in
else
if [ "$router" -eq 2 ]; then
msposd --master "$serial" --baudrate "$baud" --channels "$channels" \
--out 127.0.0.1:14555 -osd -r "$fps" --ahi "$ahi" > /dev/null &
--out 127.0.0.1:14555 -osd -r "$fps" --ahi "$ahi" > /dev/null &
else
mavfwd --channels "$channels" --master "$serial" --baudrate "$baud" -p 100 -t -a "$aggregate" \
--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
if [ "$fw" = "fpv" ] || [ "$fw" = "venc" ]; then
start_${unit}_telemetry
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 &
}
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
start)
if [ "$daemon" -eq 1 ]; then
@ -132,14 +144,18 @@ case "$1" in
if [ "$telemetry" = "true" ]; then
if [ "$chip" = "gk7205v200" ]; then
devmem 0x120c0010 32 0x1e04
devmem 0x120C0010 32 0x1E04
elif [ "$chip" = "ssc33x" ]; then
devmem 0x1F207890 16 0x8
fi
telemetry start
fi
if [ "$tunnel" = "true" ]; then
start_tunnel_wfb
fi
else
echo "Wifibroadcast service disabled in wfb.conf."
echo "Wifibroadcast service disabled in wfb.conf"
fi
;;
@ -147,10 +163,16 @@ case "$1" in
echo "Stopping wifibroadcast service..."
killall -q wfb_tx
killall -q wfb_rx
killall -q telemetry_rx
killall -q telemetry_tx
killall -q mavlink-routerd
killall -q mavfwd
if [ "$telemetry" = "true" ]; then
telemetry stop
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_LICENSE = GPL-2.0