diff --git a/internal/wifi/wpasupplicant/backend.go b/internal/wifi/wpasupplicant/backend.go index 4fa8e8b..5383f88 100644 --- a/internal/wifi/wpasupplicant/backend.go +++ b/internal/wifi/wpasupplicant/backend.go @@ -181,6 +181,12 @@ func (b *WPABackend) Connect(ssid, password string) error { return fmt.Errorf("failed to select network: %v", err) } + // Save the configuration to persist it across reboots + if err := b.iface.SaveConfig(); err != nil { + // Log warning but don't fail - connection still works + fmt.Printf("Warning: failed to save config: %v\n", err) + } + return nil } diff --git a/internal/wifi/wpasupplicant/interface.go b/internal/wifi/wpasupplicant/interface.go index ecc9fbb..a33cfa7 100644 --- a/internal/wifi/wpasupplicant/interface.go +++ b/internal/wifi/wpasupplicant/interface.go @@ -125,6 +125,15 @@ func (i *WPAInterface) Disconnect() error { return nil } +// SaveConfig saves the current configuration to the wpa_supplicant config file +func (i *WPAInterface) SaveConfig() error { + err := i.obj.Call(InterfaceInterface+".SaveConfig", 0).Err + if err != nil { + return fmt.Errorf("save config failed: %v", err) + } + return nil +} + // GetPath returns the D-Bus object path for this interface func (i *WPAInterface) GetPath() dbus.ObjectPath { return i.path