summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-05-12 16:18:49 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-05-12 16:18:49 -0700
commit2d95197b84332c6f7f7dd40e584f95b52507e490 (patch)
tree7218ba783af612da3ee8a3e10f76ed11627f44e1
parentd215729c664379b0344bfccd2096ed2e9eba84d3 (diff)
downloadconnman-2d95197b84332c6f7f7dd40e584f95b52507e490.tar.gz
connman-2d95197b84332c6f7f7dd40e584f95b52507e490.tar.bz2
connman-2d95197b84332c6f7f7dd40e584f95b52507e490.zip
Fix service lookup for WiFi and WiMAX devices
-rw-r--r--src/element.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/element.c b/src/element.c
index 9dd566a2..ecdf4bfa 100644
--- a/src/element.c
+++ b/src/element.c
@@ -272,9 +272,22 @@ int __connman_element_count(struct connman_element *element,
return data.count;
}
+static struct connman_network *__connman_element_get_network(struct connman_element *element)
+{
+ if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK &&
+ element->network != NULL)
+ return element->network;
+
+ if (element->parent == NULL)
+ return NULL;
+
+ return __connman_element_get_network(element->parent);
+}
+
struct connman_service *__connman_element_get_service(struct connman_element *element)
{
struct connman_service *service;
+ struct connman_network *network;
struct connman_device *device;
enum connman_device_type type;
@@ -287,8 +300,6 @@ struct connman_service *__connman_element_get_service(struct connman_element *el
switch (type) {
case CONNMAN_DEVICE_TYPE_UNKNOWN:
case CONNMAN_DEVICE_TYPE_VENDOR:
- case CONNMAN_DEVICE_TYPE_WIFI:
- case CONNMAN_DEVICE_TYPE_WIMAX:
case CONNMAN_DEVICE_TYPE_BLUETOOTH:
case CONNMAN_DEVICE_TYPE_GPS:
case CONNMAN_DEVICE_TYPE_HSO:
@@ -299,6 +310,13 @@ struct connman_service *__connman_element_get_service(struct connman_element *el
case CONNMAN_DEVICE_TYPE_ETHERNET:
service = __connman_service_lookup_from_device(device);
break;
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ network = __connman_element_get_network(element);
+ if (network == NULL)
+ return NULL;
+ service = __connman_service_lookup_from_network(network);
+ break;
}
return service;