From: Victor Pushkarev <VAnPushkarev@salutedevices.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: <VAnPushkarev@salutedevices.com>,
<sdfw_system_team@salutedevices.com>, <corvinus.v@gmail.com>
Subject: [PATCH BlueZ v1 1/2] main.conf: Introduce option to limit A2DP channels
Date: Mon, 29 Jan 2024 23:41:53 +0300 [thread overview]
Message-ID: <20240129204154.95773-2-VAnPushkarev@salutedevices.com> (raw)
In-Reply-To: <20240129204154.95773-1-VAnPushkarev@salutedevices.com>
This introduces Channels which can be used to
limit the number of A2DP channels.
For new option this also adds a new group A2DP to config.
Signed-off-by: Victor Pushkarev <VAnPushkarev@salutedevices.com>
---
src/btd.h | 6 ++++++
src/main.c | 16 ++++++++++++++++
src/main.conf | 5 +++++
3 files changed, 27 insertions(+)
diff --git a/src/btd.h b/src/btd.h
index b7e7ebd61..3372bd7f5 100644
--- a/src/btd.h
+++ b/src/btd.h
@@ -104,6 +104,10 @@ struct btd_avdtp_opts {
uint8_t stream_mode;
};
+struct btd_a2dp_opts {
+ uint8_t channels;
+};
+
struct btd_advmon_opts {
uint8_t rssi_sampling_period;
};
@@ -148,6 +152,8 @@ struct btd_opts {
enum jw_repairing_t jw_repairing;
+ struct btd_a2dp_opts a2dp;
+
struct btd_advmon_opts advmon;
struct btd_csis csis;
diff --git a/src/main.c b/src/main.c
index b1339c230..7e74b9728 100644
--- a/src/main.c
+++ b/src/main.c
@@ -162,6 +162,11 @@ static const char *avdtp_options[] = {
NULL
};
+static const char *a2dp_options[] = {
+ "Channels",
+ NULL
+};
+
static const char *advmon_options[] = {
"RSSISamplingPeriod",
NULL
@@ -178,6 +183,7 @@ static const struct group_table {
{ "GATT", gatt_options },
{ "CSIS", csip_options },
{ "AVDTP", avdtp_options },
+ { "A2DP", a2dp_options },
{ "AdvMon", advmon_options },
{ }
};
@@ -1130,6 +1136,13 @@ static void parse_avdtp(GKeyFile *config)
parse_avdtp_stream_mode(config);
}
+static void parse_a2dp(GKeyFile *config)
+{
+ parse_config_u8(config, "A2DP", "Channels",
+ &btd_opts.a2dp.channels,
+ 0, UINT8_MAX);
+}
+
static void parse_advmon(GKeyFile *config)
{
parse_config_u8(config, "AdvMon", "RSSISamplingPeriod",
@@ -1153,6 +1166,7 @@ static void parse_config(GKeyFile *config)
parse_gatt(config);
parse_csis(config);
parse_avdtp(config);
+ parse_a2dp(config);
parse_advmon(config);
}
@@ -1194,6 +1208,8 @@ static void init_defaults(void)
btd_opts.avdtp.session_mode = BT_IO_MODE_BASIC;
btd_opts.avdtp.stream_mode = BT_IO_MODE_BASIC;
+ btd_opts.a2dp.channels = 0;
+
btd_opts.advmon.rssi_sampling_period = 0xFF;
btd_opts.csis.encrypt = true;
}
diff --git a/src/main.conf b/src/main.conf
index 085c81a46..caeb82504 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -296,6 +296,11 @@
# streaming: Use L2CAP Streaming Mode
#StreamMode = basic
+[A2DP]
+# Maximum number of A2DP channels
+# Defaults to 0 (unlimited)
+#Channels = 0
+
[Policy]
#
# The ReconnectUUIDs defines the set of remote services that should try
--
2.39.3 (Apple Git-145)
next prev parent reply other threads:[~2024-01-29 20:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 20:41 [PATCH BlueZ v1 0/2] Introduce option to limit A2DP channels Victor Pushkarev
2024-01-29 20:41 ` Victor Pushkarev [this message]
2024-01-29 22:18 ` bluez.test.bot
2024-01-29 20:41 ` [PATCH BlueZ v1 2/2] a2dp: Reject connection when the channel limit is exceeded Victor Pushkarev
2024-01-29 21:06 ` 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=20240129204154.95773-2-VAnPushkarev@salutedevices.com \
--to=vanpushkarev@salutedevices.com \
--cc=corvinus.v@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=sdfw_system_team@salutedevices.com \
/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).