summaryrefslogtreecommitdiffstats
path: root/binding/gdbus
diff options
context:
space:
mode:
Diffstat (limited to 'binding/gdbus')
-rw-r--r--binding/gdbus/ofono_manager.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/binding/gdbus/ofono_manager.c b/binding/gdbus/ofono_manager.c
index 1086beb..98d8c5b 100644
--- a/binding/gdbus/ofono_manager.c
+++ b/binding/gdbus/ofono_manager.c
@@ -69,8 +69,19 @@ int ofono_manager_set_default_modem(const char *address)
else if (!strcmp(key, "Type"))
type = g_variant_get_string(value, NULL);
}
- /* If the HFP modem matches the BT address, is powered, and online then set as default */
- if (!g_strcmp0(type, "hfp") && !g_strcmp0(address, serial) && powered && online) {
+
+ /* If not a HFP modem then continue */
+ if (g_strcmp0(type, "hfp"))
+ continue;
+
+ /* If address is NULL then use the first modem as default,
+ * and if not then continue if doesn't match address.
+ */
+ if (address && g_strcmp0(address, serial))
+ continue;
+
+ /* If powered, and online then set as default */
+ if (powered && online) {
default_modem.address = serial;
default_modem.path = path;
default_modem.name = name;
@@ -78,7 +89,7 @@ int ofono_manager_set_default_modem(const char *address)
default_modem.powered = powered;
default_modem.online = online;
default_modem.valid = TRUE;
- AFB_NOTICE("New modem: %s (%s)", name, address);
+ AFB_NOTICE("New modem: %s (%s)", name, serial);
break;
}
}