Skip to content

Commit 59580d1

Browse files
committed
bluetooth: hogp: Fix bt_hogp_rep_unsubscribe issue
The bt_hogp_rep_unsubscribe did not reset the rep->notify_cb, while bt_hogp_rep_subscribe returned an error if notify_cb was not null. Thus, it would be impossible to subscribe again to the report notification after unsubscribing. This commit fixes this. Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
1 parent 6ec529b commit 59580d1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • subsys/bluetooth/services

subsys/bluetooth/services/hogp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ static uint8_t rep_notify_process(struct bt_conn *conn,
10131013
struct bt_gatt_subscribe_params *params,
10141014
const void *data, uint16_t length)
10151015
{
1016+
int err = 0;
10161017
struct bt_hogp_rep_info *rep;
10171018

10181019
rep = CONTAINER_OF(params,
@@ -1033,7 +1034,13 @@ static uint8_t rep_notify_process(struct bt_conn *conn,
10331034
rep->size = (uint8_t)length;
10341035
}
10351036

1036-
return rep->notify_cb(rep->hogp, rep, 0, data);
1037+
err = rep->notify_cb(rep->hogp, rep, 0, data);
1038+
1039+
if (data == NULL) {
1040+
rep->notify_cb = NULL;
1041+
}
1042+
1043+
return err;
10371044
}
10381045

10391046
int bt_hogp_rep_subscribe(struct bt_hogp *hogp,

0 commit comments

Comments
 (0)