From 606b5e7054bbb5128f2fe000c2736efe475f2b9f Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Wed, 10 Dec 2014 11:59:35 +0100 Subject: [PATCH] core: Add support for Multi Profile Specification This adds new main.conf configure option named MultiProfile. It allows to enable MPSD and MPMD scenarios for MPS. By default MPS is disabled. --- src/main.c | 24 ++++++++++++++++++++++++ src/main.conf | 7 +++++++ 2 files changed, 31 insertions(+) diff --git a/src/main.c b/src/main.c index b3140d0d2..05eb13d2e 100644 --- a/src/main.c +++ b/src/main.c @@ -69,6 +69,12 @@ struct main_opts main_opts; static GKeyFile *main_conf; +static enum { + MPS_OFF, + MPS_SINGLE, + MPS_MULTIPLE, +} mps = MPS_OFF; + static const char * const supported_options[] = { "Name", "Class", @@ -81,6 +87,7 @@ static const char * const supported_options[] = { "NameResolving", "DebugKeys", "ControllerMode", + "MultiProfile", }; GKeyFile *btd_get_main_conf(void) @@ -307,6 +314,20 @@ static void parse_config(GKeyFile *config) main_opts.mode = get_mode(str); g_free(str); } + + str = g_key_file_get_string(config, "General", "MultiProfile", &err); + if (err) { + g_clear_error(&err); + } else { + DBG("MultiProfile=%s", str); + + if (!strcmp(str, "single")) + mps = MPS_SINGLE; + else if (!strcmp(str, "multiple")) + mps = MPS_MULTIPLE; + + g_free(str); + } } static void init_defaults(void) @@ -599,6 +620,9 @@ int main(int argc, char *argv[]) register_device_id(main_opts.did_source, main_opts.did_vendor, main_opts.did_product, main_opts.did_version); + if (mps != MPS_OFF) + register_mps(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 * best order of how to init various subsystems of the Bluetooth diff --git a/src/main.conf b/src/main.conf index d4d6ab098..9be90af03 100644 --- a/src/main.conf +++ b/src/main.conf @@ -52,6 +52,13 @@ # Possible values: "dual", "bredr", "le" #ControllerMode = dual +# Enables Multi Profile Specification support. This allows to specify if +# system supports only Multiple Profiles Single Device (MPSD) configuration +# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple +# Devices (MPMD) configurations. +# Possible values: "off", "single", "multiple" +#MultiProfile = off + #[Policy] # # The ReconnectUUIDs defines the set of remote services that should try -- 2.47.3