From a63d60d4c5c6afdc5c66acd7e442c501e3706278 Mon Sep 17 00:00:00 2001 From: Saurav Babu Date: Wed, 26 Apr 2017 15:13:05 +0530 Subject: [PATCH] wifi-manager: Don't set agent fields for wps connection without SSID WPS Connection without SSID is requested from net-config so there is no need to set agent field Change-Id: I16e5bc76e20c5d39025fea96d24a17e6fd1b7a6b Signed-off-by: Saurav Babu --- include/network_dbus.h | 2 -- src/network_dbus.c | 73 ------------------------------------------------- src/network_interface.c | 22 --------------- 3 files changed, 97 deletions(-) diff --git a/include/network_dbus.h b/include/network_dbus.h index 6e6d3c2..d6e7722 100755 --- a/include/network_dbus.h +++ b/include/network_dbus.h @@ -112,8 +112,6 @@ int _net_dbus_set_passpoint(int enable); int _net_dbus_cancel_wps(void); int _net_dbus_open_connection_without_ssid(); int _net_dbus_open_pin_connection_without_ssid(const char *pin); -int _net_dbus_set_agent_wps_pbc(void); -int _net_dbus_set_agent_wps_pin(const char *wps_pin); int _net_dbus_tdls_disconnect(const char* peer_mac_addr); int _net_dbus_tdls_connected_peer(char** peer_mac_addr); diff --git a/src/network_dbus.c b/src/network_dbus.c index 3cff691..e2879c9 100755 --- a/src/network_dbus.c +++ b/src/network_dbus.c @@ -1862,38 +1862,6 @@ int _net_dbus_cancel_wps(void) } -static int __net_dbus_set_agent_field(const char *key, const char *value) -{ - __NETWORK_FUNC_ENTER__; - - GVariant *params = NULL; - GVariantBuilder *builder; - net_err_e Error = NET_ERR_NONE; - GVariant *message = NULL; - - char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH; - - builder = g_variant_builder_new(G_VARIANT_TYPE("a{ss}")); - g_variant_builder_add(builder, "{ss}", key, value); - - params = g_variant_new("(@a{ss})", g_variant_builder_end(builder)); - g_variant_builder_unref(builder); - - message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path, - CONNMAN_AGENT_INTERFACE, "SetField", params, &Error); - - if (Error != NET_ERR_NONE) - WIFI_LOG(WIFI_ERROR, "_net_invoke_dbus_method failed"); - - if (message != NULL) - g_variant_unref(message); - else - WIFI_LOG(WIFI_ERROR, "Failed to set agent field"); - - __NETWORK_FUNC_EXIT__; - return NET_ERR_NONE; -} - static void __net_wps_connect_wifi_reply(GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -1985,47 +1953,6 @@ int _net_dbus_open_pin_connection_without_ssid(const char *pin) return Error; } -int _net_dbus_set_agent_wps_pbc(void) -{ - __NETWORK_FUNC_ENTER__; - - int ret_val; - - ret_val = __net_dbus_set_agent_field(NETCONFIG_AGENT_FIELD_WPS_PBC, "enable"); - if (NET_ERR_NONE != ret_val) { - WIFI_LOG(WIFI_ERROR, "__net_dbus_set_agent_field failed. Error = %d \n", ret_val); - return ret_val; - } - - WIFI_LOG(WIFI_INFO, "Successfully sent wps pbc\n"); - - __NETWORK_FUNC_EXIT__; - return NET_ERR_NONE; -} - -int _net_dbus_set_agent_wps_pin(const char *wps_pin) -{ - __NETWORK_FUNC_ENTER__; - - int ret_val; - - if (NULL == wps_pin || strlen(wps_pin) <= 0) { - WIFI_LOG(WIFI_ERROR, "Invalid param \n"); - return NET_ERR_INVALID_PARAM; - } - - ret_val = __net_dbus_set_agent_field(NETCONFIG_AGENT_FIELD_WPS_PIN, wps_pin); - if (NET_ERR_NONE != ret_val) { - WIFI_LOG(WIFI_ERROR, "__net_dbus_set_agent_field failed. Error = %d \n", ret_val); - return ret_val; - } - - WIFI_LOG(WIFI_INFO, "Successfully sent wps pin\n"); - - __NETWORK_FUNC_EXIT__; - return NET_ERR_NONE; -} - int _net_dbus_tdls_disconnect(const char* peer_mac_addr) { __NETWORK_FUNC_ENTER__; diff --git a/src/network_interface.c b/src/network_interface.c index 7b26d46..4132e43 100755 --- a/src/network_interface.c +++ b/src/network_interface.c @@ -2026,28 +2026,6 @@ int net_wifi_enroll_wps_without_ssid(net_wifi_wps_info_s *wps_info) request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag = TRUE; if (wps_info->type == WIFI_WPS_PBC) { - /* Look How to change the use of Connman agent */ - Error = _net_dbus_set_agent_wps_pbc(); - if (NET_ERR_NONE != Error) { - WIFI_LOG(WIFI_ERROR, - "_net_dbus_set_agent_wps_pbc() failed\n"); - __NETWORK_FUNC_EXIT__; - return NET_ERR_INVALID_OPERATION; - } - } else if (wps_info->type == WIFI_WPS_PIN) { - Error = _net_dbus_set_agent_wps_pin(wps_info->pin); - if (NET_ERR_NONE != Error) { - WIFI_LOG(WIFI_ERROR, - "_net_dbus_set_agent_wps_pin() failed\n"); - __NETWORK_FUNC_EXIT__; - return NET_ERR_INVALID_OPERATION; - } - } else { - __NETWORK_FUNC_EXIT__; - return NET_ERR_INVALID_PARAM; - } - - if (wps_info->type == WIFI_WPS_PBC) { Error = _net_dbus_open_connection_without_ssid(); } else if (wps_info->type == WIFI_WPS_PIN) { Error = _net_dbus_open_pin_connection_without_ssid(wps_info->pin); -- 2.7.4