simplified air and ground scripts ()

pull/1075/head
cronyx 2023-10-20 09:46:49 +03:00 committed by GitHub
parent e86239a562
commit 1f1dc617ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 150 additions and 395 deletions

View File

@ -3,13 +3,14 @@
# datalink
#
################################################################################
DATALINK_VERSION =
DATALINK_VERSION =
DATALINK_SITE =
DATALINK_LICENSE = GPL-2.0
DATALINK_FPATH = air
DATALINK_UNIT = drone
ifeq ($(OPENIPC_SOC_FAMILY),hi3536dv100)
DATALINK_FPATH = gs
DATALINK_UNIT = gs
endif
define DATALINK_INSTALL_TARGET_CMDS
@ -17,16 +18,13 @@ define DATALINK_INSTALL_TARGET_CMDS
cp $(DATALINK_PKGDIR)/files/datalink.conf $(TARGET_DIR)/etc
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp $(DATALINK_PKGDIR)/files/$(DATALINK_FPATH)/telemetry.conf $(TARGET_DIR)/etc
cp $(DATALINK_PKGDIR)/files/telemetry_$(DATALINK_UNIT).conf $(TARGET_DIR)/etc/telemetry.conf
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
cp $(DATALINK_PKGDIR)/files/S98datalink $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(DATALINK_PKGDIR)/files/$(DATALINK_FPATH)/telemetry $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/sbin
cp $(DATALINK_PKGDIR)/files/$(DATALINK_FPATH)/channels.sh $(TARGET_DIR)/usr/sbin
cp $(DATALINK_PKGDIR)/files/telemetry $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(DATALINK_PKGDIR)/files/tweaksys $(TARGET_DIR)/usr/bin

View File

@ -43,6 +43,7 @@ case "$1" in
stop)
echo "Stopping all services..."
kill -9 $(pidof wfb_tx)
kill -9 $(pidof wfb_rx)
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)

View File

@ -1,5 +0,0 @@
#!/bin/sh
echo $1 $2 >> /tmp/channels.log
exit 1

View File

@ -1,49 +0,0 @@
#!/bin/sh
#
# Start telemetry
#
. /etc/datalink.conf
. /etc/telemetry.conf
keydir="/etc"
fw=$(grep "BUILD_OPTION" "/etc/os-release" | cut -d= -f2)
start_telemetry() {
if [ ! -f /usr/bin/telemetry_rx -a ! -f /usr/bin/telemetry_tx ]; then
ln -s /usr/bin/wfb_rx /usr/bin/telemetry_rx ; chmod +x /usr/bin/telemetry_rx
ln -s /usr/bin/wfb_tx /usr/bin/telemetry_tx ; chmod +x /usr/bin/telemetry_tx
else
if [ ${one_way} = "false" ]; then
telemetry_rx -p ${stream_rx} -u ${port_rx} -K ${keydir}/drone.key -i ${link_id} ${wlan} &
fi
telemetry_tx -p ${stream_tx} -u ${port_tx} -K ${keydir}/drone.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} &
fi
}
case "$1" in
start)
echo "Loading MAVLink telemetry service..."
if [ ${router} -eq 1 ] || [ ${fw} = "lte" ]; then
/usr/bin/mavlink-routerd &
else
mavfwd --channels ${channels} --master ${serial} --baudrate ${baud} --out 127.0.0.1:${port_tx} --in 127.0.0.1:${port_rx} &
fi
if [ ${fw} = "fpv" ] || [ ${fw} = "venc" ]; then
start_telemetry
fi
echo "Done."
;;
stop)
echo "Stopping telemetry services..."
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)
kill -9 $(pidof mavfwd)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

View File

@ -1,10 +1,11 @@
daemon=1
telemetry=true
### only for lte firmware
usb_modem=false
gs_ipaddr=127.0.0.1
gs_port=5600
# zerotier package contain only in the lte or ultimate builds
### zerotier package contain only in the lte or ultimate builds
use_zt=false
zt_netid=

View File

@ -1,3 +0,0 @@
#!/bin/sh
exit 1

View File

