summaryrefslogtreecommitdiff
path: root/mesh/mesh-io.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-11-14 15:52:10 -0800
committerBrian Gix <brian.gix@intel.com>2019-11-15 09:23:16 -0800
commitdcc46d4cee21a711e781e493ca50cf70b74bd020 (patch)
treebfe1bdf313cf6ecc4090e452b1708d0c1dacc98a /mesh/mesh-io.c
parentd64f6c885580ef23eb28e53edf1a007bb3628804 (diff)
downloadbluez-dcc46d4cee21a711e781e493ca50cf70b74bd020.tar.gz
mesh: Fix io inititalization sequence
This introduces a chain of callbacks to indicate whether mesh io is initialized and mesh network is ready to use. This fixes the reported situation when the receive callbacks were setup before the HCI was fully initialized. In other words, BT_HCI_CMD_LE_SET_SCAN_PARAMETERS was called before BT_HCI_CMD_RESET and, as the result, the callback issueing BT_HCI_CMD_LE_SET_SCAN_ENABLE command was not called.
Diffstat (limited to 'mesh/mesh-io.c')
-rw-r--r--mesh/mesh-io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mesh/mesh-io.c b/mesh/mesh-io.c
index 94a92e885..95a99b6a5 100644
--- a/mesh/mesh-io.c
+++ b/mesh/mesh-io.c
@@ -52,7 +52,8 @@ static bool match_by_type(const void *a, const void *b)
return io->type == type;
}
-struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts)
+struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts,
+ mesh_io_ready_func_t cb, void *user_data)
{
const struct mesh_io_api *api = NULL;
struct mesh_io *io;
@@ -78,7 +79,7 @@ struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts)
io->type = type;
io->api = api;
- if (!api->init(io, opts))
+ if (!api->init(io, opts, cb, user_data))
goto fail;
if (!io_list)