shared/gatt-client: Fix removing services with no attributes 25/163225/1
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 30 May 2017 11:40:56 +0000 (14:40 +0300)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 8 Dec 2017 05:21:55 +0000 (14:21 +0900)
This patch comes from below commit of upstream.

commit d6c07ecf22ba60d6dd1b7302281eb32e1f278ca7
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Tue May 30 14:40:56 2017 +0300

shared/gatt-client: Fix removing services with no attributes

If a service has no attributes, like IPSS, just mark it as active and
skip doing any attribute discover.

Change-Id: I08eac1787f95fd091470496764bf8cf9924c0520
Signed-off-by: Seungyoun Ju <sy39.ju@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/shared/gatt-client.c

index e5fe420..d8b4f72 100644 (file)
@@ -1004,7 +1004,11 @@ static void discovery_found_service(struct discovery_op *op,
 {
        /* Skip if service already active */
        if (!gatt_db_service_get_active(attr)) {
-               queue_push_tail(op->pending_svcs, attr);
+               /* Skip if there are no attributes */
+               if (end == start)
+                       gatt_db_service_set_active(attr, true);
+               else
+                       queue_push_tail(op->pending_svcs, attr);
 
                /* Update discovery range */
                if (!op->svc_first || op->svc_first > start)