@ -1,90 +0,0 @@
#!/bin/sh
#
# Start telemetry
#
eval `cat /etc/wfb.conf | grep "tab_wlan" | grep -v "#"`
eval `cat /etc/wfb.conf | grep "udp_addr" | grep -v "#"`
. /etc/datalink.conf
. /etc/telemetry.conf
keydir="/etc"
fw=$(grep "BUILD_OPTION" "/etc/os-release" | cut -d= -f2)
start_telemetry() {
if [ ! -f /usr/bin/telemetry_rx -a ! -f /usr/bin/telemetry_tx ]; then
ln -s /usr/bin/wfb_rx /usr/bin/telemetry_rx ; chmod +x /usr/bin/telemetry_rx
ln -s /usr/bin/wfb_tx /usr/bin/telemetry_tx ; chmod +x /usr/bin/telemetry_tx
else
if [ ${one_way} = "false" ]; then
if [ -z "${link_id}" ]; then
telemetry_tx -r ${stream_tx} -u ${port_tx} -K ${keydir}/gs.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -p ${fec_p} ${wlan} >/dev/null >/dev/null &
else
telemetry_tx -p ${stream_tx} -u ${port_tx} -K ${keydir}/gs.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} >/dev/null &
fi
fi
if [ -z "${link_id}" ]; then
telemetry_rx -r ${stream_rx} -c 127.0.0.1 -u ${port_rx} -K ${keydir}/gs.key ${wlan} >/dev/null &
else
telemetry_rx -p ${stream_rx} -u ${port_rx} -K ${keydir}/gs.key -i ${link_id} ${wlan} >/dev/null &
fi
fi
#for ethernet-modem
if [ ${udp_addr} = "auto" ]; then
ETH_IP=`ip route show 0.0.0.0/0 dev eth0 | cut -d\ -f3`
if [ ! -z ${ETH_IP} ]; then
echo found ethernet-modem, ip: ${ETH_IP}
MAVROUTARG=" -e ${ETH_IP}:14550"
fi
fi
#for tablet osd (FPV-VR) as usb
PHONE_IP=`ip route show 0.0.0.0/0 dev usb0 | cut -d\ -f3`
if [ ! -z ${PHONE_IP} ]; then
echo found usb0 device, usb-modem ip: ${PHONE_IP}
MAVROUTARG=" -e ${PHONE_IP}:14550"
fi
#for tablet osd (FPV-VR) as AP
TAB_IP=`ip route show 0.0.0.0/0 dev ${tab_wlan} | cut -d\ -f3`
if [ ! -z ${TAB_IP} ]; then
echo found ${tab_wlan} device, tab ip: ${TAB_IP}
MAVROUTARG=" -e ${TAB_IP}:14550"
fi
}
start_all() {
echo "Loading MAVLink telemetry service..."
if [ ${fw} = "fpv" ]; then
start_telemetry
fi
if [ ${router} -eq 1 ] || [ ${fw} = "lte" ]; then
/usr/bin/mavlink-routerd -c /etc/mavlink.conf ${MAVROUTARG} &
else
mavfwd --channels ${channels} --master ${serial} --baudrate ${baud} --out 127.0.0.1:${port_tx} --in 127.0.0.1:${port_rx} &
fi
echo "Done."
}
stop_all() {
echo "Stopping telemetry services..."
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)
kill -9 $(pidof mavfwd)
}
case "$1" in
start)
start_all
;;
stop)
stop_all
;;
restart)
stop_all
start_all
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@ -0,0 +1,56 @@
#!/bin/sh
#
# Start telemetry
#
. /etc/datalink.conf
. /etc/telemetry.conf
keydir="/etc"
fw=$(grep "BUILD_OPTION" "/etc/os-release" | cut -d= -f2)
if [ ! -f /usr/bin/telemetry_rx -a ! -f /usr/bin/telemetry_tx ]; then
ln -s /usr/bin/wfb_rx /usr/bin/telemetry_rx ; chmod +x /usr/bin/telemetry_rx
ln -s /usr/bin/wfb_tx /usr/bin/telemetry_tx ; chmod +x /usr/bin/telemetry_tx
fi
start_drone_telemetry() {
if [ ${one_way} = "false" ]; then
telemetry_rx -p ${stream_rx} -u ${port_rx} -K ${keydir}/${unit}.key -i ${link_id} ${wlan} > /dev/null &
fi
telemetry_tx -p ${stream_tx} -u ${port_tx} -K ${keydir}/${unit}.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} > /dev/null &
}
start_gs_telemetry() {
if [ ${one_way} = "false" ]; then
telemetry_tx -p ${stream_tx} -u ${port_tx} -K ${keydir}/${unit}.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} > /dev/null &
fi
telemetry_rx -p ${stream_rx} -u ${port_rx} -K ${keydir}/${unit}.key -i ${link_id} ${wlan} > /dev/null &
}
case "$1" in
start)
echo "Loading MAVLink telemetry service..."
if [ ${router} -eq 1 ] || [ ${fw} = "lte" ] || [ ${unit} = "gs" ]; then
mavlink-routerd -c /etc/mavlink.conf &
else
mavfwd --channels ${channels} --master ${serial} --baudrate ${baud} --out 127.0.0.1:${port_tx} --in 127.0.0.1:${port_rx} > /dev/null &
fi
if [ ${fw} = "fpv" ] || [ ${fw} = "venc" ]; then
start_${unit}_telemetry
fi
echo "Done."
;;
stop)
echo "Stopping telemetry services..."
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)
kill -9 $(pidof mavfwd)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

