summaryrefslogtreecommitdiffstats
path: root/btif
diff options
context:
space:
mode:
authorfredc <fredc@broadcom.com>2012-04-19 01:03:17 -0700
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:18 -0700
commit0a74f690813b98c1e8d6fa8f6ed10dc35b7949b6 (patch)
tree97ab43918797f04666eadf6164d981721184d752 /btif
parent541e4c7bdcc7377d46d264e6e1b06f4e81180165 (diff)
downloadexternal_bluetooth_bluedroid-0a74f690813b98c1e8d6fa8f6ed10dc35b7949b6.zip
external_bluetooth_bluedroid-0a74f690813b98c1e8d6fa8f6ed10dc35b7949b6.tar.gz
external_bluetooth_bluedroid-0a74f690813b98c1e8d6fa8f6ed10dc35b7949b6.tar.bz2
Fixed Bluetooth on/off issues
Change-Id: Ibd43c39a2066127458374a3b7533bab12fa20e46
Diffstat (limited to 'btif')
-rw-r--r--btif/include/btif_pan.h2
-rw-r--r--btif/src/btif_av.c6
-rwxr-xr-xbtif/src/btif_core.c14
-rw-r--r--btif/src/btif_pan.c31
4 files changed, 20 insertions, 33 deletions
diff --git a/btif/include/btif_pan.h b/btif/include/btif_pan.h
index 47635d7..065b9da 100644
--- a/btif/include/btif_pan.h
+++ b/btif/include/btif_pan.h
@@ -59,6 +59,4 @@
#define btif_pan_h_
#include <hardware/bt_pan.h>
btpan_interface_t *btif_pan_interface();
-void btif_pan_init();
-void btif_pan_cleanup();
#endif
diff --git a/btif/src/btif_av.c b/btif/src/btif_av.c
index fd8b857..c716920 100644
--- a/btif/src/btif_av.c
+++ b/btif/src/btif_av.c
@@ -714,12 +714,6 @@ static bt_status_t init(btav_callbacks_t* callbacks )
/* check if stack/gki is started/enabled yet, if not defer until bluetooth
is enabled */
- if (btif_is_enabled() == 0)
- {
- BTIF_TRACE_EVENT0("deferred av init until gki is enabled");
- return BT_STATUS_SUCCESS;
- }
-
return btif_av_init();
}
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c
index d3c8447..3c0142d 100755
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.c
@@ -513,9 +513,6 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status, BD_ADDR local_bd)
/* init rfcomm & l2cap api */
btif_sock_init();
- /* init pan */
- btif_pan_init();
-
/* load did configuration */
bte_load_did_conf(BTE_DID_CONF_FILE);
@@ -526,8 +523,6 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status, BD_ADDR local_bd)
/* cleanup rfcomm & l2cap api */
btif_sock_cleanup();
- btif_pan_cleanup();
-
btif_enabled = 0;
HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_OFF);
@@ -561,7 +556,7 @@ bt_status_t btif_disable_bluetooth(void)
/* cleanup rfcomm & l2cap api */
btif_sock_cleanup();
- btif_pan_cleanup();
+ //btif_pan_cleanup();
status = BTA_DisableBluetooth();
@@ -590,6 +585,7 @@ void btif_disable_bluetooth_evt(void)
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
bte_main_disable();
+ BTIF_TRACE_DEBUG1("%s: returning from bte_main_disable", __FUNCTION__);
/* callback to HAL */
HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_OFF);
@@ -599,6 +595,7 @@ void btif_disable_bluetooth_evt(void)
if (btif_shutdown_pending)
{
+ BTIF_TRACE_DEBUG1("%s: calling btif_shutdown_bluetooth", __FUNCTION__);
btif_shutdown_bluetooth();
}
}
@@ -632,8 +629,9 @@ bt_status_t btif_shutdown_bluetooth(void)
btif_shutdown_pending = 0;
GKI_destroy_task(BTIF_TASK);
-
+ BTIF_TRACE_DEBUG1("%s: calling bte_main_shutdown", __FUNCTION__);
bte_main_shutdown();
+ BTIF_TRACE_DEBUG1("Leaving %s", __FUNCTION__);
return BT_STATUS_SUCCESS;
}
@@ -1232,7 +1230,7 @@ bt_status_t btif_disable_service(tBTA_SERVICE_ID service_id)
*/
btif_enabled_services &= (tBTA_SERVICE_MASK)(~(1<<service_id));
BTIF_TRACE_ERROR2("%s: Current Services:0x%x", __FUNCTION__, btif_enabled_services);
- if (btif_enabled == 1)
+ if (btif_enabled == 1)
{
btif_transfer_context(btif_dm_execute_service_request,
BTIF_DM_DISABLE_SERVICE,
diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c
index 5b1e571..7edd88a 100644
--- a/btif/src/btif_pan.c
+++ b/btif/src/btif_pan.c
@@ -133,11 +133,13 @@ btpan_interface_t *btif_pan_get_interface()
{
return &pan_if;
}
-void btif_pan_init()
+
+static btpan_callbacks_t callback;
+static bt_status_t btpan_init(const btpan_callbacks_t* callbacks)
{
+ //static volatile int binit;
+
debug("in, btpan_cb.enabled:%d", btpan_cb.enabled);
- //btif_enable_service(BTA_PANU_SERVICE_ID);
- //btif_enable_service(BTA_NAP_SERVICE_ID);
if (!btpan_cb.enabled)
{
//btui_cfg.pan_security = PAN_SECURITY;
@@ -156,10 +158,15 @@ void btif_pan_init()
btpan_enable(BTPAN_ROLE_PANU);
//debug("set to BTPAN_ROLE_PANNAP for testing");
//btpan_enable(BTPAN_ROLE_PANNAP);
+ callback = *callbacks;
+ return BT_STATUS_SUCCESS;
}
+ return BT_STATUS_FAIL;
}
-void btif_pan_cleanup()
+
+static void btpan_cleanup()
{
+ debug("in, btpan_cb.enabled:%d", btpan_cb.enabled);
debug("in, bt is shuting down...");
//bt is shuting down, invalid all bta pan handles
int i;
@@ -167,19 +174,7 @@ void btif_pan_cleanup()
{
btpan_cleanup_conn(&btpan_cb.conns[i]);
}
- btpan_cleanup();
-}
-static btpan_callbacks_t callback;
-static bt_status_t btpan_init(const btpan_callbacks_t* callbacks)
-{
- debug("in, btpan_cb.enabled:%d", btpan_cb.enabled);
- static volatile int binit;
- callback = *callbacks;
- return BT_STATUS_SUCCESS;
-}
-static void btpan_cleanup()
-{
- debug("in, btpan_cb.enabled:%d", btpan_cb.enabled);
+
if (btpan_cb.enabled)
{
btpan_cb.enabled = 0;
@@ -191,7 +186,9 @@ static void btpan_cleanup()
btpan_cb.tap_fd = -1;
}
}
+ debug("out, %s", __FUNCTION__);
}
+
static inline int bta_role_to_btpan(int bta_pan_role)
{
int btpan_role = 0;