From: Yu Date: Fri, 18 Jun 2021 05:56:18 +0000 (+0900) Subject: Add legacy connection handler for addtional group iface X-Git-Tag: accepted/tizen/6.5/unified/20211028.101218^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fwifi-direct-manager.git;a=commitdiff_plain;h=a4c53f3f5ce247293257c5da489198a6030eeb5f Add legacy connection handler for addtional group iface Description: When there's additional group iface such as p2p-0-wlan0, legacy wifi connection signal can't be recevied via original wifi interface. So, I attaced the iface signal handler to addtional Wi-Fi Direct group interface if it exists. Change-Id: I0b99f469f23ba9d37fb2a7cfa731c78f63b7dbd6 Signed-off-by: Yu jiung --- diff --git a/packaging/wifi-direct-manager.spec b/packaging/wifi-direct-manager.spec index 9867706..3e75ea0 100644 --- a/packaging/wifi-direct-manager.spec +++ b/packaging/wifi-direct-manager.spec @@ -6,7 +6,7 @@ Name: wifi-direct-manager Summary: Wi-Fi Direct manger -Version: 1.3.7 +Version: 1.3.8 Release: 1 Group: Network & Connectivity/Wireless License: Apache-2.0 diff --git a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c index 06b1ba0..9b21cf7 100644 --- a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c +++ b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c @@ -632,6 +632,9 @@ static int _ws_get_local_dev_mac(unsigned char *dev_mac) return 0; } +static void _ws_manage_group_iface_signal(const gchar *group_iface_obj_path, + gboolean is_created); + static void _ws_process_interface_removed(GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface, const gchar *signal, GVariant *parameters, gpointer user_data) @@ -1232,9 +1235,12 @@ void __ws_extract_group_details(const char *key, GVariant *value, void *user_dat g_strlcpy(interface_path, i_path, DBUS_OBJECT_PATH_MAX); WDP_LOGD("Retrive Added path [%s]", interface_path); g_strlcpy(g_pd->group_iface_path, interface_path, DBUS_OBJECT_PATH_MAX); + dbus_property_get_all(interface_path, g_pd->g_dbus, SUPPLICANT_IFACE, __ws_interface_property, event); + _ws_manage_group_iface_signal(interface_path, TRUE); + } else if (g_strcmp0(key, "role") == 0) { const char *role = NULL; @@ -2864,6 +2870,8 @@ static void _ws_process_group_finished(GDBusConnection *connection, g_dbus_connection_signal_unsubscribe(g_pd->g_dbus, ws_group_signal_map[i].sub_id); ws_group_signal_map[i].sub_id = 0; } + + _ws_manage_group_iface_signal(interface, FALSE); memset(g_pd->group_iface_path, 0x0, DBUS_OBJECT_PATH_MAX); _ws_flush(); @@ -3506,6 +3514,34 @@ static struct { } }; +static struct { + int sub_id; + const char *interface; + const char *member; + void (*function) (GDBusConnection *connection, + const gchar *sender, const gchar *object_path, const gchar *interface, + const gchar *signal, GVariant *parameters, gpointer user_data); +} ws_group_interface_signal_map[] = { + { + 0, + SUPPLICANT_IFACE, + "StaAuthorized", + _ws_process_sta_authorized + }, + { + 0, + SUPPLICANT_IFACE, + "StaDeauthorized", + _ws_process_sta_deauthorized + }, + { + 0, + NULL, + NULL, + NULL + } +}; + static void __register_p2pdevice_signal(GVariant *value, void *user_data) { __WDP_LOG_FUNC_ENTER__; @@ -3791,6 +3827,52 @@ static int _ws_deinit_dbus_connection(void) return 0; } +static void _ws_manage_group_iface_signal(const gchar *group_iface_obj_path, + gboolean is_created) +{ + __WDP_LOG_FUNC_ENTER__; + GDBusConnection *connection; + + if (!g_pd) { + WDP_LOGD("Ignore"); + __WDP_LOG_FUNC_EXIT__; + return; + } + + if (!g_strcmp0(g_pd->iface_path, group_iface_obj_path)) { + WDP_LOGD("group iface is p2p iface, ignore"); + __WDP_LOG_FUNC_EXIT__; + return; + } + + connection = g_pd->g_dbus; + int i; + if (is_created) { + /* subscribe Interface iface signal */ + for (i = 0; ws_group_interface_signal_map[i].member != NULL; i++) { + ws_group_interface_signal_map[i].sub_id = + g_dbus_connection_signal_subscribe(connection, + SUPPLICANT_SERVICE, /* bus name */ + ws_group_interface_signal_map[i].interface, /* interface */ + ws_group_interface_signal_map[i].member, /* member */ + group_iface_obj_path, /* object path */ + NULL, /* arg0 */ + G_DBUS_SIGNAL_FLAGS_NONE, + ws_group_interface_signal_map[i].function, + NULL, NULL); + WDP_LOGD("Subscribed Interface iface signal [%s]", ws_group_interface_signal_map[i].member); + } + + } else { + for (i = 0; ws_group_interface_signal_map[i].member != NULL; i++) { + g_dbus_connection_signal_unsubscribe(connection, ws_group_interface_signal_map[i].sub_id); + ws_group_interface_signal_map[i].sub_id = 0; + } + } + __WDP_LOG_FUNC_EXIT__; + return; +} + int wfd_plugin_load(wfd_oem_ops_s **ops) { __WDP_LOG_FUNC_ENTER__;