local wlcursor = luci.model.uci.cursor_state()
local wireless = wlcursor:get_all("wireless")
-local wifidata = sys.wifi.getiwconfig()
local wifidevs = {}
local ifaces = {}
link = s:option(DummyValue, "_link", translate("Link"))
function link.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
- return wifidata[ifname] and wifidata[ifname]["Link Quality"] or "-"
+ local iwinfo = sys.wifi.getiwinfo(ifname)
+ return iwinfo and "%d/%d" %{ iwinfo.quality, iwinfo.quality_max } or "-"
end
essid = s:option(DummyValue, "ssid", "ESSID")
bssid = s:option(DummyValue, "_bsiid", "BSSID")
function bssid.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
- return (wifidata[ifname] and (wifidata[ifname].Cell
- or wifidata[ifname]["Access Point"])) or "-"
+ local iwinfo = sys.wifi.getiwinfo(ifname)
+ return iwinfo and iwinfo.bssid or "-"
end
channel = s:option(DummyValue, "channel", translate("Channel"))
power = s:option(DummyValue, "_power", translate("Power"))
function power.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
- return wifidata[ifname] and wifidata[ifname]["Tx-Power"] or "-"
+ local iwinfo = sys.wifi.getiwinfo(ifname)
+ return iwinfo and "%d dBm" % iwinfo.txpower or "-"
end
scan = s:option(Button, "_scan", translate("Scan"))
m.autoapply = false
t2.render = t2._render
local ifname = self.map:get(section, "ifname")
- luci.util.update(t2.data, sys.wifi.iwscan(ifname))
+ local iwinfo = sys.wifi.getiwinfo(ifname)
+ if iwinfo then
+ local _, cell
+ for _, cell in ipairs(iwinfo.scanlist) do
+ t2.data[#t2.data+1] = {
+ Quality = "%d/%d" %{ cell.quality, cell.quality_max },
+ ESSID = cell.ssid,
+ Address = cell.bssid,
+ Mode = cell.mode,
+ ["Encryption key"] = cell.encryption.enabled and "On" or "Off",
+ ["Signal level"] = "%d dBm" % cell.signal,
+ ["Noise level"] = "%d dBm" % iwinfo.noise
+ }
+ end
+ end
end
t2._render = t2.render
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="adhoc"})
encr:value("wpa", "WPA-Radius", {mode="ap"})
encr:value("wpa2", "WPA2-Radius", {mode="ap"})
- encr.description = translate("wifi_wpareq")
+ encr.description = translate(
+ "WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
+ "and ad-hoc mode) to be installed."
+ )
elseif not hostapd and supplicant then
encr:value("psk", "WPA-PSK", {mode="sta"})
encr:value("psk2", "WPA2-PSK", {mode="sta"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"})
encr:value("wpa", "WPA-EAP", {mode="sta"})
encr:value("wpa2", "WPA2-EAP", {mode="sta"})
- encr.description = translate("wifi_wpareq")
+ encr.description = translate(
+ "WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
+ "and ad-hoc mode) to be installed."
+ )
else
- encr.description = translate("wifi_wpareq")
+ encr.description = translate(
+ "WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
+ "and ad-hoc mode) to be installed."
+ )
end
elseif hwtype == "broadcom" then
encr:value("psk", "WPA-PSK")
key.rmempty = true
key.password = true
-server = s:option(Value, "server", translate("RadiusServer"))
+server = s:option(Value, "server", translate("Radius-Server"))
server:depends({mode="ap", encryption="wpa"})
server:depends({mode="ap", encryption="wpa2"})
server.rmempty = true