0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 19:13:49 +01:00

Start access point network services on boot instead of reload

This commit is contained in:
peteruithoven 2014-01-10 11:14:17 +01:00
parent 39621b215f
commit c621c618bd
3 changed files with 10 additions and 7 deletions

View File

@ -94,7 +94,7 @@ local function setupAutoWifiMode()
return nil, "autowifi: could not associate with ssid '" .. connectWith .. "' (" .. msg .. ")" return nil, "autowifi: could not associate with ssid '" .. connectWith .. "' (" .. msg .. ")"
end end
elseif netMode ~= 'ap' or netName ~= apSsid then elseif netMode ~= 'ap' or netName ~= apSsid then
local rv,msg = netconf.setupAccessPoint(apSsid) local rv,msg = netconf.setupAccessPoint(apSsid,true)
if rv then if rv then
return true, "autowifi: configured as access point with ssid '" .. apSsid .. "'" return true, "autowifi: configured as access point with ssid '" .. apSsid .. "'"
else else

View File

@ -275,16 +275,19 @@ end
-- Note: this function might belong in the wlanconfig module but that would introduce -- Note: this function might belong in the wlanconfig module but that would introduce
-- a circular dependency, easiest solution is to place the function here. -- a circular dependency, easiest solution is to place the function here.
-- @tparam string ssid The SSID to use for the access point. -- @tparam string ssid The SSID to use for the access point.
-- @tparam boolean boot If true, the components have to start instead of reloaded (only needed on boot)
-- @return True on success or nil+msg on error. -- @return True on success or nil+msg on error.
function M.setupAccessPoint(ssid) function M.setupAccessPoint(ssid,boot)
M.setStatus(M.CREATING,"Creating access point '"..ssid.."'..."); M.setStatus(M.CREATING,"Creating access point '"..ssid.."'...");
boot = boot or false
if boot then log:info(" boot mode") end
M.switchConfiguration{apnet="add_noreload"} -- add access point configuration
M.switchConfiguration({apnet="add_noreload"},boot)
wifi.activateConfig(ssid) wifi.activateConfig(ssid)
-- NOTE: dnsmasq must be reloaded after network or it will be unable to serve IP addresses -- NOTE: dnsmasq must be reloaded after network or it will be unable to serve IP addresses
M.switchConfiguration{ wifiiface="add", network="reload", staticaddr="add", dhcppool="add_noreload", wwwredir="add", dnsredir="add" } M.switchConfiguration({ wifiiface="add", network="reload", staticaddr="add", dhcppool="add_noreload", wwwredir="add", dnsredir="add" },boot)
M.switchConfiguration{dhcp="reload"} M.switchConfiguration({dhcp="reload"},boot)
M.setStatus(M.CREATED,"Access point created"); M.setStatus(M.CREATED,"Access point created");

View File

@ -147,7 +147,7 @@ function M.associate_POST(request, response)
response:setSuccess("wlan is trying to associate") response:setSuccess("wlan is trying to associate")
local rv,msg = netconf.associateSsid(argSsid, argPhrase, argRecreate) local rv,msg = netconf.associateSsid(argSsid, argPhrase, argRecreate,false)
if rv then if rv then
log:info("associated to wifi: "..utils.dump(argSsid)) log:info("associated to wifi: "..utils.dump(argSsid))
else else