[PATCH v3 2/2] fff-web: Disable WiFi devices via Web UI

Adrian Schmutzler freifunk at adrianschmutzler.de
So Jan 21 15:47:49 CET 2018


This uses the new fff-config option to provide users the
possibility of enabling/disabling WiFi devices via the Web UI.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

---

Changes in v2:
- Added uci -q set fff.wifi=fff

Changes in v3:
- Use functions introduced in patch 1/2.
---
 .../fff-web/files/www/ssl/cgi-bin/settings.html    | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
index 26acb8a..6147ae9 100755
--- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
+++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
@@ -1,7 +1,11 @@
 #!/usr/bin/haserl
 
 <%
+. /lib/functions/fff/wireless
+
 # write
+radio2="$(wifiGetPhy "2")"
+radio5="$(wifiGetPhy "5")"
 if [ "$REQUEST_METHOD" == "POST" ] ; then
 	#check for valid hostname as specified in rfc 1123
 	#see http://stackoverflow.com/a/3824105
@@ -58,8 +62,21 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
 				uci -q set "system.poe_passthrough.value=0"
 			fi
 		fi
+		
+		if [ "$POST_enable24ghz" == "on" ] ; then
+			wifiSetActive "2" "1"
+		else
+			wifiSetActive "2" "0"
+		fi
+		if [ "$POST_enable5ghz" == "on" ] ; then
+			wifiSetActive "5" "1"
+		else
+			wifiSetActive "5" "0"
+		fi
 
 		uci -q commit
+		
+		wifi > /dev/null
 
 		MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
 	fi
@@ -80,6 +97,16 @@ if [ "$(uci -q get 'fff.notifyupdate.value')" == "0" ] ; then # not set=1
 else
 	upgrade_checked="$chkd"
 fi
+if [ "$(uci -q get 'fff.wifi.disable24ghz')" = "1" ] ; then # not set=0
+	enable24ghz_checked=""
+else
+	enable24ghz_checked="$chkd"
+fi
+if [ "$(uci -q get 'fff.wifi.disable5ghz')" = "1" ] ; then # not set=0
+	enable5ghz_checked=""
+else
+	enable5ghz_checked="$chkd"
+fi
 %>
 <% show_msg %>
 <form method="post">
@@ -132,6 +159,16 @@ fi
 			<input type="checkbox" name="poe_passthrough" <%= ${poe_pt_checked} %>/>
 		</td></tr>
 		<% fi %>
+		<% if [ -n "$radio2" ] ; then %>
+		<tr><th>Enable 2.4 GHz WiFi device:</th><td colspan="2">
+			<input type="checkbox" name="enable24ghz" <%= ${enable24ghz_checked} %>/>
+		</td></tr>
+		<% fi %>
+		<% if [ -n "$radio5" ] ; then %>
+		<tr><th>Enable 5 GHz WiFi device:</th><td colspan="2">
+			<input type="checkbox" name="enable5ghz" <%= ${enable5ghz_checked} %>/>
+		</td></tr>
+		<% fi %>
 		
 	</table>
 </fieldset>
-- 
2.7.4



Mehr Informationen über die Mailingliste franken-dev