[no ci] Package: add experimental wifibroadcast-ng (#1575)

pull/1576/head
viktorxda 2024-10-11 19:20:26 +02:00 committed by GitHub
parent 8bdde2f5a7
commit 78250d1513
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 224 additions and 0 deletions

View File

@ -111,6 +111,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/vtund-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/webui/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/webrtc-audio-processing-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/wifibroadcast/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/wifibroadcast-ng/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/xiongmai-opensdk-xm510/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/xiongmai-osdrv-xm510/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/xiongmai-osdrv-xm530/Config.in"

View File

@ -0,0 +1,5 @@
config BR2_PACKAGE_WIFIBROADCAST_NG
bool "wifibroadcast-ng"
help
Long-range packet radio link based on raw WiFi radio.
https://github.com/svpcom/wfb-ng

View File

@ -0,0 +1,18 @@
#!/bin/sh
case "$1" in
start)
echo "Starting wifibroadcast..."
wifibroadcast start
;;
stop)
echo "Stopping wifibroadcast..."
wifibroadcast stop
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -0,0 +1 @@
ЛЗэn<EFBFBD>Єj<EFBFBD><EFBFBD><EFBFBD> љ<C2A0>Ю+м<><D0BC>И GВ<5F>Ќ{FФ<>a<EFBFBD>ћp<D19B>tzfш<ц@НkОЕВQSz<53>ЂtЂc

View File

@ -0,0 +1,31 @@
#!/bin/sh
finish() {
touch /etc/system.ok
echo "Restart system to apply fpv changes..."
reboot
}
sigmastar() {
cli -s .isp.sensorConfig /etc/sensors/imx415_fpv.bin
cli -s .isp.exposure 5
cli -s .video0.codec h265
cli -s .video0.size 1920x1080
cli -s .video0.fps 90
cli -s .video0.rcMode cbr
cli -s .jpeg.enabled false
cli -s .outgoing.enabled true
cli -s .outgoing.server udp://127.0.0.1:5600
}
case "$1" in
ssc33x)
sigmastar
finish
;;
*)
echo "Usage: $0 {ssc33x}"
exit 1
;;
esac

View File

@ -0,0 +1,21 @@
# Broadcast
wlan=wlan0
region=00
channel=161
txpower=1
driver_txpower_override=1
bandwidth=20
stbc=0
ldpc=0
mcs_index=1
stream=0
link_id=7669206
rcv_buf=456000
fec_k=8
fec_n=12
# Telemetry
serial=/dev/ttyS2
baud=115200
channels=8
aggregate=15

View File

@ -0,0 +1,118 @@
#!/bin/sh
wfb_soc=$(ipcinfo -c)
wfb_key=/etc/drone.key
if [ -e /etc/wfb.conf ]; then
. /etc/wfb.conf
fi
load_modules() {
devices=$(lsusb | cut -d ' ' -f6 | sort | uniq)
for card in $devices; do
case "$card" in
"0bda:8812" | "0bda:881a" | "0b05:17d2" | "2357:0101" | "2604:0012")
driver="88XXau"
modprobe 88XXau rtw_tx_pwr_idx_override="$driver_txpower_override"
;;
"0bda:a81a")
driver="8812eu"
modprobe 8812eu rtw_regd_src=1 rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0
;;
"0bda:f72b")
driver="8733bu"
modprobe 8733bu rtw_regd_src=1 rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0
;;
esac
done
if [ -z "$driver" ]; then
echo "Wireless module not detected, check the usb connection."
exit 1
else
echo "Detected driver: $driver"
fi
while ! ifconfig -a | grep -q "$wlan"; do
if [ "$n" -ge 5 ]; then
echo "No interface for $wlan, check the usb connection."
exit 1
fi
sleep 0.5
n=$((n + 1))
done
}
load_interface() {
ifconfig "$wlan" up
iwconfig "$wlan" mode monitor
if [ "$driver" = "8812eu" ] || [ "$driver" = "8733bu" ]; then
iw dev "$wlan" set txpower fixed $((driver_txpower_override * 50))
fi
iw reg set "$region"
iwconfig "$wlan" channel "$channel"
}
start_wfb() {
echo "Starting wfb_tx"
wfb_tx -p "$stream" -R "$rcv_buf" -K "$wfb_key" -B "$bandwidth" -M "$mcs_index" -C 8000 \
-S "$stbc" -L "$ldpc" -k "$fec_k" -n "$fec_n" -i "$link_id" "$wlan" &> /dev/null &
}
start_tunnel() {
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
echo "Starting wfb_tun"
tunnel_rx -p 160 -u 5800 -K "$wfb_key" -i "$link_id" "$wlan" &> /dev/null &
tunnel_tx -p 32 -u 5801 -K "$wfb_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 &
}
start_telemetry() {
if [ "$wfb_soc" = "gk7205v200" ]; then
devmem 0x120C0010 32 0x1E04
elif [ "$wfb_soc" = "ssc33x" ]; then
devmem 0x1F207890 16 0x8
fi
echo "Starting mavfwd"
mavfwd --channels "$channels" --master "$serial" --baudrate "$baud" -p 100 -t -a "$aggregate" \
--out 10.5.0.1:14550 --in 0.0.0.0:14551 > /dev/null &
}
case "$1" in
start)
if [ ! -e /etc/system.ok ]; then
echo "Preparing system tweaks for $wfb_soc..."
tweaksys "$wfb_soc"
fi
load_modules
load_interface
start_wfb
start_tunnel
start_telemetry
;;
stop)
killall -q wfb_tx
killall -q wfb_rx
killall -q wfb_tun
killall -q tunnel_rx
killall -q tunnel_tx
killall -q mavfwd
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -0,0 +1,29 @@
################################################################################
#
# wifibroadcast-ng
#
################################################################################
WIFIBROADCAST_NG_VERSION = 3a053040442174e6c1ce76866c6da4b12c19dbb4
WIFIBROADCAST_NG_SITE = $(call github,svpcom,wfb-ng,$(WIFIBROADCAST_NG_VERSION))
WIFIBROADCAST_NG_LICENSE = GPL-3.0
WIFIBROADCAST_NG_DEPENDENCIES += libpcap libsodium iw
define WIFIBROADCAST_NG_BUILD_CMDS
$(MAKE) CC=$(TARGET_CC) CXX=$(TARGET_CXX) LDFLAGS=-s -C $(@D) all_bin
endef
define WIFIBROADCAST_NG_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
$(INSTALL) -m 644 -D $(WIFIBROADCAST_NG_PKGDIR)/files/drone.key $(TARGET_DIR)/etc
$(INSTALL) -m 644 -D $(WIFIBROADCAST_NG_PKGDIR)/files/wfb.conf $(TARGET_DIR)/etc
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -D $(@D)/wfb_rx $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -D $(@D)/wfb_tx $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -D $(@D)/wfb_tun $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -D $(WIFIBROADCAST_NG_PKGDIR)/files/wifibroadcast $(TARGET_DIR)/usr/bin
endef
$(eval $(generic-package))