summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKausik Sinnaswamy <kausik@broadcom.com>2012-09-21 17:58:59 +0530
committerMatthew Xie <mattx@google.com>2012-09-21 16:39:58 -0700
commitcdd49a6cfd2fedf775dd06e511c050e95508f5b8 (patch)
tree7bfb63a533d74d57d286acec6859e3960598a625
parent0fdeb593e27922d90da480ef8db95537f9c36c6e (diff)
downloadexternal_bluetooth_bluedroid-cdd49a6cfd2fedf775dd06e511c050e95508f5b8.zip
external_bluetooth_bluedroid-cdd49a6cfd2fedf775dd06e511c050e95508f5b8.tar.gz
external_bluetooth_bluedroid-cdd49a6cfd2fedf775dd06e511c050e95508f5b8.tar.bz2
Added a configurable BT disable timer
This timer(BTA_DISABLE_DELAY) if set to a value greater than zero shall delay the chip/transport shutdown. The BTA_DISABLE_DELAY can be fine-tuned per platform. bug 7212447 Change-Id: Ib0346af42f6b596e9fbb281203058872bceffbd9
-rw-r--r--bta/dm/bta_dm_act.c13
-rw-r--r--include/bt_target.h4
2 files changed, 15 insertions, 2 deletions
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index 91577bf..8260847 100644
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -454,9 +454,18 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
if(BTM_GetNumAclLinks()==0)
{
- /* Earlier there used to be a 1-second timer to fire this callback.
- * Doesn't look like it is needed. */
+#if (defined(BTA_DISABLE_DELAY) && BTA_DISABLE_DELAY > 0)
+ /* If BTA_DISABLE_DELAY is defined and greater than zero, then delay the shutdown by
+ * BTA_DISABLE_DELAY milliseconds
+ */
+ APPL_TRACE_WARNING2("%s BTA_DISABLE_DELAY set to %d ms",
+ __FUNCTION__, BTA_DISABLE_DELAY);
+ bta_sys_stop_timer(&bta_dm_cb.disable_timer);
+ bta_dm_cb.disable_timer.p_cback = (TIMER_CBACK*)&bta_dm_disable_conn_down_timer_cback;
+ bta_sys_start_timer(&bta_dm_cb.disable_timer, 0, BTA_DISABLE_DELAY);
+#else
bta_dm_disable_conn_down_timer_cback(NULL);
+#endif
}
else
{
diff --git a/include/bt_target.h b/include/bt_target.h
index 68c8417..05c4a35 100644
--- a/include/bt_target.h
+++ b/include/bt_target.h
@@ -271,6 +271,10 @@
#define BTA_GATT_INCLUDED FALSE
#endif
+#ifndef BTA_DISABLE_DELAY
+#define BTA_DISABLE_DELAY 200 /* in milliseconds */
+#endif
+
#ifndef RPC_TRACE_ONLY
#define RPC_TRACE_ONLY FALSE
#endif