From bbc3b1c042b85b22bda6a89e8c1d5d6d00a2875b Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:46:57 -0400 Subject: [PATCH 01/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 589cbb96..8ab73491 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2182,32 +2182,9 @@ namespace WPEFramework // that can cause networking issues. nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); - // Wait until device is truly disconnected - int retry = 24; // 12 seconds - NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; - while (retry-- > 0) { - /* Force glib event processing to update state - * This below line will create an uncertain time wait. We are taking a fixed time interval of 12 seconds. - */ - // while (g_main_context_iteration(NULL, FALSE)); - g_usleep(500 * 1000); // give some time to NM to process the request - deviceState = nm_device_get_state(device); - if(oldDevState != deviceState) - { - oldDevState = deviceState; - NMLOG_WARNING("Device state: %d", deviceState); - } - - if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) - break; - } } } - if(deviceState > NM_DEVICE_STATE_DISCONNECTED) - { - NMLOG_WARNING("Device not fully disconnected (state: %d), setting to unmanaged state", deviceState); - } // Set the "Managed" property to enable/disable the device m_isSuccess = false; const char *objectPath = nm_object_get_path(NM_OBJECT(device)); From 74430ba8cb2e72a0862c80d1b6020a41bcc63c10 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:21:11 -0400 Subject: [PATCH 02/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 8ab73491..6429f313 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2182,9 +2182,31 @@ namespace WPEFramework // that can cause networking issues. nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); + // Wait until device is truly disconnected + int retry = 6; // 2 seconds + NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; + while (retry-- > 0) { + /* Force glib event processing to update state + * This below line will create an uncertain time wait. We are taking a fixed time interval of 3 seconds. + */ + // while (g_main_context_iteration(NULL, FALSE)); + g_usleep(500 * 1000); // give some time to NM to process the request + deviceState = nm_device_get_state(device); + if(oldDevState != deviceState) + { + oldDevState = deviceState; + NMLOG_WARNING("Device state: %d", deviceState); + } + + if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) + break; + } } } - + if(deviceState > NM_DEVICE_STATE_DISCONNECTED) + { + NMLOG_WARNING("Device not fully disconnected (state: %d), setting to unmanaged state", deviceState); + } // Set the "Managed" property to enable/disable the device m_isSuccess = false; const char *objectPath = nm_object_get_path(NM_OBJECT(device)); From d00c4cf6831efd65098bb4c391cf634af2caa110 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:04:49 -0400 Subject: [PATCH 03/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 35 ++++-------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 6429f313..1432bf17 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2175,38 +2175,13 @@ namespace WPEFramework } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { NMLOG_DEBUG("Disconnecting device..."); - // Disconnect the device before setting it to unmanaged. - // This ensures that NetworkManager cleanly removes any IP addresses, routes, - // and DNS configuration associated with the interface. Setting an interface - // to unmanaged without disconnecting first may leave residual configuration - // that can cause networking issues. - nm_device_disconnect_async(device, nullptr, disconnectCb, this); - wait(m_loop); - // Wait until device is truly disconnected - int retry = 6; // 2 seconds - NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; - while (retry-- > 0) { - /* Force glib event processing to update state - * This below line will create an uncertain time wait. We are taking a fixed time interval of 3 seconds. - */ - // while (g_main_context_iteration(NULL, FALSE)); - g_usleep(500 * 1000); // give some time to NM to process the request - deviceState = nm_device_get_state(device); - if(oldDevState != deviceState) - { - oldDevState = deviceState; - NMLOG_WARNING("Device state: %d", deviceState); - } - - if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) - break; - } + char cmd[100] = ""; + string tempResult = ""; + snprintf (cmd, sizeof(cmd), "ip link set dev %s %s", interface.c_str(), enabled ? "up" : "down"); + string commandToExecute(cmd); + executeExternally(NETMGR_GENERIC, commandToExecute, tempResult); } } - if(deviceState > NM_DEVICE_STATE_DISCONNECTED) - { - NMLOG_WARNING("Device not fully disconnected (state: %d), setting to unmanaged state", deviceState); - } // Set the "Managed" property to enable/disable the device m_isSuccess = false; const char *objectPath = nm_object_get_path(NM_OBJECT(device)); From e2d0a001a02816934d82408c18abc1a865cd9332 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:06:05 -0400 Subject: [PATCH 04/31] Update NetworkManagerImplementation.h --- plugin/NetworkManagerImplementation.h | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/NetworkManagerImplementation.h b/plugin/NetworkManagerImplementation.h index 8a0c33d0..f99f9e1c 100644 --- a/plugin/NetworkManagerImplementation.h +++ b/plugin/NetworkManagerImplementation.h @@ -63,6 +63,7 @@ namespace WPEFramework { NETMGR_PING, NETMGR_TRACE, + NETMGR_GENERIC, }; class ConnectivityConf : public Core::JSON::Container { From 78a00560983722dd268d8069cdb5aea3e4c1eb4e Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:10:42 -0400 Subject: [PATCH 05/31] Update NetworkManagerImplementation.cpp --- plugin/NetworkManagerImplementation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/NetworkManagerImplementation.cpp b/plugin/NetworkManagerImplementation.cpp index 56cedd93..7c0f03d9 100644 --- a/plugin/NetworkManagerImplementation.cpp +++ b/plugin/NetworkManagerImplementation.cpp @@ -583,6 +583,10 @@ namespace WPEFramework list.ToString(response); NMLOG_INFO("Response is, %s", response.c_str()); } + else if (NETMGR_GENERIC == event) + { + pclose(pipe); + } return; } From 357d865700d5636c58f67d3474358ee769b0832f Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:33:29 -0400 Subject: [PATCH 06/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 1432bf17..60a68501 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2179,7 +2179,7 @@ namespace WPEFramework string tempResult = ""; snprintf (cmd, sizeof(cmd), "ip link set dev %s %s", interface.c_str(), enabled ? "up" : "down"); string commandToExecute(cmd); - executeExternally(NETMGR_GENERIC, commandToExecute, tempResult); + _instance->executeExternally(NETMGR_GENERIC, commandToExecute, tempResult); } } // Set the "Managed" property to enable/disable the device From cfecd97be6f13631d7027d1b724fb8d00621b125 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Wed, 29 Apr 2026 09:45:57 -0400 Subject: [PATCH 07/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 60a68501..3ef3ea70 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2179,7 +2179,7 @@ namespace WPEFramework string tempResult = ""; snprintf (cmd, sizeof(cmd), "ip link set dev %s %s", interface.c_str(), enabled ? "up" : "down"); string commandToExecute(cmd); - _instance->executeExternally(NETMGR_GENERIC, commandToExecute, tempResult); + _instance->executeExternally(NetworkManagerImplementation::NETMGR_GENERIC, commandToExecute, tempResult); } } // Set the "Managed" property to enable/disable the device From bef15d138a7f03c6989c3d7f3596e02b9254dcaa Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:56:39 -0400 Subject: [PATCH 08/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 31 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 6f6c675c..9b52f803 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2192,11 +2192,32 @@ namespace WPEFramework } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { NMLOG_DEBUG("Disconnecting device..."); - char cmd[100] = ""; - string tempResult = ""; - snprintf (cmd, sizeof(cmd), "ip link set dev %s %s", interface.c_str(), enabled ? "up" : "down"); - string commandToExecute(cmd); - _instance->executeExternally(NetworkManagerImplementation::NETMGR_GENERIC, commandToExecute, tempResult); + // Disconnect the device before setting it to unmanaged. + // This ensures that NetworkManager cleanly removes any IP addresses, routes, + // and DNS configuration associated with the interface. Setting an interface + // to unmanaged without disconnecting first may leave residual configuration + // that can cause networking issues. + nm_device_disconnect_async(device, nullptr, disconnectCb, this); + wait(m_loop); + // Wait until device is truly disconnected + int retry = 24; // 12 seconds + NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; + while (retry-- > 0) { + /* Force glib event processing to update state + * This below line will create an uncertain time wait. We are taking a fixed time interval of 12 seconds. + */ + while (g_main_context_iteration(NULL, FALSE)); + g_usleep(500 * 1000); // give some time to NM to process the request + deviceState = nm_device_get_state(device); + if(oldDevState != deviceState) + { + oldDevState = deviceState; + NMLOG_WARNING("Device state: %d", deviceState); + } + + if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) + break; + } } } // Set the "Managed" property to enable/disable the device From ead11f8807bc41f08cfafec42afbbc125a9c90e2 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:58:00 -0400 Subject: [PATCH 09/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 9b52f803..1d0cc766 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2220,6 +2220,11 @@ namespace WPEFramework } } } + + if(deviceState > NM_DEVICE_STATE_DISCONNECTED) + { + NMLOG_WARNING("Device not fully disconnected (state: %d), setting to unmanaged state", deviceState); + } // Set the "Managed" property to enable/disable the device m_isSuccess = false; const char *objectPath = nm_object_get_path(NM_OBJECT(device)); From 53ead2830cc7219a32a73b07b9fb5e30e0a6b501 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:59:10 -0400 Subject: [PATCH 10/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 1d0cc766..e9e2e297 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2191,7 +2191,7 @@ namespace WPEFramework return true; } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { - NMLOG_DEBUG("Disconnecting device..."); + NMLOG_DEBUG("MYTEST Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface From b60fe245e1f318bfb7d656fd5d6dd1ec2346fedf Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 13:19:28 -0400 Subject: [PATCH 11/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index e9e2e297..afcecd4d 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2191,7 +2191,7 @@ namespace WPEFramework return true; } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { - NMLOG_DEBUG("MYTEST Disconnecting device..."); + NMLOG_DEBUG(" Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface @@ -2207,16 +2207,17 @@ namespace WPEFramework * This below line will create an uncertain time wait. We are taking a fixed time interval of 12 seconds. */ while (g_main_context_iteration(NULL, FALSE)); - g_usleep(500 * 1000); // give some time to NM to process the request deviceState = nm_device_get_state(device); if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_WARNING("Device state: %d", deviceState); + NMLOG_WARNING("MYTEST: Device state: %d", deviceState); } - + NMLOG_WARNING("MYTEST:Current Device state: %d", deviceState); if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) break; + + g_usleep(500 * 1000); // give some time to NM to process the request } } } From 7328da11321b18b26e897b0247de1e943324169a Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 14:48:09 -0400 Subject: [PATCH 12/31] Update NetworkManagerImplementation.h --- plugin/NetworkManagerImplementation.h | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/NetworkManagerImplementation.h b/plugin/NetworkManagerImplementation.h index 9404d2d5..f5bd49b1 100644 --- a/plugin/NetworkManagerImplementation.h +++ b/plugin/NetworkManagerImplementation.h @@ -68,7 +68,6 @@ namespace WPEFramework { NETMGR_PING, NETMGR_TRACE, - NETMGR_GENERIC, }; class ConnectivityConf : public Core::JSON::Container { From 7e168ff466f69b0840aa7636fd0bccc51a66b765 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 14:49:37 -0400 Subject: [PATCH 13/31] Update NetworkManagerImplementation.cpp --- plugin/NetworkManagerImplementation.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugin/NetworkManagerImplementation.cpp b/plugin/NetworkManagerImplementation.cpp index 680a998d..b4b5bca6 100644 --- a/plugin/NetworkManagerImplementation.cpp +++ b/plugin/NetworkManagerImplementation.cpp @@ -587,10 +587,6 @@ namespace WPEFramework list.ToString(response); NMLOG_INFO("Response is, %s", response.c_str()); } - else if (NETMGR_GENERIC == event) - { - pclose(pipe); - } return; } From 8fbfd409851755b06aa925325db07167b4023758 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 14:50:18 -0400 Subject: [PATCH 14/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index afcecd4d..889cc231 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2206,7 +2206,7 @@ namespace WPEFramework /* Force glib event processing to update state * This below line will create an uncertain time wait. We are taking a fixed time interval of 12 seconds. */ - while (g_main_context_iteration(NULL, FALSE)); + //while (g_main_context_iteration(NULL, FALSE)); deviceState = nm_device_get_state(device); if(oldDevState != deviceState) { From 06623e352a1abd8f3789651990ce1b5422d1f860 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Thu, 30 Apr 2026 15:50:53 -0400 Subject: [PATCH 15/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 889cc231..6fcfa22c 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2191,7 +2191,7 @@ namespace WPEFramework return true; } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { - NMLOG_DEBUG(" Disconnecting device..."); + NMLOG_ERROR("MYTEST Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface @@ -2206,14 +2206,14 @@ namespace WPEFramework /* Force glib event processing to update state * This below line will create an uncertain time wait. We are taking a fixed time interval of 12 seconds. */ - //while (g_main_context_iteration(NULL, FALSE)); + while (g_main_context_iteration(NULL, FALSE)); deviceState = nm_device_get_state(device); + NMLOG_ERROR("MYTEST:Current Device state: %d", deviceState); if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_WARNING("MYTEST: Device state: %d", deviceState); + NMLOG_ERROR("MYTEST: Device state: %d", deviceState); } - NMLOG_WARNING("MYTEST:Current Device state: %d", deviceState); if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) break; From d0648bbb3aae963f34ddae212596ddbbbb195239 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Fri, 1 May 2026 10:26:50 -0400 Subject: [PATCH 16/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 6fcfa22c..34c6f208 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2203,11 +2203,15 @@ namespace WPEFramework int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { - /* Force glib event processing to update state - * This below line will create an uncertain time wait. We are taking a fixed time interval of 12 seconds. - */ - while (g_main_context_iteration(NULL, FALSE)); - deviceState = nm_device_get_state(device); + // Force a synchronous D-Bus property fetch + GVariant *v = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(device), "State"); + if (v) { + deviceState = (NMDeviceState)g_variant_get_uint32(v); + g_variant_unref(v); + } else { + // Fallback to the local cache if D-Bus fails + deviceState = nm_device_get_state(device); + } NMLOG_ERROR("MYTEST:Current Device state: %d", deviceState); if(oldDevState != deviceState) { From 2d9f0469763d33d80e7809a3d0ee08df7fbfa045 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Fri, 1 May 2026 11:24:59 -0400 Subject: [PATCH 17/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 46 +++++++++++++----------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 34c6f208..233c7747 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2191,7 +2191,7 @@ namespace WPEFramework return true; } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { - NMLOG_ERROR("MYTEST Disconnecting device..."); + NMLOG_ERROR("MYTEST1 Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface @@ -2199,29 +2199,35 @@ namespace WPEFramework // that can cause networking issues. nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); - // Wait until device is truly disconnected - int retry = 24; // 12 seconds - NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; + while (retry-- > 0) { - // Force a synchronous D-Bus property fetch - GVariant *v = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(device), "State"); - if (v) { - deviceState = (NMDeviceState)g_variant_get_uint32(v); - g_variant_unref(v); - } else { - // Fallback to the local cache if D-Bus fails - deviceState = nm_device_get_state(device); - } - NMLOG_ERROR("MYTEST:Current Device state: %d", deviceState); - if(oldDevState != deviceState) - { + /* + * 2. PUMP THE CONTEXT (The Fix) + * This drains the D-Bus socket and updates the internal 'device' struct. + * We run it in a loop to process all pending state-change messages. + */ + while (g_main_context_iteration(device_context, FALSE)); + + // 3. Fetch the updated state + deviceState = nm_device_get_state(device); + + if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_ERROR("MYTEST: Device state: %d", deviceState); + NMLOG_ERROR("MYTEST: Device state changed to: %d (Retry: %d)", deviceState, retry); } - if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) + + // 4. Check for completion (Disconnected = 30, Unmanaged = 10, Unavailable = 20) + if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) { + NMLOG_INFO("MYTEST: Target state reached. Proceeding to flush."); break; - - g_usleep(500 * 1000); // give some time to NM to process the request + } + + /* + * 5. SMART SLEEP + * Instead of a blind usleep, we tell the context to wait for 500ms + * OR until a new D-Bus message arrives. This is much more efficient. + */ + g_main_context_iteration(device_context, TRUE); } } } From 030a5122c9f79c82c2b16aa2c23f6538d74c8c31 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Fri, 1 May 2026 11:43:52 -0400 Subject: [PATCH 18/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 233c7747..a484e19e 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2199,7 +2199,12 @@ namespace WPEFramework // that can cause networking issues. nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); - + // 1. Identify the correct context (Crucial for multi-threaded RDK apps) + GMainContext *device_context = g_main_context_get_thread_default(); + if (!device_context) device_context = g_main_context_default(); + + int retry = 24; // 12 seconds + NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { /* * 2. PUMP THE CONTEXT (The Fix) From dff456dc3b3f5d0af04feede372d008176508b9e Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Fri, 1 May 2026 13:59:50 -0400 Subject: [PATCH 19/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 26 ++++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index a484e19e..7182d632 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2191,7 +2191,7 @@ namespace WPEFramework return true; } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { - NMLOG_ERROR("MYTEST1 Disconnecting device..."); + NMLOG_DEBUG("Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface @@ -2199,40 +2199,30 @@ namespace WPEFramework // that can cause networking issues. nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); - // 1. Identify the correct context (Crucial for multi-threaded RDK apps) + + // Identify the correct context GMainContext *device_context = g_main_context_get_thread_default(); if (!device_context) device_context = g_main_context_default(); int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { - /* - * 2. PUMP THE CONTEXT (The Fix) - * This drains the D-Bus socket and updates the internal 'device' struct. - * We run it in a loop to process all pending state-change messages. - */ + //if there are multiple messages backed up, + // clears all of them until the queue is completely empty while (g_main_context_iteration(device_context, FALSE)); - // 3. Fetch the updated state + // Fetch the updated state deviceState = nm_device_get_state(device); if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_ERROR("MYTEST: Device state changed to: %d (Retry: %d)", deviceState, retry); + NMLOG_WARNING("Device state: %d Retry: %d", deviceState, retry); } - // 4. Check for completion (Disconnected = 30, Unmanaged = 10, Unavailable = 20) if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) { - NMLOG_INFO("MYTEST: Target state reached. Proceeding to flush."); break; } - - /* - * 5. SMART SLEEP - * Instead of a blind usleep, we tell the context to wait for 500ms - * OR until a new D-Bus message arrives. This is much more efficient. - */ - g_main_context_iteration(device_context, TRUE); + g_usleep(500 * 1000); // give some time to NM to process the request } } } From cd1ff84d1ecf950b985f5a3e3d909bf15cce3cb7 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Mon, 4 May 2026 11:30:23 -0400 Subject: [PATCH 20/31] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 7182d632..e7e849c0 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2207,9 +2207,11 @@ namespace WPEFramework int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { - //if there are multiple messages backed up, - // clears all of them until the queue is completely empty - while (g_main_context_iteration(device_context, FALSE)); + // If there are multiple messages backed up, process a bounded number + // of pending iterations so this path cannot stall indefinitely if the + // context keeps receiving new work. + for (int i = 0; i < 100 && g_main_context_iteration(device_context, FALSE); ++i) { + } // Fetch the updated state deviceState = nm_device_get_state(device); From 4eff3ee9a1356c916b99d86104817a9390c82da0 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Mon, 4 May 2026 11:45:09 -0400 Subject: [PATCH 21/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index e7e849c0..73a09fa7 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2201,8 +2201,7 @@ namespace WPEFramework wait(m_loop); // Identify the correct context - GMainContext *device_context = g_main_context_get_thread_default(); - if (!device_context) device_context = g_main_context_default(); + GMainContext *device_context = g_main_loop_get_context(m_loop); int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; From e5a0aaecebc65fa63b3a0484030c342efcb2fad5 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Mon, 4 May 2026 12:47:31 -0400 Subject: [PATCH 22/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 73a09fa7..38885366 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2202,24 +2202,24 @@ namespace WPEFramework // Identify the correct context GMainContext *device_context = g_main_loop_get_context(m_loop); - int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { // If there are multiple messages backed up, process a bounded number // of pending iterations so this path cannot stall indefinitely if the // context keeps receiving new work. - for (int i = 0; i < 100 && g_main_context_iteration(device_context, FALSE); ++i) { + if (device_context) + { + for (int i = 0; i < 100 && g_main_context_iteration(device_context, FALSE); ++i) { + } } // Fetch the updated state deviceState = nm_device_get_state(device); - if(oldDevState != deviceState) { oldDevState = deviceState; NMLOG_WARNING("Device state: %d Retry: %d", deviceState, retry); } - if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) { break; } @@ -2227,7 +2227,7 @@ namespace WPEFramework } } } - + if(deviceState > NM_DEVICE_STATE_DISCONNECTED) { NMLOG_WARNING("Device not fully disconnected (state: %d), setting to unmanaged state", deviceState); From 122c191f9b07b4b5df6d33020703befc4634ad81 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 11:38:46 -0400 Subject: [PATCH 23/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 38885366..9fef847a 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2197,28 +2197,29 @@ namespace WPEFramework // and DNS configuration associated with the interface. Setting an interface // to unmanaged without disconnecting first may leave residual configuration // that can cause networking issues. - nm_device_disconnect_async(device, nullptr, disconnectCb, this); + nm_device_disconnect_async(device, nullptr, nullptr, nullptr); wait(m_loop); // Identify the correct context - GMainContext *device_context = g_main_loop_get_context(m_loop); + //GMainContext *device_context = g_main_loop_get_context(m_loop); int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { // If there are multiple messages backed up, process a bounded number // of pending iterations so this path cannot stall indefinitely if the // context keeps receiving new work. + #if 0 if (device_context) { for (int i = 0; i < 100 && g_main_context_iteration(device_context, FALSE); ++i) { } } - + #endif // Fetch the updated state deviceState = nm_device_get_state(device); if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_WARNING("Device state: %d Retry: %d", deviceState, retry); + NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); } if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) { break; From b7c93e3ccfc21fe2e5348c26d6808d7f84daafef Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 12:34:41 -0400 Subject: [PATCH 24/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 9fef847a..cbbd9e49 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2192,6 +2192,7 @@ namespace WPEFramework } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { NMLOG_DEBUG("Disconnecting device..."); + NMLOG_WARNING("MYTEST1: Disconnecting device...); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface @@ -2216,10 +2217,12 @@ namespace WPEFramework } #endif // Fetch the updated state + NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); deviceState = nm_device_get_state(device); + NMLOG_WARNING("MYTEST2: Device state: %d Retry: %d", deviceState, retry); if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); + NMLOG_WARNING("MYTEST3: Device state: %d Retry: %d", deviceState, retry); } if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) { break; @@ -2251,7 +2254,7 @@ namespace WPEFramework else // wifi nmUtils::setMarkerFile(WiFiDisableMarker, enabled); } - + NMLOG_WARNING("MYTEST1: Disconnected device...); return m_isSuccess; } From 1b25a2c777d74551350b3c318bcd03a410bfb9ae Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 12:41:32 -0400 Subject: [PATCH 25/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index cbbd9e49..790f6c4c 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2198,24 +2198,19 @@ namespace WPEFramework // and DNS configuration associated with the interface. Setting an interface // to unmanaged without disconnecting first may leave residual configuration // that can cause networking issues. - nm_device_disconnect_async(device, nullptr, nullptr, nullptr); + nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); // Identify the correct context - //GMainContext *device_context = g_main_loop_get_context(m_loop); + GMainContext *device_context = g_main_loop_get_context(m_loop); int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { // If there are multiple messages backed up, process a bounded number // of pending iterations so this path cannot stall indefinitely if the // context keeps receiving new work. - #if 0 - if (device_context) - { - for (int i = 0; i < 100 && g_main_context_iteration(device_context, FALSE); ++i) { - } - } - #endif + while (g_main_context_iteration(device_context, FALSE)); + // Fetch the updated state NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); deviceState = nm_device_get_state(device); From 71b30efd620374a4146508868cc550f8aaad33a4 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 13:30:57 -0400 Subject: [PATCH 26/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 790f6c4c..90174081 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2192,7 +2192,7 @@ namespace WPEFramework } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { NMLOG_DEBUG("Disconnecting device..."); - NMLOG_WARNING("MYTEST1: Disconnecting device...); + NMLOG_WARNING("MYTEST1: Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface @@ -2214,7 +2214,6 @@ namespace WPEFramework // Fetch the updated state NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); deviceState = nm_device_get_state(device); - NMLOG_WARNING("MYTEST2: Device state: %d Retry: %d", deviceState, retry); if(oldDevState != deviceState) { oldDevState = deviceState; NMLOG_WARNING("MYTEST3: Device state: %d Retry: %d", deviceState, retry); @@ -2249,7 +2248,7 @@ namespace WPEFramework else // wifi nmUtils::setMarkerFile(WiFiDisableMarker, enabled); } - NMLOG_WARNING("MYTEST1: Disconnected device...); + NMLOG_WARNING("MYTEST1: Disconnected device..."); return m_isSuccess; } From 70d603e2bba5b73461d2d63d90f594a3de182919 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 13:35:09 -0400 Subject: [PATCH 27/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 90174081..2b1c6604 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2198,18 +2198,19 @@ namespace WPEFramework // and DNS configuration associated with the interface. Setting an interface // to unmanaged without disconnecting first may leave residual configuration // that can cause networking issues. - nm_device_disconnect_async(device, nullptr, disconnectCb, this); + nm_device_disconnect_async(device, nullptr, nullptr, nullptr, nullptr); + NMLOG_WARNING("MYTEST1: No callback"); wait(m_loop); // Identify the correct context - GMainContext *device_context = g_main_loop_get_context(m_loop); + //GMainContext *device_context = g_main_loop_get_context(m_loop); int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { // If there are multiple messages backed up, process a bounded number // of pending iterations so this path cannot stall indefinitely if the // context keeps receiving new work. - while (g_main_context_iteration(device_context, FALSE)); + //while (g_main_context_iteration(device_context, FALSE)); // Fetch the updated state NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); From 8172687d953d1c708dea3a98add843a9da14aeb6 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 13:53:01 -0400 Subject: [PATCH 28/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 2b1c6604..ad48707e 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2198,7 +2198,7 @@ namespace WPEFramework // and DNS configuration associated with the interface. Setting an interface // to unmanaged without disconnecting first may leave residual configuration // that can cause networking issues. - nm_device_disconnect_async(device, nullptr, nullptr, nullptr, nullptr); + nm_device_disconnect_async(device, nullptr, nullptr, nullptr); NMLOG_WARNING("MYTEST1: No callback"); wait(m_loop); From 97bfc0242b721e45dd6e78421f4d798aa008e08e Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 15:28:48 -0400 Subject: [PATCH 29/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index ad48707e..789efd89 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2192,14 +2192,12 @@ namespace WPEFramework } else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) { NMLOG_DEBUG("Disconnecting device..."); - NMLOG_WARNING("MYTEST1: Disconnecting device..."); // Disconnect the device before setting it to unmanaged. // This ensures that NetworkManager cleanly removes any IP addresses, routes, // and DNS configuration associated with the interface. Setting an interface // to unmanaged without disconnecting first may leave residual configuration // that can cause networking issues. - nm_device_disconnect_async(device, nullptr, nullptr, nullptr); - NMLOG_WARNING("MYTEST1: No callback"); + nm_device_disconnect_async(device, nullptr, disconnectCb, this); wait(m_loop); // Identify the correct context @@ -2210,14 +2208,13 @@ namespace WPEFramework // If there are multiple messages backed up, process a bounded number // of pending iterations so this path cannot stall indefinitely if the // context keeps receiving new work. - //while (g_main_context_iteration(device_context, FALSE)); + while (g_main_context_iteration(device_context, FALSE)); // Fetch the updated state - NMLOG_WARNING("MYTEST1: Device state: %d Retry: %d", deviceState, retry); deviceState = nm_device_get_state(device); if(oldDevState != deviceState) { oldDevState = deviceState; - NMLOG_WARNING("MYTEST3: Device state: %d Retry: %d", deviceState, retry); + NMLOG_WARNING("Device state: %d Retry: %d", deviceState, retry); } if (deviceState <= NM_DEVICE_STATE_DISCONNECTED) { break; From 32159ef89eb2576d26f279a8a43fb475e51e94fb Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 15:29:43 -0400 Subject: [PATCH 30/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 789efd89..0651bdc9 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2201,7 +2201,7 @@ namespace WPEFramework wait(m_loop); // Identify the correct context - //GMainContext *device_context = g_main_loop_get_context(m_loop); + GMainContext *device_context = g_main_loop_get_context(m_loop); int retry = 24; // 12 seconds NMDeviceState oldDevState = NM_DEVICE_STATE_UNKNOWN; while (retry-- > 0) { From 320254d252ef4be2ab4225fe44214b1e28c2d6f7 Mon Sep 17 00:00:00 2001 From: jincysam87 <167995204+jincysam87@users.noreply.github.com> Date: Tue, 5 May 2026 15:31:10 -0400 Subject: [PATCH 31/31] Update NetworkManagerGnomeWIFI.cpp --- plugin/gnome/NetworkManagerGnomeWIFI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gnome/NetworkManagerGnomeWIFI.cpp b/plugin/gnome/NetworkManagerGnomeWIFI.cpp index 0651bdc9..2348124d 100644 --- a/plugin/gnome/NetworkManagerGnomeWIFI.cpp +++ b/plugin/gnome/NetworkManagerGnomeWIFI.cpp @@ -2246,7 +2246,7 @@ namespace WPEFramework else // wifi nmUtils::setMarkerFile(WiFiDisableMarker, enabled); } - NMLOG_WARNING("MYTEST1: Disconnected device..."); + return m_isSuccess; }