linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH BlueZ v2 5/6] media: Create multiple transports if needed
Date: Mon, 30 Apr 2012 10:56:38 +0200	[thread overview]
Message-ID: <1335776199-16704-6-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1335776199-16704-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

During endpoint registration one than one device might be connected.
Thus all matching devices should have one transport each.
---
 audio/media.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index 88b994f..9c7a103 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -688,30 +688,44 @@ static gboolean endpoint_init_a2dp_sink(struct media_endpoint *endpoint,
 
 static gboolean endpoint_init_ag(struct media_endpoint *endpoint, int *err)
 {
-	struct audio_device *dev;
+	GSList *list;
+	GSList *l;
 
 	endpoint->hs_watch = headset_add_state_cb(headset_state_changed,
 								endpoint);
-	dev = manager_find_device(NULL, &endpoint->adapter->src, BDADDR_ANY,
+	list = manager_find_devices(NULL, &endpoint->adapter->src, BDADDR_ANY,
 						AUDIO_HEADSET_INTERFACE, TRUE);
-	if (dev)
+
+	for (l = list; l != NULL; l = l->next) {
+		struct audio_device *dev = l->data;
+
 		set_configuration(endpoint, dev, NULL, 0,
 						headset_setconf_cb, dev, NULL);
+	}
+
+	g_slist_free(list);
 
 	return TRUE;
 }
 
 static gboolean endpoint_init_hs(struct media_endpoint *endpoint, int *err)
 {
-	struct audio_device *dev;
+	GSList *list;
+	GSList *l;
 
 	endpoint->ag_watch = gateway_add_state_cb(gateway_state_changed,
 								endpoint);
-	dev = manager_find_device(NULL, &endpoint->adapter->src, BDADDR_ANY,
+	list = manager_find_devices(NULL, &endpoint->adapter->src, BDADDR_ANY,
 						AUDIO_GATEWAY_INTERFACE, TRUE);
-	if (dev)
+
+	for (l = list; l != NULL; l = l->next) {
+		struct audio_device *dev = l->data;
+
 		set_configuration(endpoint, dev, NULL, 0,
 						gateway_setconf_cb, dev, NULL);
+	}
+
+	g_slist_free(list);
 
 	return TRUE;
 }
-- 
1.7.7.6


  parent reply	other threads:[~2012-04-30  8:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30  8:56 [PATCH BlueZ v2 0/6] Multiple Bluetooth SCO connections (userspace) Mikel Astiz
2012-04-30  8:56 ` [PATCH BlueZ v2 1/6] audio: Fix gateway state check Mikel Astiz
2012-04-30  8:56 ` [PATCH BlueZ v2 2/6] audio: Add multiple device search to manager Mikel Astiz
2012-05-02 18:25   ` Vinicius Costa Gomes
2012-04-30  8:56 ` [PATCH BlueZ v2 3/6] media: Support multiple transports per endpoint Mikel Astiz
2012-04-30  8:56 ` [PATCH BlueZ v2 4/6] media: Split media_endpoint_create Mikel Astiz
2012-05-02 12:21   ` Luiz Augusto von Dentz
2012-04-30  8:56 ` Mikel Astiz [this message]
2012-04-30  8:56 ` [PATCH BlueZ v2 6/6] media: Enable parallel requests to endpoint Mikel Astiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335776199-16704-6-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).