From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v3 1/4] a2dp: Fix caching endpoints for unknown version
Date: Tue, 19 May 2020 13:03:42 -0700 [thread overview]
Message-ID: <20200519200345.217345-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Don't cache the capabilities of endpoints which the version is unknown
since so capabilities may not be available in such case.
---
profiles/audio/a2dp.c | 11 +++++++++--
profiles/audio/avdtp.c | 7 ++++++-
profiles/audio/avdtp.h | 1 +
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index a2ce3204d..15e211b95 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -2667,15 +2667,22 @@ static void discover_cb(struct avdtp *session, GSList *seps,
struct avdtp_error *err, void *user_data)
{
struct a2dp_setup *setup = user_data;
+ uint16_t version = avdtp_get_version(session);
- DBG("err %p", err);
+ DBG("version 0x%04x err %p", version, err);
setup->seps = seps;
setup->err = err;
if (!err) {
g_slist_foreach(seps, register_remote_sep, setup->chan);
- store_remote_seps(setup->chan);
+
+ /* Only store version has been initialized as features like
+ * Delay Reporting may not be queried if the version in
+ * unknown.
+ */
+ if (version)
+ store_remote_seps(setup->chan);
}
finalize_discover(setup);
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index b632e41c5..1fd2be051 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2256,7 +2256,7 @@ static uint16_t get_version(struct avdtp *session)
const sdp_record_t *rec;
sdp_list_t *protos;
sdp_data_t *proto_desc;
- uint16_t ver = 0x0100;
+ uint16_t ver = 0x0000;
rec = btd_device_get_record(session->device, A2DP_SINK_UUID);
if (!rec)
@@ -2396,6 +2396,11 @@ struct avdtp *avdtp_new(GIOChannel *chan, struct btd_device *device,
return session;
}
+uint16_t avdtp_get_version(struct avdtp *session)
+{
+ return session->version;
+}
+
static GIOChannel *l2cap_connect(struct avdtp *session)
{
GError *err = NULL;
diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h
index ad2cb9bcb..f1e51d4e3 100644
--- a/profiles/audio/avdtp.h
+++ b/profiles/audio/avdtp.h
@@ -310,3 +310,4 @@ struct avdtp_server *avdtp_get_server(struct avdtp_local_sep *lsep);
struct avdtp *avdtp_new(GIOChannel *chan, struct btd_device *device,
struct queue *lseps);
+uint16_t avdtp_get_version(struct avdtp *session);
--
2.25.3
next reply other threads:[~2020-05-19 20:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 20:03 Luiz Augusto von Dentz [this message]
2020-05-19 20:03 ` [PATCH v3 2/4] doc/media-api: Add documentation for DelayReporting Luiz Augusto von Dentz
2020-05-19 20:03 ` [PATCH v3 3/4] a2dp: Store Delay Reporting capability Luiz Augusto von Dentz
2020-05-19 20:03 ` [PATCH v3 4/4] doc/settings-storage: Update documentation of Endpoints Luiz Augusto von Dentz
2020-05-19 20:39 ` [v3,1/4] a2dp: Fix caching endpoints for unknown version bluez.test.bot
2020-05-19 21:06 ` Luiz Augusto von Dentz
2020-05-19 21:43 ` An, Tedd
2020-05-21 16:22 ` [PATCH v3 1/4] " 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=20200519200345.217345-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/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).