From patchwork Mon Nov 6 09:18:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [v5,1/2] fff-web: Show WiFi channels and SSID From: Adrian Schmutzler X-Patchwork-Id: 670 Message-Id: <1509959890-1845-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Mon, 6 Nov 2017 10:18:09 +0100 This patch introduced more detailed information about the hood in the WebUI, i.e. channel and SSIDs. The patch includes a reorganization of the columns. Signed-off-by: Adrian Schmutzler Tested-by: Adrian Schmutzler Reviewed-by: Tim Niemeyer Tested-By: Fabian Bläse --- Changes in v2: - Rebased onto fff-hoods: Fix case of missing keyxchangev2data Changes in v3: - Display client AP ssid - Display both value demanded by json and value actually set Changes in v4: - Read/set-up hood data in separate file to make it reusable Changes in v5: - Suppress uci wXap output --- .../fff-hoods/files/lib/functions/fff/evalhoodinfo | 36 ++++++++++++++++ .../fff/fff-web/files/www/ssl/cgi-bin/home.html | 49 ++++++++-------------- 2 files changed, 54 insertions(+), 31 deletions(-) create mode 100644 src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo b/src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo new file mode 100644 index 0000000..c487ea7 --- /dev/null +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo @@ -0,0 +1,36 @@ +#!/bin/sh +# Copyright 2017 Adrian Schmutzler +# License GPLv3 + +. /lib/functions/fff/keyxchange + +jsonfile="$(getJsonPath)" +if [ -n "$jsonfile" ] ; then + json_load "$(cat "$jsonfile")" + json_select hood + json_get_var mesh_type2 mesh_type2 + json_get_var mesh_type5 mesh_type5 + json_get_var chan2ghz channel2 + json_get_var chan5ghz channel5 + json_get_var essid essid +else + mesh_type2="-" + mesh_type5="-" + chan2ghz="-" + chan5ghz="-" + essid="-" +fi + +real_chan2ghz="--" +real_chan5ghz="--" +real_essid="-" +if uci -q get wireless.w2ap > /dev/null ; then + radio2="$(uci -q get wireless.w2ap.device)" + real_chan2ghz="$(uci -q get "wireless.${radio2}.channel")" + real_essid="$(uci -q get wireless.w2ap.ssid)" +fi +if uci -q get wireless.w5ap > /dev/null ; then + radio5="$(uci -q get wireless.w5ap.device)" + real_chan5ghz="$(uci -q get "wireless.${radio5}.channel")" + real_essid="$(uci -q get wireless.w5ap.ssid)" +fi diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html index 7931ea9..21bd4e7 100755 --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html @@ -1,7 +1,8 @@ #!/usr/bin/haserl <% -. /lib/functions/fff/keyxchange +# read from keyxchangev2data +. /lib/functions/fff/evalhoodinfo # prepare if [ "$REQUEST_METHOD" == "POST" ] ; then @@ -49,23 +50,10 @@ else internet_active="Nein" fi -# read from keyxchangev2data -. /lib/functions/fff/keyxchange -jsonfile="$(getJsonPath)" -if [ -n "$jsonfile" ] ; then - json_load "$(cat "$jsonfile")" - json_select hood - json_get_var mesh_type2 mesh_type2 - json_get_var mesh_type5 mesh_type5 -else - mesh_type2="-" - mesh_type5="-" -fi - %> -
-
+
System @@ -80,8 +68,18 @@ fi
Name:<%= ${HOSTNAME} %>
Uhrzeit:<% date %>
+
+ Netz: Freifunk + + + + + + +
Nutzer:<% cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W' %>
Empfangen:<% cat /sys/class/net/br-mesh/statistics/rx_bytes 2> /dev/null | human_bytes %>
Gesendet:<% cat /sys/class/net/br-mesh/statistics/tx_bytes 2> /dev/null | human_bytes %>
IPv4 Adressen:<% addr 4 br-mesh %>
IPv6 Adressen:<% addr 6 br-mesh %>
+
-
+
Software @@ -92,31 +90,20 @@ fi
Firmware Version:<%= ${FIRMWARE_VERSION} %>
-
+
Hood + +
Hood:<% echo "$hood" %>
Mesh-Type (2.4/5 GHz):<% echo "${mesh_type2} / ${mesh_type5}" %>
Channel (2.4/5 GHz):Gerät: <% echo "${real_chan2ghz} / ${real_chan5ghz}" %> | Hood: <% echo "${chan2ghz} / ${chan5ghz}" %>
SSID (Client-AP):Gerät: <% echo "${real_essid}" %> | Hood: <% echo "${essid}" %>
 
Beim Klicken werden die Hood-Daten innerhalb von 5 Minuten neu abgerufen und angewandt:
-
-
- Netz: Freifunk - - - - - - -
Nutzer:<% cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W' %>
Empfangen:<% cat /sys/class/net/br-mesh/statistics/rx_bytes 2> /dev/null | human_bytes %>
Gesendet:<% cat /sys/class/net/br-mesh/statistics/tx_bytes 2> /dev/null | human_bytes %>
IPv4 Adressen:<% addr 4 br-mesh %>
IPv6 Adressen:<% addr 6 br-mesh %>
-
-
-
+
Netz: WAN
Internet vorhanden:<%= ${internet_active} %>