applications/ffwizard: Do not disable diversity because we don't know which antenna...
authorManuel Munz <freifunk@somakoma.de>
Thu, 27 Jan 2011 13:52:37 +0000 (13:52 +0000)
committerManuel Munz <freifunk@somakoma.de>
Thu, 27 Jan 2011 13:52:37 +0000 (13:52 +0000)
applications/luci-ffwizard/luasrc/model/cbi/freifunk/ffwizard.lua
applications/luci-ffwizard/root/etc/uci-defaults/device-defaults
modules/freifunk/luasrc/view/freifunk/adminindex.htm

index 3047ec37a9b6dd6c52bb22be1aa8a4e406db8ea4..7c1f64ac68a7a2db1eaeabb1cf7bb390060e1cb5 100644 (file)
@@ -101,15 +101,15 @@ end
 
 -------------------- View --------------------
 f = SimpleForm("ffwizward", "Freifunkassistent",
"Dieser Assistent unterstützt Sie bei der Einrichtung des Routers für das Freifunknetz.")
translate("This wizard will assist you in setting up your router for your local Freifunk network or another similar wireless community network."))
 
 -- if password is not set or default then force the user to set a new one
 if sys.exec("diff /rom/etc/passwd /etc/passwd") == "" then
-       pw1 = f:field(Value, "pw1", translate("password"))
+       pw1 = f:field(Value, "pw1", translate("Password"))
        pw1.password = true
        pw1.rmempty = false
 
-       pw2 = f:field(Value, "pw2", translate("confirmation"))
+       pw2 = f:field(Value, "pw2", translate("Confirmation"))
        pw2.password = true
        pw2.rmempty = false
 
@@ -122,13 +122,13 @@ end
 
 local cc = uci:get(community, "wifi_device", "country") or "DE"
 
-main = f:field(Flag, "netconfig", "Netzwerk einrichten", "Setzen Sie den Haken, wenn Sie Ihr Freifunk Netzwerk einrichten wollen.")
+main = f:field(Flag, "netconfig", translate("Configure network"), translate("Select this checkbox to configure your network interfaces."))
 uci:foreach("wireless", "wifi-device",
        function(section)
                local device = section[".name"]
                local hwtype = section.type
+               local syscc = section.country
 
-               local syscc  = uci:get("wireless", device, "country")
                if not syscc then
                        if hwtype == "atheros" then
                                cc = sys.exec("grep -i '" .. cc .. "' /lib/wifi/cc_translate.txt |cut -d ' ' -f 2") or 0
@@ -136,7 +136,6 @@ uci:foreach("wireless", "wifi-device",
                        elseif hwtype == "mac80211" then
                                sys.exec("iw reg set " .. cc)
                        elseif hwtype == "broadcom" then
-                               -- verify that ot works!
                                sys.exec ("wlc country " .. cc)
                        end
                else
@@ -662,6 +661,14 @@ function main.write(self, section, value)
                local hwmode = "11bg"
                local bssid = uci:get_all(community, "wifi_iface", "bssid") or "02:CA:FF:EE:BA:BE"
                local mrate = 5500
+               devconfig.diversity = sec.diversity or "1"
+               if sec.txantenna then
+                       devconfig.txantenna = sec.txantenna
+               end
+                if sec.rxantenna then
+                        devconfig.rxantenna = sec.rxantenna
+                end
+
                -- set bssid, see https://kifuse02.pberg.freifunk.net/moin/channel-bssid-essid for schema
                if channel and channel ~= "default" then
                        if devconfig.channel ~= channel then
index 011148d59291a78b2a8af75a8bf98a0d95db7257..6a70e67a2ee3ad016d1f1c0af5db7b27ae24d1da 100755 (executable)
@@ -8,9 +8,7 @@ set_default_config()
                atheros)
                        uci -q batch <<-EOF
                                set freifunk.wifi_device.channel=1
-                               set freifunk.wifi_device.diversity=0
-                               set freifunk.wifi_device.txantenna=1
-                               set freifunk.wifi_device.rxantenna=1
+                               set freifunk.wifi_device.diversity=1
                                set freifunk.wifi_device.disabled=0
                                set freifunk.wifi_device.txpower=""
                                set freifunk.wifi_device.hwmode=11g
@@ -27,7 +25,7 @@ set_default_config()
                mac80211)
                        uci -q batch <<-EOF
                                set freifunk.wifi_device.channel=1
-                               set freifunk.wifi_device.diversity=""
+                               set freifunk.wifi_device.diversity=1
                                set freifunk.wifi_device.disabled=0
                                set freifunk.wifi_device.txpower=""
                                set freifunk.wifi_device.distance=1000
@@ -43,11 +41,9 @@ set_default_config()
                broadcom)
                        uci -q batch <<-EOF
                                set freifunk.wifi_device.channel=1
-                               set freifunk.wifi_device.diversity=""
+                               set freifunk.wifi_device.diversity=1
                                set freifunk.wifi_device.disabled=0
                                set freifunk.wifi_device.txpower=""
-                               set freifunk.wifi_device.txantenna=0
-                               set freifunk.wifi_device.rxantenna=0
                                set freifunk.wifi_device.hwmode=11g
                                set freifunk.wifi_device.distance=1000
                                set freifunk.wifi_iface=defaults
index d2bf0b7eaa0eaa101b462f5924d8297ca8e0c5a4..57f6bddbaa73bc6fc4e882bc4a8b2ae38b418c62 100644 (file)
@@ -26,8 +26,17 @@ local basicsurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "fr
 <% if not (contact.nickname and contact.name and contact.mail) then%>
 <div class="error">
        <%:Contact information missing. Please go to this page and fill all required fields: %>
-       <a href='<%=contacturl%>'><%:Contact%></a>
+       <a href='<%=contacturl%>'><%:Contact%></a><p />
 </div>
 <%end%>
 
+<% uci:foreach("wireless", "wifi-device", function(section)
+       local device = section[".name"]
+       local url = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "network", "wireless")
+       if section.diversity ~= "0" and section.disabled ~= "1" then
+               print('<div class="error">Diversity is enabled for device <b>' .. device .. '</b>. Go to <a href="' .. url .. '">wireless settings</a> to change that.</div><p />')
+       end
+end) %>
+
+
 <%+footer%>