Diff between 4d0336ea40499714747c27389098f76ef10d3700 and eb4b99a433dc163f49d641847ea32fbb317f45b4

Changed Files

File Additions Deletions Status
profiles/input/device.c +2 -0 modified
src/shared/uhid.c +9 -0 modified
src/shared/uhid.h +1 -0 modified

Full Patch

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 4421388..375314e 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -982,6 +982,8 @@ static int uhid_disconnect(struct input_device *idev)
 	if (!idev->uhid_created)
 		return 0;
 
+	bt_uhid_unregister_all(idev->uhid);
+
 	memset(&ev, 0, sizeof(ev));
 	ev.type = UHID_DESTROY;
 
diff --git a/src/shared/uhid.c b/src/shared/uhid.c
index 685f902..71a4e04 100644
--- a/src/shared/uhid.c
+++ b/src/shared/uhid.c
@@ -219,6 +219,15 @@ bool bt_uhid_unregister(struct bt_uhid *uhid, unsigned int id)
 	return true;
 }
 
+bool bt_uhid_unregister_all(struct bt_uhid *uhid)
+{
+	if (!uhid)
+		return false;
+
+	queue_remove_all(uhid->notify_list, NULL, NULL, free);
+	return true;
+}
+
 int bt_uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev)
 {
 	ssize_t len;
diff --git a/src/shared/uhid.h b/src/shared/uhid.h
index 459a249..dbdca85 100644
--- a/src/shared/uhid.h
+++ b/src/shared/uhid.h
@@ -40,5 +40,6 @@ typedef void (*bt_uhid_callback_t)(struct uhid_event *ev, void *user_data);
 unsigned int bt_uhid_register(struct bt_uhid *uhid, uint32_t event,
 				bt_uhid_callback_t func, void *user_data);
 bool bt_uhid_unregister(struct bt_uhid *uhid, unsigned int id);
+bool bt_uhid_unregister_all(struct bt_uhid *uhid);
 
 int bt_uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev);