From a27a6291f49ef442ec9d3893ef14aa0d3736e38e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 29 May 2009 18:58:38 +0000 Subject: [PATCH] luci-0.8: merge r4476, r4477, r4585 and r4587 --- i18n/english/luasrc/i18n/wifi.en.lua | 2 + libs/sys/luasrc/sys.lua | 7 ++- .../root/lib/uci/schema/default/wireless | 31 ++++++++--- .../luasrc/model/cbi/admin_network/wifi.lua | 55 +++++++++++++++++-- 4 files changed, 80 insertions(+), 15 deletions(-) diff --git a/i18n/english/luasrc/i18n/wifi.en.lua b/i18n/english/luasrc/i18n/wifi.en.lua index 47859b3dbe..1c4bc60974 100644 --- a/i18n/english/luasrc/i18n/wifi.en.lua +++ b/i18n/english/luasrc/i18n/wifi.en.lua @@ -10,7 +10,9 @@ wifi_whitelist = 'Allow listed only' wifi_blacklist = 'Allow all except listed' wifi_maclist = 'MAC-List' wifi_bursting = 'Frame Bursting' +wifi_regdomain = 'Regulatory Domain' wifi_country = 'Country Code' +wifi_outdoor = 'Outdoor Channels' wifi_maxassoc = 'Connection Limit' wifi_essid = 'ESSID' wifi_bssid = 'BSSID' diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index ad80ae5ba3..9910ed37ce 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -691,13 +691,14 @@ function wifi.channels(iface) local fd = io.popen(cmd) if fd then local ln, c, f - repeat - ln = fd:read("*l") or "" + while true do + ln = fd:read("*l") + if not ln then break end c, f = ln:match("Channel (%d+) : (%d+%.%d+) GHz") if c and f then cns[tonumber(c)] = tonumber(f) end - until not ( #ln > 0 ) + end fd:close() end diff --git a/modules/admin-core/root/lib/uci/schema/default/wireless b/modules/admin-core/root/lib/uci/schema/default/wireless index e8a4d300d8..000e3adf7f 100644 --- a/modules/admin-core/root/lib/uci/schema/default/wireless +++ b/modules/admin-core/root/lib/uci/schema/default/wireless @@ -94,6 +94,7 @@ config variable option datatype uint list depends type=atheros list depends type=broadcom + list depends type=prism2 config variable option name 'rxantenna' @@ -102,6 +103,7 @@ config variable option datatype uint list depends type=atheros list depends type=broadcom + list depends type=prism2 config variable option name 'distance' @@ -145,11 +147,25 @@ config variable option datatype boolean list depends 'type=broadcom' +config variable + option name 'regdomain' + option section 'wireless.wifi-device' + option title 'Regulatory Domain' + list depends 'type=atheros' + config variable option name 'country' option section 'wireless.wifi-device' - option title 'Country Code (broadcom)' + option title 'Country Code' list depends 'type=broadcom' + list depends 'type=atheros' + +config variable + option name 'outdoor' + option section 'wireless.wifi-device' + option title 'Outdoor Channels' + option datatype boolean + list depends 'type=atheros' config variable option name 'maxassoc' @@ -235,13 +251,13 @@ config variable config variable option name 'frag' option section 'wireless.wifi-iface' - option title 'Fragmentation Threshold (mac80211, atheros)' + option title 'Fragmentation Threshold (mac80211, atheros, prism2)' option datatype uint config variable option name 'rts' option section 'wireless.wifi-iface' - option title 'RTS/CTS Threshold (mac80211, atheros)' + option title 'RTS/CTS Threshold (mac80211, atheros, prism2)' option datatype uint config variable @@ -268,7 +284,7 @@ config variable config variable option name 'hidden' option section 'wireless.wifi-iface' - option title 'Hide ESSID (atheros, broadcom)' + option title 'Hide ESSID (atheros, broadcom, prism2)' option datatype boolean list depends 'mode=ap' list depends 'mode=adhoc' @@ -308,7 +324,7 @@ config variable config variable option name 'macpolicy' option section 'wireless.wifi-iface' - option title 'MAC-Address Filter (atheros)' + option title 'MAC-Address Filter (atheros, prism2)' option type enum config enum @@ -324,7 +340,7 @@ config enum config variable option name 'maclist' option section 'wireless.wifi-iface' - option title 'MAC-List (atheros)' + option title 'MAC-List (atheros, prism2)' list depends 'macpolicy=allow' list depends 'macpolicy=deny' option type lazylist @@ -333,7 +349,7 @@ config variable config variable option name 'rate' option section 'wireless.wifi-iface' - option title 'Transmission Rate (atheros)' + option title 'Transmission Rate (atheros, prism2)' config variable option name 'mcast_rate' @@ -372,6 +388,7 @@ config variable option name 'ff' option section 'wireless.wifi-iface' option title 'Fast Frames (atheros)' + option datatype boolean config variable option name 'wmm' diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index 7ccfadd554..6a8e245d3c 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -39,23 +39,25 @@ local hwtype = m:get(arg[1], "type") local nsantenna = m:get(arg[1], "antenna") ch = s:option(Value, "channel", translate("a_w_channel")) +ch:value("auto", translate("wifi_auto")) for c, f in luci.util.kspairs(luci.sys.wifi.channels()) do ch:value(c, "%i (%.3f GHz)" %{ c, f }) end -s:option(Value, "txpower", translate("a_w_txpwr"), "dBm").rmempty = true ------------------- MAC80211 Device ------------------ if hwtype == "mac80211" then - + s:option(Value, "txpower", translate("a_w_txpwr"), "dBm").rmempty = true end ------------------- Madwifi Device ------------------ if hwtype == "atheros" then + s:option(Value, "txpower", translate("a_w_txpwr"), "dBm").rmempty = true + mode = s:option(ListValue, "mode", translate("mode")) mode:value("", translate("wifi_auto")) mode:value("11b", "802.11b") @@ -80,6 +82,9 @@ if hwtype == "atheros" then end s:option(Value, "distance", translate("wifi_distance"), translate("wifi_distance_desc")).optional = true + --s:option(Value, "regdomain", translate("wifi_regdomain")).optional = true + s:option(Value, "country", translate("wifi_country")).optional = true + s:option(Flag, "outdoor", translate("wifi_outdoor")).optional = true --s:option(Flag, "nosbeacon", translate("wifi_nosbeacon")).optional = true end @@ -89,6 +94,8 @@ end ------------------- Broadcom Device ------------------ if hwtype == "broadcom" then + s:option(Value, "txpower", translate("a_w_txpwr"), "dBm").rmempty = true + mp = s:option(ListValue, "macfilter", translate("wifi_macpolicy")) mp.optional = true mp:value("") @@ -111,6 +118,16 @@ if hwtype == "broadcom" then end +--------------------- HostAP Device --------------------- + +if hwtype == "prism2" then + s:option(Value, "txpower", translate("a_w_txpwr"), "att units").rmempty = true + + s:option(Value, "txantenna", translate("wifi_txantenna")).optional = true + s:option(Value, "rxantenna", translate("wifi_rxantenna")).optional = true +end + + ----------------------- Interface ----------------------- s = m:section(TypedSection, "wifi-iface", translate("interfaces")) @@ -213,7 +230,7 @@ if hwtype == "atheros" then s:option(Flag, "bursting", translate("wifi_bursting")).optional = true s:option(Flag, "turbo", translate("wifi_turbo")).optional = true - s:option(Value, "ff", translate("wifi_ff")).optional = true + s:option(Flag, "ff", translate("wifi_ff")).optional = true s:option(Flag, "wmm", translate("wifi_wmm")).optional = true s:option(Flag, "xr", translate("wifi_xr")).optional = true @@ -256,6 +273,34 @@ if hwtype == "broadcom" then end +----------------------- HostAP Interface --------------------- + +if hwtype == "prism2" then + mode:value("wds", translate("a_w_wds")) + mode:value("monitor", translate("a_w_monitor")) + + hidden = s:option(Flag, "hidden", translate("wifi_hidden")) + hidden:depends({mode="ap"}) + hidden:depends({mode="adhoc"}) + hidden:depends({mode="wds"}) + hidden.optional = true + + bssid:depends({mode="sta"}) + + mp = s:option(ListValue, "macpolicy", translate("wifi_macpolicy")) + mp.optional = true + mp:value("") + mp:value("deny", translate("wifi_whitelist")) + mp:value("allow", translate("wifi_blacklist")) + ml = s:option(DynamicList, "maclist", translate("wifi_maclist")) + ml:depends({macpolicy="allow"}) + ml:depends({macpolicy="deny"}) + + s:option(Value, "rate", translate("wifi_rate")).optional = true + s:option(Value, "frag", translate("wifi_frag")).optional = true + s:option(Value, "rts", translate("wifi_rts")).optional = true +end + ------------------- WiFI-Encryption ------------------- @@ -270,7 +315,7 @@ encr:depends({mode="wds"}) encr:value("none", "No Encryption") encr:value("wep", "WEP") -if hwtype == "atheros" or hwtype == "mac80211" then +if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then local supplicant = luci.fs.mtime("/usr/sbin/wpa_supplicant") local hostapd = luci.fs.mtime("/usr/sbin/hostapd") @@ -321,7 +366,7 @@ key:depends("encryption", "psk2") key:depends({mode="ap", encryption="wpa2"}) key.rmempty = true -if hwtype == "atheros" or hwtype == "mac80211" then +if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then nasid = s:option(Value, "nasid", translate("a_w_nasid")) nasid:depends({mode="ap", encryption="wpa"}) nasid:depends({mode="ap", encryption="wpa2"}) -- 2.30.2