mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-01 13:55:36 +00:00
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
This commit is contained in:
parent
5ab87886f3
commit
05ef682bb5
16
configure.ac
16
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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue