* [PATCH BlueZ] a2dp: Do not attempt to connect if there are no available SEPs
@ 2017-11-07 13:14 Luiz Augusto von Dentz
0 siblings, 0 replies; only message in thread
From: Luiz Augusto von Dentz @ 2017-11-07 13:14 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If all SEPs are taken do not even attempt to connect AVDTP since
no stream can be created.
---
profiles/audio/a2dp.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 5ecdab73c..35b9e9d11 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1399,11 +1399,26 @@ struct avdtp *a2dp_avdtp_get(struct btd_device *device)
{
struct a2dp_server *server;
struct a2dp_channel *chan;
+ const struct queue_entry *entry;
server = find_server(servers, device_get_adapter(device));
if (server == NULL)
return NULL;
+ /* Check if there is any SEP available */
+ for (entry = queue_get_entries(server->seps); entry;
+ entry = entry->next) {
+ struct a2dp_sep *sep = entry->data;
+
+ if (avdtp_sep_get_state(sep->lsep) == AVDTP_STATE_IDLE)
+ goto found;
+ }
+
+ DBG("Unable to find any available SEP");
+
+ return NULL;
+
+found:
chan = queue_find(server->channels, match_by_device, device);
if (!chan) {
chan = channel_new(server, device, NULL);
--
2.13.6
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-07 13:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 13:14 [PATCH BlueZ] a2dp: Do not attempt to connect if there are no available SEPs Luiz Augusto von Dentz
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).