diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2020-11-16 14:01:34 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2020-11-17 09:30:32 -0800 |
commit | f3bd1908b0db7e829ab580736ed5ec187322de68 (patch) | |
tree | c827ee2a04ab80d99f822ed304eb942264dee456 /src/main.c | |
parent | b6e37c1213fdc3387c8e8324225db69933b8809c (diff) | |
download | bluez-f3bd1908b0db7e829ab580736ed5ec187322de68.tar.gz |
main.conf: Add option to configure AVDP session/stream channel modes
This adds a new group AVDTP where platform can configure the preferred
L2CAP channel modes for both session (signalling) and stream
(transport). For backward compatibility the both SessionMode and
StreamMode defaults to basic mode.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index e6c4d861e..33c0f0d15 100644 --- a/src/main.c +++ b/src/main.c @@ -34,6 +34,7 @@ #include "lib/sdp.h" #include "gdbus/gdbus.h" +#include "btio/btio.h" #include "log.h" #include "backtrace.h" @@ -137,6 +138,12 @@ static const char *gatt_options[] = { NULL }; +static const char *avdtp_options[] = { + "SessionMode", + "StreamMode", + NULL +}; + static const struct group_table { const char *name; const char **options; @@ -146,6 +153,7 @@ static const struct group_table { { "LE", le_options }, { "Policy", policy_options }, { "GATT", gatt_options }, + { "AVDTP", avdtp_options }, { } }; @@ -744,6 +752,40 @@ static void parse_config(GKeyFile *config) btd_opts.gatt_channels = val; } + str = g_key_file_get_string(config, "AVDTP", "SessionMode", &err); + if (err) { + DBG("%s", err->message); + g_clear_error(&err); + } else { + DBG("SessionMode=%s", str); + + if (!strcmp(str, "basic")) + btd_opts.avdtp.session_mode = BT_IO_MODE_BASIC; + else if (!strcmp(str, "ertm")) + btd_opts.avdtp.session_mode = BT_IO_MODE_ERTM; + else { + DBG("Invalid mode option: %s", str); + btd_opts.avdtp.session_mode = BT_IO_MODE_BASIC; + } + } + + val = g_key_file_get_integer(config, "AVDTP", "StreamMode", &err); + if (err) { + DBG("%s", err->message); + g_clear_error(&err); + } else { + DBG("StreamMode=%s", str); + + if (!strcmp(str, "basic")) + btd_opts.avdtp.stream_mode = BT_IO_MODE_BASIC; + else if (!strcmp(str, "streaming")) + btd_opts.avdtp.stream_mode = BT_IO_MODE_STREAMING; + else { + DBG("Invalid mode option: %s", str); + btd_opts.avdtp.stream_mode = BT_IO_MODE_BASIC; + } + } + parse_br_config(config); parse_le_config(config); } @@ -780,6 +822,9 @@ static void init_defaults(void) btd_opts.gatt_cache = BT_GATT_CACHE_ALWAYS; btd_opts.gatt_mtu = BT_ATT_MAX_LE_MTU; btd_opts.gatt_channels = 3; + + btd_opts.avdtp.session_mode = BT_IO_MODE_BASIC; + btd_opts.avdtp.stream_mode = BT_IO_MODE_BASIC; } static void log_handler(const gchar *log_domain, GLogLevelFlags log_level, |