@@ -5,9 +5,33 @@ nics="$*"
5
5
auto_nics=0
6
6
release=master
7
7
8
+ if [ $( id -u) != " 0" ]
9
+ then
10
+ echo " Root access is required. Run: sudo $0 $* "
11
+ exit 1
12
+ fi
13
+
14
+ err_handler ()
15
+ {
16
+ echo " --------------------------------------------------------------------------------"
17
+ echo " WFB-ng setup failed"
18
+ exit 1
19
+ }
20
+
21
+ wfb_nics ()
22
+ {
23
+ for i in $( find /sys/class/net/ -maxdepth 1 -type l | sort)
24
+ do
25
+ if udevadm info $i | grep -qE ' ID_NET_DRIVER=(rtl88xxau_wfb|rtl88x2eu)'
26
+ then
27
+ echo $( basename $i )
28
+ fi
29
+ done
30
+ }
31
+
8
32
if [ -z " $nics " ]
9
33
then
10
- nics=" $( $( dirname $0 ) /wfb-nics ) "
34
+ nics=" $( wfb_nics ) "
11
35
auto_nics=1
12
36
fi
13
37
19
43
exit 1
20
44
fi
21
45
46
+ trap err_handler ERR
47
+
22
48
# Try to install prebuilt packages from wfb-ng apt repository
23
49
24
- curl -s https://apt.wfb-ng.org/public.asc | sudo gpg --dearmor --yes -o /usr/share/keyrings/wfb-ng.gpg
25
- 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
26
- sudo apt update
50
+ curl -s https://apt.wfb-ng.org/public.asc | gpg --dearmor --yes -o /usr/share/keyrings/wfb-ng.gpg
51
+ 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
27
52
28
- if ! sudo apt -y install wfb-ng
53
+ if ! apt update
54
+ then
55
+ rm -f /etc/apt/sources.list.d/wfb-ng.list /usr/share/keyrings/wfb-ng.gpg
56
+ apt update
57
+ fi
58
+
59
+ if ! apt -y install wfb-ng
29
60
then
30
61
# Install required packages for wfb-ng source build
31
62
32
63
apt -y install python3-all python3-all-dev libpcap-dev libsodium-dev libevent-dev python3-pip python3-pyroute2 python3-msgpack \
33
64
python3-future python3-twisted python3-serial python3-jinja2 iw virtualenv debhelper dh-python fakeroot build-essential \
34
- libgstrtspserver-1.0-dev
65
+ libgstrtspserver-1.0-dev socat git
35
66
36
67
tmpdir=" $( mktemp -d) "
37
68
git clone -b $release --depth 1 https://github.com/svpcom/wfb-ng.git " $tmpdir "
38
69
39
- (cd " $tmpdir " && make deb && sudo apt -y install ./deb_dist/* .deb)
70
+ (cd " $tmpdir " && make deb && apt -y install ./deb_dist/* .deb)
40
71
rm -rf " $tmpdir "
41
72
fi
42
73
52
83
fi
53
84
54
85
# Setup config
55
- cat << EOF >> /etc/wifibroadcast.cfg
86
+ cat << EOF > /etc/wifibroadcast.cfg
56
87
[common]
57
88
wifi_channel = 165 # 165 -- radio channel @5825 MHz, range: 5815–5835 MHz, width 20MHz
58
89
# 1 -- radio channel @2412 Mhz,
@@ -82,13 +113,50 @@ options 8812eu rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0
82
113
EOF
83
114
84
115
if [ -f /etc/dhcpcd.conf ]; then
85
- echo " denyinterfaces $( nics) " >> /etc/dhcpcd.conf
116
+ echo " denyinterfaces $nics " >> /etc/dhcpcd.conf
86
117
fi
87
118
119
+ cat > /etc/motd << __EOF__
120
+ WFB-ng: http://wfb-ng.org
121
+ Setup HOWTO: https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO
122
+ Community chat: (wfb-ng support) https://t.me/wfb_ng
123
+
124
+ Version: $release
125
+
126
+ Quickstart (x86 laptop):
127
+ 1. Run "wfb-cli gs" to monitor link state
128
+ 2. Run QGroundControl
129
+
130
+ Quickstart (SBC + RTP video):
131
+ 1. Run "wfb-cli gs" to monitor link state
132
+ 2. Edit /etc/wifibroadcast.cfg and in section [gs_video] set peer to ip address of your laptop with QGC
133
+ 3. Edit /etc/wifibroadcast.cfg and in section [gs_mavlink] set peer to ip address of your laptop with QGC
134
+ 4. Reboot SBC.
135
+ 5. Run QGroundControl on your laptop
136
+
137
+ Quickstart (SBC + RTSP video):
138
+ 1. Run "wfb-cli gs" to monitor link state
139
+ 2. Run "sudo systemctl enable rtsp@h264" or "sudo systemctl enable rtsp@h265" (according to your video codec)
140
+ 3. Edit /etc/wifibroadcast.cfg and in section [gs_mavlink] set peer to ip address of your laptop with QGC
141
+ 4. Reboot SBC.
142
+ 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.
143
+ 6. (optional) Run any other RTSP video player(s) for rtsp://x.x.x.x:8554/wfb
144
+
145
+ To set TX power edit /etc/modprobe.d/wfb.conf and reboot.
146
+
147
+ In case of any failures check "sudo systemctl status wifibroadcast@gs" service status.
148
+ See full logs via: "sudo journalctl -xu wifibroadcast@gs"
149
+ __EOF__
150
+
88
151
# Start gs service
89
152
systemctl daemon-reload
90
153
systemctl start wifibroadcast@gs
91
154
systemctl status wifibroadcast@gs
92
155
systemctl enable wifibroadcast@gs
93
156
157
+ echo " --------------------------------------------------------------------------------"
158
+ echo
159
+ cat /etc/motd
160
+ echo
161
+ echo " --------------------------------------------------------------------------------"
94
162
echo " GS setup successfully finished"
0 commit comments