summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-08-03 15:24:55 (GMT)
committerSamuel Ortiz <sameo@linux.intel.com>2010-08-03 15:32:21 (GMT)
commit37a9470eb4f45412c15cbb44e9e83e4b78b20903 (patch)
tree05e8d1894b51afa82b1bd0ebd5fe98dd5b1683ec
parent55777f34e6e927406efdeff2e717d5d94796a2be (diff)
downloadconnman-37a9470eb4f45412c15cbb44e9e83e4b78b20903.zip
connman-37a9470eb4f45412c15cbb44e9e83e4b78b20903.tar.gz
connman-37a9470eb4f45412c15cbb44e9e83e4b78b20903.tar.bz2
Forward device_enable() error from enable_technolgy()
-rw-r--r--src/element.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/element.c b/src/element.c
index c2068d6..e52e8fc 100644
--- a/src/element.c
+++ b/src/element.c
@@ -259,6 +259,7 @@ const char *__connman_element_get_network_path(struct connman_element *element)
struct find_data {
enum connman_service_type type;
struct connman_device *device;
+ connman_bool_t error;
};
static gboolean find_device(GNode *node, gpointer user_data)
@@ -341,6 +342,7 @@ static gboolean enable_technology(GNode *node, gpointer user_data)
struct connman_element *element = node->data;
struct find_data *data = user_data;
enum connman_service_type type;
+ int err;
if (element->type != CONNMAN_ELEMENT_TYPE_DEVICE)
return FALSE;
@@ -367,18 +369,23 @@ static gboolean enable_technology(GNode *node, gpointer user_data)
break;
}
- __connman_device_enable_persistent(element->device);
+ err = __connman_device_enable_persistent(element->device);
+ if (err == 0 || (err < 0 && err == -EINPROGRESS))
+ data->error = FALSE;
return FALSE;
}
int __connman_element_enable_technology(enum connman_service_type type)
{
- struct find_data data = { .type = type, .device = NULL };
+ struct find_data data = { .type = type, .device = NULL, .error = TRUE };
g_node_traverse(element_root, G_PRE_ORDER,
G_TRAVERSE_ALL, -1, enable_technology, &data);
+ if (data.error == TRUE)
+ return -ENODEV;
+
return 0;
}
@@ -387,6 +394,7 @@ static gboolean disable_technology(GNode *node, gpointer user_data)
struct connman_element *element = node->data;
struct find_data *data = user_data;
enum connman_service_type type;
+ int err;
if (element->type != CONNMAN_ELEMENT_TYPE_DEVICE)
return FALSE;
@@ -413,18 +421,23 @@ static gboolean disable_technology(GNode *node, gpointer user_data)
break;
}
- __connman_device_disable_persistent(element->device);
+ err = __connman_device_disable_persistent(element->device);
+ if (err == 0 || (err < 0 && err == -EINPROGRESS))
+ data->error = FALSE;
return FALSE;
}
int __connman_element_disable_technology(enum connman_service_type type)
{
- struct find_data data = { .type = type, .device = NULL };
+ struct find_data data = { .type = type, .device = NULL, .error = TRUE };
g_node_traverse(element_root, G_PRE_ORDER,
G_TRAVERSE_ALL, -1, disable_technology, &data);
+ if (data.error == TRUE)
+ return -ENODEV;
+
return 0;
}