diff --git a/README.md b/README.md index 997adc7..cbabe17 100644 --- a/README.md +++ b/README.md @@ -111,12 +111,10 @@ wlan0: flags=4163 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: ``` diff --git a/scripts/install_gs.sh b/scripts/install_gs.sh index 99e36ca..ca98c64 100755 --- a/scripts/install_gs.sh +++ b/scripts/install_gs.sh @@ -5,9 +5,33 @@ 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 "--------------------------------------------------------------------------------" + 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 @@ -19,24 +43,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 @@ -52,7 +83,7 @@ else fi # Setup config -cat <> /etc/wifibroadcast.cfg +cat < /etc/wifibroadcast.cfg [common] wifi_channel = 165 # 165 -- radio channel @5825 MHz, range: 5815–5835 MHz, width 20MHz # 1 -- radio channel @2412 Mhz, @@ -82,13 +113,50 @@ 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 +echo "--------------------------------------------------------------------------------" +echo +cat /etc/motd +echo +echo "--------------------------------------------------------------------------------" echo "GS setup successfully finished" diff --git a/stdeb.cfg b/stdeb.cfg index ac81beb..4f2d087 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -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