summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-mini/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-09-07 14:06:20 +0000
committerSteven Barth <steven@midlink.org>2008-09-07 14:06:20 +0000
commit43ff3a40925cf87634d96d89e7ee7c5e0071c661 (patch)
tree632de2e2c97a23b061f156f4cc1d56c0ec36b5a5 /modules/admin-mini/luasrc
parent6a5ce5e45f13fe74d3b7784d366b34e95b09960f (diff)
Added hostapd/wpa_supplicant notices to WiFi configuration, closes #117
Diffstat (limited to 'modules/admin-mini/luasrc')
-rw-r--r--modules/admin-mini/luasrc/controller/mini/network.lua2
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/wifi.lua31
2 files changed, 28 insertions, 5 deletions
diff --git a/modules/admin-mini/luasrc/controller/mini/network.lua b/modules/admin-mini/luasrc/controller/mini/network.lua
index 1ea6dc52c..e1a82e6c5 100644
--- a/modules/admin-mini/luasrc/controller/mini/network.lua
+++ b/modules/admin-mini/luasrc/controller/mini/network.lua
@@ -21,6 +21,6 @@ function index()
entry({"mini", "network"}, alias("mini", "network", "index"), i18n("network"), 20)
entry({"mini", "network", "index"}, cbi("mini/network"), i18n("general"), 1)
- entry({"mini", "network", "wifi"}, cbi("mini/wifi"), i18n("wifi"), 10)
+ entry({"mini", "network", "wifi"}, cbi("mini/wifi"), i18n("wifi"), 10).i18n="wifi"
entry({"mini", "network", "dhcp"}, cbi("mini/dhcp"), "DHCP", 20)
end \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
index e36d39be9..1aa01d1d7 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
@@ -208,10 +208,33 @@ end
encr = s:option(ListValue, "encryption", translate("encryption"))
encr:value("none", "No Encryption")
encr:value("wep", "WEP")
-encr:value("psk", "WPA-PSK")
-encr:value("wpa", "WPA-Radius", {mode="ap"})
-encr:value("psk2", "WPA2-PSK")
-encr:value("wpa2i", "WPA2-Radius", {mode="ap"})
+
+if hwtype == "atheros" or hwtype == "mac80211" then
+ local supplicant = luci.fs.mtime("/usr/sbin/wpa_supplicant")
+ local hostapd = luci.fs.mtime("/usr/sbin/hostapd")
+
+ if hostapd and supplicant then
+ encr:value("psk", "WPA-PSK")
+ encr:value("psk2", "WPA2-PSK")
+ encr:value("wpa", "WPA-EAP", {mode="ap"})
+ encr:value("wpa2i", "WPA2-EAP", {mode="ap"})
+ elseif hostapd and not supplicant then
+ encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="adhoc"})
+ encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="adhoc"})
+ encr:value("wpa", "WPA-Radius", {mode="ap"})
+ encr:value("wpa2i", "WPA2-Radius", {mode="ap"})
+ encr.description = translate("wifi_wpareq")
+ elseif not hostapd and supplicant then
+ encr:value("psk", "WPA-PSK", {mode="sta"})
+ encr:value("psk2", "WPA2-PSK", {mode="sta"})
+ encr.description = translate("wifi_wpareq")
+ else
+ encr.description = translate("wifi_wpareq")
+ end
+elseif hwtype == "broadcom" then
+ encr:value("psk", "WPA-PSK")
+ encr:value("psk2", "WPA2-PSK")
+end
key = s:option(Value, "key", translate("key"))
key:depends("encryption", "wep")