aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-05-04 15:14:39 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-05-07 07:05:40 -0700
commit9ffc69cbfd86c622cebbafe6c5f9e0d3b67ada90 (patch)
treee51bc079796c9e738bc95e6d5e6b65091679dce6
parentee315221517e97490975886055a1484fc8e85c12 (diff)
downloadbluez-9ffc69cbfd86c622cebbafe6c5f9e0d3b67ada90.tar.gz
bluez-9ffc69cbfd86c622cebbafe6c5f9e0d3b67ada90.tar.xz
bluez-9ffc69cbfd86c622cebbafe6c5f9e0d3b67ada90.zip
media: Create multiple transports if needed
During endpoint registration one than one device might be connected. Thus all matching devices should have one transport each.
-rw-r--r--audio/media.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/audio/media.c b/audio/media.c
index 88b994fa..9c7a103a 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;
}