[PATCH] UPower signaling obsolescence

poma pomidorabelisima at gmail.com
Mon Mar 21 19:11:29 UTC 2016


On 21.03.2016 17:12, Dan Williams wrote:
> On Mon, 2016-03-21 at 10:16 +0100, Aleksander Morgado wrote:
>> On 20/03/16 20:39, poma wrote:
>>>
>>> "Newer upower versions no longer emit that signal since this
>>> handled by systemd."
>>> by Michael Biebl <mbiebl at gmail.org>
>>> https://lists.freedesktop.org/archives/devkit-devel/2014-March/0015
>>> 75.html
>>>
>>> See also "Plans for UPower 1.0"
>>> by Richard Hughes <hughsient at gmail.com>
>>> https://lists.freedesktop.org/archives/devkit-devel/2013-January/00
>>> 1339.html
>>>
>>> Signed-off-by: poma <pomidorabelisima at gmail.com>
>> Yeah, it may be a good idea to remove this. I explicitly avoided
>> talking
>> about upower in the NEWS, only because of this.
>>
>> But NetworkManager still has the same build option; is there anything
>> we're missing? or is it that NM should also remove upower support for
>> suspend/resume?
> 
> I wasn't really tracking the deprecation stuff for UPower and NM,
> though Lubomir might have.  The only question I'd have is whether
> people use current versions of NM and MM on systems that still run
> older versions of UPower, and if so, how long do we support that.
> 
> Dan
> 

Same goes for NetworkManager, UPower suspend/resume signaling obsolescence.

"Newer upower versions no longer emit that signal since this handled by systemd."
by Michael Biebl <mbiebl at gmail.org>
https://lists.freedesktop.org/archives/devkit-devel/2014-March/001575.html

"Plans for UPower 1.0"
by Richard Hughes <hughsient at gmail.com>
https://lists.freedesktop.org/archives/devkit-devel/2013-January/001339.html

"daemon: Remove obsolete features"
https://cgit.freedesktop.org/upower/commit/?id=1ee642e705a63f5ad56a6b55e4bf5c4a64c959b8
part of the UPower versions >= 0.99.0, date back to 2013-10-29.

Signed-off-by: poma <pomidorabelisima at gmail.com>
---
 configure.ac                  |   9 +--
 src/Makefile.am               |   6 +-
 src/nm-sleep-monitor-upower.c | 134 ------------------------------------------
 3 files changed, 3 insertions(+), 146 deletions(-)
 delete mode 100644 src/nm-sleep-monitor-upower.c

diff --git a/configure.ac b/configure.ac
index c0c8716..be8e373 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,7 +449,7 @@ if test "$use_consolekit" = "yes"; then
 fi
 session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
 
-AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd|consolekit], [Build NetworkManager with specific suspend/resume support]))
+AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=systemd|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],
                      [PKG_CHECK_EXISTS([libsystemd-login >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])])
@@ -460,15 +460,11 @@ if test "z$with_suspend_resume" = "z"; then
         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
     fi
 fi
 
 case $with_suspend_resume in
-    upower) ;;
     systemd)
         PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd >= 209],,
                           [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
@@ -478,10 +474,9 @@ 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, consolekit])
+        AC_MSG_ERROR(--with-suspend-resume must be one of [systemd, consolekit])
         ;;
 esac
-AM_CONDITIONAL(SUSPEND_RESUME_UPOWER, test "x$with_suspend_resume" = "xupower")
 AM_CONDITIONAL(SUSPEND_RESUME_SYSTEMD, test "x$with_suspend_resume" = "xsystemd")
 AM_CONDITIONAL(SUSPEND_RESUME_CONSOLEKIT, test "x$with_suspend_resume" = "xconsolekit")
 
diff --git a/src/Makefile.am b/src/Makefile.am
index aee7eae..ef4e166 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -447,12 +447,8 @@ libNetworkManager_la_SOURCES = \
 	NetworkManagerUtils.h
 
 
-if SUSPEND_RESUME_UPOWER
-libNetworkManager_la_SOURCES += nm-sleep-monitor-upower.c
-else
-# systemd/consolekit suspend/resume used whenever upower is not enabled
+# systemd/consolekit suspend/resume
 libNetworkManager_la_SOURCES += nm-sleep-monitor-systemd.c
