Skip to content

Commit eba3fd1

Browse files
committed
bluetooth: hids: 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 f10635e commit eba3fd1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • subsys/bluetooth/services

subsys/bluetooth/services/hogp.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,10 +1077,19 @@ int bt_hogp_rep_subscribe(struct bt_hogp *hogp,
10771077
int bt_hogp_rep_unsubscribe(struct bt_hogp *hogp,
10781078
struct bt_hogp_rep_info *rep)
10791079
{
1080+
int ret;
1081+
10801082
if (!hogp || !rep) {
10811083
return -EINVAL;
10821084
}
1083-
return bt_gatt_unsubscribe(hogp->conn, &rep->notify_params);
1085+
1086+
ret = bt_gatt_unsubscribe(hogp->conn, &rep->notify_params);
1087+
1088+
if (!ret) {
1089+
rep->notify_cb = NULL;
1090+
}
1091+
1092+
return ret;
10841093
}
10851094

10861095
/**

0 commit comments

Comments
 (0)