Merge pull request 'Fix network connection timeouts and security detection' (#59) from wifi-fix-06-28-2026 into dev

Reviewed-on: https://codeberg.org/RhemaWave-Technologies/RhemaWave/pulls/59
This commit is contained in:
NeilClack
2026-06-28 02:04:52 -05:00
2 changed files with 11 additions and 9 deletions
+9 -8
View File
@@ -541,22 +541,23 @@ func waitForConnection(dev gonm.DeviceWireless, ssid string, timeout time.Durati
continue continue
} }
// NmDeviceStateActivated = 100, fully connected with IP logger.Debug("network: device state %d, waiting...", state)
if state == gonm.NmDeviceStateActivated {
// Confirm it's actually the SSID we wanted switch state {
case gonm.NmDeviceStateActivated:
current, err := CurrentNetwork() current, err := CurrentNetwork()
if err == nil && current == ssid { if err == nil && current == ssid {
logger.Info("network: fully connected to %q", ssid) logger.Info("network: fully connected to %q (DHCP complete)", ssid)
return nil return nil
} }
}
// NmDeviceStateFailed = 120, NmDeviceStateDisconnected = 30 case gonm.NmDeviceStateFailed:
if state == gonm.NmDeviceStateFailed {
return fmt.Errorf("network: connection to %q failed (wrong password?)", ssid) return fmt.Errorf("network: connection to %q failed (wrong password?)", ssid)
case gonm.NmDeviceStateDisconnected:
return fmt.Errorf("network: connection to %q was rejected by the network", ssid)
} }
logger.Debug("network: device state %d, waiting...", state)
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
} }
return fmt.Errorf("network: timed out waiting for connection to %q", ssid) return fmt.Errorf("network: timed out waiting for connection to %q", ssid)
+2 -1
View File
@@ -123,6 +123,7 @@ func (p *WiFiSetupPage) startScan() {
logger.Error("wifi: failed to start scan: %v", err) logger.Error("wifi: failed to start scan: %v", err)
p.status = wifiStatusError p.status = wifiStatusError
p.statusMessage = "Failed to start network scan. No Wi-Fi adapter found." p.statusMessage = "Failed to start network scan. No Wi-Fi adapter found."
p.rebuildStatusTexture()
} }
} }
@@ -183,7 +184,7 @@ func (p *WiFiSetupPage) handleNavKey(sym sdl.Keycode) {
return return
} }
selected := p.networks[p.selectedIndex].Net selected := p.networks[p.selectedIndex].Net
p.selectedNet = &selected p.selectedNet = &p.networks[p.selectedIndex].Net
p.connectError = "" p.connectError = ""
if selected.Security != network.SecurityOpen { if selected.Security != network.SecurityOpen {