All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection
@ 2013-01-31 19:01 Claudio Takahasi
  2013-01-31 19:01 ` [PATCH v0 2/2] hfp_hf_bluez5: Remove BlueZ devices proxies hash Claudio Takahasi
  2013-01-31 22:04 ` [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Claudio Takahasi @ 2013-01-31 19:01 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2195 bytes --]

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.
---
 plugins/hfp_hf_bluez5.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index ff4dbad..d2f3abb 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);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v0 2/2] hfp_hf_bluez5: Remove BlueZ devices proxies hash
  2013-01-31 19:01 [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection Claudio Takahasi
@ 2013-01-31 19:01 ` Claudio Takahasi
  2013-01-31 22:04   ` Denis Kenzior
  2013-01-31 22:04 ` [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Claudio Takahasi @ 2013-01-31 19:01 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2081 bytes --]

The hash table to track the devices is not necessary anymore since
dynamic modem registration on NewConnection was removed.
---
 plugins/hfp_hf_bluez5.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index d2f3abb..2f4a89e 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -64,7 +64,6 @@ struct hfp {
 };
 
 static GHashTable *modem_hash = NULL;
-static GHashTable *devices_proxies = NULL;
 static GDBusClient *bluez = NULL;
 static guint sco_watch = 0;
 
@@ -500,10 +499,6 @@ static void proxy_added(GDBusProxy *proxy, void *user_data)
 	if (g_str_equal(BLUEZ_DEVICE_INTERFACE, interface) == FALSE)
 		return;
 
-	g_hash_table_insert(devices_proxies, g_strdup(path),
-						g_dbus_proxy_ref(proxy));
-	DBG("Device proxy: %s(%p)", path, proxy);
-
 	modem_register_from_proxy(proxy, path);
 }
 
@@ -515,10 +510,8 @@ static void proxy_removed(GDBusProxy *proxy, void *user_data)
 	interface = g_dbus_proxy_get_interface(proxy);
 	path = g_dbus_proxy_get_path(proxy);
 
-	if (g_str_equal(BLUEZ_DEVICE_INTERFACE, interface)) {
-		g_hash_table_remove(devices_proxies, path);
-		DBG("Device proxy: %s(%p)", path, proxy);
-	}
+	if (g_str_equal(BLUEZ_DEVICE_INTERFACE, interface) == FALSE)
+		return;
 
 	modem = g_hash_table_lookup(modem_hash, path);
 	if (modem == NULL)
@@ -602,9 +595,6 @@ static int hfp_init(void)
 	modem_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
 								NULL);
 
-	devices_proxies = g_hash_table_new_full(g_str_hash, g_str_equal,
-				g_free, (GDestroyNotify) g_dbus_proxy_unref);
-
 	g_dbus_client_set_connect_watch(bluez, connect_handler, NULL);
 	g_dbus_client_set_proxy_handlers(bluez, proxy_added, proxy_removed,
 						property_changed, NULL);
@@ -623,7 +613,6 @@ static void hfp_exit(void)
 	g_dbus_client_unref(bluez);
 
 	g_hash_table_destroy(modem_hash);
-	g_hash_table_destroy(devices_proxies);
 
 	if (sco_watch > 0)
 		g_source_remove(sco_watch);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection
  2013-01-31 19:01 [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection Claudio Takahasi
  2013-01-31 19:01 ` [PATCH v0 2/2] hfp_hf_bluez5: Remove BlueZ devices proxies hash Claudio Takahasi
@ 2013-01-31 22:04 ` Denis Kenzior
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2013-01-31 22:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi Claudio,

On 01/31/2013 01:01 PM, Claudio Takahasi wrote:
> 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.
> ---
>   plugins/hfp_hf_bluez5.c | 23 +++--------------------
>   1 file changed, 3 insertions(+), 20 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v0 2/2] hfp_hf_bluez5: Remove BlueZ devices proxies hash
  2013-01-31 19:01 ` [PATCH v0 2/2] hfp_hf_bluez5: Remove BlueZ devices proxies hash Claudio Takahasi
@ 2013-01-31 22:04   ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2013-01-31 22:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

Hi Claudio,

On 01/31/2013 01:01 PM, Claudio Takahasi wrote:
> The hash table to track the devices is not necessary anymore since
> dynamic modem registration on NewConnection was removed.
> ---
>   plugins/hfp_hf_bluez5.c | 15 ++-------------
>   1 file changed, 2 insertions(+), 13 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-31 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-31 19:01 [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection Claudio Takahasi
2013-01-31 19:01 ` [PATCH v0 2/2] hfp_hf_bluez5: Remove BlueZ devices proxies hash Claudio Takahasi
2013-01-31 22:04   ` Denis Kenzior
2013-01-31 22:04 ` [PATCH v0 1/2] hfp_hf_bluez5: Fix registering modem on NewConnection Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.