2022-08-11 05:18:56 -03:00
|
|
|
|
#!/bin/bash
|
2022-08-01 10:03:06 -03:00
|
|
|
|
set -e
|
2022-08-01 09:58:04 -03:00
|
|
|
|
|
2022-08-11 05:18:56 -03:00
|
|
|
|
if [[ $# -eq 0 ]] ; then
|
|
|
|
|
echo 'Please specify the name of the WiFi adapter'
|
2022-09-22 12:31:03 -03:00
|
|
|
|
echo 'Find the name using command: ip a'
|
2022-08-11 05:18:56 -03:00
|
|
|
|
echo 'Aborting ...'
|
2022-09-22 12:31:03 -03:00
|
|
|
|
exit 1
|
2022-08-11 05:18:56 -03:00
|
|
|
|
fi
|
|
|
|
|
|
2022-09-22 12:31:03 -03:00
|
|
|
|
IFNAME="${1}"
|
|
|
|
|
|
2022-08-01 09:58:04 -03:00
|
|
|
|
# Install required packages
|
|
|
|
|
apt update
|
|
|
|
|
apt upgrade
|
|
|
|
|
|
2024-05-21 08:20:20 -03:00
|
|
|
|
apt install python3-all python3-all-dev libpcap-dev libsodium-dev python3-pip python3-pyroute2 python3-msgpack \
|
2024-07-09 09:27:44 -03:00
|
|
|
|
python3-future python3-twisted python3-serial iw virtualenv debhelper dh-python fakeroot build-essential -y
|
2022-08-01 09:58:04 -03:00
|
|
|
|
|
|
|
|
|
# Build
|
|
|
|
|
make deb
|
|
|
|
|
|
|
|
|
|
# Create key and copy to right location
|
|
|
|
|
./wfb_keygen
|
|
|
|
|
mv gs.key /etc/gs.key
|
|
|
|
|
|
|
|
|
|
# Install
|
|
|
|
|
dpkg -i deb_dist/*.deb
|
|
|
|
|
|
|
|
|
|
# Setup config
|
2022-09-22 12:31:03 -03:00
|
|
|
|
cat <<EOF >> /etc/wifibroadcast.cfg
|
2022-08-01 09:58:04 -03:00
|
|
|
|
[common]
|
|
|
|
|
wifi_channel = 161 # 161 -- radio channel @5825 MHz, range: 5815–5835 MHz, width 20MHz
|
|
|
|
|
# 1 -- radio channel @2412 Mhz,
|
|
|
|
|
# see https://en.wikipedia.org/wiki/List_of_WLAN_channels for reference
|
|
|
|
|
wifi_region = 'BO' # Your country for CRDA (use BO or GY if you want max tx power)
|
|
|
|
|
|
|
|
|
|
[gs_mavlink]
|
|
|
|
|
peer = 'connect://127.0.0.1:14550' # outgoing connection
|
|
|
|
|
# peer = 'listen://0.0.0.0:14550' # incoming connection
|
|
|
|
|
|
|
|
|
|
[gs_video]
|
|
|
|
|
peer = 'connect://127.0.0.1:5600' # outgoing connection for
|
|
|
|
|
# video sink (QGroundControl on GS)
|
2022-09-22 12:31:03 -03:00
|
|
|
|
EOF
|
2022-08-01 09:58:04 -03:00
|
|
|
|
|
2022-09-22 12:31:03 -03:00
|
|
|
|
echo "WFB_NICS=\"${IFNAME}\"" > /etc/default/wifibroadcast
|
2022-08-01 09:58:04 -03:00
|
|
|
|
|
2024-07-09 09:27:44 -03:00
|
|
|
|
cat > /etc/modprobe.d/wfb.conf << EOF
|
|
|
|
|
# blacklist stock module
|
|
|
|
|
blacklist 88XXau
|
|
|
|
|
blacklist 8812au
|
|
|
|
|
options cfg80211 ieee80211_regdom=RU
|
|
|
|
|
# maximize output power by default
|
|
|
|
|
#options 88XXau_wfb rtw_tx_pwr_idx_override=30
|
|
|
|
|
# minimize output power by default
|
|
|
|
|
options 88XXau_wfb rtw_tx_pwr_idx_override=1
|
|
|
|
|
options 8812eu rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0
|
2022-09-22 12:31:03 -03:00
|
|
|
|
EOF
|
2022-08-01 09:58:04 -03:00
|
|
|
|
|
2022-09-22 12:31:03 -03:00
|
|
|
|
if [ -f /etc/dhcpcd.conf ]; then
|
|
|
|
|
echo "denyinterfaces ${IFNAME}" >> /etc/dhcpcd.conf
|
2022-08-01 09:58:04 -03:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Start gs service
|
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
systemctl start wifibroadcast@gs
|
|
|
|
|
|
2022-09-22 12:31:03 -03:00
|
|
|
|
echo "Started wifibroadcast@gs"
|
|
|
|
|
systemctl status wifibroadcast@gs
|