From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: inga.stotland@intel.com, johan.hedberg@intel.com,
Brian Gix <brian.gix@intel.com>
Subject: [PATCH BlueZ] mesh: Add MGMT bypass when specifying controller
Date: Thu, 31 Jan 2019 12:50:22 -0800 [thread overview]
Message-ID: <20190131205022.6689-1-brian.gix@intel.com> (raw)
If Daemon is started with an explicit controller specified, the
MGMT search for an unused shared controller is bypassed, and
the controller is opened directly.
---
mesh/mesh.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/mesh/mesh.c b/mesh/mesh.c
index 881b6ed73..e49653ef8 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -304,7 +304,7 @@ bool mesh_init(uint16_t index, const char *config_dir)
if (initialized)
return true;
- if (!init_mgmt()) {
+ if (index == MGMT_INDEX_NONE && !init_mgmt()) {
l_error("Failed to initialize mesh management");
return false;
}
@@ -326,12 +326,18 @@ bool mesh_init(uint16_t index, const char *config_dir)
if (!storage_load_nodes(config_dir))
return false;
- l_debug("send read index_list");
- if (mgmt_send(mgmt_mesh, MGMT_OP_READ_INDEX_LIST,
- MGMT_INDEX_NONE, 0, NULL,
- read_index_list_cb, NULL, NULL) <= 0)
- return false;
-
+ if (index == MGMT_INDEX_NONE) {
+ /* Use MGMT to find a candidate controller */
+ l_debug("send read index_list");
+ if (mgmt_send(mgmt_mesh, MGMT_OP_READ_INDEX_LIST,
+ MGMT_INDEX_NONE, 0, NULL,
+ read_index_list_cb, NULL, NULL) <= 0)
+ return false;
+ } else {
+ /* Open specified controller without searching */
+ start_io(mesh.req_index);
+ return mesh.io != NULL;
+ }
return true;
}
--
2.14.5
next reply other threads:[~2019-01-31 20:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-31 20:50 Brian Gix [this message]
2019-02-04 20:11 ` [PATCH BlueZ] mesh: Add MGMT bypass when specifying controller Gix, Brian
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=20190131205022.6689-1-brian.gix@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@intel.com \
--cc=johan.hedberg@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/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).