summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-07-04 16:48:06 +0300
committerMarcel Holtmann <marcel@holtmann.org>2012-07-05 09:04:53 +0200
commit04fbb74b4db232da8a59eb5c028cea48491ecab6 (patch)
tree6b7123674ec9d756d8450e4431492b200a6e61c4 /plugins
parenta12dd0b535aab4fde237cbdceebd37f6d1588364 (diff)
downloadconnman-04fbb74b4db232da8a59eb5c028cea48491ecab6.tar.gz
connman-04fbb74b4db232da8a59eb5c028cea48491ecab6.tar.bz2
connman-04fbb74b4db232da8a59eb5c028cea48491ecab6.zip
wifi: Add capability to set regulatory domain through device's interface
Fixes BMC#25244
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wifi.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 6be5c0c7..0a842f9b 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -953,6 +953,36 @@ static int wifi_scan_hidden(struct connman_device *device,
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,
@@ -964,6 +994,7 @@ static struct connman_device_driver wifi_ng_driver = {
.scan = wifi_scan,
.scan_fast = wifi_scan_fast,
.scan_hidden = wifi_scan_hidden,
+ .set_regdom = wifi_set_regdom,
};
static void system_ready(void)