OSDN Git Service

Bluetooth: Add logic to cancel link timeout alarm
authorNitin Arora <niarora@codeaurora.org>
Mon, 25 Jul 2016 18:33:19 +0000 (11:33 -0700)
committerLinux Build Service Account <lnxbuild@localhost>
Wed, 24 Aug 2016 14:10:07 +0000 (08:10 -0600)
Issue:
Post bonding process, temporary gatt connections are
created to perform device name discovery and remote
device discovery before any profile level connections
are made for remote devices. At every disconnection
the number of apps holding the physical link is validated
to keep the link alive. A disconnection starts the idle
timeout of 1sec if there is no other apps available.
However, a new logical connection is unable to reset
the timer, even if the link comes up, within 1sec of
the last disconnection.

Fix:
At every connection occuring within the "No app timeout",
the link timer is cancelled since there is still a gatt_if
that needs to keep the link alive.

CRs-Fixed: 1050047
Change-Id: I3205894e4d692e4e8b1a547b6fb4d346c4f281a5

stack/gatt/gatt_main.c
stack/l2cap/l2c_utils.c [changed mode: 0755->0644]

index 8bbd650..9ed17df 100644 (file)
@@ -417,7 +417,7 @@ BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT trans
 
     if (ret)
     {
-        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, FALSE);
+        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE);
     }
 
     return ret;
old mode 100755 (executable)
new mode 100644 (file)
index aaf65d7..e774175
@@ -2870,13 +2870,17 @@ void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb)
         }
     }
 
+    if (timeout_ms == (1000) * (0xFFFF))
+        start_timeout = false;
+
     if (start_timeout) {
-        L2CAP_TRACE_DEBUG("%s starting IDLE timeout: %d ms", __func__,
+        L2CAP_TRACE_DEBUG("%s starting IDLE timeout: %llu ms", __func__,
                           timeout_ms);
         alarm_set_on_queue(p_lcb->l2c_lcb_timer, timeout_ms,
                            l2c_lcb_timer_timeout, p_lcb,
                            btu_general_alarm_queue);
     } else {
+        L2CAP_TRACE_DEBUG("%s, alarm cancel", __func__);
         alarm_cancel(p_lcb->l2c_lcb_timer);
     }
 }