fixed wifiscan for layer-3 firmware (#172)

This commit is contained in:
mark 2021-10-24 20:26:20 +02:00
parent 0a790b13bf
commit 243330bad2
2 changed files with 25 additions and 6 deletions

View File

@ -3,9 +3,17 @@
<%in /www/include/header %>
<table style="width: 100%">
<tr><td>
<fieldset>
<legend>Wifi Scan</legend>
<table class="wifitable">
<%
htmloutput=0
devs=`iw dev | sed -n -r 's/^\s+Interface\s+(\w+)/\1/p'`
for dev in $devs
do
scanresult="$(iw dev $dev scan)"
if [ $? -ne 0 ]; then continue; fi
%>
<fieldset class="wifitable">
<legend>Wifi Scan: <% echo -n $dev %></legend>
<table>
<tr>
<th>Name</th>
<th>Frequenz</th>
@ -14,12 +22,19 @@
</tr>
<%
iw dev w2mesh scan | sed 's/^BSS/\nBSS/g' |\
awk -v RS='' '{r = gensub(/.*BSS ([0-9a-f:]*)?.*freq: ([0-9]*).*signal: (-[0-9]*\.[0-9]*) dBm.*SSID: ([^\n]*).*/, "<!-- \\3 --><tr><td>\\4</td><td>\\2 MHz</td><td>\\3 dBm</td><td>\\1</td></tr>", "g"); print r;}' | sort -n | sed 's#&#\&amp;#'
# The HTML comment contains the signal quality to allow sorting
echo "$scanresult" | sed 's/^BSS/\nBSS/g' |\
awk -v RS='' '{r = gensub(/.*BSS ([0-9a-f:]*)?.*freq: ([0-9]*).*signal: (-[0-9]*\.[0-9]*) dBm.*SSID: ([^\n]*).*/, "<!-- \\3 --><tr><td>\\4</td><td>\\2 MHz</td><td>\\3 dBm</td><td>\\1</td></tr>", "g"); print r;}' | sort -n | sed 's#&#\&amp;#'
# The HTML comment contains the signal quality to allow sorting
htmloutput=1
%>
</table>
</fieldset>
<%
done
if [ ${htmloutput} -eq 0 ]; then
echo "No wireless interface available that supports scan."
fi
%>
</td></tr>
</table>

View File

@ -146,6 +146,10 @@ fieldset th {
vertical-align: top;
}
fieldset.wifitable:not(:last-child) {
margin-bottom: 1.5em !important;
}
.wifitable th {
text-align: center;
}