From 9f054de38fb32de0c842da1f4b3e7226fc311e02 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Tue, 10 Jul 2012 16:17:04 -0300 Subject: [PATCH] hog: Fix re-discovering HoG characteristics when reconnecting 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 b8a58bc3c..c7b5bcbfa 100644 --- a/profiles/input/hog_device.c +++ b/profiles/input/hog_device.c @@ -537,12 +537,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) -- 2.47.3