Add legacy connection handler for addtional group iface accepted/tizen_6.5_unified tizen_6.5 accepted/tizen/6.5/unified/20211028.101218 accepted/tizen/unified/20210624.131856 submit/tizen/20210620.232458 submit/tizen_6.5/20211028.162201 tizen_6.5.m2_release
authorYu <jiung.yu@samsung.com>
Fri, 18 Jun 2021 05:56:18 +0000 (14:56 +0900)
committerYu <jiung.yu@samsung.com>
Fri, 18 Jun 2021 05:56:33 +0000 (14:56 +0900)
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 <jiung.yu@samsung.com>
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c

index 9867706..3e75ea0 100644 (file)
@@ -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
index 06b1ba0..9b21cf7 100644 (file)
@@ -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__;