-endif
 
 if WITH_WEXT
 libNetworkManager_la_SOURCES += \
diff --git a/src/nm-sleep-monitor-upower.c b/src/nm-sleep-monitor-upower.c
deleted file mode 100644
index 5f0ff24..0000000
--- a/src/nm-sleep-monitor-upower.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * (C) Copyright 2012 Red Hat, Inc.
- * Author: Matthias Clasen <mclasen at redhat.com>
- */
-
-#include "nm-default.h"
-
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "nm-core-internal.h"
-
-#include "nm-sleep-monitor.h"
-
-#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower"
-
-struct _NMSleepMonitor {
-	GObject parent_instance;
-
-	GDBusProxy *upower_proxy;
-};
-
-struct _NMSleepMonitorClass {
-	GObjectClass parent_class;
-
-	void (*sleeping) (NMSleepMonitor *monitor);
-	void (*resuming) (NMSleepMonitor *monitor);
-};
-
-
-enum {
-	SLEEPING,
-	RESUMING,
-	LAST_SIGNAL,
-};
-static guint signals[LAST_SIGNAL] = {0};
-
-G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT);
-
-/********************************************************************/
-
-static void
-upower_sleeping_cb (GDBusProxy *proxy, gpointer user_data)
-{
-	nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal");
-	g_signal_emit (user_data, signals[SLEEPING], 0);
-}
-
-static void
-upower_resuming_cb (GDBusProxy *proxy, gpointer user_data)
-{
-	nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal");
-	g_signal_emit (user_data, signals[RESUMING], 0);
-}
-
-static void
-nm_sleep_monitor_init (NMSleepMonitor *self)
-{
-	GError *error = NULL;
-
-	self->upower_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
-	                                                    G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
-	                                                        G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
-	                                                    NULL,
-	                                                    UPOWER_DBUS_SERVICE,
-	                                                    "/org/freedesktop/UPower",
-	                                                    "org.freedesktop.UPower",
-	                                                    NULL, &error);
-	if (self->upower_proxy) {
-		_nm_dbus_signal_connect (self->upower_proxy, "Sleeping", NULL,
-		                         G_CALLBACK (upower_sleeping_cb), self);
-		_nm_dbus_signal_connect (self->upower_proxy, "Resuming", NULL,
-		                         G_CALLBACK (upower_resuming_cb), self);
-	} else {
-		nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy: %s", error->message);
-		g_error_free (error);
-	}
-}
-
-static void
-finalize (GObject *object)
-{
-	NMSleepMonitor *self = NM_SLEEP_MONITOR (object);
-
-	g_clear_object (&self->upower_proxy);
-
-	G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object);
-}
-
-static void
-nm_sleep_monitor_class_init (NMSleepMonitorClass *klass)
-{
-	GObjectClass *gobject_class;
-
-	gobject_class = G_OBJECT_CLASS (klass);
-
-	gobject_class->finalize = finalize;
-
-	signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING,
-	                                  NM_TYPE_SLEEP_MONITOR,
-	                                  G_SIGNAL_RUN_LAST,
-	                                  G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping),
-	                                  NULL,                   /* accumulator      */
-	                                  NULL,                   /* accumulator data */
-	                                  g_cclosure_marshal_VOID__VOID,
-	                                  G_TYPE_NONE, 0);
-	signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING,
-	                                  NM_TYPE_SLEEP_MONITOR,
-	                                  G_SIGNAL_RUN_LAST,
-	                                  G_STRUCT_OFFSET (NMSleepMonitorClass, resuming),
-	                                  NULL,                   /* accumulator      */
-	                                  NULL,                   /* accumulator data */
-	                                  g_cclosure_marshal_VOID__VOID,
-	                                  G_TYPE_NONE, 0);
-}
-
-NM_DEFINE_SINGLETON_GETTER (NMSleepMonitor, nm_sleep_monitor_get, NM_TYPE_SLEEP_MONITOR);
-
-/* ---------------------------------------------------------------------------------------------------- */
-- 
2.4.3




More information about the ModemManager-devel mailing list