View File

@ -1,5 +1,9 @@
### unit: drone or gs
unit=drone
serial=/dev/ttyAMA0
baud=115200
### router: use simple mavfwd (0) or classic mavlink-routerd (1)
router=0

View File

@ -1,5 +1,9 @@
### unit: drone or gs
unit=gs
serial=/dev/ttyAMA0
baud=115200
### router: use simple mavfwd (0) or classic mavlink-routerd (1)
router=1

View File

@ -3,7 +3,11 @@
chip=$(ipcinfo -c)
family=$(ipcinfo -f)
vendor=$(ipcinfo -v)
sensor=$(ipcinfo -s)
if ! [ ${chip} = "hi3536dv100" ]; then
sensor=$(ipcinfo -s)
fi
prefix=${family}
hisi_goke() {
@ -118,7 +122,12 @@ case "$1" in
all_other
;;
hi3536dv100)
echo "Preparing system tweaks for ${chip}..."
touch /etc/system.ok
echo "Preparing system done."
;;
*)
echo "Usage: $0 {gk7205v200|gk7205v210|gk7205v300|hi3516ev200|hi3516ev300|t31l|t31n|t31x|t31zx}"
echo "Usage: $0 {gk7205v200|gk7205v210|gk7205v300|hi3516ev200|hi3516ev300|t31l|t31n|t31x|t31zx|hi3536dv100}"
exit 1
esac

View File

@ -27,6 +27,14 @@ report_error() {
exit 1
}
insert_wdt() {
insmod wdt.ko
}
remove_wdt() {
rmmod wdt.ko
}
insert_audio() {
insmod hi3536dv100_aio.ko
insmod hi3536dv100_ai.ko
@ -46,19 +54,18 @@ remove_audio() {
}
insert_ko() {
HVRMEM=`cat /proc/cmdline | awk '{print $1}' | sed s/mem=//`
HVRMEM_OS=`echo $HVRMEM | sed s/M//`
HVRMEM=`cat /proc/cmdline | awk '{print $1}' | sed s/mem=//`
HVRMEM_OS=`echo $HVRMEM | sed s/M//`
MEM_LEN=`echo "$MEM_ALL $HVRMEM_OS $VOU_LEN"|awk '{printf("%d",$1-$2-$3)}'`M
VOU_START=`echo "$MEM_START $HVRMEM_OS $MEM_LEN "|awk '{printf("0x%03x00000",$1+$2+$3)}'`
MEM_START=`echo "$MEM_START $MEM_SAMALL_LIN $HVRMEM_OS"|awk '{printf("0x%03x00000",$1+$2*$3)}'`
VOU_LEN=`echo $VOU_LEN`M
echo MEM_START=$MEM_START HVRMEM=$HVRMEM MEM_LEN=$MEM_LEN VOU_START=$VOU_START VOU_LEN=$VOU_LEN
MEM_LEN=`echo "$MEM_ALL $HVRMEM_OS $VOU_LEN"|awk '{printf("%d",$1-$2-$3)}'`M
VOU_START=`echo "$MEM_START $HVRMEM_OS $MEM_LEN "|awk '{printf("0x%03x00000",$1+$2+$3)}'`
MEM_START=`echo "$MEM_START $MEM_SAMALL_LIN $HVRMEM_OS"|awk '{printf("0x%03x00000",$1+$2*$3)}'`
VOU_LEN=`echo $VOU_LEN`M
echo MEM_START=$MEM_START HVRMEM=$HVRMEM MEM_LEN=$MEM_LEN VOU_START=$VOU_START VOU_LEN=$VOU_LEN
insmod hi_osal.ko mmz=anonymous,0,$mmz_start,$mmz_size:vou,0,$VOU_START,$VOU_LEN anony=1 || report_error
insmod hi3536dv100_base.ko
insmod hi3536dv100_sys.ko mem_total=$mem_total
if [[ $? -ne 0 ]]; then
@ -68,49 +75,51 @@ insert_ko() {
insmod hi3536dv100_vdec.ko VBSource=0 u32ProtocolSwitch=0 StreamCompaMode=1 MiniBufMode=0
insmod hi3536dv100_vfmw.ko
insmod hi3536dv100_jpegd.ko
insmod hi3536dv100_tde.ko
insmod hi3536dv100_region.ko
insmod hi3536dv100_vgs.ko
insmod hi3536dv100_vpss.ko vpss_vb_source=0 vpss_en_ratio=0
insmod hi3536dv100_vou.ko bSaveBufMode=1
#insmod hifb.ko video="hifb:vram0_size:8100,vram1_size:128" softcursor="off"
insmod hifb.ko video="hifb:vram0_size:7200,vram1_size:128" softcursor="off"
insmod hi3536dv100_hdmi.ko
insmod hi3536dv100_venc.ko
insmod hi3536dv100_chnl.ko
insmod hi3536dv100_jpege.ko
insert_audio
insert_wdt
remove_wdt
}
remove_ko() {
remove_audio
remove_wdt
rmmod hi3536dv100_jpege
rmmod hi3536dv100_chnl
rmmod hi3536dv100_venc
rmmod hi3536dv100_hdmi
rmmod hifb
rmmod hi3536dv100_vou
rmmod hi3536dv100_vpss
rmmod hi3536dv100_vgs
rmmod hi3536dv100_region
rmmod hi3536dv100_tde
rmmod hi3536dv100_vou
rmmod hi3536dv100_vpss
rmmod hi3536dv100_vgs
rmmod hi3536dv100_region
rmmod hi3536dv100_tde
rmmod hi3536dv100_jpegd
rmmod hi3536dv100_vfmw
rmmod hi3536dv100_vdec
rmmod hi3536dv100_sys
rmmod hi3536dv100_base
rmmod hi_osal
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
# echo $1 $2 >> /tmp/channels.log
exit 1

View File

@ -20,6 +20,9 @@ endef
define MAVFWD_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
$(INSTALL) -m 0755 -D $(@D)/mavfwd $(TARGET_DIR)/usr/bin/mavfwd
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/sbin
cp $(MAVFWD_PKGDIR)/files/channels.sh $(TARGET_DIR)/usr/sbin
endef
$(eval $(generic-package))

View File

@ -1,195 +0,0 @@
#!/bin/sh
#
# Start wifibroadcast
#
. /etc/datalink.conf
. /etc/wfb.conf
keydir="/etc"
chip=$(ipcinfo -c)
driver=""
# "0bda:8813" -> (8814) -> 8814au
# "0846:9052" -> (8811) -> 8821au
detect_wifi_card() {
echo "Detecting wifi card vendor..."
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="realtek"
modprobe 88XXau rtw_tx_pwr_idx_override=${driver_txpower_override}
;;
"0cf3:9271" | "040d:3801")
driver="atheros"
modprobe mac80211
modprobe ath9k_htc
;;
"148f:3070")
driver="ralink"
modprobe mac80211
modprobe rt2x00usb
modprobe rt2800usb
;;
esac
done
if [ -z "${driver}" ]; then
echo "No usb wifi card detected. Check wifi stick connection, usb power or possible bad soldering."
exit
else
echo "Detected:" ${driver}
fi
echo "Awaiting interface ${wlan} in system..."
local n=0
while ! $(ifconfig -a | grep -q ${wlan})
do
if [ ${n} -ge 5 ]; then
echo "No interface ${wlan}. Check wifi stick connection, usb power or possible bad soldering."
exit
fi
sleep 0.5
n=$(expr ${n} + 1)
done
}
load_modules() {
modprobe cfg80211
detect_wifi_card
}
load_interface() {
if [ ${driver} = "realtek" ]; then
ifconfig ${wlan} up
iwconfig ${wlan} mode monitor
elif [ ${driver} = "atheros" ] || [ ${driver} = "ralink" ]; then
iwconfig ${wlan} mode monitor
ifconfig ${wlan} up
fi
iw reg set ${region}
if [ ! -z "${frequency}" ]; then
iwconfig ${wlan} freq ${frequency}
else
iwconfig ${wlan} channel ${channel}
fi
iw dev ${wlan} set txpower fixed $((${txpower} * 100))
}
start_wfb() {
#forward to PC
if [ ! -z "${udp_addr}" ]; then
if [ ${udp_addr} = "auto" ]; then
ifdown eth0
ifup eth0
udp_addr=`ip route show 0.0.0.0/0 dev eth0 | cut -d\ -f3`
fi
if [ -z "${link_id}" ]; then
wfb_rx -c ${udp_addr} -u ${udp_port} -r ${stream} -K ${keydir}/gs.key ${wlan} >/dev/null &
else
wfb_rx -c ${udp_addr} -u ${udp_port} -p ${stream} -K ${keydir}/gs.key -i ${link_id} ${wlan} >/dev/null &
fi
fi
#use tablet as usb-modem
PHONE_IP=`ip route show 0.0.0.0/0 dev usb0 | cut -d\ -f3`
if [ ! -z ${PHONE_IP} ]; then
echo found usb0 device: ${PHONE_IP}
if [ -z "${link_id}" ]; then
wfb_rx -c ${PHONE_IP} -u 5600 -r ${stream} -K ${keydir}/gs.key ${wlan} >/dev/null &
else
wfb_rx -c ${PHONE_IP} -u 5600 -p ${stream} -K ${keydir}/gs.key -i ${link_id} ${wlan} >/dev/null &
fi
fi
#use tablet as wifi-ap
if [ ! -z ${tab_wlan} ]; then
ifdown ${tab_wlan}
ifup ${tab_wlan}
TAB_IP=`ip route show 0.0.0.0/0 dev ${tab_wlan} | cut -d\ -f3`
if [ ! -z ${TAB_IP} ]; then
echo found ${tab_wlan} ap ${TAB_IP}
if [ -z "${link_id}" ]; then
wfb_rx -c ${TAB_IP} -u 5600 -r ${stream} -K ${keydir}/gs.key ${wlan} >/dev/null &
else
wfb_rx -c ${TAB_IP} -u 5600 -p ${stream} -K ${keydir}/gs.key -i ${link_id} ${wlan} >/dev/null &
fi
fi
fi
#use hdmi
if [ ${use_hdmi} = "true" ]; then
/root/vdec &
if [ -z "${link_id}" ]; then
wfb_rx -c 127.0.0.1 -u 5600 -r ${stream} -K ${keydir}/gs.key ${wlan} >/dev/null &
else
wfb_rx -c 127.0.0.1 -u 5600 -p ${stream} -K ${keydir}/gs.key -i ${link_id} ${wlan} >/dev/null &
fi
fi
}
start_all() {
if [ ${daemon} -eq 1 ]; then
echo "Loading modules and wifi card driver..."
load_modules
echo "Preparing interface wlan..."
load_interface
if ! cat ${keydir}/drone.key > /dev/null 2>&1; then
echo "Generating drone & ground station keys..."
cd ${keydir} ; wfb_keygen
else
echo "Drone key exist..."
fi
echo "Starting Wifibroadcast service..."
start_wfb
echo "Done."
if [ ${telemetry} = "true" ]; then
if [ ${chip} = "gk7205v200" ]; then
# UART2_RX mux
devmem 0x120c0010 32 0x1e04
fi
/usr/bin/telemetry start
fi
else
echo "Wifibroadcast service disabled in wfb.conf..."
fi
}
stop_all() {
echo "Stopping all services..."
kill -9 $(pidof wfb_rx)
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)
kill -9 $(pidof mavfwd)
}
case "$1" in
start)
start_all
;;
stop)
stop_all
;;
restart)
stop_all
start_all
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@ -1,6 +1,9 @@
### unit: drone or gs
unit=drone
wlan=wlan0
region=BO
# By default used channel number, but, you may set freq instead. For ex: 2387M
### By default used channel number, but, you may set freq instead. For ex: 2387M
channel=14
frequency=
txpower=20

