[PATCH BlueZ 12/13] hog: Fix re-discovering HoG characteristics when reconnecting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxxxxxx>

If the reports list is already present there's no need rediscovering all
the characteristics. This should also make reconnections faster.
---
 profiles/input/hog_device.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c
index 18854b8..7f4cf2d 100644
--- a/profiles/input/hog_device.c
+++ b/profiles/input/hog_device.c
@@ -536,12 +536,15 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
 
 	hogdev->attrib = g_attrib_ref(attrib);
 
-	gatt_discover_char(hogdev->attrib, prim->range.start, prim->range.end,
-					NULL, char_discovered_cb, hogdev);
-
 	hogdev->report_cb_id = g_attrib_register(hogdev->attrib,
 					ATT_OP_HANDLE_NOTIFY, report_value_cb,
 					hogdev, NULL);
+
+	if (hogdev->reports == NULL) {
+		gatt_discover_char(hogdev->attrib, prim->range.start,
+						prim->range.end, NULL,
+						char_discovered_cb, hogdev);
+	}
 }
 
 static void attio_disconnected_cb(gpointer user_data)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux