diff options
author | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2024-02-05 15:48:15 +0100 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2024-03-04 18:29:07 +0100 |
commit | 05ef682bb5bf16a4de2cef4ed9eba4f9473ff19d (patch) | |
tree | 38142238ed075e7a2a8d503d5adb777fe1370331 | |
parent | 5ab87886f345967184e477b721e53fe3279bf2cd (diff) |
power: remove monitoring of upower signals
UPower "Sleeping" and "Resuming" signals were dropped long ago [1].
Therefore we are also dropping the support of it.
[1] https://lists.freedesktop.org/archives/devkit-devel/2014-March/001575.html
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | docs/internal/daemon.md | 2 | ||||
-rw-r--r-- | meson.build | 6 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | src/core/nm-power-monitor.c | 52 |
5 files changed, 9 insertions, 69 deletions
diff --git a/configure.ac b/configure.ac index 7ee3b73738..4e8ef43c99 100644 --- a/configure.ac +++ b/configure.ac @@ -510,7 +510,7 @@ fi session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')" AC_ARG_WITH(suspend-resume, - AS_HELP_STRING([--with-suspend-resume=upower|systemd|elogind|consolekit], + AS_HELP_STRING([--with-suspend-resume=systemd|elogind|consolekit], [Build NetworkManager with specific suspend/resume support])) if test "z$with_suspend_resume" = "z"; then PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes], @@ -525,21 +525,13 @@ if test "z$with_suspend_resume" = "z"; then # Use elogind if it's new enough with_suspend_resume="elogind" else - if test "$use_consolekit" = "yes"; then - # Use consolekit suspend if session tracking is consolekit - with_suspend_resume="consolekit" - else - # Fall back to upower - with_suspend_resume="upower" - fi + # Fallback to consolekit + with_suspend_resume="consolekit" fi fi fi case $with_suspend_resume in - upower) - AC_DEFINE([SUSPEND_RESUME_UPOWER], 1, [Define to 1 to use UPower suspend api]) - ;; systemd) PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd >= 209],, [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])]) @@ -554,7 +546,7 @@ case $with_suspend_resume in AC_DEFINE([SUSPEND_RESUME_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit2 suspend api]) ;; *) - AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd, elogind, consolekit]) + AC_MSG_ERROR(--with-suspend-resume must be one of [systemd, elogind, consolekit]) ;; esac diff --git a/docs/internal/daemon.md b/docs/internal/daemon.md index b563dcddc6..67cce725e0 100644 --- a/docs/internal/daemon.md +++ b/docs/internal/daemon.md @@ -160,7 +160,7 @@ The diagram shows other objects on the right side: - *SleepMonitor*: gets notifications for sleep and wake events by registering to the available subsystem provided by the distro such - as systemd-logind, upower or ConsoleKit. + as systemd-logind or ConsoleKit. - *SessionMonitor*: tracks which users have an active session by using systemd-logind, elogind or ConsoleKit. diff --git a/meson.build b/meson.build index c6b2c0decb..f65e5792e3 100644 --- a/meson.build +++ b/meson.build @@ -427,10 +427,8 @@ if suspend_resume == 'auto' suspend_resume = 'systemd' elif libelogind_dep.found() suspend_resume = 'elogind' - elif session_tracking_consolekit - suspend_resume = 'consolekit' else - suspend_resume = 'upower' + suspend_resume = 'consolekit' endif endif @@ -449,8 +447,6 @@ elif suspend_resume == 'elogind' config_h.set('SUSPEND_RESUME_ELOGIND', true) elif suspend_resume == 'consolekit' config_h.set('SUSPEND_RESUME_CONSOLEKIT', true) -elif suspend_resume == 'upower' - config_h.set('SUSPEND_RESUME_UPOWER', true) else error('bug') endif diff --git a/meson_options.txt b/meson_options.txt index f2aca21b63..4f796615b3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,7 +13,7 @@ option('modprobe', type: 'string', value: '', description: 'path to modprobe') option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string') option('session_tracking_consolekit', type: 'boolean', value: true, description: 'Support consolekit session tracking') option('session_tracking', type: 'combo', choices: ['systemd', 'elogind', 'no'], value: 'systemd', description: 'Compatibility option to choose one session tracking module') -option('suspend_resume', type: 'combo', choices: ['upower', 'systemd', 'elogind', 'consolekit', 'auto'], value: 'auto', description: 'Build NetworkManager with specific suspend/resume support') +option('suspend_resume', type: 'combo', choices: ['systemd', 'elogind', 'consolekit', 'auto'], value: 'auto', description: 'Build NetworkManager with specific suspend/resume support') option('polkit', type: 'boolean', value: true, description: 'User auth-polkit configuration option.') option('config_auth_polkit_default', type: 'combo', choices: ['default', 'true', 'false', 'root-only'], value: 'default', description: 'Default value for configuration main.auth-polkit.') option('modify_system', type: 'boolean', value: false, description: 'Allow users to modify system connections') diff --git a/src/core/nm-power-monitor.c b/src/core/nm-power-monitor.c index 1f703a63eb..02e5307bbc 100644 --- a/src/core/nm-power-monitor.c +++ b/src/core/nm-power-monitor.c @@ -15,20 +15,11 @@ #include "libnm-core-intern/nm-core-internal.h" #include "NetworkManagerUtils.h" -#if defined(SUSPEND_RESUME_UPOWER) - -#define SUSPEND_DBUS_NAME "org.freedesktop.UPower" -#define SUSPEND_DBUS_PATH "/org/freedesktop/UPower" -#define SUSPEND_DBUS_INTERFACE "org.freedesktop.UPower" -#define USE_UPOWER 1 -#define _NMLOG_PREFIX_NAME "power-monitor-up" - -#elif defined(SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_ELOGIND) +#if defined(SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_ELOGIND) #define SUSPEND_DBUS_NAME "org.freedesktop.login1" #define SUSPEND_DBUS_PATH "/org/freedesktop/login1" #define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" -#define USE_UPOWER 0 #if defined(SUSPEND_RESUME_SYSTEMD) #define _NMLOG_PREFIX_NAME "power-monitor-sd" #else @@ -44,12 +35,11 @@ #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" -#define USE_UPOWER 0 #define _NMLOG_PREFIX_NAME "power-monitor-ck" #else -#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER +#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT #endif @@ -95,22 +85,6 @@ static void sleep_signal(NMPowerMonitor *self, gboolean is_about_to_suspend); /*****************************************************************************/ -#if USE_UPOWER - -static void -upower_sleeping_cb(GDBusProxy *proxy, gpointer user_data) -{ - sleep_signal(user_data, TRUE); -} - -static void -upower_resuming_cb(GDBusProxy *proxy, gpointer user_data) -{ - sleep_signal(user_data, FALSE); -} - -#else /* USE_UPOWER */ - static void drop_inhibitor(NMPowerMonitor *self, gboolean force) { @@ -207,7 +181,6 @@ name_owner_cb(GObject *object, GParamSpec *pspec, gpointer user_data) drop_inhibitor(self, TRUE); g_free(owner); } -#endif /* USE_UPOWER */ static void sleep_signal(NMPowerMonitor *self, gboolean is_about_to_suspend) @@ -216,17 +189,13 @@ sleep_signal(NMPowerMonitor *self, gboolean is_about_to_suspend) _LOGD("received %s signal", is_about_to_suspend ? "SLEEP" : "RESUME"); -#if !USE_UPOWER if (!is_about_to_suspend) take_inhibitor(self); -#endif g_signal_emit(self, signals[SLEEPING], 0, is_about_to_suspend); -#if !USE_UPOWER if (is_about_to_suspend) drop_inhibitor(self, FALSE); -#endif } /** @@ -273,9 +242,7 @@ nm_power_monitor_inhibit_release(NMPowerMonitor *self, NMPowerMonitorInhibitorHa self->handles_active = g_slist_delete_link(self->handles_active, l); -#if !USE_UPOWER drop_inhibitor(self, FALSE); -#endif } static void @@ -294,18 +261,6 @@ on_proxy_acquired(GObject *object, GAsyncResult *res, NMPowerMonitor *self) self->proxy = proxy; g_clear_object(&self->cancellable); -#if USE_UPOWER - self->sig_id_1 = _nm_dbus_proxy_signal_connect(self->proxy, - "Sleeping", - NULL, - G_CALLBACK(upower_sleeping_cb), - self); - self->sig_id_2 = _nm_dbus_proxy_signal_connect(self->proxy, - "Resuming", - NULL, - G_CALLBACK(upower_resuming_cb), - self); -#else self->sig_id_1 = g_signal_connect(self->proxy, "notify::g-name-owner", G_CALLBACK(name_owner_cb), self); self->sig_id_2 = _nm_dbus_proxy_signal_connect(self->proxy, @@ -320,7 +275,6 @@ on_proxy_acquired(GObject *object, GAsyncResult *res, NMPowerMonitor *self) if (owner) take_inhibitor(self); } -#endif } /*****************************************************************************/ @@ -353,9 +307,7 @@ dispose(GObject *object) { NMPowerMonitor *self = NM_POWER_MONITOR(object); -#if !USE_UPOWER drop_inhibitor(self, TRUE); -#endif nm_clear_g_cancellable(&self->cancellable); |