Skip to content

Commit

Permalink
Bluetooth: GATT: Fix regression in lazy loading of CCCs
Browse files Browse the repository at this point in the history
Fix regression in lazy loading handling of GATT CCCs.
Bug introduced by: 00d370b
The commit failed to account for ccc_set_direct calling ccc_set.

Fixes: #29150

Signed-off-by: Joakim Andersson <[email protected]>
  • Loading branch information
joerchan authored and nashif committed Nov 17, 2020
1 parent 60c27be commit c2a0b0f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions subsys/bluetooth/host/gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4339,11 +4339,6 @@ static uint8_t ccc_load(const struct bt_gatt_attr *attr, uint16_t handle,
static int ccc_set(const char *name, size_t len_rd, settings_read_cb read_cb,
void *cb_arg)
{
if (IS_ENABLED(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING)) {
/* Only load CCCs on demand */
return 0;
}

if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
struct ccc_store ccc_store[CCC_STORE_MAX];
struct ccc_load load;
Expand Down Expand Up @@ -4401,7 +4396,18 @@ static int ccc_set(const char *name, size_t len_rd, settings_read_cb read_cb,
return 0;
}

SETTINGS_STATIC_HANDLER_DEFINE(bt_ccc, "bt/ccc", NULL, ccc_set, NULL, NULL);
static int ccc_set_cb(const char *name, size_t len_rd, settings_read_cb read_cb,
void *cb_arg)
{
if (IS_ENABLED(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING)) {
/* Only load CCCs on demand */
return 0;
}

return ccc_set(name, len_rd, read_cb, cb_arg);
}

SETTINGS_STATIC_HANDLER_DEFINE(bt_ccc, "bt/ccc", NULL, ccc_set_cb, NULL, NULL);

static int ccc_set_direct(const char *key, size_t len, settings_read_cb read_cb,
void *cb_arg, void *param)
Expand Down

0 comments on commit c2a0b0f

Please sign in to comment.