From: Julien Massot <[email protected]>

Return 0 if one of the wifi interface has successfully set the country
---
 plugins/wifi.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index f89222d..61a84ed 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1470,7 +1470,35 @@ static void regdom_callback(void *user_data)
 
 static int tech_set_regdom(struct connman_technology *technology, const char 
*alpha2)
 {
-       return g_supplicant_set_country(alpha2, regdom_callback, alpha2);
+       GList *list;
+       GSupplicantInterface *interface;
+       struct wifi_data *wifi;
+       int err = 0;
+       connman_bool_t success = FALSE;
+       int last_err = -ENXIO;
+
+       for (list = iface_list; list; list = list->next) {
+               wifi = list->data;
+
+               interface = wifi->interface;
+
+               if (interface == NULL)
+                       continue;
+
+               err = g_supplicant_interface_set_country(interface, alpha2,
+                                               regdom_callback, alpha2);
+               if (err == 0) {
+                       success = TRUE;
+               } else {
+                       last_err = err;
+                       DBG("interface %p err %d", interface, err);
+               }
+       }
+
+       if (success == TRUE)
+               return 0;
+
+       return last_err;
 }
 
 static struct connman_technology_driver tech_driver = {
-- 
1.7.5.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to