summaryrefslogtreecommitdiff
path: root/debian/patches/0009-Check-at-runtime-whether-to-start-ModemManager.patch
blob: 2b77012eddff0af0ae293686c79c2445c90b242f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From: Didier Raboud <odyx@debian.org>
Date: Mon, 2 Feb 2015 16:06:32 +0100
Subject: Check at runtime whether to start ModemManager

This makes NetworkManager use runtime detection to manage the
ModemManager lifecycle when not run by systemd. Under systemd, we expect
the ModemManager service to be started by systemd, under non-systemd, we
use the dbus activation feature to start ModemManager.

Closes: #770871
---
 src/devices/wwan/nm-modem-manager.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c
index f0e5692..b8ecba1 100644
--- a/src/devices/wwan/nm-modem-manager.c
+++ b/src/devices/wwan/nm-modem-manager.c
@@ -25,6 +25,7 @@
 #include <string.h>
 
 #include <libmm-glib.h>
+#include <systemd/sd-daemon.h>
 
 #include "nm-modem-manager.h"
 #include "nm-logging.h"
@@ -202,10 +203,9 @@ modem_manager_name_owner_changed (MMManager *modem_manager,
 	if (!name_owner) {
 		nm_log_info (LOGD_MB, "ModemManager disappeared from bus");
 
-#if !HAVE_SYSTEMD
 		/* If not managed by systemd, schedule relaunch */
-		schedule_modem_manager_relaunch (self, 0);
-#endif
+		if (!sd_booted())
+			schedule_modem_manager_relaunch (self, 0);
 
 		return;
 	}
@@ -226,8 +226,6 @@ modem_manager_name_owner_changed (MMManager *modem_manager,
 	 */
 }
 
-#if !HAVE_SYSTEMD
-
 static void
 modem_manager_poke_cb (GDBusConnection *connection,
                        GAsyncResult *res,
@@ -276,8 +274,6 @@ modem_manager_poke (NMModemManager *self)
 	                        g_object_ref (self)); /* user_data */
 }
 
-#endif /* HAVE_SYSTEMD */
-
 static void
 modem_manager_check_name_owner (NMModemManager *self)
 {
@@ -291,10 +287,9 @@ modem_manager_check_name_owner (NMModemManager *self)
 		return;
 	}
 
-#if !HAVE_SYSTEMD
 	/* If the lifecycle is not managed by systemd, poke */
-	modem_manager_poke (self);
-#endif
+	if (!sd_booted())
+		modem_manager_poke (self);
 }
 
 static void