diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 0a66589..f00e5c9 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
#include "gdbus/gdbus.h"
+#include "src/hcid.h"
#include "src/plugin.h"
#include "src/adapter.h"
#include "src/device.h"
static bool a2dp_server_listen(struct a2dp_server *server)
{
GError *err = NULL;
+ BtIOMode mode;
if (server->io)
return true;
+ if (main_opts.mps == MPS_OFF)
+ mode = BT_IO_MODE_BASIC;
+ else
+ mode = BT_IO_MODE_STREAMING;
+
server->io = bt_io_listen(NULL, confirm_cb, server, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
btd_adapter_get_address(server->adapter),
BT_IO_OPT_PSM, AVDTP_PSM,
+ BT_IO_OPT_MODE, mode,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
BT_IO_OPT_MASTER, true,
BT_IO_OPT_INVALID);
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 45727f0..e5193f7 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
#include "lib/uuid.h"
#include "btio/btio.h"
+#include "src/hcid.h"
#include "src/log.h"
#include "src/shared/util.h"
#include "src/shared/queue.h"
GError *err = NULL;
GIOChannel *io;
const bdaddr_t *src;
+ BtIOMode mode;
src = btd_adapter_get_address(device_get_adapter(session->device));
+ if (main_opts.mps == MPS_OFF)
+ mode = BT_IO_MODE_BASIC;
+ else
+ mode = BT_IO_MODE_STREAMING;
+
if (session->phy)
io = bt_io_connect(avdtp_connect_cb, session,
NULL, &err,
BT_IO_OPT_DEST_BDADDR,
device_get_address(session->device),
BT_IO_OPT_PSM, AVDTP_PSM,
+ BT_IO_OPT_MODE, mode,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
/* Set Input MTU to 0 to auto-tune */
BT_IO_OPT_IMTU, 0,
BT_IO_OPT_DEST_BDADDR,
device_get_address(session->device),
BT_IO_OPT_PSM, AVDTP_PSM,
+ BT_IO_OPT_MODE, mode,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
BT_IO_OPT_INVALID);
if (!io) {
diff --git a/src/hcid.h b/src/hcid.h
index 56e2b4f..1b2714b 100644
--- a/src/hcid.h
+++ b/src/hcid.h
JW_REPAIRING_ALWAYS,
};
+enum mps_mode_t {
+ MPS_OFF,
+ MPS_SINGLE,
+ MPS_MULTIPLE,
+};
+
struct main_opts {
char *name;
uint32_t class;
bt_gatt_cache_t gatt_cache;
uint16_t gatt_mtu;
uint8_t gatt_channels;
+ enum mps_mode_t mps;
uint8_t key_size;
diff --git a/src/main.c b/src/main.c
index 50e37e5..e51f614 100644
--- a/src/main.c
+++ b/src/main.c
static GKeyFile *main_conf;
static char *main_conf_file_path;
-static enum {
- MPS_OFF,
- MPS_SINGLE,
- MPS_MULTIPLE,
-} mps = MPS_OFF;
-
static const char *supported_options[] = {
"Name",
"Class",
DBG("MultiProfile=%s", str);
if (!strcmp(str, "single"))
- mps = MPS_SINGLE;
+ main_opts.mps = MPS_SINGLE;
else if (!strcmp(str, "multiple"))
- mps = MPS_MULTIPLE;
+ main_opts.mps = MPS_MULTIPLE;
+ else
+ main_opts.mps = MPS_OFF;
g_free(str);
}
main_opts.did_version);
}
- if (mps != MPS_OFF)
- register_mps(mps == MPS_MULTIPLE);
+ if (main_opts.mps != MPS_OFF)
+ register_mps(main_opts.mps == MPS_MULTIPLE);
/* Loading plugins has to be done after D-Bus has been setup since
* the plugins might wanna expose some paths on the bus. However the