From: Luiz Augusto von Dentz <luiz.von.de...@intel.com>

In case the UUIDs are not updated, as they are still being resolved, when
Paired property changes a modem will never be registered.

In order to fix this problem allow modems to be registered directly
during NewConnection.
---
 plugins/hfp_hf_bluez5.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 5f23b7f..6e4e499 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -598,10 +598,18 @@ static DBusMessage *profile_new_connection(DBusConnection 
*conn,
 
        modem = ofono_modem_find(device_path_compare, (void *) device);
        if (modem == NULL) {
-               close(fd);
-               return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
+               GDBusProxy *proxy;
+
+               proxy = g_dbus_proxy_new(bluez, device, BLUEZ_DEVICE_INTERFACE);
+               modem = modem_register(device, proxy);
+               g_dbus_proxy_unref(proxy);
+
+               if (!modem) {
+                       close(fd);
+                       return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
                                                ".Rejected",
                                                "Unknown Bluetooth device");
+               }
        }
 
        err = service_level_connection(modem, fd, version);
-- 
2.9.3

_______________________________________________
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to