0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-06-03 00:44:33 +02:00

Fixed boot wifi connection issues by adding sleep

This commit is contained in:
peteruithoven 2013-10-04 16:29:53 +02:00
parent d083ee70dd
commit 37783f3f06
5 changed files with 36 additions and 26 deletions

View File

@ -143,7 +143,7 @@ local function init(environment)
end
if dbgText ~= "" then dbgText = " (" .. dbgText .. " debugging enabled)" end
log:info("===========================")
log:info("Wifibox CGI handler started" .. dbgText)
if (environment['REQUEST_METHOD'] == 'POST') then
@ -177,15 +177,16 @@ local function main(environment)
log:info("running in signin mode")
local ds = wifi.getDeviceState()
log:info(" ds.mode: "..util.dump(ds.mode))
if ds.mode == "sta" then
local rv,msg = Signin.signin()
end
--[[if rv then
log:info("autowifi setup done (" .. msg .. ")")
log:info(" attempting signin")
local success,msg = Signin.signin()
if success then
log:info("Signin successful")
else
log:error("autowifi setup failed (" .. msg .. ")")
end]]--
log:info("Signin failed: "..util.dump(msg))
end
end
elseif rq:getRequestMethod() ~= 'CMDLINE' or confDefaults.DEBUG_API then
-- log:info("received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>")
-- .. "/" .. (rq:getRealApiFunctionName() or "<unknown>") .. " with arguments: " .. util.dump(rq:getAll()))

View File

@ -267,6 +267,7 @@ end
-- @tparam boolean recreate If true, a new UCI configuration based on scan data will always be created, otherwise an attempt will be made to use an existing configuration.
-- @return True on success or nil+msg on error.
function M.associateSsid(ssid, passphrase, recreate)
log:info("netconfig:associateSsid: "..(ssid or "<nil>")..", "..(passphrase or "<nil>")..", "..(recreate or "<nil>"))
-- see if previously configured network for given ssid exists
local cfg = nil
for _, net in ipairs(wifi.getConfigs()) do

View File

@ -175,10 +175,7 @@ end
--- Activate wireless section for given SSID and disable all others
-- @param ssid SSID of config to enable, or nil to disable all network configs
function M.activateConfig(ssid)
--local utils = require('util.utils')
--local log = require('util.logger')
--log:info("wlanconfig:activateConfig: "..utils.dump(ssid))
--log:info("wlanconfig.activateConfig: "..ssid);
-- make sure only one is enabled
uci:foreach('wireless', 'wifi-iface', function(s)
@ -201,9 +198,13 @@ function M.activateConfig(ssid)
return false
end
end)
--[[log:info(" result:");
uci:foreach('wireless', 'wifi-iface', function(s)
local disabled = s.ssid ~= ssid and '1' or '0'
log:info(" "..utils.dump(s.ssid).." disable: "..utils.dump(disabled))
end)]]--
uci:commit('wireless')
end
--- Create a new UCI network from the given iwinfo data

View File

@ -78,7 +78,12 @@ function M.status(request, response)
local withRaw = utils.toboolean(request:get("with_raw"))
local ds = wifi.getDeviceState()
if ds.ssid == nil then
response:setFail("Not connected")
else
response:setSuccess()
end
response:addData("ssid", ds.ssid or "")
response:addData("bssid", ds.bssid or "")
response:addData("channel", ds.channel or "")

View File

@ -6,6 +6,8 @@ START=22
LOGGER="logger -s -t autowifi -p 6"
boot() {
sleep 1
$LOGGER "Invoking Doodle3D WiFi box network auto-initialization..."
/usr/share/lua/wifibox/script/d3dapi autowifi