summaryrefslogtreecommitdiffstats
path: root/binding/gdbus/ofono_manager.c
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-02-13 12:53:39 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-02-13 12:53:39 +0000
commit6748e9e5b1dc4c452b8932414485dbf79c6b8228 (patch)
tree8059e0bc1960edb9ac144eeada215d35b2e1dd70 /binding/gdbus/ofono_manager.c
parent2bab1bb8be412200cac8deec3fbb0e32781cd02e (diff)
parenta96d4695e4cca3f0590ddcf4c8346fcc38236a56 (diff)
Merge "binding: telephony: remove bluetooth dependency"
Diffstat (limited to 'binding/gdbus/ofono_manager.c')
-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;
}
}