summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-07-22 13:16:32 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-07-22 13:16:32 +0200
commit0c64e6bc924c3df2955801cd55a8b569d7da2bd9 (patch)
tree3a0d190f5193c55d40491b39a138df30a6f70510
parentf45139f38cdc7171f1375b28bcc82a1c2397e06a (diff)
downloadconnman-0c64e6bc924c3df2955801cd55a8b569d7da2bd9.tar.gz
connman-0c64e6bc924c3df2955801cd55a8b569d7da2bd9.tar.bz2
connman-0c64e6bc924c3df2955801cd55a8b569d7da2bd9.zip
Enforce current offline mode for new devices
-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;