diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 626f61d..59d11a0 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
if (server->io)
return true;
- if (btd_opts.mps == MPS_OFF)
- mode = BT_IO_MODE_BASIC;
- else
- mode = BT_IO_MODE_STREAMING;
+ mode = btd_opts.avdtp.session_mode;
server->io = bt_io_listen(NULL, confirm_cb, server, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 619b94e..ff0a124 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
int err, timeout;
if (session->state == AVDTP_SESSION_STATE_DISCONNECTED) {
- BtIOMode mode;
-
- if (btd_opts.mps == MPS_OFF)
- mode = BT_IO_MODE_BASIC;
- else
- mode = BT_IO_MODE_ERTM;
+ BtIOMode mode = btd_opts.avdtp.session_mode;
session->io = l2cap_connect(session, mode);
if (!session->io) {
struct seid_rej *resp, int size)
{
struct avdtp_local_sep *sep = stream->lsep;
- BtIOMode mode;
-
- if (btd_opts.mps == MPS_OFF)
- mode = BT_IO_MODE_BASIC;
- else
- mode = BT_IO_MODE_STREAMING;
+ BtIOMode mode = btd_opts.avdtp.stream_mode;
stream->io = l2cap_connect(session, mode);
if (!stream->io) {
diff --git a/src/btd.h b/src/btd.h
index c98414e..a3247e4 100644
--- a/src/btd.h
+++ b/src/btd.h
struct btd_le_defaults le;
};
+struct btd_avdtp_opts {
+ uint8_t session_mode;
+ uint8_t stream_mode;
+};
+
struct btd_opts {
char *name;
uint32_t class;
uint8_t gatt_channels;
enum mps_mode_t mps;
+ struct btd_avdtp_opts avdtp;
+
uint8_t key_size;
enum jw_repairing_t jw_repairing;
diff --git a/src/main.c b/src/main.c
index e6c4d86..33c0f0d 100644
--- a/src/main.c
+++ b/src/main.c
#include "lib/sdp.h"
#include "gdbus/gdbus.h"
+#include "btio/btio.h"
#include "log.h"
#include "backtrace.h"
NULL
};
+static const char *avdtp_options[] = {
+ "SessionMode",
+ "StreamMode",
+ NULL
+};
+
static const struct group_table {
const char *name;
const char **options;
{ "LE", le_options },
{ "Policy", policy_options },
{ "GATT", gatt_options },
+ { "AVDTP", avdtp_options },
{ }
};
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);
}
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,
diff --git a/src/main.conf b/src/main.conf
index 54f6a36..d3bc614 100644
--- a/src/main.conf
+++ b/src/main.conf
# Default to 3
#Channels = 3
+[AVDTP]
+# AVDTP L2CAP Signalling Channel Mode.
+# Possible values:
+# basic: Use L2CAP Basic Mode
+# ertm: Use L2CAP Enhanced Retransmission Mode
+#SessionMode = basic
+
+# AVDTP L2CAP Transport Channel Mode.
+# Possible values:
+# basic: Use L2CAP Basic Mode
+# streaming: Use L2CAP Streaming Mode
+#StreamMode = basic
+
[Policy]
#
# The ReconnectUUIDs defines the set of remote services that should try