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 v0 5/7] media: Create multiple transports if needed
Date: Wed, 11 Apr 2012 08:57:16 +0200	[thread overview]
Message-ID: <1334127438-27617-6-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1334127438-27617-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 |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index 23c3217..3324103 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -713,26 +713,42 @@ static struct media_endpoint *media_endpoint_create(struct media_adapter *adapte
 			goto failed;
 	} else if (strcasecmp(uuid, HFP_AG_UUID) == 0 ||
 					strcasecmp(uuid, HSP_AG_UUID) == 0) {
-		struct audio_device *dev;
+		GSList *list;
+		GSList *l;
 
 		endpoint->hs_watch = headset_add_state_cb(headset_state_changed,
 								endpoint);
-		dev = manager_find_device(NULL, &adapter->src, BDADDR_ANY,
-						AUDIO_HEADSET_INTERFACE, TRUE);
-		if (dev)
+		list = manager_find_devices(NULL, &adapter->src, BDADDR_ANY,
+						AUDIO_HEADSET_INTERFACE, TRUE,
+						0);
+
+		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);
 	} else if (strcasecmp(uuid, HFP_HS_UUID) == 0 ||
 					strcasecmp(uuid, HSP_HS_UUID) == 0) {
-		struct audio_device *dev;
+		GSList *list;
+		GSList *l;
 
 		endpoint->ag_watch = gateway_add_state_cb(gateway_state_changed,
 								endpoint);
-		dev = manager_find_device(NULL, &adapter->src, BDADDR_ANY,
-						AUDIO_GATEWAY_INTERFACE, TRUE);
-		if (dev)
+		list = manager_find_devices(NULL, &adapter->src, BDADDR_ANY,
+						AUDIO_GATEWAY_INTERFACE, TRUE,
+						0);
+
+		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);
 	} else {
 		if (err)
 			*err = -EINVAL;
-- 
1.7.7.6


  parent reply	other threads:[~2012-04-11  6:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  6:57 [PATCH BlueZ v0 0/7] Multiple Bluetooth SCO connections (userspace) Mikel Astiz
2012-04-11  6:57 ` [PATCH BlueZ v0 1/7] btio: Fix bind SCO socket only if server Mikel Astiz
2012-04-11 11:20   ` Luiz Augusto von Dentz
2012-04-11 12:20     ` Luiz Augusto von Dentz
2012-04-12  8:58       ` Mikel Astiz
2012-04-12  9:18         ` Johan Hedberg
2012-04-12 15:29           ` Mikel Astiz
2012-04-11  6:57 ` [PATCH BlueZ v0 2/7] audio: Fix gateway state check Mikel Astiz
2012-04-11 11:21   ` Luiz Augusto von Dentz
2012-04-11  6:57 ` [PATCH BlueZ v0 3/7] audio: Add multiple device search to manager Mikel Astiz
2012-04-17 12:20   ` Luiz Augusto von Dentz
2012-04-17 14:12     ` Mikel Astiz
2012-04-11  6:57 ` [PATCH BlueZ v0 4/7] media: Support multiple transports per endpoint Mikel Astiz
2012-04-17 12:30   ` Luiz Augusto von Dentz
2012-04-11  6:57 ` Mikel Astiz [this message]
2012-04-11  6:57 ` [PATCH BlueZ v0 6/7] media: Enable parallel requests to endpoint Mikel Astiz
2012-04-17 12:33   ` Luiz Augusto von Dentz
2012-04-11  6:57 ` [PATCH BlueZ v0 7/7] media: Increase hardcoded incoming MTU Mikel Astiz
2012-04-17 12:41   ` Luiz Augusto von Dentz

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=1334127438-27617-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).