This is necessary for the next coming patches, to fix country setting by interface
typedef struct _GSupplicantScanParams GSupplicantScanParams;
/* global API */
typedef struct _GSupplicantScanParams GSupplicantScanParams;
/* global API */
-typedef void (*GSupplicantCountryCallback) (void *user_data);
+typedef void (*GSupplicantCountryCallback) (int result,
+ const char *alpha2,
+ void *user_data);
int g_supplicant_set_country(const char *alpha2,
GSupplicantCountryCallback callback,
int g_supplicant_set_country(const char *alpha2,
GSupplicantCountryCallback callback,
struct supplicant_regdom {
GSupplicantCountryCallback callback;
struct supplicant_regdom {
GSupplicantCountryCallback callback;
const void *user_data;
};
const void *user_data;
};
DBusMessageIter *iter, void *user_data)
{
struct supplicant_regdom *regdom = user_data;
DBusMessageIter *iter, void *user_data)
{
struct supplicant_regdom *regdom = user_data;
SUPPLICANT_DBG("Country setting result");
if (user_data == NULL)
return;
SUPPLICANT_DBG("Country setting result");
if (user_data == NULL)
return;
- if (error == NULL) {
- alpha2 = (char *)regdom->user_data;
- } else {
SUPPLICANT_DBG("Country setting failure %s", error);
SUPPLICANT_DBG("Country setting failure %s", error);
- regdom->callback(alpha2);
+ regdom->callback(result, regdom->alpha2,
+ (void *) regdom->user_data);
static void country_params(DBusMessageIter *iter, void *user_data)
{
struct supplicant_regdom *regdom = user_data;
static void country_params(DBusMessageIter *iter, void *user_data)
{
struct supplicant_regdom *regdom = user_data;
- const char *country;
-
- country = regdom->user_data;
- dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &country);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
+ ®dom->alpha2);
}
int g_supplicant_set_country(const char *alpha2,
}
int g_supplicant_set_country(const char *alpha2,
return -ENOMEM;
regdom->callback = callback;
return -ENOMEM;
regdom->callback = callback;
+ regdom->alpha2 = alpha2;
regdom->user_data = user_data;
return supplicant_dbus_property_set(SUPPLICANT_PATH, SUPPLICANT_INTERFACE,
regdom->user_data = user_data;
return supplicant_dbus_property_set(SUPPLICANT_PATH, SUPPLICANT_INTERFACE,
-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;
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)
{
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 = {
}
static struct connman_technology_driver tech_driver = {