From 7195cc0d3cea7d05adc23a2e9fe9084df36cfc01 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 22 Jan 2019 15:28:12 +0200 Subject: [PATCH] a2dp: Add reverse discovery Now that remote endpoints are exposed there is a chance that a configured device will reconnect and initiate SetConfiguration skipping the discovery phase which is now required in order to be able to switch endpoints, so this introduces the reverse discovery logic in order to find out about remote endpoints capabilities if they have not been found yet. Change-Id: Ib92837aca13a17ccc1b37e363d157f0cdb6e13bc Signed-off-by: himanshu --- profiles/audio/a2dp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index acd0e7a..5b4e363 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -639,6 +639,12 @@ static gboolean endpoint_match_codec_ind(struct avdtp *session, return TRUE; } +static void reverse_discover(struct avdtp *session, GSList *seps, int err, + void *user_data) +{ + DBG("err %d", err); +} + static gboolean endpoint_setconf_ind(struct avdtp *session, struct avdtp_local_sep *sep, struct avdtp_stream *stream, @@ -694,8 +700,14 @@ static gboolean endpoint_setconf_ind(struct avdtp *session, setup_ref(setup), endpoint_setconf_cb, a2dp_sep->user_data); - if (ret == 0) + if (ret == 0) { + /* Attempt to reverve discover if there are no remote + * SEPs. + */ + if (queue_isempty(setup->chan->seps)) + a2dp_discover(session, reverse_discover, NULL); return TRUE; + } setup_unref(setup); setup->err = g_new(struct avdtp_error, 1); -- 2.7.4