[PATCH 2/4] ofono: Set modem->interfaces earlier

Denis Kenzior <[email protected]>
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Update modem->interfaces earlier so that handlers invoked on an
interface being added or removed can check the current interface list.
---
 plugins/ofono.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 1906843335cf..fd8b442a674c 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -2018,18 +2018,15 @@ static gboolean modem_changed(DBusConnection *conn, DBusMessage *message,
 
 		connman_device_set_powered(modem->device, modem->online);
 	} else if (g_str_equal(key, "Interfaces")) {
-		uint8_t interfaces;
+		uint8_t new_interfaces = extract_interfaces(&value);
+		uint8_t old_interfaces = modem->interfaces;
 
-		interfaces = extract_interfaces(&value);
-
-		if (interfaces == modem->interfaces)
+		if (new_interfaces == old_interfaces)
 			return TRUE;
 
-		DBG("%s Interfaces 0x%02x", modem->path, interfaces);
-
-		modem_update_interfaces(modem, modem->interfaces, interfaces);
-
-		modem->interfaces = interfaces;
+		DBG("%s Interfaces 0x%02x", modem->path, new_interfaces);
+		modem->interfaces = new_interfaces;
+		modem_update_interfaces(modem, old_interfaces, new_interfaces);
 	} else if (g_str_equal(key, "Serial")) {
 		char *serial;
 
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.