From cc41a2a4c0862163c740f1489548af1d09aaa980 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 28 Apr 2017 12:31:07 +0300 Subject: [PATCH] hfp_hf: Handle ServicesResolved signal This adds handling for ServicesResolved signal which tells when BlueZ is done resolving the device services so the code will no longer ignore devices that got its services resolved after Paired signal. --- plugins/hfp_hf_bluez5.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c index fb7cc3f7..f7d24501 100644 --- a/plugins/hfp_hf_bluez5.c +++ b/plugins/hfp_hf_bluez5.c @@ -555,9 +555,9 @@ static struct ofono_modem *modem_register_from_proxy(GDBusProxy *proxy, dbus_message_iter_get_basic(&iter, &paired); - if (paired == FALSE) { - modem = ofono_modem_find(device_path_compare, (void *) path); + modem = ofono_modem_find(device_path_compare, (void *) path); + if (paired == FALSE) { if (modem != NULL) { ofono_modem_remove(modem); g_dbus_proxy_set_removed_watch(proxy, NULL, NULL); @@ -566,6 +566,9 @@ static struct ofono_modem *modem_register_from_proxy(GDBusProxy *proxy, return NULL; } + if (modem) + return modem; + if (g_dbus_proxy_get_property(proxy, "UUIDs", &iter) == FALSE) return NULL; @@ -808,7 +811,8 @@ static void property_changed(GDBusProxy *proxy, const char *name, if (g_str_equal(BLUEZ_DEVICE_INTERFACE, interface) == FALSE) return; - if (g_str_equal("Paired", name) != TRUE) + if (g_str_equal("Paired", name) != TRUE && + g_str_equal("ServicesResolved", name) != TRUE) return; modem_register_from_proxy(proxy, path);