diff --git a/NEWS b/NEWS index e3cadb4007..2a94822867 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! * Use an internal implementation of the ping functionality when the "connection.gateway-ping-timeout" or "connection.ip-ping-addresses" properties are set, instead of relying on the "ping" tool. +* The powersave property now functions with the iwd backend. ============================================= NetworkManager-1.56 diff --git a/src/core/devices/wifi/nm-device-iwd.c b/src/core/devices/wifi/nm-device-iwd.c index fa6e2f9d3a..94b9a7d703 100644 --- a/src/core/devices/wifi/nm-device-iwd.c +++ b/src/core/devices/wifi/nm-device-iwd.c @@ -2270,6 +2270,37 @@ add_new: return NM_ACT_STAGE_RETURN_SUCCESS; } +static void +set_powersave(NMDevice *device) +{ + NMDeviceIwd *self = NM_DEVICE_IWD(device); + NMSettingWireless *s_wireless; + NMSettingWirelessPowersave val; + + s_wireless = nm_device_get_applied_setting(device, NM_TYPE_SETTING_WIRELESS); + + g_return_if_fail(s_wireless); + + val = nm_setting_wireless_get_powersave(s_wireless); + if (val == NM_SETTING_WIRELESS_POWERSAVE_DEFAULT) { + val = nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA, + "wifi.powersave", + device, + NM_SETTING_WIRELESS_POWERSAVE_IGNORE, + NM_SETTING_WIRELESS_POWERSAVE_ENABLE, + NM_SETTING_WIRELESS_POWERSAVE_IGNORE); + } + + _LOGT(LOGD_WIFI, "powersave is set to %u", (unsigned) val); + + if (val == NM_SETTING_WIRELESS_POWERSAVE_IGNORE) + return; + + nm_platform_wifi_set_powersave(nm_device_get_platform(device), + nm_device_get_ifindex(device), + val == NM_SETTING_WIRELESS_POWERSAVE_ENABLE); +} + static NMActStageReturn act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) { @@ -2297,6 +2328,8 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) goto out_fail; } + set_powersave(device); + /* With priv->iwd_autoconnect we have to let IWD handle retries for * infrastructure networks. IWD will not necessarily retry the same * network after a failure but it will likely go into an autoconnect