View File

@ -1,3 +1,6 @@
### unit: drone or gs
unit=gs
wlan=wlan0
region=BO
channel=14
@ -6,9 +9,6 @@ txpower=20
driver_txpower_override=20
stream=0
link_id=7669206
# tab_wlan=wlan1
# udp_addr=auto
udp_addr=127.0.0.1
udp_port=5600
use_hdmi=false
telemetry=true

View File

@ -44,7 +44,9 @@ detect_wifi_card() {
;;
"0cf3:9271" | "040d:3801")
driver="atheros"
set_mcs
if ! [ ${unit} = "gs" ]; then
set_mcs
fi
modprobe mac80211
modprobe ath9k_htc
;;
@ -97,8 +99,12 @@ load_interface() {
# iw dev ${wlan} set txpower fixed $((${txpower} * 100))
}
start_wfb() {
wfb_tx -p ${stream} -u ${udp_port} -K ${keydir}/drone.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} &
start_drone_wfb() {
wfb_tx -p ${stream} -u ${udp_port} -K ${keydir}/${unit}.key -B ${bandwidth} -M ${mcs_index} -S ${stbc} -L ${ldpc} -G ${guard_interval} -k ${fec_k} -n ${fec_n} -T ${fec_timeout} -i ${link_id} ${wlan} > /dev/null &
}
start_gs_wfb() {
wfb_rx -c ${udp_addr} -u ${udp_port} -p ${stream} -K ${keydir}/${unit}.key -i ${link_id} ${wlan} > /dev/null &
}
case "$1" in
@ -113,16 +119,16 @@ case "$1" in
load_interface
if ! cat ${keydir}/drone.key > /dev/null 2>&1; then
if ! cat ${keydir}/${unit}.key > /dev/null 2>&1; then
echo "Generating drone & ground station keys..."
cd ${keydir} ; wfb_keygen
else
echo "Drone key exist..."
echo ${unit} "key exist..."
fi
echo "Starting Wifibroadcast service..."
start_wfb
start_${unit}_wfb
echo "Done."
@ -141,6 +147,7 @@ case "$1" in
stop)
echo "Stopping all services..."
kill -9 $(pidof wfb_tx)
kill -9 $(pidof wfb_rx)
kill -9 $(pidof telemetry_rx)
kill -9 $(pidof telemetry_tx)
kill -9 $(pidof mavlink-routerd)

