Skip to content

Commit

Permalink
Update install_gs.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Feb 5, 2025
1 parent 1613daf commit e3a877d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 15 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 2312
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```
- Run `$ ethtool -i wlan0` and ensure that it show right driver: `rtl88xxau_wfb` or `rtl8812eu`
- Copy the name of the RTL8812AU/EU WiFi card.
- Install wfb-ng. Replace `wlan0` with the previously copied name of the WiFi card.
- Download and run [install_gs.sh](https://raw.githubusercontent.com/svpcom/wfb-ng/refs/heads/master/scripts/install_gs.sh):
```
git clone -b stable https://github.com/svpcom/wfb-ng.git
cd wfb-ng
sudo ./scripts/install_gs.sh
curl -o install_gs.sh https://raw.githubusercontent.com/svpcom/wfb-ng/refs/heads/master/scripts/install_gs.sh
sudo bash ./install_gs.sh
```
- Done! To monitor the link use the following command on the ground station:
```
Expand Down
82 changes: 73 additions & 9 deletions scripts/install_gs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,32 @@ nics="$*"
auto_nics=0
release=master

if [ $(id -u) != "0" ]
then
echo "Root access is required. Run: sudo $0 $*"
exit 1
fi

err_handler()
{
echo "WFB-ng setup failed"
exit 1
}

wfb_nics()
{
for i in $(find /sys/class/net/ -maxdepth 1 -type l | sort)
do
if udevadm info $i | grep -qE 'ID_NET_DRIVER=(rtl88xxau_wfb|rtl88x2eu)'
then
echo $(basename $i)
fi
done
}

if [ -z "$nics" ]
then
nics="$($(dirname $0)/wfb-nics)"
nics="$(wfb_nics)"
auto_nics=1
fi

Expand All @@ -19,24 +42,31 @@ then
exit 1
fi

trap err_handler ERR

# Try to install prebuilt packages from wfb-ng apt repository

curl -s https://apt.wfb-ng.org/public.asc | sudo gpg --dearmor --yes -o /usr/share/keyrings/wfb-ng.gpg
echo "deb [signed-by=/usr/share/keyrings/wfb-ng.gpg] https://apt.wfb-ng.org/ $(lsb_release -cs) $release" | sudo tee /etc/apt/sources.list.d/wfb-ng.list
sudo apt update
curl -s https://apt.wfb-ng.org/public.asc | gpg --dearmor --yes -o /usr/share/keyrings/wfb-ng.gpg
echo "deb [signed-by=/usr/share/keyrings/wfb-ng.gpg] https://apt.wfb-ng.org/ $(lsb_release -cs) $release" > /etc/apt/sources.list.d/wfb-ng.list

if ! sudo apt -y install wfb-ng
if ! apt update
then
rm -f /etc/apt/sources.list.d/wfb-ng.list /usr/share/keyrings/wfb-ng.gpg
apt update
fi

if ! apt -y install wfb-ng
then
# Install required packages for wfb-ng source build

apt -y install python3-all python3-all-dev libpcap-dev libsodium-dev libevent-dev python3-pip python3-pyroute2 python3-msgpack \
python3-future python3-twisted python3-serial python3-jinja2 iw virtualenv debhelper dh-python fakeroot build-essential \
libgstrtspserver-1.0-dev
libgstrtspserver-1.0-dev socat git

tmpdir="$(mktemp -d)"
git clone -b $release --depth 1 https://github.com/svpcom/wfb-ng.git "$tmpdir"

(cd "$tmpdir" && make deb && sudo apt -y install ./deb_dist/*.deb)
(cd "$tmpdir" && make deb && apt -y install ./deb_dist/*.deb)
rm -rf "$tmpdir"
fi

Expand All @@ -52,7 +82,7 @@ else
fi

# Setup config
cat <<EOF >> /etc/wifibroadcast.cfg
cat <<EOF > /etc/wifibroadcast.cfg
[common]
wifi_channel = 165 # 165 -- radio channel @5825 MHz, range: 5815–5835 MHz, width 20MHz
# 1 -- radio channel @2412 Mhz,
Expand Down Expand Up @@ -82,13 +112,47 @@ options 8812eu rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0
EOF

if [ -f /etc/dhcpcd.conf ]; then
echo "denyinterfaces $(nics)" >> /etc/dhcpcd.conf
echo "denyinterfaces $nics" >> /etc/dhcpcd.conf
fi

cat > /etc/motd <<__EOF__
WFB-ng: http://wfb-ng.org
Setup HOWTO: https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO
Community chat: (wfb-ng support) https://t.me/wfb_ng
Version: $release
Quickstart (x86 laptop):
1. Run "wfb-cli gs" to monitor link state
2. Run QGroundControl
Quickstart (SBC + RTP video):
1. Run "wfb-cli gs" to monitor link state
2. Edit /etc/wifibroadcast.cfg and in section [gs_video] set peer to ip address of your laptop with QGC
3. Edit /etc/wifibroadcast.cfg and in section [gs_mavlink] set peer to ip address of your laptop with QGC
4. Reboot SBC.
5. Run QGroundControl on your laptop
Quickstart (SBC + RTSP video):
1. Run "wfb-cli gs" to monitor link state
2. Run "sudo systemctl enable rtsp@h264" or "sudo systemctl enable rtsp@h265" (according to your video codec)
3. Edit /etc/wifibroadcast.cfg and in section [gs_mavlink] set peer to ip address of your laptop with QGC
4. Reboot SBC.
5. Run QGroundControl on your laptop. Set video QGC source to rtsp://x.x.x.x:8554/wfb , where x.x.x.x is GS IP address.
6. (optional) Run any other RTSP video player(s) for rtsp://x.x.x.x:8554/wfb
To set TX power edit /etc/modprobe.d/wfb.conf and reboot.
In case of any failures check "sudo systemctl status wifibroadcast@gs" service status.
See full logs via: "sudo journalctl -xu wifibroadcast@gs"
__EOF__

# Start gs service
systemctl daemon-reload
systemctl start wifibroadcast@gs
systemctl status wifibroadcast@gs
systemctl enable wifibroadcast@gs

cat /etc/motd
echo
echo "GS setup successfully finished"
2 changes: 1 addition & 1 deletion stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[DEFAULT]
Depends3: python3-twisted, libpcap-dev, libsodium-dev, libevent-dev, python3-pyroute2, python3-future, python3-serial, python3-msgpack, python3-jinja2, python3-yaml, socat, libgstrtspserver-1.0-dev
Depends3: python3-twisted, libpcap-dev, libsodium-dev, libevent-dev, python3-pyroute2, python3-future, python3-serial, python3-msgpack, python3-jinja2, python3-yaml, socat, iw, libgstrtspserver-1.0-dev
Package3: wfb-ng
Replaces3: wifibroadcast
Maintainer: Vasily Evseenko <[email protected]>

0 comments on commit e3a877d

Please sign in to comment.