Merge pull request 'cant-connect-to-wifi' (#58) from cant-connect-to-wifi into dev
Reviewed-on: https://codeberg.org/RhemaWave-Technologies/RhemaWave/pulls/58
This commit is contained in:
@@ -39,7 +39,7 @@ func init() {
|
||||
var err error
|
||||
nm, err = gonm.NewNetworkManager()
|
||||
if err != nil {
|
||||
fmt.Printf("network: failed to connect to NetworkManager: %v\n", err)
|
||||
logger.Error("network: failed to connect to NetworkManager: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,22 +524,23 @@ func waitForConnection(dev gonm.DeviceWireless, ssid string, timeout time.Durati
|
||||
continue
|
||||
}
|
||||
|
||||
// NmDeviceStateActivated = 100, fully connected with IP
|
||||
if state == gonm.NmDeviceStateActivated {
|
||||
// Confirm it's actually the SSID we wanted
|
||||
logger.Debug("network: device state %d, waiting...", state)
|
||||
|
||||
switch state {
|
||||
case gonm.NmDeviceStateActivated:
|
||||
current, err := CurrentNetwork()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// NmDeviceStateFailed = 120, NmDeviceStateDisconnected = 30
|
||||
if state == gonm.NmDeviceStateFailed {
|
||||
case gonm.NmDeviceStateFailed:
|
||||
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)
|
||||
}
|
||||
return fmt.Errorf("network: timed out waiting for connection to %q", ssid)
|
||||
|
||||
@@ -123,6 +123,7 @@ func (p *WiFiSetupPage) startScan() {
|
||||
logger.Error("wifi: failed to start scan: %v", err)
|
||||
p.status = wifiStatusError
|
||||
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
|
||||
}
|
||||
selected := p.networks[p.selectedIndex].Net
|
||||
p.selectedNet = &selected
|
||||
p.selectedNet = &p.networks[p.selectedIndex].Net
|
||||
p.connectError = ""
|
||||
|
||||
if selected.Security != network.SecurityOpen {
|
||||
|
||||
Reference in New Issue
Block a user