All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v3] input/hog: Fix double registering report value callbacks
@ 2021-01-25 19:33 Sonny Sasaka
  2021-01-25 20:08 ` [BlueZ,v3] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Sonny Sasaka @ 2021-01-25 19:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sonny Sasaka

In commit 23b69ab3e484 ("input/hog: Cache the HID report map"), we
optimized HOG reconnection by registering report value callbacks early,
but there was a bug where we also re-register the same report value
callbacks after at CCC write callback. We should handle this case by
avoiding the second callback register if we know we have done it
earlier.

---
 profiles/input/hog-lib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index 1f132aa4c..6ac14e401 100644
--- a/profiles/input/hog-lib.c
+++ b/profiles/input/hog-lib.c
@@ -336,6 +336,9 @@ static void report_ccc_written_cb(guint8 status, const guint8 *pdu,
 		return;
 	}
 
+	if (report->notifyid)
+		return;
+
 	report->notifyid = g_attrib_register(hog->attrib,
 					ATT_OP_HANDLE_NOTIFY,
 					report->value_handle,
@@ -1697,6 +1700,9 @@ bool bt_hog_attach(struct bt_hog *hog, void *gatt)
 	for (l = hog->reports; l; l = l->next) {
 		struct report *r = l->data;
 
+		if (r->notifyid)
+			continue;
+
 		r->notifyid = g_attrib_register(hog->attrib,
 					ATT_OP_HANDLE_NOTIFY,
 					r->value_handle,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-25 20:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-25 19:33 [PATCH BlueZ v3] input/hog: Fix double registering report value callbacks Sonny Sasaka
2021-01-25 20:08 ` [BlueZ,v3] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.