@@ -595,6 +595,7 @@ void __connman_technology_remove_interface(enum connman_service_type type,
int index, const char *ident);
void __connman_technology_notify_regdom_by_device(struct connman_device *device,
int result, const char *alpha2);
+const char *__connman_technology_get_regdom(enum connman_service_type type);
#include <connman/device.h>
@@ -43,6 +43,8 @@ static GHashTable *rfkill_list;
static bool global_offlinemode;
+static char *global_regdom = NULL;
+
struct connman_rfkill {
unsigned int index;
enum connman_service_type type;
@@ -333,8 +335,14 @@ int connman_technology_set_regdom(const char *alpha2)
driver->set_regdom(technology, alpha2);
}
}
+
+ /* Save regdom for this technology */
+ connman_technology_regdom_notify(technology, alpha2);
}
+ g_free(global_regdom);
+ global_regdom = g_strdup(alpha2);
+
return 0;
}
@@ -354,6 +362,22 @@ static struct connman_technology *technology_find(enum connman_service_type type
return NULL;
}
+const char *__connman_technology_get_regdom(enum connman_service_type type)
+{
+ struct connman_technology *technology;
+
+ DBG("type %d/%s", type, get_name(type));
+
+ technology = technology_find(type);
+ if (!technology)
+ return NULL;
+
+ if (technology->regdom)
+ return technology->regdom;
+
+ return global_regdom;
+}
+
enum connman_service_type connman_technology_get_type
(struct connman_technology *technology)
{
@@ -1283,6 +1307,7 @@ static struct connman_technology *technology_get(enum connman_service_type type)
technology_load(technology);
technology_list = g_slist_prepend(technology_list, technology);
technology->driver_list = tech_drivers;
+ technology->regdom = g_strdup(global_regdom);
for (list = tech_drivers; list; list = list->next) {
driver = list->data;
@@ -1905,4 +1930,6 @@ void __connman_technology_cleanup(void)
g_hash_table_destroy(rfkill_list);
dbus_connection_unref(connection);
+
+ g_free(global_regdom);
}