From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> 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. --- 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 ff384cd23..4001ea0ea 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -583,6 +583,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, @@ -638,8 +644,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.17.2