View File

@ -8,9 +8,9 @@ WIFIBROADCAST_VERSION = 23.08
WIFIBROADCAST_SITE = $(call github,svpcom,wfb-ng,wfb-ng-$(WIFIBROADCAST_VERSION))
WIFIBROADCAST_LICENSE = GPL-2.0
WIFIBROADCAST_FPATH = air
WIFIBROADCAST_UNIT = drone
ifeq ($(OPENIPC_SOC_FAMILY),hi3536dv100)
WIFIBROADCAST_FPATH = gs
WIFIBROADCAST_UNIT = gs
endif
WIFIBROADCAST_DEPENDENCIES += libpcap libsodium iw
@ -29,10 +29,7 @@ define WIFIBROADCAST_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/wfb_keygen $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp $(WIFIBROADCAST_PKGDIR)/files/$(WIFIBROADCAST_FPATH)/wfb.conf $(TARGET_DIR)/etc
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(WIFIBROADCAST_PKGDIR)/files/$(WIFIBROADCAST_FPATH)/wifibroadcast $(TARGET_DIR)/usr/bin
cp $(WIFIBROADCAST_PKGDIR)/files/wfb_$(WIFIBROADCAST_UNIT).conf $(TARGET_DIR)/etc/wfb.conf
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(WIFIBROADCAST_PKGDIR)/files/setmcs $(TARGET_DIR)/usr/bin