summaryrefslogtreecommitdiffstats
path: root/hci/src
diff options
context:
space:
mode:
authorKiran Kelageri <kirankelageri@codeaurora.org>2015-08-04 15:46:33 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:21:49 -0600
commit4a924fdcae4493b082295b76511d448456c5e36a (patch)
treefef44680c55ba85f3175fdb599da8eb23e27ddd0 /hci/src
parent273de486f3b1771be80b83ed30fa7df4449c7eab (diff)
downloadandroid_system_bt-4a924fdcae4493b082295b76511d448456c5e36a.tar.gz
android_system_bt-4a924fdcae4493b082295b76511d448456c5e36a.tar.bz2
android_system_bt-4a924fdcae4493b082295b76511d448456c5e36a.zip
Bluetooth: Enable SSR.
Enabling SSR feature. Change-Id: I26eab5b3a10ac7823ff5e9f2adc3bc187939c87e
Diffstat (limited to 'hci/src')
-rw-r--r--hci/src/hci_layer.c19
-rw-r--r--hci/src/vendor.c8
2 files changed, 26 insertions, 1 deletions
diff --git a/hci/src/hci_layer.c b/hci/src/hci_layer.c
index 5138ce6e1..0d1c62b92 100644
--- a/hci/src/hci_layer.c
+++ b/hci/src/hci_layer.c
@@ -44,6 +44,7 @@
#include "packet_fragmenter.h"
#include "osi/include/reactor.h"
#include "vendor.h"
+#include "bt_target.h"
// TODO(zachoverflow): remove this hack extern
#include <hardware/bluetooth.h>
@@ -162,6 +163,8 @@ static bool filter_incoming_event(BT_HDR *packet);
static serial_data_type_t event_to_data_type(uint16_t event);
static waiting_command_t *get_waiting_command(command_opcode_t opcode);
+void ssr_cleanup (void);
+
// Module lifecycle functions
static future_t *start_up(void) {
@@ -517,7 +520,8 @@ static void command_timed_out(UNUSED_ATTR void *context) {
}
LOG_ERROR("%s restarting the bluetooth process.", __func__);
- usleep(10000);
+ ssr_cleanup();
+ usleep(20000);
kill(getpid(), SIGKILL);
}
@@ -690,6 +694,18 @@ intercepted:;
return true;
}
+/** SSR cleanup is used in HW reset cases
+** which would close all the client channels
+** and turns off the chip*/
+void ssr_cleanup (void) {
+ LOG_INFO("%s", __func__);
+ if (vendor != NULL) {
+ vendor->ssr_cleanup();
+ } else {
+ LOG_ERROR("%s: vendor is NULL", __func__);
+ }
+}
+
// Callback for the fragmenter to dispatch up a completely reassembled packet
static void dispatch_reassembled(BT_HDR *packet) {
// Events should already have been dispatched before this point
@@ -758,6 +774,7 @@ static void init_layer_interface() {
interface.transmit_command = transmit_command;
interface.transmit_command_futured = transmit_command_futured;
interface.transmit_downward = transmit_downward;
+ interface.ssr_cleanup = ssr_cleanup;
interface_created = true;
}
}
diff --git a/hci/src/vendor.c b/hci/src/vendor.c
index 2e220e4a7..ccc0003d5 100644
--- a/hci/src/vendor.c
+++ b/hci/src/vendor.c
@@ -89,6 +89,13 @@ static void vendor_close(void) {
lib_interface = NULL;
lib_handle = NULL;
}
+void vendor_ssrcleanup(void) {
+ if (lib_interface)
+ lib_interface->ssr_cleanup();
+ else
+ LOG_ERROR("%s lib_interface is NULL", __func__);
+
+}
static int send_command(vendor_opcode_t opcode, void *param) {
assert(lib_interface != NULL);
@@ -204,6 +211,7 @@ static const vendor_t interface = {
send_command,
send_async_command,
set_callback,
+ vendor_ssrcleanup
};
const vendor_t *vendor_get_interface() {