return ret;
}
+static void wifi_regdom_callback(int result,
+ const char *alpha2,
+ void *user_data)
+{
+ struct connman_device *device = user_data;
+
+ connman_device_regdom_notify(device, result, alpha2);
+
+ connman_device_unref(device);
+}
+
+static int wifi_set_regdom(struct connman_device *device, const char *alpha2)
+{
+ struct wifi_data *wifi = connman_device_get_data(device);
+ int ret;
+
+ if (wifi == NULL)
+ return -EINVAL;
+
+ connman_device_ref(device);
+
+ ret = g_supplicant_interface_set_country(wifi->interface,
+ wifi_regdom_callback,
+ alpha2, device);
+ if (ret != 0)
+ connman_device_unref(device);
+
+ return ret;
+}
+
static struct connman_device_driver wifi_ng_driver = {
.name = "wifi",
.type = CONNMAN_DEVICE_TYPE_WIFI,
.scan = wifi_scan,
.scan_fast = wifi_scan_fast,
.scan_hidden = wifi_scan_hidden,
+ .set_regdom = wifi_set_regdom,
};
static void system_ready(void)
return -EOPNOTSUPP;
}
-static void regdom_callback(void *user_data)
+static void regdom_callback(int result, const char *alpha2, void *user_data)
{
- char *alpha2 = user_data;
-
DBG("");
if (wifi_technology == NULL)
return;
+ if (result != 0)
+ alpha2 = NULL;
+
connman_technology_regdom_notify(wifi_technology, alpha2);
}
static int tech_set_regdom(struct connman_technology *technology, const char *alpha2)
{
- return g_supplicant_set_country(alpha2, regdom_callback, alpha2);
+ return g_supplicant_set_country(alpha2, regdom_callback, NULL);
}
static struct connman_technology_driver tech_driver = {