summaryrefslogtreecommitdiff
path: root/src/technology.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-07-04 16:48:03 +0300
committerMarcel Holtmann <marcel@holtmann.org>2012-07-05 09:04:53 +0200
commitdcbd6fa4220183280b5b94683cfe7f3033009d37 (patch)
tree1c32f6a613785398b5aa188cabb4f2ecc022b31b /src/technology.c
parent00efd6e25a0b25fb3fb8cf994191329468cc3eef (diff)
downloadconnman-dcbd6fa4220183280b5b94683cfe7f3033009d37.tar.gz
connman-dcbd6fa4220183280b5b94683cfe7f3033009d37.tar.bz2
connman-dcbd6fa4220183280b5b94683cfe7f3033009d37.zip
technology: Set regulatory domain by device or fallback to technology based
Diffstat (limited to 'src/technology.c')
-rw-r--r--src/technology.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/technology.c b/src/technology.c
index e2e00e53..31587e55 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -244,6 +244,21 @@ void connman_technology_regdom_notify(struct connman_technology *technology,
technology->regdom = g_strdup(alpha2);
}
+static int set_regdom_by_device(struct connman_technology *technology,
+ const char *alpha2)
+{
+ GSList *list;
+
+ for (list = technology->device_list; list; list = list->next) {
+ struct connman_device *device = list->data;
+
+ if (connman_device_set_regdom(device, alpha2) != 0)
+ return -ENOTSUP;
+ }
+
+ return 0;
+}
+
int connman_technology_set_regdom(const char *alpha2)
{
GSList *list;
@@ -251,11 +266,14 @@ int connman_technology_set_regdom(const char *alpha2)
for (list = technology_list; list; list = list->next) {
struct connman_technology *technology = list->data;
- if (technology->driver == NULL)
- continue;
+ if (set_regdom_by_device(technology, alpha2) != 0) {
+ if (technology->driver == NULL)
+ continue;
- if (technology->driver->set_regdom)
- technology->driver->set_regdom(technology, alpha2);
+ if (technology->driver->set_regdom != NULL)
+ technology->driver->set_regdom(technology,
+ alpha2);
+ }
}
return 0;
@@ -857,6 +875,16 @@ void __connman_technology_notify_regdom_by_device(struct connman_device *device,
if (technology == NULL)
return;
+ if (result < 0) {
+ if (technology->driver != NULL &&
+ technology->driver->set_regdom != NULL) {
+ technology->driver->set_regdom(technology, alpha2);
+ return;
+ }
+
+ alpha2 = NULL;
+ }
+
connman_technology_regdom_notify(technology, alpha2);
}