From d6b5205c4674173e05d9fc421dcf898314c62d8d Mon Sep 17 00:00:00 2001 From: Niraj Kumar Goit Date: Wed, 15 Jun 2016 16:13:46 +0530 Subject: [SPIN] request RemoveNetwork when disconnected to stop scanning in supplicant. Change-Id: I4248b2de4d00d4218dcfac078bcda3e95db83896 Signed-off-by: Niraj Kumar Goit --- gsupplicant/gsupplicant.h | 3 +++ gsupplicant/supplicant.c | 25 +++++++++++++++++++++++++ plugins/wifi.c | 8 ++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 776f6136..9d53d161 100755 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -291,6 +291,9 @@ int g_supplicant_interface_disconnect(GSupplicantInterface *interface, GSupplicantInterfaceCallback callback, void *user_data); +#if defined TIZEN_EXT +int g_supplicant_interface_remove_network(GSupplicantInterface *interface); +#endif int g_supplicant_interface_set_apscan(GSupplicantInterface *interface, unsigned int ap_scan); diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 2bb676eb..fb71df63 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2254,6 +2254,9 @@ static void interface_property(const char *key, DBusMessageIter *iter, } else if (g_strcmp0(key, "CurrentBSS") == 0) { interface_bss_added_without_keys(iter, interface); } else if (g_strcmp0(key, "CurrentNetwork") == 0) { +#if defined TIZEN_EXT + if (interface->state != G_SUPPLICANT_STATE_COMPLETED) +#endif interface_network_added(iter, interface); } else if (g_strcmp0(key, "BSSs") == 0) { supplicant_dbus_array_foreach(iter, @@ -5606,6 +5609,28 @@ int g_supplicant_set_widi_ies(GSupplicantP2PServiceParams *p2p_service_params, return -EINPROGRESS; } +#if defined TIZEN_EXT +int g_supplicant_interface_remove_network(GSupplicantInterface *interface) +{ + struct interface_data *data; + + SUPPLICANT_DBG(""); + + if (interface == NULL) + return -EINVAL; + + if (system_available == FALSE) + return -EFAULT; + + data = dbus_malloc0(sizeof(*data)); + if (data == NULL) + return -ENOMEM; + + data->interface = interface; + + return network_remove(data); +} +#endif static const char *g_supplicant_rule0 = "type=signal," "path=" DBUS_PATH_DBUS "," diff --git a/plugins/wifi.c b/plugins/wifi.c index 4bf40473..499c73e4 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -2673,6 +2673,12 @@ static void interface_state(GSupplicantInterface *interface) DBG("Could not disables selected network"); #if defined TIZEN_EXT + int err; + + err = g_supplicant_interface_remove_network(wifi->interface); + if (err < 0) + DBG("Failed to remove network(%d)", err); + /* Some of Wi-Fi networks are not comply Wi-Fi specification. * Retry association until its retry count is expired */ if (handle_wifi_assoc_retry(network, wifi) == true) { @@ -2684,8 +2690,6 @@ static void interface_state(GSupplicantInterface *interface) /* To avoid unnecessary repeated association in wpa_supplicant, * "RemoveNetwork" should be made when Wi-Fi is disconnected */ if (wps != true && wifi->network && wifi->disconnecting == false) { - int err; - wifi->disconnecting = true; err = g_supplicant_interface_disconnect(wifi->interface, disconnect_callback, wifi->network); -- cgit v1.2.3