From: Jaehyun Kim Date: Sat, 8 Apr 2023 17:01:10 +0000 (+0900) Subject: Update wifi state when DeviceDetected is received X-Git-Tag: accepted/tizen/7.0/unified/20230622.035135^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b98161ed416e0fe59e22bf6d146afbbd180b5249;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Update wifi state when DeviceDetected is received 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 --- diff --git a/src/wifi-power.c b/src/wifi-power.c index 6437f9d..cda3032 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -104,9 +104,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); diff --git a/src/wifi-state.c b/src/wifi-state.c index e67fd3a..1472718 100755 --- a/src/wifi-state.c +++ b/src/wifi-state.c @@ -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