summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2013-01-31 16:01:53 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-01-31 16:01:04 -0600
commitf044c6c1fae17169f58f47f95f141f53cc4fd25f (patch)
tree3e8d0cb212870dcef49b9e42ae922f4bd649ffe6
parent852ea612c80d24968ab5c0268b53ed0b707e0895 (diff)
downloadofono-f044c6c1fae17169f58f47f95f141f53cc4fd25f.tar.bz2
hfp_hf_bluez5: Fix registering modem on NewConnection
HFP modem will be registered when Proxy Added callback gets called or when Pair is True. This patch removes the support for dynamic modem registration when a new connection is notified and there isn't a modem associated with the Bluetooth remote device. BlueZ behaviour has been changed and a NewConnection is not notified before the service discovery finishes.
-rw-r--r--plugins/hfp_hf_bluez5.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index ff4dbadf..d2f3abb4 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -270,10 +270,8 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
{
struct hfp *hfp;
struct ofono_modem *modem;
- DBusMessageIter iter;
- GDBusProxy *proxy;
DBusMessageIter entry;
- const char *device, *alias, *address;
+ const char *device;
int fd, err;
DBG("Profile handler NewConnection");
@@ -286,21 +284,6 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
dbus_message_iter_get_basic(&entry, &device);
- proxy = g_hash_table_lookup(devices_proxies, device);
- if (proxy == NULL)
- return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
- ".Rejected",
- "Unknown Bluetooth device");
-
- g_dbus_proxy_get_property(proxy, "Alias", &iter);
-
- dbus_message_iter_get_basic(&iter, &alias);
-
- if (g_dbus_proxy_get_property(proxy, "Address", &iter) == FALSE)
- goto invalid;
-
- dbus_message_iter_get_basic(&iter, &address);
-
dbus_message_iter_next(&entry);
if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_UNIX_FD)
goto invalid;
@@ -309,12 +292,12 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
if (fd < 0)
goto invalid;
- modem = modem_register(device, address, alias);
+ modem = g_hash_table_lookup(modem_hash, device);
if (modem == NULL) {
close(fd);
return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
".Rejected",
- "Could not register HFP modem");
+ "Unknown Bluetooth device");
}
err = service_level_connection(modem, fd, HFP_VERSION_LATEST);