From fa91ace160287ec93a99590803b0ff2d98c7561c Mon Sep 17 00:00:00 2001 From: olijf Date: Wed, 23 Mar 2016 13:33:14 +0100 Subject: [PATCH] Fixed wifi issue Different approach different solution. Instead of using the API to govern whether or not connection was succesful the netconfig.lua figurers this out. --- src/network/netconfig.lua | 4 ++++ src/network/wlanconfig.lua | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/network/netconfig.lua b/src/network/netconfig.lua index 60bb5fb..170aa05 100644 --- a/src/network/netconfig.lua +++ b/src/network/netconfig.lua @@ -386,7 +386,11 @@ function M.associateSsid(ssid, passphrase, recreate) if attempt >= maxAttempts then -- still no correct ssid; fail local msg = "Could not associate with network (incorrect password?)" + wifi.removeConfig(ssid) M.setStatus(M.CONNECTING_FAILED,msg); + local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid')) + M.setupAccessPoint(backupssid) + M.enableAccessPoint(backupssid) return false, msg else nextAttemptTime = os.time() + attemptInterval diff --git a/src/network/wlanconfig.lua b/src/network/wlanconfig.lua index b7bff30..77ee5fe 100644 --- a/src/network/wlanconfig.lua +++ b/src/network/wlanconfig.lua @@ -177,11 +177,16 @@ end function M.removeConfig(ssid) local rv = false uci:foreach('wireless', 'wifi-iface', function(s) + log:info(MOD_ABBR, utils.dump(s.ssid).."\n "..utils.dump(s)) if s.ssid == ssid then - uci:delete('wireless', s['.name']) - rv = true + log:info(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name'])) + rv = uci:delete('wireless', s['.name']) + end + if s.disabled == 1 then + M.activateConfig(s.ssid) end end) + uci:save('wireless') uci:commit('wireless') return rv end