Update wifi state when DeviceDetected is received 58/292058/1 accepted/tizen/7.0/unified/20230427.150216
authorJaehyun Kim <jeik01.kim@samsung.com>
Sat, 8 Apr 2023 17:01:10 +0000 (02:01 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 27 Apr 2023 01:48:43 +0000 (10:48 +0900)
Net-config assumes that when DeviceChanged signal is received,
wifi is enabled.
However, there are cases where wifi is already enabled at the time
DeviceDetected signal is received due to IPC communication delay
during net-config initialization.
In this case, an issue may occur because the state assumed by
net-config does not match the actual state.
Therefore, it has been modified to match the actual state by updating
the entire state even when the DeviceDetected signal is received.

Change-Id: I1bafee94b8940e9d477998495b6096a1b34304b1
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/wifi-power.c
src/wifi-state.c

index 8c399851349113eefd92e8b80e51461111b2bf53..3caccfe3a80adf54b60108422946a1f04cd6d033 100755 (executable)
@@ -100,9 +100,11 @@ static void __technology_reply(GObject *source_object, GAsyncResult *res, gpoint
                if (error != NULL) {
                        if (g_strstr_len(error->message, strlen(error->message),
                                        CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") != NULL) {
+                               DBG(".AlreadyEnabled");
                                wifi_state_update_power_state(interface_name, TRUE);
                        } else if (g_strstr_len(error->message, strlen(error->message),
                                        CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") != NULL) {
+                               DBG(".AlreadyDisabled");
                                wifi_state_update_power_state(interface_name, FALSE);
                        } else {
                                ERR("Fail to request status [%d: %s]", error->code, error->message);
index e67fd3abc00c40cbf72751a9a72fbfdd10392eca..14727184665dfef0d5d9b1be9a6c1cef0dc57962 100755 (executable)
@@ -652,6 +652,8 @@ gboolean wifi_state_update_device_list(void)
                return updated;
        }
 
+       DBG("Wi-Fi g_device_list: %p", g_device_list);
+
        device_list = g_device_list;
        g_device_list = NULL;
 
@@ -700,6 +702,14 @@ gboolean wifi_state_update_device_list(void)
                                                if (g_strcmp0(dev_key, "Powered") == 0) {
                                                        if (device_data) {
                                                                device_data->powered = g_variant_get_boolean(dev_var);
+
+                                                               if (device_data->tech_state == NETCONFIG_WIFI_TECH_UNKNOWN)
+                                                                       device_data->tech_state = NETCONFIG_WIFI_TECH_OFF;
+
+                                                               if (device_data->interface_name)
+                                                                       wifi_state_update_power_state(
+                                                                                       device_data->interface_name, device_data->powered);
+
                                                                if (device_data->powered == TRUE)
                                                                        device_data->tech_state = NETCONFIG_WIFI_TECH_POWERED;
                                                                else