From f8217980ebcc6a6800052d32f023ebd8f4fbf7fc Mon Sep 17 00:00:00 2001 From: Kausik Sinnaswamy Date: Mon, 24 Sep 2012 17:23:51 +0530 Subject: Trigger restart on BT Controller H/W error On a Bluetooth chip h/w error, trigger an event from the core stack to restart the Bluetooth process. This would ensure that any state is cleaned up and the process starts from scratch Bug: 7001800 Change-Id: I57b0b44276585e2ae3c22ddbcc9d80bd467135b2 Signed-off-by: Iliyan Malchev --- btif/src/btif_dm.c | 10 ++++++++++ btif/src/btif_util.c | 1 + 2 files changed, 11 insertions(+) (limited to 'btif') diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c index 7ab03b4..ac46e87 100644 --- a/btif/src/btif_dm.c +++ b/btif/src/btif_dm.c @@ -40,6 +40,7 @@ #include "btif_util.h" #include "btif_storage.h" #include "btif_hh.h" +#include "btif_config.h" /****************************************************************************** ** Constants & Macros @@ -1227,6 +1228,15 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param) &bd_addr, BT_ACL_STATE_DISCONNECTED); break; + case BTA_DM_HW_ERROR_EVT: + BTIF_TRACE_ERROR0("Received H/W Error. "); + /* Flush storage data */ + btif_config_flush(); + usleep(100000); /* 100milliseconds */ + /* Killing the process to force a restart as part of fault tolerance */ + kill(getpid(), SIGKILL); + break; + case BTA_DM_AUTHORIZE_EVT: case BTA_DM_SIG_STRENGTH_EVT: case BTA_DM_SP_RMT_OOB_EVT: diff --git a/btif/src/btif_util.c b/btif/src/btif_util.c index da23361..5539c11 100644 --- a/btif/src/btif_util.c +++ b/btif/src/btif_util.c @@ -275,6 +275,7 @@ const char* dump_dm_event(UINT16 event) CASE_RETURN_STR(BTA_DM_BLE_LOCAL_ER_EVT) CASE_RETURN_STR(BTA_DM_BLE_AUTH_CMPL_EVT) CASE_RETURN_STR(BTA_DM_DEV_UNPAIRED_EVT) + CASE_RETURN_STR(BTA_DM_HW_ERROR_EVT) default: return "UNKNOWN DM EVENT"; -- cgit v1.1