diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-12-23 13:45:59 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:37 +0100 |
commit | 5c74c53354000968e55097a42631a202b935318b (patch) | |
tree | 365b8e66e1e3dab6486f0dddf411404693396e33 /src | |
parent | 54d718efe51d4e19a6cda3c9f4bac92a4ed1496e (diff) |
iface-modem: don't update access tech if it didn't change
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 5782c338..3a3762bf 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -252,33 +252,40 @@ mm_iface_modem_update_access_tech (MMIfaceModem *self, guint32 mask) { MmGdbusModem *skeleton = NULL; - MMModemAccessTechnology access_tech; - gchar *old_access_tech_string; - gchar *new_access_tech_string; - const gchar *dbus_path; + MMModemAccessTechnology old_access_tech; + MMModemAccessTechnology built_access_tech; g_object_get (self, MM_IFACE_MODEM_DBUS_SKELETON, &skeleton, NULL); - access_tech = mm_gdbus_modem_get_access_technologies (skeleton); - old_access_tech_string = mm_common_get_access_technologies_string (access_tech); - - /* Clear the flags to be set */ - access_tech &= ~mask; - /* And set our new flags */ - access_tech |= new_access_tech; - mm_gdbus_modem_set_access_technologies (skeleton, access_tech); - - /* Log */ - new_access_tech_string = mm_common_get_access_technologies_string (access_tech); - dbus_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (self)); - mm_info ("Modem %s: access technology changed (%s -> %s)", - dbus_path, - old_access_tech_string, - new_access_tech_string); - g_free (old_access_tech_string); - g_free (new_access_tech_string); + old_access_tech = mm_gdbus_modem_get_access_technologies (skeleton); + + /* Build the new access tech */ + built_access_tech = old_access_tech; + built_access_tech &= ~mask; + built_access_tech |= new_access_tech; + + if (built_access_tech != old_access_tech) { + gchar *old_access_tech_string; + gchar *new_access_tech_string; + const gchar *dbus_path; + + mm_gdbus_modem_set_access_technologies (skeleton, built_access_tech); + + /* Log */ + old_access_tech_string = mm_common_get_access_technologies_string (old_access_tech); + new_access_tech_string = mm_common_get_access_technologies_string (built_access_tech); + dbus_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (self)); + mm_info ("Modem %s: access technology changed (%s -> %s)", + dbus_path, + old_access_tech_string, + new_access_tech_string); + g_free (old_access_tech_string); + g_free (new_access_tech_string); + } + + g_object_unref (skeleton); } /*****************************************************************************/ |