modules/admin-full: make wireless survey work on actual hardware, add a warning if...
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 26 Sep 2009 14:00:23 +0000 (14:00 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 26 Sep 2009 14:00:23 +0000 (14:00 +0000)
modules/admin-full/luasrc/view/admin_network/wifi_join.htm
modules/admin-full/luasrc/view/admin_network/wifi_join_settings.htm
modules/admin-full/luasrc/view/admin_network/wifi_overview.htm

index 3963a5ae283c28d82797f4778cecb3dbe8e90218..ec776f697929663bdfd56d55cfae40b8c9da0232 100644 (file)
@@ -52,12 +52,12 @@ $Id$
        function format_wifi_encryption(info)
                if info.wep == true and not info.wpa_version then
                        return "WEP"
-               elseif info.wpa_version then
+               elseif info.wpa then
                        return "<abbr title='Pairwise: %s / Group: %s'>%s - %s</abbr>" % {
                                table.concat(info.pair_ciphers, ", "),
                                table.concat(info.group_ciphers, ", "),
-                               (info.wpa_version == 3) and "mixed WPA/WPA2"
-                                       or (info.wpa_version == 2 and "WPA2" or "WPA"),
+                               (info.wpa == 3) and "mixed WPA/WPA2"
+                                       or (info.wpa == 2 and "WPA2" or "WPA"),
                                table.concat(info.auth_suites, ", ")
                        }
                else
@@ -100,8 +100,8 @@ $Id$
                                                <input type="hidden" name="bssid" value="<%=net.bssid%>" />
                                                <input type="hidden" name="channel" value="<%=net.channel%>" />
                                                <input type="hidden" name="wep" value="<%=net.wep and 1 or 0%>" />
-                                               <% if net.wpa_version then %>
-                                               <input type="hidden" name="wpa_version" value="<%=net.wpa_version%>" />
+                                               <% if net.wpa then %>
+                                               <input type="hidden" name="wpa_version" value="<%=net.wpa%>" />
                                                <% for _, v in ipairs(net.auth_suites) do %><input type="hidden" name="wpa_suites" value="<%=v%>" />
                                                <% end; for _, v in ipairs(net.group_ciphers) do %><input type="hidden" name="wpa_group" value="<%=v%>" />
                                                <% end; for _, v in ipairs(net.pair_ciphers) do %><input type="hidden" name="wpa_pairwise" value="<%=v%>" />
index c914f3eddbf744c6bff25c8ae2b0548c01dd04e3..1be6c22665d4e157a058fe5aa59a2d806b0f5999 100644 (file)
@@ -28,6 +28,18 @@ $Id$
        local dev = luci.http.formvalue("device")
        local iw = luci.sys.wifi.getiwinfo(dev)
 
+       local requirement
+
+       if iwinfo.type(dev) == "broadcom" and not nixio.fs.access("/usr/sbin/nas") then
+               requirement = luci.i18n.translatef("a_s_iw_require_nas",
+                       "You need to install the <a href='%s'>Broadcom <em>nas</em> supplicant</a> to use WPA!"
+                       % luci.dispatcher.build_url("admin/system/packages?url=nas&amp;submit=1"))
+       elseif not nixio.fs.access("/usr/sbin/wpa_supplicant") then
+               requirement = luci.i18n.translatef("a_s_iw_require_wpasupplicant",
+                       "You need to install <a href='%s'><em>wpa-supplicant</em></a> to use WPA!"
+                       % luci.dispatcher.build_url("admin/system/packages?url=wpa-supplicant&amp;submit=1"))
+       end
+
 -%>
 
 <%+header%>
@@ -71,6 +83,10 @@ $Id$
                                        <input type="hidden" name="wpa_suite" value="psk<%=tonumber(luci.http.formvalue("wpa_version") or 0) == 2 and 2%>" />
                                <% end %>
 
+                               <% if requirement then %>
+                                       <strong class="error">&nbsp; <%=requirement%></strong>
+                               <% end %>
+
                                <br /><br />
                        <% end %>
 
@@ -87,7 +103,7 @@ $Id$
 
                        <% if luci.http.formvalue("mode") == "Ad-Hoc" then %>
                        <input type="checkbox" name="fixed_bssid" value="1" id="cb_fixed_bssid" checked="checked" />
-                       <label for="cb_fixed_bssid">Lock to BSSID <%=luci.http.formvalue("bssid")%></label>
+                       <label for="cb_fixed_bssid">Lock BSSID to <%=luci.http.formvalue("bssid")%></label>
                        <br />
                        <% end %>
 
index 251f767d23272ca0d9a0d5444716e13de5a46189..580fe9abec383968683486f0575f1168053357b0 100644 (file)
@@ -130,7 +130,7 @@ $Id$
        end
 
        function find_wifi_frequency(state)
-               if state.active then
+               if state and state.active and state.networks[1] and state.networks[1].info then
                        return string.format("%d (%.03f GHz)",
                                state.networks[1].info.channel,
                                state.networks[1].info.frequency / 1000);
@@ -161,7 +161,7 @@ $Id$
                                <td colspan="2" style="text-align:left">
                                        <big><strong><%=state.hwname%> (<%=dev%>)</strong></big><br />
                                        <strong>Channel:</strong> <%=find_wifi_frequency(state)%> |
-                                       <strong>Bitrate:</strong> <%=state.active and (state.networks[1].info.bitrate / 1000) .. " Mb/s" or "n/a"%>
+                                       <strong>Bitrate:</strong> <%=(state and state.networks[1]) and (state.networks[1].info.bitrate / 1000) .. " Mb/s" or "n/a"%>
                                </td>
                                <td style="width:40px">
                                        <a href="<%=luci.dispatcher.build_url("admin/network/wireless_join?device="..dev)%>"><img style="border:none" src="<%=resource%>/cbi/find.gif" alt="Find and join network" title="Find and join network" /></a>