diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 030a417d58a..f1714a805bb 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1152,6 +1152,7 @@ endif # BT_MESH_OP_AGG_CLI config BT_MESH_LARGE_COMP_DATA_SRV bool "Support for Large Composition Data Server Model" + depends on BT_MESH_MODEL_EXTENSIONS help Enable support for the Large Composition Data Server model. diff --git a/subsys/bluetooth/mesh/large_comp_data_srv.c b/subsys/bluetooth/mesh/large_comp_data_srv.c index f47947b9b92..d4e5af40147 100644 --- a/subsys/bluetooth/mesh/large_comp_data_srv.c +++ b/subsys/bluetooth/mesh/large_comp_data_srv.c @@ -170,8 +170,11 @@ const struct bt_mesh_model_op _bt_mesh_large_comp_data_srv_op[] = { static int large_comp_data_srv_init(const struct bt_mesh_model *model) { - if (!bt_mesh_model_in_primary(model)) { - LOG_ERR("Large Composition Data Server only allowed in primary element"); + const struct bt_mesh_model *config_srv = + bt_mesh_model_find(bt_mesh_model_elem(model), BT_MESH_MODEL_ID_CFG_SRV); + + if (config_srv == NULL) { + LOG_ERR("Large Composition Data Server cannot extend Configuration server"); return -EINVAL; } @@ -181,6 +184,8 @@ static int large_comp_data_srv_init(const struct bt_mesh_model *model) srv.model = model; + bt_mesh_model_extend(model, config_srv); + return 0; }