summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/connman.h4
-rw-r--r--src/device.c8
-rw-r--r--src/manager.c5
3 files changed, 16 insertions, 1 deletions
diff --git a/src/connman.h b/src/connman.h
index 63e8a68a..456c1f7e 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -48,9 +48,13 @@ DBusMessage *__connman_error_invalid_property(DBusMessage *msg);
int __connman_selftest(void);
+#include <connman/types.h>
+
int __connman_manager_init(DBusConnection *conn, gboolean compat);
void __connman_manager_cleanup(void);
+connman_bool_t __connman_manager_get_offlinemode(void);
+
int __connman_agent_init(DBusConnection *conn);
void __connman_agent_cleanup(void);
diff --git a/src/device.c b/src/device.c
index 710c6cef..e9bbeb5a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -37,6 +37,7 @@ struct connman_device {
enum connman_device_type type;
enum connman_device_mode mode;
connman_bool_t secondary;
+ connman_bool_t offlinemode;
connman_bool_t powered;
connman_bool_t powered_persistent;
connman_bool_t carrier;
@@ -686,7 +687,8 @@ static int setup_device(struct connman_device *device)
break;
}
- if (device->powered_persistent == TRUE)
+ if (device->offlinemode == FALSE &&
+ device->powered_persistent == TRUE)
__connman_device_enable(device);
return 0;
@@ -1545,6 +1547,8 @@ static void set_offlinemode(struct connman_element *element, gpointer user_data)
if (device == NULL)
return;
+ device->offlinemode = offlinemode;
+
powered = (offlinemode == TRUE) ? FALSE : TRUE;
if (device->powered == powered)
@@ -1696,6 +1700,8 @@ int connman_device_register(struct connman_device *device)
__connman_storage_load_device(device);
+ device->offlinemode = __connman_manager_get_offlinemode();
+
switch (device->mode) {
case CONNMAN_DEVICE_MODE_UNKNOWN:
case CONNMAN_DEVICE_MODE_TRANSPORT_IP:
diff --git a/src/manager.c b/src/manager.c
index 711fa631..b047a790 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -29,6 +29,11 @@
static connman_bool_t global_offlinemode = FALSE;
+connman_bool_t __connman_manager_get_offlinemode(void)
+{
+ return global_offlinemode;
+}
+
static void append_profiles(DBusMessageIter *dict)
{
DBusMessageIter entry, value, iter;