Add platform-independent logging macros to OSI.
These macros should replace ALOG* and the various trace macros
used throughout bluedroid. This change eliminates all uses of the
ALOG* macros in favor of the new ones.
diff --git a/audio_a2dp_hw/Android.mk b/audio_a2dp_hw/Android.mk
index 86dd5a7..62a0505 100644
--- a/audio_a2dp_hw/Android.mk
+++ b/audio_a2dp_hw/Android.mk
@@ -7,6 +7,7 @@
LOCAL_C_INCLUDES += \
. \
+ $(LOCAL_PATH)/../ \
$(LOCAL_PATH)/../utils/include
LOCAL_CFLAGS += -std=c99 $(bdroid_CFLAGS)
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c
index 88ac8d6..632b1da 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.c
+++ b/audio_a2dp_hw/audio_a2dp_hw.c
@@ -47,8 +47,7 @@
#include "bt_utils.h"
#define LOG_TAG "audio_a2dp_hw"
-/* #define LOG_NDEBUG 0 */
-#include <log/log.h>
+#include "osi/include/log.h"
/*****************************************************************************
** Constants & Macros
@@ -59,10 +58,10 @@
#define CASE_RETURN_STR(const) case const: return #const;
-#define FNLOG() ALOGV("%s", __FUNCTION__);
-#define DEBUG(fmt, ...) ALOGV("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define INFO(fmt, ...) ALOGI("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define ERROR(fmt, ...) ALOGE("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
+#define FNLOG() LOG_VERBOSE("%s", __FUNCTION__);
+#define DEBUG(fmt, ...) LOG_VERBOSE("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
+#define INFO(fmt, ...) LOG_INFO("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
+#define ERROR(fmt, ...) LOG_ERROR("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define ASSERTC(cond, msg, val) if (!(cond)) {ERROR("### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
diff --git a/bta/Android.mk b/bta/Android.mk
index c650066..e5e853f 100644
--- a/bta/Android.mk
+++ b/bta/Android.mk
@@ -93,6 +93,7 @@
$(LOCAL_PATH)/sys \
$(LOCAL_PATH)/dm \
$(LOCAL_PATH)/hh \
+ $(LOCAL_PATH)/../ \
$(LOCAL_PATH)/../btcore/include \
$(LOCAL_PATH)/../gki/common \
$(LOCAL_PATH)/../gki/ulinux \
diff --git a/bta/gatt/bta_gattc_act.c b/bta/gatt/bta_gattc_act.c
index a512969..0731c7a 100755
--- a/bta/gatt/bta_gattc_act.c
+++ b/bta/gatt/bta_gattc_act.c
@@ -22,6 +22,7 @@
* machine.
*
******************************************************************************/
+#define LOG_TAG "bta_gattc_act"
#include "bt_target.h"
@@ -38,6 +39,8 @@
#include <string.h>
+#include "osi/include/log.h"
+
#if BTA_GATT_INCLUDED && BLE_INCLUDED == TRUE
/*****************************************************************************
@@ -2303,7 +2306,7 @@
/* if listen to all */
else
{
- APPL_TRACE_ERROR("Listen For All now");
+ LOG_DEBUG("Listen For All now");
/* go through all connected device and send
callback for all connected slave connection */
bta_gattc_process_listen_all(p_msg->api_listen.client_if);
diff --git a/bta/sys/bta_sys_main.c b/bta/sys/bta_sys_main.c
index 096b86a..ee9e953 100644
--- a/bta/sys/bta_sys_main.c
+++ b/bta/sys/bta_sys_main.c
@@ -21,9 +21,9 @@
* This is the main implementation file for the BTA system manager.
*
******************************************************************************/
-#include <assert.h>
#define LOG_TAG "bta_sys_main"
-#include <cutils/log.h>
+
+#include <assert.h>
#include <string.h>
#include "alarm.h"
@@ -37,6 +37,7 @@
#include "hash_functions.h"
#include "hash_map.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "thread.h"
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#include "bta_ar_api.h"
@@ -632,7 +633,7 @@
alarm_t *alarm = hash_map_get(bta_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGE("%s unable to create alarm.", __func__);
+ LOG_ERROR("%s unable to create alarm.", __func__);
return;
}
@@ -655,7 +656,7 @@
alarm_t *alarm = hash_map_get(bta_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGE("%s expected alarm was not in bta alarm hash map.", __func__);
+ LOG_ERROR("%s expected alarm was not in bta alarm hash map.", __func__);
return;
}
alarm_cancel(alarm);
diff --git a/btcore/src/counter.c b/btcore/src/counter.c
index da0dcc8..d7bdc3c 100644
--- a/btcore/src/counter.c
+++ b/btcore/src/counter.c
@@ -19,7 +19,6 @@
#define LOG_TAG "bt_counter"
#include <assert.h>
-#include <cutils/log.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
@@ -33,6 +32,7 @@
#include "list.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "socket.h"
#include "thread.h"
@@ -123,12 +123,12 @@
hash_map_counter_ = hash_map_new(COUNTER_NUM_BUCKETS, hash_function_string,
NULL, hash_element_free_);
if (hash_map_counter_ == NULL) {
- ALOGE("%s unable to allocate resources", __func__);
+ LOG_ERROR("%s unable to allocate resources", __func__);
return future_new_immediate(FUTURE_FAIL);
}
if (!counter_socket_open()) {
- ALOGE("%s unable to open counter port", __func__);
+ LOG_ERROR("%s unable to open counter port", __func__);
return future_new_immediate(FUTURE_FAIL);
}
return future_new_immediate(FUTURE_SUCCESS);
@@ -221,13 +221,13 @@
counter = counter_new_(0);
if (!counter) {
- ALOGE("%s unable to create new counter name:%s", __func__, name);
+ LOG_ERROR("%s unable to create new counter name:%s", __func__, name);
goto exit;
}
hash_element_t *element = hash_element_new_();
if (!element) {
- ALOGE("%s unable to create counter element name:%s", __func__, name);
+ LOG_ERROR("%s unable to create counter element name:%s", __func__, name);
counter_free_(counter);
counter = NULL;
goto exit;
@@ -236,7 +236,7 @@
element->key = name;
element->val = counter;
if (!hash_map_set(hash_map_counter_, name, counter)) {
- ALOGE("%s unable to set new counter into hash map name:%s", __func__, name);
+ LOG_ERROR("%s unable to set new counter into hash map name:%s", __func__, name);
hash_element_free_(element);
counter_free_(counter);
counter = NULL;
@@ -263,28 +263,28 @@
clients_ = list_new(client_free);
if (!clients_) {
- ALOGE("%s unable to create counter clients list", __func__);
+ LOG_ERROR("%s unable to create counter clients list", __func__);
goto error;
}
thread_ = thread_new("counter_socket");
if (!thread_) {
- ALOGE("%s unable to create counter thread", __func__);
+ LOG_ERROR("%s unable to create counter thread", __func__);
goto error;
}
listen_socket_ = socket_new();
if (!listen_socket_) {
- ALOGE("%s unable to create listen socket", __func__);
+ LOG_ERROR("%s unable to create listen socket", __func__);
goto error;
}
if (!socket_listen(listen_socket_, LISTEN_PORT)) {
- ALOGE("%s unable to setup listen socket", __func__);
+ LOG_ERROR("%s unable to setup listen socket", __func__);
goto error;
}
- ALOGI("%s opened counter server socket", __func__);
+ LOG_INFO("%s opened counter server socket", __func__);
socket_register(listen_socket_, thread_get_reactor(thread_), NULL, accept_ready, NULL);
return true;
@@ -302,7 +302,7 @@
thread_ = NULL;
clients_ = NULL;
- ALOGI("%s closed counter server socket", __func__);
+ LOG_INFO("%s closed counter server socket", __func__);
}
static bool monitor_counter_iter_cb(const char *name, counter_data_t val, void *context) {
@@ -324,14 +324,14 @@
assert(socket != NULL);
assert(socket == listen_socket_);
- ALOGI("%s accepted OSI monitor socket", __func__);
+ LOG_INFO("%s accepted OSI monitor socket", __func__);
socket = socket_accept(socket);
if (!socket)
return;
client_t *client = (client_t *)osi_calloc(sizeof(client_t));
if (!client) {
- ALOGE("%s unable to allocate memory for client", __func__);
+ LOG_ERROR("%s unable to allocate memory for client", __func__);
socket_free(socket);
return;
}
@@ -339,7 +339,7 @@
client->socket = socket;
if (!list_append(clients_, client)) {
- ALOGE("%s unable to add client to list", __func__);
+ LOG_ERROR("%s unable to add client to list", __func__);
client_free(client);
return;
}
diff --git a/btcore/src/module.c b/btcore/src/module.c
index 494d723..9b96bb2 100644
--- a/btcore/src/module.c
+++ b/btcore/src/module.c
@@ -21,13 +21,13 @@
#include <assert.h>
#include <dlfcn.h>
#include <pthread.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "hash_functions.h"
#include "hash_map.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
typedef enum {
MODULE_STATE_NONE = 0,
@@ -75,7 +75,7 @@
assert(get_module_state(module) == MODULE_STATE_NONE);
if (!call_lifecycle_function(module->init)) {
- ALOGE("%s failed to initialize \"%s\"", __func__, module->name);
+ LOG_ERROR("%s failed to initialize \"%s\"", __func__, module->name);
return false;
}
@@ -92,7 +92,7 @@
assert(get_module_state(module) == MODULE_STATE_INITIALIZED || module->init == NULL);
if (!call_lifecycle_function(module->start_up)) {
- ALOGE("%s failed to start up \"%s\"", __func__, module->name);
+ LOG_ERROR("%s failed to start up \"%s\"", __func__, module->name);
return false;
}
@@ -111,7 +111,7 @@
return;
if (!call_lifecycle_function(module->shut_down))
- ALOGE("%s found \"%s\" reported failure during shutdown. Continuing anyway.", __func__, module->name);
+ LOG_ERROR("%s found \"%s\" reported failure during shutdown. Continuing anyway.", __func__, module->name);
set_module_state(module, MODULE_STATE_INITIALIZED);
}
@@ -127,7 +127,7 @@
return;
if (!call_lifecycle_function(module->clean_up))
- ALOGE("%s found \"%s\" reported failure during cleanup. Continuing anyway.", __func__, module->name);
+ LOG_ERROR("%s found \"%s\" reported failure during cleanup. Continuing anyway.", __func__, module->name);
set_module_state(module, MODULE_STATE_NONE);
}
diff --git a/btif/co/bta_ag_co.c b/btif/co/bta_ag_co.c
index 13c1aff..7072093 100755
--- a/btif/co/bta_ag_co.c
+++ b/btif/co/bta_ag_co.c
@@ -15,6 +15,9 @@
* limitations under the License.
*
******************************************************************************/
+
+#define LOG_TAG "BTA_AG_CO"
+
#include "gki.h"
#include "bta_api.h"
#include "bta_sys.h"
@@ -23,11 +26,8 @@
#include "bte_appl.h"
#include "bt_utils.h"
-#define LOG_TAG "BTA_AG_CO: "
-
#ifndef LINUX_NATIVE
#include <cutils/properties.h>
-#include <cutils/log.h>
#else
#include <stdio.h>
#define LOGI(format, ...) fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
diff --git a/btif/co/bta_gattc_co.c b/btif/co/bta_gattc_co.c
index 5ed7f8f..96f1bd7 100644
--- a/btif/co/bta_gattc_co.c
+++ b/btif/co/bta_gattc_co.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#include <stdio.h>
+#include <unistd.h>
#include "gki.h"
#include "bta_gattc_co.h"
diff --git a/btif/co/bta_hl_co.c b/btif/co/bta_hl_co.c
index 22b7c89..9aa91f7 100644
--- a/btif/co/bta_hl_co.c
+++ b/btif/co/bta_hl_co.c
@@ -34,7 +34,6 @@
#include <fcntl.h>
#include <ctype.h>
#include <cutils/sockets.h>
-#include <cutils/log.h>
#include "bta_api.h"
#include "btm_api.h"
#include "bta_sys.h"
diff --git a/btif/include/btif_common.h b/btif/include/btif_common.h
index 4b1f480..9fc8df8 100644
--- a/btif/include/btif_common.h
+++ b/btif/include/btif_common.h
@@ -30,13 +30,13 @@
#error "LOG_TAG not defined, please add in .c file prior to including bt_common.h"
#endif
-#include <utils/Log.h>
+#include "osi/include/log.h"
/*******************************************************************************
** Constants & Macros
********************************************************************************/
-#define ASSERTC(cond, msg, val) if (!(cond)) { ALOGE( \
+#define ASSERTC(cond, msg, val) if (!(cond)) { LOG_ERROR( \
"### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
/* Calculate start of event enumeration; id is top 8 bits of event */
diff --git a/btif/include/btif_sock_util.h b/btif/include/btif_sock_util.h
index e0f7066..0659930 100644
--- a/btif/include/btif_sock_util.h
+++ b/btif/include/btif_sock_util.h
@@ -28,7 +28,8 @@
#define BTIF_SOCK_UTIL_H
#include <pthread.h>
-#include <cutils/log.h>
+
+#include "osi/include/log.h"
/*******************************************************************************
** Functions
@@ -46,14 +47,14 @@
{
if(mutex->value)
pthread_mutex_lock(mutex);
- else ALOGE("mutex: %p is not initialized", mutex);
+ else LOG_ERROR("mutex: %p is not initialized", mutex);
}
static inline void unlock_slot(pthread_mutex_t* mutex)
{
if(mutex->value)
pthread_mutex_unlock(mutex);
- else ALOGE("mutex: %p is not initialized", mutex);
+ else LOG_ERROR("mutex: %p is not initialized", mutex);
}
void dump_bin(const char* title, const char* data, int size);
diff --git a/btif/include/btif_storage.h b/btif/include/btif_storage.h
index 14bb265..bf6a5ed 100644
--- a/btif/include/btif_storage.h
+++ b/btif/include/btif_storage.h
@@ -21,8 +21,6 @@
#include "bt_types.h"
-#include <utils/Log.h>
-
/*******************************************************************************
** Constants & Macros
********************************************************************************/
diff --git a/btif/include/btif_util.h b/btif/include/btif_util.h
index 49b54c9..6699463 100644
--- a/btif/include/btif_util.h
+++ b/btif/include/btif_util.h
@@ -22,7 +22,6 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_hf.h>
-#include <utils/Log.h>
#include <stdbool.h>
#include <sys/time.h>
diff --git a/btif/src/bluetooth.c b/btif/src/bluetooth.c
index 3db51da..e9c29b3 100644
--- a/btif/src/bluetooth.c
+++ b/btif/src/bluetooth.c
@@ -48,6 +48,7 @@
#include "bt_utils.h"
#include "osi.h"
#include "osi/include/allocation_tracker.h"
+#include "osi/include/log.h"
#include "stack_manager.h"
/************************************************************************************
@@ -112,7 +113,7 @@
*****************************************************************************/
static int init(bt_callbacks_t *callbacks) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
if (interface_ready())
return BT_STATUS_DONE;
@@ -127,7 +128,7 @@
}
static int enable(void) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -304,7 +305,7 @@
static const void* get_profile_interface (const char *profile_id)
{
- ALOGI("get_profile_interface %s", profile_id);
+ LOG_INFO("get_profile_interface %s", profile_id);
/* sanity check */
if (interface_ready() == FALSE)
@@ -354,7 +355,7 @@
int dut_mode_configure(uint8_t enable)
{
- ALOGI("dut_mode_configure");
+ LOG_INFO("dut_mode_configure");
/* sanity check */
if (interface_ready() == FALSE)
@@ -365,7 +366,7 @@
int dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len)
{
- ALOGI("dut_mode_send");
+ LOG_INFO("dut_mode_send");
/* sanity check */
if (interface_ready() == FALSE)
@@ -377,7 +378,7 @@
#if BLE_INCLUDED == TRUE
int le_test_mode(uint16_t opcode, uint8_t* buf, uint8_t len)
{
- ALOGI("le_test_mode");
+ LOG_INFO("le_test_mode");
/* sanity check */
if (interface_ready() == FALSE)
@@ -389,7 +390,7 @@
int config_hci_snoop_log(uint8_t enable)
{
- ALOGI("config_hci_snoop_log");
+ LOG_INFO("config_hci_snoop_log");
if (!interface_ready())
return BT_STATUS_NOT_READY;
diff --git a/btif/src/btif_config.c b/btif/src/btif_config.c
index e867dff..71a7c07 100644
--- a/btif/src/btif_config.c
+++ b/btif/src/btif_config.c
@@ -23,7 +23,6 @@
#include <pthread.h>
#include <stdio.h>
#include <string.h>
-#include <utils/Log.h>
#include "alarm.h"
#include "bdaddr.h"
@@ -33,6 +32,7 @@
#include "config.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "bt_types.h"
@@ -58,7 +58,7 @@
if (!btif_config_get_int(bd_addr_str, "DevType", p_device_type))
return FALSE;
- ALOGD("%s: Device [%s] type %d", __FUNCTION__, bd_addr_str, *p_device_type);
+ LOG_DEBUG("%s: Device [%s] type %d", __FUNCTION__, bd_addr_str, *p_device_type);
return TRUE;
}
@@ -76,7 +76,7 @@
if (!btif_config_get_int(bd_addr_str, "AddrType", p_addr_type))
return FALSE;
- ALOGD("%s: Device [%s] address type %d", __FUNCTION__, bd_addr_str, *p_addr_type);
+ LOG_DEBUG("%s: Device [%s] address type %d", __FUNCTION__, bd_addr_str, *p_addr_type);
return TRUE;
}
@@ -90,13 +90,13 @@
pthread_mutex_init(&lock, NULL);
config = config_new(CONFIG_FILE_PATH);
if (!config) {
- ALOGW("%s unable to load config file; attempting to transcode legacy file.", __func__);
+ LOG_WARN("%s unable to load config file; attempting to transcode legacy file.", __func__);
config = btif_config_transcode(LEGACY_CONFIG_FILE_PATH);
if (!config) {
- ALOGW("%s unable to transcode legacy file, starting unconfigured.", __func__);
+ LOG_WARN("%s unable to transcode legacy file, starting unconfigured.", __func__);
config = config_new_empty();
if (!config) {
- ALOGE("%s unable to allocate a config object.", __func__);
+ LOG_ERROR("%s unable to allocate a config object.", __func__);
goto error;
}
}
@@ -110,7 +110,7 @@
// write back to disk.
alarm_timer = alarm_new();
if (!alarm_timer) {
- ALOGE("%s unable to create alarm.", __func__);
+ LOG_ERROR("%s unable to create alarm.", __func__);
goto error;
}
diff --git a/btif/src/btif_config_transcode.cpp b/btif/src/btif_config_transcode.cpp
index 192e7dc..fb38a4a 100644
--- a/btif/src/btif_config_transcode.cpp
+++ b/btif/src/btif_config_transcode.cpp
@@ -19,10 +19,10 @@
#define LOG_TAG "bt_btif_config_transcode"
#include <tinyxml2.h>
-#include <utils/Log.h>
extern "C" {
-#include "config.h"
+#include "osi/include/config.h"
+#include "osi/include/log.h"
}
using namespace tinyxml2;
@@ -31,19 +31,19 @@
XMLDocument document;
int error = document.LoadFile(xml_filename);
if (error != XML_SUCCESS) {
- ALOGE("%s unable to load XML file '%s': %d", __func__, xml_filename, error);
+ LOG_ERROR("%s unable to load XML file '%s': %d", __func__, xml_filename, error);
return NULL;
}
XMLElement *rootElement = document.RootElement();
if (!rootElement) {
- ALOGE("%s unable to find root element; assuming corrupted config file.", __func__);
+ LOG_ERROR("%s unable to find root element; assuming corrupted config file.", __func__);
return NULL;
}
config_t *config = config_new_empty();
if (!config) {
- ALOGE("%s unable to allocate config object.", __func__);
+ LOG_ERROR("%s unable to allocate config object.", __func__);
return NULL;
}
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c
index 7aa6bb5..d58cc89 100644
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.c
@@ -56,9 +56,10 @@
#include "fixed_queue.h"
#include "future.h"
#include "gki.h"
+#include "osi.h"
+#include "osi/include/log.h"
#include "stack_manager.h"
#include "thread.h"
-#include "osi.h"
/************************************************************************************
** Constants & Macros
@@ -426,7 +427,7 @@
bt_jni_workqueue_thread = thread_new(BT_JNI_WORKQUEUE_NAME);
if (bt_jni_workqueue_thread == NULL) {
- ALOGE("%s Unable to create thread %s\n", __func__, BT_JNI_WORKQUEUE_NAME);
+ LOG_ERROR("%s Unable to create thread %s\n", __func__, BT_JNI_WORKQUEUE_NAME);
goto error_exit;
}
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 264233b..3f96b0a 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -24,13 +24,15 @@
*
*
***********************************************************************************/
+
+#define LOG_TAG "btif_dm"
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <hardware/bluetooth.h>
-#include <utils/Log.h>
#include <cutils/properties.h>
#include "gki.h"
#include "btu.h"
@@ -44,6 +46,8 @@
#include "btif_config.h"
#include "bta_gatt_api.h"
+#include "include/stack_config.h"
+#include "osi/include/log.h"
/******************************************************************************
** Device specific workarounds
@@ -511,7 +515,7 @@
btm_status = BTM_ReadRemoteVersion(*(BD_ADDR*)p_bd, &lmp_ver,
&mfct_set, &lmp_subver);
- ALOGD("remote version info [%s]: %x, %x, %x", bdaddr_to_string(p_bd, bdstr, sizeof(bdstr)),
+ LOG_DEBUG("remote version info [%s]: %x, %x, %x", bdaddr_to_string(p_bd, bdstr, sizeof(bdstr)),
lmp_ver, mfct_set, lmp_subver);
if (btm_status == BTM_SUCCESS)
@@ -965,7 +969,7 @@
cod = devclass2uint(p_ssp_cfm_req->dev_class);
if ( cod == 0) {
- ALOGD("cod is 0, set as unclassified");
+ LOG_DEBUG("cod is 0, set as unclassified");
cod = COD_UNCLASSIFIED;
}
@@ -1000,7 +1004,7 @@
cod = devclass2uint(p_ssp_key_notif->dev_class);
if ( cod == 0) {
- ALOGD("cod is 0, set as unclassified");
+ LOG_DEBUG("cod is 0, set as unclassified");
cod = COD_UNCLASSIFIED;
}
@@ -1063,15 +1067,14 @@
if (check_sdp_bl(&bd_addr) && check_cod_hid(&bd_addr, COD_HID_MAJOR))
{
- ALOGW("%s:skip SDP",
- __FUNCTION__);
+ LOG_WARN("%s:skip SDP", __FUNCTION__);
skip_sdp = TRUE;
}
if(!pairing_cb.is_local_initiated && skip_sdp)
{
bond_state_changed(status, &bd_addr, state);
- ALOGW("%s: Incoming HID Connection",__FUNCTION__);
+ LOG_WARN("%s: Incoming HID Connection",__FUNCTION__);
bt_property_t prop;
bt_bdaddr_t bd_addr;
bt_uuid_t uuid;
@@ -1245,7 +1248,7 @@
cod = devclass2uint (p_search_data->inq_res.dev_class);
if ( cod == 0) {
- ALOGD("cod is 0, set as unclassified");
+ LOG_DEBUG("cod is 0, set as unclassified");
cod = COD_UNCLASSIFIED;
}
diff --git a/btif/src/btif_gatt_client.c b/btif/src/btif_gatt_client.c
index 272dbe5..7eecaf6 100644
--- a/btif/src/btif_gatt_client.c
+++ b/btif/src/btif_gatt_client.c
@@ -51,6 +51,7 @@
#include "btif_dm.h"
#include "btif_storage.h"
+#include "osi/include/log.h"
#include "vendor_api.h"
/*******************************************************************************
@@ -59,10 +60,10 @@
#define CHECK_BTGATT_INIT() if (bt_gatt_callbacks == NULL)\
{\
- BTIF_TRACE_WARNING("%s: BTGATT not initialized", __FUNCTION__);\
+ LOG_WARN("%s: BTGATT not initialized", __FUNCTION__);\
return BT_STATUS_NOT_READY;\
} else {\
- BTIF_TRACE_DEBUG("%s", __FUNCTION__);\
+ LOG_DEBUG("%s", __FUNCTION__);\
}
#define BLE_RESOLVE_ADDR_MSB 0x40 /* bit7, bit6 is 01 to be resolvable random */
@@ -346,7 +347,7 @@
memcpy(p_dev_cb->remote_dev[i].bd_addr.address, p_bda, BD_ADDR_LEN);
p_dev_cb->addr_type = addr_type;
p_dev_cb->remote_dev[i].in_use = TRUE;
- BTIF_TRACE_DEBUG("%s device added idx=%d", __FUNCTION__, i );
+ LOG_DEBUG("%s device added idx=%d", __FUNCTION__, i );
break;
}
}
@@ -357,7 +358,7 @@
memcpy(p_dev_cb->remote_dev[i].bd_addr.address, p_bda, BD_ADDR_LEN);
p_dev_cb->addr_type = addr_type;
p_dev_cb->remote_dev[i].in_use = TRUE;
- BTIF_TRACE_DEBUG("%s device overwrite idx=%d", __FUNCTION__, i );
+ LOG_DEBUG("%s device overwrite idx=%d", __FUNCTION__, i );
p_dev_cb->next_storage_idx++;
if (p_dev_cb->next_storage_idx >= BTIF_GATT_MAX_OBSERVED_DEV)
p_dev_cb->next_storage_idx = 0;
@@ -398,7 +399,7 @@
memcpy(bdname.name, p_eir_remote_name, remote_name_len);
bdname.name[remote_name_len]='\0';
- BTIF_TRACE_DEBUG("%s BLE device name=%s len=%d dev_type=%d", __FUNCTION__, bdname.name,
+ LOG_DEBUG("%s BLE device name=%s len=%d dev_type=%d", __FUNCTION__, bdname.name,
remote_name_len, p_btif_cb->device_type );
btif_dm_update_ble_remote_properties( p_btif_cb->bd_addr.address, bdname.name,
p_btif_cb->device_type);
@@ -409,7 +410,7 @@
static void btif_gattc_upstreams_evt(uint16_t event, char* p_param)
{
- BTIF_TRACE_EVENT("%s: Event %d", __FUNCTION__, event);
+ LOG_DEBUG("%s: Event %d", __FUNCTION__, event);
tBTA_GATTC *p_data = (tBTA_GATTC*) p_param;
switch (event)
@@ -551,7 +552,7 @@
}
case BTA_GATTC_ACL_EVT:
- BTIF_TRACE_EVENT("BTA_GATTC_ACL_EVT: status = %d", p_data->status);
+ LOG_DEBUG("BTA_GATTC_ACL_EVT: status = %d", p_data->status);
/* Ignore for now */
break;
@@ -786,7 +787,7 @@
}
default:
- BTIF_TRACE_ERROR("%s: Unhandled event (%d)!", __FUNCTION__, event);
+ LOG_ERROR("%s: Unhandled event (%d)!", __FUNCTION__, event);
break;
}
@@ -1078,7 +1079,7 @@
btif_gattc_cb_t* p_cb = (btif_gattc_cb_t*) p_param;
if (!p_cb) return;
- BTIF_TRACE_EVENT("%s: Event %d", __FUNCTION__, event);
+ LOG_DEBUG("%s: Event %d", __FUNCTION__, event);
switch (event)
{
@@ -1472,7 +1473,7 @@
}
default:
- BTIF_TRACE_ERROR("%s: Unknown filter type (%d)!", __FUNCTION__, p_cb->action);
+ LOG_ERROR("%s: Unknown filter type (%d)!", __FUNCTION__, p_cb->action);
break;
}
break;
@@ -1666,7 +1667,7 @@
}
default:
- BTIF_TRACE_ERROR("%s: Unknown event (%d)!", __FUNCTION__, event);
+ LOG_ERROR("%s: Unknown event (%d)!", __FUNCTION__, event);
break;
}
}
diff --git a/btif/src/btif_gatt_server.c b/btif/src/btif_gatt_server.c
index 4ca0c94..3a4fa29 100644
--- a/btif/src/btif_gatt_server.c
+++ b/btif/src/btif_gatt_server.c
@@ -48,6 +48,7 @@
#include "btif_gatt.h"
#include "btif_gatt_util.h"
+#include "osi/include/log.h"
/************************************************************************************
** Constants & Macros
@@ -55,10 +56,10 @@
#define CHECK_BTGATT_INIT() if (bt_gatt_callbacks == NULL)\
{\
- ALOGW("%s: BTGATT not initialized", __FUNCTION__);\
+ LOG_WARN("%s: BTGATT not initialized", __FUNCTION__);\
return BT_STATUS_NOT_READY;\
} else {\
- ALOGD("%s", __FUNCTION__);\
+ LOG_DEBUG("%s", __FUNCTION__);\
}
@@ -168,7 +169,7 @@
static void btapp_gatts_handle_cback(uint16_t event, char* p_param)
{
- ALOGD("%s: Event %d", __FUNCTION__, event);
+ LOG_DEBUG("%s: Event %d", __FUNCTION__, event);
tBTA_GATTS *p_data = (tBTA_GATTS*)p_param;
switch (event)
@@ -343,11 +344,11 @@
case BTA_GATTS_OPEN_EVT:
case BTA_GATTS_CANCEL_OPEN_EVT:
case BTA_GATTS_CLOSE_EVT:
- ALOGD("%s: Empty event (%d)!", __FUNCTION__, event);
+ LOG_DEBUG("%s: Empty event (%d)!", __FUNCTION__, event);
break;
default:
- ALOGE("%s: Unhandled event (%d)!", __FUNCTION__, event);
+ LOG_ERROR("%s: Unhandled event (%d)!", __FUNCTION__, event);
break;
}
@@ -367,7 +368,7 @@
btif_gatts_cb_t* p_cb = (btif_gatts_cb_t*)p_param;
if (!p_cb) return;
- ALOGD("%s: Event %d", __FUNCTION__, event);
+ LOG_DEBUG("%s: Event %d", __FUNCTION__, event);
switch (event)
{
@@ -508,7 +509,7 @@
}
default:
- ALOGE("%s: Unknown event (%d)!", __FUNCTION__, event);
+ LOG_ERROR("%s: Unknown event (%d)!", __FUNCTION__, event);
break;
}
}
diff --git a/btif/src/btif_gatt_test.c b/btif/src/btif_gatt_test.c
index de42a38..219136f 100644
--- a/btif/src/btif_gatt_test.c
+++ b/btif/src/btif_gatt_test.c
@@ -41,6 +41,7 @@
#include "btif_dm.h"
#include "gatt_api.h"
+#include "osi/include/log.h"
/*******************************************************************************
* Typedefs & Macros
@@ -107,14 +108,14 @@
UNUSED(reason);
UNUSED (transport);
- ALOGD("%s: conn_id=%d, connected=%d", __FUNCTION__, conn_id, connected);
+ LOG_DEBUG("%s: conn_id=%d, connected=%d", __FUNCTION__, conn_id, connected);
test_cb.conn_id = connected ? conn_id : 0;
}
static void btif_test_command_complete_cback(UINT16 conn_id, tGATTC_OPTYPE op,
tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
{
- ALOGD ("%s: op_code=0x%02x, conn_id=0x%x. status=0x%x",
+ LOG_DEBUG ("%s: op_code=0x%02x, conn_id=0x%x. status=0x%x",
__FUNCTION__, op, conn_id, status);
switch (op)
@@ -131,7 +132,7 @@
break;
default:
- ALOGD ("%s: Unknown op_code (0x%02x)", __FUNCTION__, op);
+ LOG_DEBUG ("%s: Unknown op_code (0x%02x)", __FUNCTION__, op);
break;
}
}
@@ -143,50 +144,50 @@
char str_buf[50];
UNUSED(conn_id);
- ALOGD("------ GATT Discovery result %-22s -------", disc_name[disc_type]);
- ALOGD(" Attribute handle: 0x%04x (%d)", p_data->handle, p_data->handle);
+ LOG_DEBUG("------ GATT Discovery result %-22s -------", disc_name[disc_type]);
+ LOG_DEBUG(" Attribute handle: 0x%04x (%d)", p_data->handle, p_data->handle);
if (disc_type != GATT_DISC_CHAR_DSCPT) {
- ALOGD(" Attribute type: %s", format_uuid(p_data->type, str_buf));
+ LOG_DEBUG(" Attribute type: %s", format_uuid(p_data->type, str_buf));
}
switch (disc_type)
{
case GATT_DISC_SRVC_ALL:
- ALOGD(" Handle range: 0x%04x ~ 0x%04x (%d ~ %d)",
+ LOG_DEBUG(" Handle range: 0x%04x ~ 0x%04x (%d ~ %d)",
p_data->handle, p_data->value.group_value.e_handle,
p_data->handle, p_data->value.group_value.e_handle);
- ALOGD(" Service UUID: %s",
+ LOG_DEBUG(" Service UUID: %s",
format_uuid(p_data->value.group_value.service_type, str_buf));
break;
case GATT_DISC_SRVC_BY_UUID:
- ALOGD(" Handle range: 0x%04x ~ 0x%04x (%d ~ %d)",
+ LOG_DEBUG(" Handle range: 0x%04x ~ 0x%04x (%d ~ %d)",
p_data->handle, p_data->value.handle,
p_data->handle, p_data->value.handle);
break;
case GATT_DISC_INC_SRVC:
- ALOGD(" Handle range: 0x%04x ~ 0x%04x (%d ~ %d)",
+ LOG_DEBUG(" Handle range: 0x%04x ~ 0x%04x (%d ~ %d)",
p_data->value.incl_service.s_handle, p_data->value.incl_service.e_handle,
p_data->value.incl_service.s_handle, p_data->value.incl_service.e_handle);
- ALOGD(" Service UUID: %s",
+ LOG_DEBUG(" Service UUID: %s",
format_uuid(p_data->value.incl_service.service_type, str_buf));
break;
case GATT_DISC_CHAR:
- ALOGD(" Properties: 0x%02x",
+ LOG_DEBUG(" Properties: 0x%02x",
p_data->value.dclr_value.char_prop);
- ALOGD(" Characteristic UUID: %s",
+ LOG_DEBUG(" Characteristic UUID: %s",
format_uuid(p_data->value.dclr_value.char_uuid, str_buf));
break;
case GATT_DISC_CHAR_DSCPT:
- ALOGD(" Descriptor UUID: %s", format_uuid(p_data->type, str_buf));
+ LOG_DEBUG(" Descriptor UUID: %s", format_uuid(p_data->type, str_buf));
break;
}
- ALOGD("-----------------------------------------------------------");
+ LOG_DEBUG("-----------------------------------------------------------");
}
static void btif_test_discovery_complete_cback(UINT16 conn_id,
@@ -195,7 +196,7 @@
{
UNUSED(conn_id);
UNUSED(disc_type);
- ALOGD("%s: status=%d", __FUNCTION__, status);
+ LOG_DEBUG("%s: status=%d", __FUNCTION__, status);
}
static tGATT_CBACK btif_test_callbacks =
@@ -218,7 +219,7 @@
switch(command) {
case 0x01: /* Enable */
{
- ALOGD("%s: ENABLE - enable=%d", __FUNCTION__, params->u1);
+ LOG_DEBUG("%s: ENABLE - enable=%d", __FUNCTION__, params->u1);
if (params->u1)
{
tBT_UUID app_uuid = {LEN_UUID_128,{0xAE}};
@@ -233,7 +234,7 @@
case 0x02: /* Connect */
{
- ALOGD("%s: CONNECT - device=%02x:%02x:%02x:%02x:%02x:%02x (dev_type=%d, addr_type=%d)",
+ LOG_DEBUG("%s: CONNECT - device=%02x:%02x:%02x:%02x:%02x:%02x (dev_type=%d, addr_type=%d)",
__FUNCTION__,
params->bda1->address[0], params->bda1->address[1],
params->bda1->address[2], params->bda1->address[3],
@@ -245,14 +246,14 @@
if ( !GATT_Connect(test_cb.gatt_if, params->bda1->address, TRUE, BT_TRANSPORT_LE) )
{
- ALOGE("%s: GATT_Connect failed!", __FUNCTION__);
+ LOG_ERROR("%s: GATT_Connect failed!", __FUNCTION__);
}
break;
}
case 0x03: /* Disconnect */
{
- ALOGD("%s: DISCONNECT - conn_id=%d", __FUNCTION__, test_cb.conn_id);
+ LOG_DEBUG("%s: DISCONNECT - conn_id=%d", __FUNCTION__, test_cb.conn_id);
GATT_Disconnect(test_cb.conn_id);
break;
}
@@ -265,7 +266,7 @@
if (params->u1 >= GATT_DISC_MAX)
{
- ALOGE("%s: DISCOVER - Invalid type (%d)!", __FUNCTION__, params->u1);
+ LOG_ERROR("%s: DISCOVER - Invalid type (%d)!", __FUNCTION__, params->u1);
return 0;
}
@@ -273,7 +274,7 @@
param.e_handle = params->u3;
btif_to_bta_uuid(¶m.service, params->uuid1);
- ALOGD("%s: DISCOVER (%s), conn_id=%d, uuid=%s, handles=0x%04x-0x%04x",
+ LOG_DEBUG("%s: DISCOVER (%s), conn_id=%d, uuid=%s, handles=0x%04x-0x%04x",
__FUNCTION__, disc_name[params->u1], test_cb.conn_id,
format_uuid(param.service, buf), params->u2, params->u3);
GATTC_Discover(test_cb.conn_id, params->u1, ¶m);
@@ -281,7 +282,7 @@
}
case 0xF0: /* Pairing configuration */
- ALOGD("%s: Setting pairing config auth=%d, iocaps=%d, keys=%d/%d/%d",
+ LOG_DEBUG("%s: Setting pairing config auth=%d, iocaps=%d, keys=%d/%d/%d",
__FUNCTION__, params->u1, params->u2, params->u3, params->u4,
params->u5);
@@ -293,7 +294,7 @@
break;
default:
- ALOGE("%s: UNKNOWN TEST COMMAND 0x%02x", __FUNCTION__, command);
+ LOG_ERROR("%s: UNKNOWN TEST COMMAND 0x%02x", __FUNCTION__, command);
break;
}
return 0;
diff --git a/btif/src/btif_gatt_util.c b/btif/src/btif_gatt_util.c
index 2c585ea..ca079e9 100644
--- a/btif/src/btif_gatt_util.c
+++ b/btif/src/btif_gatt_util.c
@@ -102,7 +102,7 @@
break;
default:
- ALOGE("%s: Unknown UUID length %d!", __FUNCTION__, p_dest->len);
+ LOG_ERROR("%s: Unknown UUID length %d!", __FUNCTION__, p_dest->len);
break;
}
}
@@ -192,7 +192,7 @@
break;
default:
- ALOGE("%s: Unknown UUID length %d!", __FUNCTION__, p_src->len);
+ LOG_ERROR("%s: Unknown UUID length %d!", __FUNCTION__, p_src->len);
break;
}
}
@@ -258,7 +258,7 @@
default:
if (( p_src->status == BTA_GATT_OK ) &&(p_src->p_value != NULL))
{
- ALOGI("%s unformat.len = %d ", __FUNCTION__, p_src->p_value->unformat.len);
+ LOG_INFO("%s unformat.len = %d ", __FUNCTION__, p_src->p_value->unformat.len);
p_dest->value.len = p_src->p_value->unformat.len;
if ( p_src->p_value->unformat.len > 0 && p_src->p_value->unformat.p_value != NULL )
{
diff --git a/btif/src/btif_hh.c b/btif/src/btif_hh.c
index 7f75621..99ce373 100644
--- a/btif/src/btif_hh.c
+++ b/btif/src/btif_hh.c
@@ -42,7 +42,7 @@
#include "btif_hh.h"
#include "gki.h"
#include "l2c_api.h"
-
+#include "osi/include/log.h"
#define BTIF_HH_APP_ID_MI 0x01
#define BTIF_HH_APP_ID_KB 0x02
@@ -502,7 +502,7 @@
btif_hh_device_t *p_dev;
btif_hh_added_device_t *p_added_dev;
- ALOGI("%s: bda = %02x:%02x:%02x:%02x:%02x:%02x", __FUNCTION__,
+ LOG_INFO("%s: bda = %02x:%02x:%02x:%02x:%02x:%02x", __FUNCTION__,
bd_addr.address[0], bd_addr.address[1], bd_addr.address[2], bd_addr.address[3], bd_addr.address[4], bd_addr.address[5]);
for (i = 0; i < BTIF_HH_MAX_ADDED_DEV; i++) {
@@ -926,7 +926,7 @@
return;
}
if (p_dev->fd < 0) {
- ALOGE("BTA_HH_GET_DSCP_EVT: Error, failed to find the uhid driver...");
+ LOG_ERROR("BTA_HH_GET_DSCP_EVT: Error, failed to find the uhid driver...");
return;
}
{
@@ -1068,7 +1068,7 @@
break;
case BTA_HH_API_ERR_EVT :
- ALOGI("BTA_HH API_ERR");
+ LOG_INFO("BTA_HH API_ERR");
break;
@@ -1361,7 +1361,7 @@
dscp_info.descriptor.dsc_list = (UINT8 *) GKI_getbuf(dscp_info.descriptor.dl_len);
if (dscp_info.descriptor.dsc_list == NULL)
{
- ALOGE("%s: Failed to allocate DSCP for CB", __FUNCTION__);
+ LOG_ERROR("%s: Failed to allocate DSCP for CB", __FUNCTION__);
return BT_STATUS_FAIL;
}
memcpy(dscp_info.descriptor.dsc_list, &(hid_info.dsc_list), hid_info.dl_len);
@@ -1555,7 +1555,7 @@
memset(hexbuf, 0, len);
//TODO
hex_bytes_filled = ascii_2_hex(report, len, hexbuf);
- BTIF_TRACE_DEBUG("Hex bytes filled, hex value: %d", hex_bytes_filled);
+ LOG_INFO("Hex bytes filled, hex value: %d", hex_bytes_filled);
if (hex_bytes_filled) {
BT_HDR* p_buf = create_pbuf(hex_bytes_filled, hexbuf);
if (p_buf == NULL) {
diff --git a/btif/src/btif_hl.c b/btif/src/btif_hl.c
index 210734c..934f2fa 100644
--- a/btif/src/btif_hl.c
+++ b/btif/src/btif_hl.c
@@ -28,7 +28,6 @@
#include <assert.h>
#include <ctype.h>
-#include <cutils/log.h>
#include <cutils/sockets.h>
#include <errno.h>
#include <fcntl.h>
@@ -71,6 +70,7 @@
#include "gki.h"
#include "list.h"
#include "mca_api.h"
+#include "osi/include/log.h"
#define MAX_DATATYPE_SUPPORTED 8
@@ -5066,7 +5066,7 @@
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
soc_queue = list_new(NULL);
if (soc_queue == NULL)
- ALOGE("%s unable to allocate resources for thread", __func__);
+ LOG_ERROR("%s unable to allocate resources for thread", __func__);
select_thread_id = create_thread(btif_hl_select_thread, NULL);
}
/*******************************************************************************
diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c
index 3f0c98b..d842d8a 100644
--- a/btif/src/btif_pan.c
+++ b/btif/src/btif_pan.c
@@ -60,6 +60,7 @@
#include "btif_pan_internal.h"
#include "gki.h"
#include "osi.h"
+#include "osi/include/log.h"
#define FORWARD_IGNORE 1
#define FORWARD_SUCCESS 0
@@ -446,7 +447,7 @@
memcpy(packet, ð_hdr, sizeof(tETH_HDR));
if(len > 2000)
{
- ALOGE("btpan_tap_send eth packet size:%d is exceeded limit!", len);
+ LOG_ERROR("btpan_tap_send eth packet size:%d is exceeded limit!", len);
return -1;
}
memcpy(packet + sizeof(tETH_HDR), buf, len);
@@ -606,7 +607,7 @@
bt_status_t status;
btpan_conn_t *conn = btpan_find_conn_handle(p_data->open.handle);
- ALOGV("%s pan connection open status: %d", __func__, p_data->open.status);
+ LOG_VERBOSE("%s pan connection open status: %d", __func__, p_data->open.status);
if(p_data->open.status == BTA_PAN_SUCCESS)
{
state = BTPAN_STATE_CONNECTED;
@@ -630,7 +631,7 @@
{
btpan_conn_t* conn = btpan_find_conn_handle(p_data->close.handle);
- ALOGI("%s: event = BTA_PAN_CLOSE_EVT handle %d", __FUNCTION__, p_data->close.handle);
+ LOG_INFO("%s: event = BTA_PAN_CLOSE_EVT handle %d", __FUNCTION__, p_data->close.handle);
if(conn && conn->handle >= 0)
{
diff --git a/btif/src/btif_sock.c b/btif/src/btif_sock.c
index 91b3461..3ab95c9 100644
--- a/btif/src/btif_sock.c
+++ b/btif/src/btif_sock.c
@@ -29,6 +29,7 @@
#include "btif_sock_thread.h"
#include "btif_util.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "thread.h"
static bt_status_t btsock_listen(btsock_type_t type, const char *service_name, const uint8_t *uuid, int channel, int *sock_fd, int flags);
@@ -56,26 +57,26 @@
btsock_thread_init();
thread_handle = btsock_thread_create(btsock_signaled, NULL);
if (thread_handle == -1) {
- ALOGE("%s unable to create btsock_thread.", __func__);
+ LOG_ERROR("%s unable to create btsock_thread.", __func__);
goto error;
}
bt_status_t status = btsock_rfc_init(thread_handle);
if (status != BT_STATUS_SUCCESS) {
- ALOGE("%s error initializing RFCOMM sockets: %d", __func__, status);
+ LOG_ERROR("%s error initializing RFCOMM sockets: %d", __func__, status);
goto error;
}
thread = thread_new("btif_sock");
if (!thread) {
- ALOGE("%s error creating new thread.", __func__);
+ LOG_ERROR("%s error creating new thread.", __func__);
btsock_rfc_cleanup();
goto error;
}
status = btsock_sco_init(thread);
if (status != BT_STATUS_SUCCESS) {
- ALOGE("%s error initializing SCO sockets: %d", __func__, status);
+ LOG_ERROR("%s error initializing SCO sockets: %d", __func__, status);
btsock_rfc_cleanup();
goto error;
}
@@ -122,7 +123,7 @@
break;
default:
- ALOGE("%s unknown/unsupported socket type: %d", __func__, type);
+ LOG_ERROR("%s unknown/unsupported socket type: %d", __func__, type);
status = BT_STATUS_UNSUPPORTED;
break;
}
@@ -147,7 +148,7 @@
break;
default:
- ALOGE("%s unknown/unsupported socket type: %d", __func__, type);
+ LOG_ERROR("%s unknown/unsupported socket type: %d", __func__, type);
status = BT_STATUS_UNSUPPORTED;
break;
}
diff --git a/btif/src/btif_sock_rfc.c b/btif/src/btif_sock_rfc.c
index b42f1f7..5b2b775 100644
--- a/btif/src/btif_sock_rfc.c
+++ b/btif/src/btif_sock_rfc.c
@@ -19,14 +19,12 @@
#define LOG_TAG "btif_sock_rfcomm"
#include <assert.h>
-#include <cutils/log.h>
#include <errno.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_sock.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <utils/Log.h>
#include "bta_api.h"
#include "bt_target.h"
@@ -44,6 +42,7 @@
#include "hcimsgs.h"
#include "list.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "port_api.h"
#include "sdp_api.h"
@@ -138,7 +137,7 @@
if (rfc_slots[i].id == id)
return &rfc_slots[i];
- ALOGE("%s unable to find RFCOMM slot id: %d", __func__, id);
+ LOG_ERROR("%s unable to find RFCOMM slot id: %d", __func__, id);
return NULL;
}
@@ -170,13 +169,13 @@
rfc_slot_t *slot = find_free_slot();
if (!slot) {
- ALOGE("%s unable to find free RFCOMM slot.", __func__);
+ LOG_ERROR("%s unable to find free RFCOMM slot.", __func__);
return NULL;
}
int fds[2] = { INVALID_FD, INVALID_FD };
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) == -1) {
- ALOGE("%s error creating socketpair: %s", __func__, strerror(errno));
+ LOG_ERROR("%s error creating socketpair: %s", __func__, strerror(errno));
return NULL;
}
@@ -209,7 +208,7 @@
static rfc_slot_t *create_srv_accept_rfc_slot(rfc_slot_t *srv_rs, const bt_bdaddr_t *addr, int open_handle, int new_listen_handle) {
rfc_slot_t *accept_rs = alloc_rfc_slot(addr, srv_rs->service_name, srv_rs->service_uuid, srv_rs->scn, 0, false);
if (!accept_rs) {
- ALOGE("%s unable to allocate RFCOMM slot.", __func__);
+ LOG_ERROR("%s unable to allocate RFCOMM slot.", __func__);
return NULL;
}
@@ -259,7 +258,7 @@
rfc_slot_t *slot = alloc_rfc_slot(NULL, service_name, service_uuid, channel, flags, true);
if (!slot) {
- ALOGE("%s unable to allocate RFCOMM slot.", __func__);
+ LOG_ERROR("%s unable to allocate RFCOMM slot.", __func__);
goto out;
}
@@ -291,20 +290,20 @@
rfc_slot_t *slot = alloc_rfc_slot(bd_addr, NULL, service_uuid, channel, flags, false);
if (!slot) {
- ALOGE("%s unable to allocate RFCOMM slot.", __func__);
+ LOG_ERROR("%s unable to allocate RFCOMM slot.", __func__);
goto out;
}
if (is_uuid_empty(service_uuid)) {
tBTA_JV_STATUS ret = BTA_JvRfcommConnect(slot->security, slot->role, slot->scn, slot->addr.address, rfcomm_cback, (void *)(uintptr_t)slot->id);
if (ret != BTA_JV_SUCCESS) {
- ALOGE("%s unable to initiate RFCOMM connection: %d", __func__, ret);
+ LOG_ERROR("%s unable to initiate RFCOMM connection: %d", __func__, ret);
cleanup_rfc_slot(slot);
goto out;
}
if (!send_app_scn(slot)) {
- ALOGE("%s unable to send channel number.", __func__);
+ LOG_ERROR("%s unable to send channel number.", __func__);
cleanup_rfc_slot(slot);
goto out;
}
@@ -336,11 +335,11 @@
static int create_server_sdp_record(rfc_slot_t *slot) {
if (slot->scn > 0) {
if (!BTM_TryAllocateSCN(slot->scn)) {
- ALOGE("%s attempting to allocate fixed channel %d which is already in use.", __func__, slot->scn);
+ LOG_ERROR("%s attempting to allocate fixed channel %d which is already in use.", __func__, slot->scn);
return false;
}
} else if ((slot->scn = BTM_AllocateSCN()) == 0) {
- ALOGE("%s unable to allocate RFCOMM server channel.", __func__);
+ LOG_ERROR("%s unable to allocate RFCOMM server channel.", __func__);
return false;
}
@@ -436,7 +435,7 @@
slot->rfc_handle = p_start->handle;
if (!send_app_scn(slot)) {
- ALOGE("%s unable to send server channel number for slot %d.", __func__, slot->id);
+ LOG_ERROR("%s unable to send server channel number for slot %d.", __func__, slot->id);
cleanup_rfc_slot(slot);
}
} else
@@ -488,7 +487,7 @@
if (send_app_connect_signal(slot->fd, &slot->addr, slot->scn, 0, -1))
slot->f.connected = true;
else
- ALOGE("%s unable to send connect completion signal to caller.", __func__);
+ LOG_ERROR("%s unable to send connect completion signal to caller.", __func__);
out:;
unlock_slot(&slot_lock);
@@ -569,7 +568,7 @@
break;
default:
- ALOGE("%s unhandled event %d, slot id: %d", __func__, event, (uintptr_t)user_data);
+ LOG_ERROR("%s unhandled event %d, slot id: %d", __func__, event, (uintptr_t)user_data);
break;
}
return new_user_data;
@@ -610,7 +609,7 @@
}
} else if (slot) {
// TODO(sharvil): this is really a logic error and we should probably assert.
- ALOGE("%s SDP response returned but RFCOMM slot %d did not request SDP record.", __func__, id);
+ LOG_ERROR("%s SDP response returned but RFCOMM slot %d did not request SDP record.", __func__, id);
}
} else if (slot) {
cleanup_rfc_slot(slot);
@@ -653,7 +652,7 @@
if (sent == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
return SENT_NONE;
- ALOGE("%s error writing RFCOMM data back to app: %s", __func__, strerror(errno));
+ LOG_ERROR("%s error writing RFCOMM data back to app: %s", __func__, strerror(errno));
return SENT_FAILED;
}
@@ -714,7 +713,7 @@
if (!(flags & SOCK_THREAD_FD_EXCEPTION) || (ioctl(slot->fd, FIONREAD, &size) == 0 && size))
BTA_JvRfcommWrite(slot->rfc_handle, slot->id);
} else {
- ALOGE("%s socket signaled for read while disconnected, slot: %d, channel: %d", __func__, slot->id, slot->scn);
+ LOG_ERROR("%s socket signaled for read while disconnected, slot: %d, channel: %d", __func__, slot->id, slot->scn);
need_close = true;
}
}
@@ -722,7 +721,7 @@
if (flags & SOCK_THREAD_FD_WR) {
// App is ready to receive more data, tell stack to enable data flow.
if (!slot->f.connected || !flush_incoming_que_on_wr_signal(slot)) {
- ALOGE("%s socket signaled for write while disconnected (or write failure), slot: %d, channel: %d", __func__, slot->id, slot->scn);
+ LOG_ERROR("%s socket signaled for write while disconnected (or write failure), slot: %d, channel: %d", __func__, slot->id, slot->scn);
need_close = true;
}
}
@@ -787,7 +786,7 @@
if (ioctl(slot->fd, FIONREAD, size) == 0) {
ret = true;
} else {
- ALOGE("%s unable to determine bytes remaining to be read on fd %d: %s", __func__, slot->fd, strerror(errno));
+ LOG_ERROR("%s unable to determine bytes remaining to be read on fd %d: %s", __func__, slot->fd, strerror(errno));
cleanup_rfc_slot(slot);
}
@@ -809,7 +808,7 @@
if(received == size) {
ret = true;
} else {
- ALOGE("%s error receiving RFCOMM data from app: %s", __func__, strerror(errno));
+ LOG_ERROR("%s error receiving RFCOMM data from app: %s", __func__, strerror(errno));
cleanup_rfc_slot(slot);
}
diff --git a/btif/src/btif_sock_sco.c b/btif/src/btif_sock_sco.c
index a18ba40..9608e11 100644
--- a/btif/src/btif_sock_sco.c
+++ b/btif/src/btif_sock_sco.c
@@ -23,11 +23,11 @@
#include <hardware/bt_sock.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <utils/Log.h>
#include "btif_common.h"
#include "list.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "socket.h"
#include "thread.h"
@@ -138,25 +138,25 @@
sco_socket_t *sco_socket = NULL;
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, pair) == -1) {
- ALOGE("%s unable to allocate socket pair: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to allocate socket pair: %s", __func__, strerror(errno));
goto error;
}
sco_socket = sco_socket_new();
if (!sco_socket) {
- ALOGE("%s unable to allocate new SCO socket.", __func__);
+ LOG_ERROR("%s unable to allocate new SCO socket.", __func__);
goto error;
}
tBTM_STATUS status = BTM_CreateSco((uint8_t *)bd_addr, !is_listening, sco_parameters.packet_types, &sco_socket->sco_handle, connect_completed_cb, disconnect_completed_cb);
if (status != BTM_CMD_STARTED) {
- ALOGE("%s unable to create SCO socket: %d", __func__, status);
+ LOG_ERROR("%s unable to create SCO socket: %d", __func__, status);
goto error;
}
socket_t *socket = socket_new_from_fd(pair[1]);
if (!socket) {
- ALOGE("%s unable to allocate socket from file descriptor %d.", __func__, pair[1]);
+ LOG_ERROR("%s unable to allocate socket from file descriptor %d.", __func__, pair[1]);
goto error;
}
@@ -220,18 +220,18 @@
int client_fd = INVALID_FD;
if (!sco_socket) {
- ALOGE("%s unable to find sco_socket for handle: %hu", __func__, conn_data->sco_inx);
+ LOG_ERROR("%s unable to find sco_socket for handle: %hu", __func__, conn_data->sco_inx);
goto error;
}
if (sco_socket != listen_sco_socket) {
- ALOGE("%s received connection request on non-listening socket handle: %hu", __func__, conn_data->sco_inx);
+ LOG_ERROR("%s received connection request on non-listening socket handle: %hu", __func__, conn_data->sco_inx);
goto error;
}
sco_socket_t *new_sco_socket = sco_socket_establish_locked(true, NULL, &client_fd);
if (!new_sco_socket) {
- ALOGE("%s unable to allocate new sco_socket.", __func__);
+ LOG_ERROR("%s unable to allocate new sco_socket.", __func__);
goto error;
}
@@ -247,7 +247,7 @@
connect_signal.status = 0;
if (socket_write_and_transfer_fd(sco_socket->socket, &connect_signal, sizeof(connect_signal), client_fd) != sizeof(connect_signal)) {
- ALOGE("%s unable to send new file descriptor to listening socket.", __func__);
+ LOG_ERROR("%s unable to send new file descriptor to listening socket.", __func__);
goto error;
}
@@ -270,7 +270,7 @@
sco_socket_t *sco_socket = sco_socket_find_locked(sco_handle);
if (!sco_socket) {
- ALOGE("%s SCO socket not found on connect for handle: %hu", __func__, sco_handle);
+ LOG_ERROR("%s SCO socket not found on connect for handle: %hu", __func__, sco_handle);
goto out;
}
@@ -293,7 +293,7 @@
sco_socket_t *sco_socket = sco_socket_find_locked(sco_handle);
if (!sco_socket) {
- ALOGE("%s SCO socket not found on disconnect for handle: %hu", __func__, sco_handle);
+ LOG_ERROR("%s SCO socket not found on disconnect for handle: %hu", __func__, sco_handle);
goto out;
}
diff --git a/btif/src/btif_sock_sdp.c b/btif/src/btif_sock_sdp.c
index e139382..f929c1f 100644
--- a/btif/src/btif_sock_sdp.c
+++ b/btif/src/btif_sock_sdp.c
@@ -26,7 +26,6 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_sock.h>
-#include <cutils/log.h>
#include "btif_common.h"
#include "btif_util.h"
diff --git a/btif/src/btif_sock_thread.c b/btif/src/btif_sock_thread.c
index 7d82ae6..b83f83d 100644
--- a/btif/src/btif_sock_thread.c
+++ b/btif/src/btif_sock_thread.c
@@ -58,7 +58,6 @@
#include "btif_sock_thread.h"
#include "btif_sock_util.h"
-#include <cutils/log.h>
#define asrt(s) if(!(s)) APPL_TRACE_ERROR("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
#define print_events(events) do { \
APPL_TRACE_DEBUG("print poll event:%x", events); \
diff --git a/btif/src/btif_sock_util.c b/btif/src/btif_sock_util.c
index 8e016e2..9738371 100644
--- a/btif/src/btif_sock_util.c
+++ b/btif/src/btif_sock_util.c
@@ -63,6 +63,7 @@
#include "bta_jv_api.h"
#include "bta_jv_co.h"
#include "port_api.h"
+#include "osi/include/log.h"
#define asrt(s) if(!(s)) BTIF_TRACE_ERROR("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
@@ -186,7 +187,7 @@
char *line;
int i, j, addr;
const int width = 16;
- ALOGD("%s, size:%d, dump started {", title, size);
+ LOG_DEBUG("%s, size:%d, dump started {", title, size);
if(size <= 0)
return;
//write offset
@@ -254,6 +255,6 @@
//output the line
PRINT(line_buff);
}
- ALOGD("%s, size:%d, dump ended }", title, size);
+ LOG_DEBUG("%s, size:%d, dump ended }", title, size);
}
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index a16d583..f770df9 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -47,8 +47,7 @@
#include "osi.h"
#include "bta_hh_api.h"
#include "btif_hh.h"
-
-#include <cutils/log.h>
+#include "osi/include/log.h"
/************************************************************************************
** Constants & Macros
@@ -1586,7 +1585,7 @@
config_t *config = config_new(BTIF_AUTO_PAIR_CONF_FILE);
if (!config) {
- ALOGE("%s failed to open auto pair blacklist conf file '%s'.", __func__, BTIF_AUTO_PAIR_CONF_FILE);
+ LOG_ERROR("%s failed to open auto pair blacklist conf file '%s'.", __func__, BTIF_AUTO_PAIR_CONF_FILE);
return BT_STATUS_FAIL;
}
diff --git a/btif/src/stack_manager.c b/btif/src/stack_manager.c
index 3928dd5..13a3d42 100644
--- a/btif/src/stack_manager.c
+++ b/btif/src/stack_manager.c
@@ -19,13 +19,13 @@
#define LOG_TAG "bt_stack_manager"
#include <hardware/bluetooth.h>
-#include <utils/Log.h>
#include "btif_api.h"
#include "btif_common.h"
#include "device/include/controller.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "semaphore.h"
#include "stack_manager.h"
#include "thread.h"
@@ -107,7 +107,7 @@
static void ensure_stack_is_initialized(void) {
if (!stack_is_initialized) {
- ALOGW("%s found the stack was uninitialized. Initializing now.", __func__);
+ LOG_WARN("%s found the stack was uninitialized. Initializing now.", __func__);
// No semaphore needed since we are calling it directly
event_init_stack(NULL);
}
@@ -116,13 +116,13 @@
// Synchronous function to start up the stack
static void event_start_up_stack(UNUSED_ATTR void *context) {
if (stack_is_running) {
- ALOGD("%s stack already brought up.", __func__);
+ LOG_DEBUG("%s stack already brought up.", __func__);
return;
}
ensure_stack_is_initialized();
- ALOGD("%s is bringing up the stack.", __func__);
+ LOG_DEBUG("%s is bringing up the stack.", __func__);
hack_future = future_new();
// Include this for now to put btif config into a shutdown-able state
@@ -136,18 +136,18 @@
}
stack_is_running = true;
- ALOGD("%s finished", __func__);
+ LOG_DEBUG("%s finished", __func__);
btif_thread_post(event_signal_stack_up, NULL);
}
// Synchronous function to shut down the stack
static void event_shut_down_stack(UNUSED_ATTR void *context) {
if (!stack_is_running) {
- ALOGD("%s stack is already brought down.", __func__);
+ LOG_DEBUG("%s stack is already brought down.", __func__);
return;
}
- ALOGD("%s is bringing down the stack.", __func__);
+ LOG_DEBUG("%s is bringing down the stack.", __func__);
hack_future = future_new();
stack_is_running = false;
@@ -156,13 +156,13 @@
future_await(hack_future);
module_shut_down(get_module(CONTROLLER_MODULE)); // Doesn't do any work, just puts it in a restartable state
- ALOGD("%s finished.", __func__);
+ LOG_DEBUG("%s finished.", __func__);
btif_thread_post(event_signal_stack_down, NULL);
}
static void ensure_stack_is_not_running(void) {
if (stack_is_running) {
- ALOGW("%s found the stack was still running. Bringing it down now.", __func__);
+ LOG_WARN("%s found the stack was still running. Bringing it down now.", __func__);
event_shut_down_stack(NULL);
}
}
@@ -170,13 +170,13 @@
// Synchronous function to clean up the stack
static void event_clean_up_stack(UNUSED_ATTR void *context) {
if (!stack_is_initialized) {
- ALOGD("%s found the stack already in a clean state.", __func__);
+ LOG_DEBUG("%s found the stack already in a clean state.", __func__);
return;
}
ensure_stack_is_not_running();
- ALOGD("%s is cleaning up the stack.", __func__);
+ LOG_DEBUG("%s is cleaning up the stack.", __func__);
hack_future = future_new();
stack_is_initialized = false;
@@ -186,7 +186,7 @@
future_await(hack_future);
module_management_stop();
- ALOGD("%s finished.", __func__);
+ LOG_DEBUG("%s finished.", __func__);
}
static void event_signal_stack_up(UNUSED_ATTR void *context) {
@@ -206,7 +206,7 @@
management_thread = thread_new("stack_manager");
if (!management_thread) {
- ALOGE("%s unable to create stack management thread.", __func__);
+ LOG_ERROR("%s unable to create stack management thread.", __func__);
return;
}
}
diff --git a/device/src/controller.c b/device/src/controller.c
index 471aebc..43e16e4 100644
--- a/device/src/controller.c
+++ b/device/src/controller.c
@@ -20,7 +20,6 @@
#include <assert.h>
#include <stdbool.h>
-#include <utils/Log.h>
#include "bdaddr.h"
#include "bt_types.h"
diff --git a/gki/common/gki_buffer.c b/gki/common/gki_buffer.c
index 4c41c49..29ec246 100644
--- a/gki/common/gki_buffer.c
+++ b/gki/common/gki_buffer.c
@@ -15,7 +15,6 @@
* limitations under the License.
*
******************************************************************************/
-#include <cutils/log.h>
#include "allocator.h"
#include "gki_int.h"
diff --git a/gki/common/gki_time.c b/gki/common/gki_time.c
index e8f10ea..c95e28f 100644
--- a/gki/common/gki_time.c
+++ b/gki/common/gki_time.c
@@ -17,8 +17,8 @@
******************************************************************************/
#include <assert.h>
-#include <utils/Log.h>
#include "gki_int.h"
+#include "osi/include/log.h"
#define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL) /* Largest signed positive timer count */
@@ -235,7 +235,7 @@
{
// When using alarms from AlarmService we should
// always have work to be done here.
- ALOGE("%s no work to be done when expected work", __func__);
+ LOG_ERROR("%s no work to be done when expected work", __func__);
gki_cb.com.timer_nesting = 0;
return;
}
diff --git a/gki/ulinux/gki_ulinux.c b/gki/ulinux/gki_ulinux.c
index 4ad88d1..aedc0a7 100644
--- a/gki/ulinux/gki_ulinux.c
+++ b/gki/ulinux/gki_ulinux.c
@@ -32,13 +32,13 @@
#include <hardware/bluetooth.h>
#include <sys/prctl.h>
#include <sys/times.h>
-#include <utils/Log.h>
#include "alarm.h"
#include "bt_utils.h"
#include "gki_int.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
/*****************************************************************************
** Constants & Macros
@@ -88,7 +88,7 @@
if (alarm_ticks > 0)
alarm_set(alarm_timer, GKI_TICKS_TO_MS(alarm_ticks), bt_alarm_cb, NULL);
else
- ALOGV("%s no more alarms.", __func__);
+ LOG_VERBOSE("%s no more alarms.", __func__);
}
static future_t *init(void)
@@ -395,20 +395,20 @@
void GKI_exception(UINT16 code, char *msg)
{
- ALOGE( "GKI_exception(): Task State Table");
+ LOG_ERROR( "GKI_exception(): Task State Table");
for (int task_id = 0; task_id < GKI_MAX_TASKS; task_id++)
{
- ALOGE( "TASK ID [%d] task name [%s] state [%d]",
+ LOG_ERROR( "TASK ID [%d] task name [%s] state [%d]",
task_id,
gki_cb.com.task_name[task_id],
gki_cb.com.task_state[task_id]);
}
- ALOGE("GKI_exception %d %s", code, msg);
- ALOGE( "********************************************************************");
- ALOGE( "* GKI_exception(): %d %s", code, msg);
- ALOGE( "********************************************************************");
+ LOG_ERROR("GKI_exception %d %s", code, msg);
+ LOG_ERROR( "********************************************************************");
+ LOG_ERROR( "* GKI_exception(): %d %s", code, msg);
+ LOG_ERROR( "********************************************************************");
GKI_TRACE("GKI_exception %d %s done", code, msg);
}
diff --git a/hci/src/btsnoop.c b/hci/src/btsnoop.c
index 703c522..2d45c10 100644
--- a/hci/src/btsnoop.c
+++ b/hci/src/btsnoop.c
@@ -19,7 +19,6 @@
#define LOG_TAG "btsnoop"
#include <assert.h>
-#include <cutils/log.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
@@ -32,6 +31,7 @@
#include "btsnoop.h"
#include "bt_types.h"
#include "hci_layer.h"
+#include "osi/include/log.h"
#include "stack_config.h"
typedef enum {
@@ -145,7 +145,7 @@
logfile_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
if (logfile_fd == INVALID_FD) {
- ALOGE("%s unable to open '%s': %s", __func__, path, strerror(errno));
+ LOG_ERROR("%s unable to open '%s': %s", __func__, path, strerror(errno));
return;
}
diff --git a/hci/src/btsnoop_net.c b/hci/src/btsnoop_net.c
index adaddcd..bac99fb 100644
--- a/hci/src/btsnoop_net.c
+++ b/hci/src/btsnoop_net.c
@@ -19,7 +19,6 @@
#define LOG_TAG "btsnoop_net"
#include <assert.h>
-#include <cutils/log.h>
#include <errno.h>
#include <netinet/in.h>
#include <pthread.h>
@@ -30,6 +29,7 @@
#include <sys/types.h>
#include "osi.h"
+#include "osi/include/log.h"
static void safe_close_(int *fd);
static void *listen_fn_(void *context);
@@ -47,9 +47,9 @@
void btsnoop_net_open() {
listen_thread_valid_ = (pthread_create(&listen_thread_, NULL, listen_fn_, NULL) == 0);
if (!listen_thread_valid_) {
- ALOGE("%s pthread_create failed: %s", __func__, strerror(errno));
+ LOG_ERROR("%s pthread_create failed: %s", __func__, strerror(errno));
} else {
- ALOGD("initialized");
+ LOG_DEBUG("initialized");
}
}
@@ -78,13 +78,13 @@
listen_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listen_socket_ == -1) {
- ALOGE("%s socket creation failed: %s", __func__, strerror(errno));
+ LOG_ERROR("%s socket creation failed: %s", __func__, strerror(errno));
goto cleanup;
}
int enable = 1;
if (setsockopt(listen_socket_, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) == -1) {
- ALOGE("%s unable to set SO_REUSEADDR: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to set SO_REUSEADDR: %s", __func__, strerror(errno));
goto cleanup;
}
@@ -93,29 +93,27 @@
addr.sin_addr.s_addr = htonl(LOCALHOST_);
addr.sin_port = htons(LISTEN_PORT_);
if (bind(listen_socket_, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- ALOGE("%s unable to bind listen socket: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to bind listen socket: %s", __func__, strerror(errno));
goto cleanup;
}
if (listen(listen_socket_, 10) == -1) {
- ALOGE("%s unable to listen: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to listen: %s", __func__, strerror(errno));
goto cleanup;
}
for (;;) {
- ALOGD("waiting for client connection");
int client_socket = accept(listen_socket_, NULL, NULL);
if (client_socket == -1) {
if (errno == EINVAL || errno == EBADF) {
break;
}
- ALOGW("%s error accepting socket: %s", __func__, strerror(errno));
+ LOG_WARN("%s error accepting socket: %s", __func__, strerror(errno));
continue;
}
/* When a new client connects, we have to send the btsnoop file header. This allows
a decoder to treat the session as a new, valid btsnoop file. */
- ALOGI("client connected");
pthread_mutex_lock(&client_socket_lock_);
safe_close_(&client_socket_);
client_socket_ = client_socket;
diff --git a/hci/src/hci_hal_h4.c b/hci/src/hci_hal_h4.c
index d53c4ef..0c3efeb 100644
--- a/hci/src/hci_hal_h4.c
+++ b/hci/src/hci_hal_h4.c
@@ -19,11 +19,11 @@
#define LOG_TAG "hci_hal_h4"
#include <assert.h>
-#include <utils/Log.h>
#include "eager_reader.h"
#include "hci_hal.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "reactor.h"
#include "vendor.h"
@@ -55,26 +55,26 @@
}
static bool hal_open() {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
// TODO(zachoverflow): close if already open / or don't reopen (maybe at the hci layer level)
int fd_array[CH_MAX];
int number_of_ports = vendor->send_command(VENDOR_OPEN_USERIAL, &fd_array);
if (number_of_ports != 1) {
- ALOGE("%s opened the wrong number of ports: got %d, expected 1.", __func__, number_of_ports);
+ LOG_ERROR("%s opened the wrong number of ports: got %d, expected 1.", __func__, number_of_ports);
goto error;
}
uart_fd = fd_array[0];
if (uart_fd == INVALID_FD) {
- ALOGE("%s unable to open the uart serial port.", __func__);
+ LOG_ERROR("%s unable to open the uart serial port.", __func__);
goto error;
}
uart_stream = eager_reader_new(uart_fd, &allocator_malloc, HCI_HAL_SERIAL_BUFFER_SIZE, SIZE_MAX, "hci_single_channel");
if (!uart_stream) {
- ALOGE("%s unable to create eager reader for the uart serial port.", __func__);
+ LOG_ERROR("%s unable to create eager reader for the uart serial port.", __func__);
goto error;
}
@@ -89,7 +89,7 @@
}
static void hal_close() {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
eager_reader_free(uart_stream);
vendor->send_command(VENDOR_CLOSE_USERIAL, NULL);
@@ -98,13 +98,13 @@
static size_t read_data(serial_data_type_t type, uint8_t *buffer, size_t max_size, bool block) {
if (type < DATA_TYPE_ACL || type > DATA_TYPE_EVENT) {
- ALOGE("%s invalid data type: %d", __func__, type);
+ LOG_ERROR("%s invalid data type: %d", __func__, type);
return 0;
} else if (!stream_has_interpretation) {
- ALOGE("%s with no valid stream intepretation.", __func__);
+ LOG_ERROR("%s with no valid stream intepretation.", __func__);
return 0;
} else if (current_data_type != type) {
- ALOGE("%s with different type than existing interpretation.", __func__);
+ LOG_ERROR("%s with different type than existing interpretation.", __func__);
return 0;
}
@@ -113,9 +113,9 @@
static void packet_finished(serial_data_type_t type) {
if (!stream_has_interpretation)
- ALOGE("%s with no existing stream interpretation.", __func__);
+ LOG_ERROR("%s with no existing stream interpretation.", __func__);
else if (current_data_type != type)
- ALOGE("%s with different type than existing interpretation.", __func__);
+ LOG_ERROR("%s with different type than existing interpretation.", __func__);
stream_has_interpretation = false;
}
@@ -125,7 +125,7 @@
assert(length > 0);
if (type < DATA_TYPE_COMMAND || type > DATA_TYPE_SCO) {
- ALOGE("%s invalid data type: %d", __func__, type);
+ LOG_ERROR("%s invalid data type: %d", __func__, type);
return 0;
}
@@ -140,7 +140,7 @@
ssize_t ret = write(uart_fd, data + transmitted_length, length);
switch (ret) {
case -1:
- ALOGE("In %s, error writing to the uart serial port: %s", __func__, strerror(errno));
+ LOG_ERROR("In %s, error writing to the uart serial port: %s", __func__, strerror(errno));
goto done;
case 0:
// If we wrote nothing, don't loop more because we
@@ -174,7 +174,7 @@
uint8_t type_byte;
eager_reader_read(reader, &type_byte, 1, true);
if (type_byte < DATA_TYPE_ACL || type_byte > DATA_TYPE_EVENT) {
- ALOGE("[h4] Unknown HCI message type. Dropping this byte 0x%x, min %x, max %x", type_byte, DATA_TYPE_ACL, DATA_TYPE_EVENT);
+ LOG_ERROR("[h4] Unknown HCI message type. Dropping this byte 0x%x, min %x, max %x", type_byte, DATA_TYPE_ACL, DATA_TYPE_EVENT);
return;
}
diff --git a/hci/src/hci_hal_mct.c b/hci/src/hci_hal_mct.c
index 3e92a69..f43afae 100644
--- a/hci/src/hci_hal_mct.c
+++ b/hci/src/hci_hal_mct.c
@@ -19,12 +19,12 @@
#define LOG_TAG "hci_hal_mct"
#include <assert.h>
-#include <utils/Log.h>
#include "bt_vendor_lib.h"
#include "eager_reader.h"
#include "hci_hal.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "reactor.h"
#include "vendor.h"
@@ -57,48 +57,48 @@
}
static bool hal_open() {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
// TODO(zachoverflow): close if already open / or don't reopen (maybe at the hci layer level)
int number_of_ports = vendor->send_command(VENDOR_OPEN_USERIAL, &uart_fds);
if (number_of_ports != 2 && number_of_ports != 4) {
- ALOGE("%s opened the wrong number of ports: got %d, expected 2 or 4.", __func__, number_of_ports);
+ LOG_ERROR("%s opened the wrong number of ports: got %d, expected 2 or 4.", __func__, number_of_ports);
goto error;
}
- ALOGI("%s got uart fds: CMD=%d, EVT=%d, ACL_OUT=%d, ACL_IN=%d",
+ LOG_INFO("%s got uart fds: CMD=%d, EVT=%d, ACL_OUT=%d, ACL_IN=%d",
__func__, uart_fds[CH_CMD], uart_fds[CH_EVT], uart_fds[CH_ACL_OUT], uart_fds[CH_ACL_IN]);
if (uart_fds[CH_CMD] == INVALID_FD) {
- ALOGE("%s unable to open the command uart serial port.", __func__);
+ LOG_ERROR("%s unable to open the command uart serial port.", __func__);
goto error;
}
if (uart_fds[CH_EVT] == INVALID_FD) {
- ALOGE("%s unable to open the event uart serial port.", __func__);
+ LOG_ERROR("%s unable to open the event uart serial port.", __func__);
goto error;
}
if (uart_fds[CH_ACL_OUT] == INVALID_FD) {
- ALOGE("%s unable to open the acl-out uart serial port.", __func__);
+ LOG_ERROR("%s unable to open the acl-out uart serial port.", __func__);
goto error;
}
if (uart_fds[CH_ACL_IN] == INVALID_FD) {
- ALOGE("%s unable to open the acl-in uart serial port.", __func__);
+ LOG_ERROR("%s unable to open the acl-in uart serial port.", __func__);
goto error;
}
event_stream = eager_reader_new(uart_fds[CH_EVT], &allocator_malloc, HCI_HAL_SERIAL_BUFFER_SIZE, SIZE_MAX, "hci_mct");
if (!event_stream) {
- ALOGE("%s unable to create eager reader for the event uart serial port.", __func__);
+ LOG_ERROR("%s unable to create eager reader for the event uart serial port.", __func__);
goto error;
}
acl_stream = eager_reader_new(uart_fds[CH_ACL_IN], &allocator_malloc, HCI_HAL_SERIAL_BUFFER_SIZE, SIZE_MAX, "hci_mct");
if (!event_stream) {
- ALOGE("%s unable to create eager reader for the acl-in uart serial port.", __func__);
+ LOG_ERROR("%s unable to create eager reader for the acl-in uart serial port.", __func__);
goto error;
}
@@ -113,7 +113,8 @@
}
static void hal_close() {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
+
eager_reader_free(event_stream);
eager_reader_free(acl_stream);
vendor->send_command(VENDOR_CLOSE_USERIAL, NULL);
@@ -129,7 +130,7 @@
return eager_reader_read(event_stream, buffer, max_size, block);
}
- ALOGE("%s invalid data type: %d", __func__, type);
+ LOG_ERROR("%s invalid data type: %d", __func__, type);
return 0;
}
@@ -144,7 +145,7 @@
return transmit_data_on(uart_fds[CH_CMD], data, length);
}
- ALOGE("%s invalid data type: %d", __func__, type);
+ LOG_ERROR("%s invalid data type: %d", __func__, type);
return 0;
}
@@ -159,7 +160,7 @@
ssize_t ret = write(fd, data + transmitted_length, length);
switch (ret) {
case -1:
- ALOGE("In %s, error writing to the serial port with fd %d: %s", __func__, fd, strerror(errno));
+ LOG_ERROR("In %s, error writing to the serial port with fd %d: %s", __func__, fd, strerror(errno));
return transmitted_length;
case 0:
// If we wrote nothing, don't loop more because we
diff --git a/hci/src/hci_inject.c b/hci/src/hci_inject.c
index c017f2c..bf9fc5c 100644
--- a/hci/src/hci_inject.c
+++ b/hci/src/hci_inject.c
@@ -20,7 +20,6 @@
#include <assert.h>
#include <errno.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "bt_types.h"
@@ -29,6 +28,7 @@
#include "hci_layer.h"
#include "list.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "socket.h"
#include "thread.h"
@@ -109,7 +109,7 @@
case HCI_PACKET_SCO_DATA:
return MSG_STACK_TO_HC_HCI_SCO;
default:
- ALOGE("%s unsupported packet type: %d", __func__, packet);
+ LOG_ERROR("%s unsupported packet type: %d", __func__, packet);
return -1;
}
}
@@ -124,7 +124,7 @@
client_t *client = (client_t *)osi_calloc(sizeof(client_t));
if (!client) {
- ALOGE("%s unable to allocate memory for client.", __func__);
+ LOG_ERROR("%s unable to allocate memory for client.", __func__);
socket_free(socket);
return;
}
@@ -132,7 +132,7 @@
client->socket = socket;
if (!list_append(clients, client)) {
- ALOGE("%s unable to add client to list.", __func__);
+ LOG_ERROR("%s unable to add client to list.", __func__);
client_free(client);
return;
}
@@ -175,7 +175,7 @@
memcpy(buf->data, buffer + 3, packet_len);
hci->transmit_downward(buf->event, buf);
} else {
- ALOGE("%s dropping injected packet of length %zu", __func__, packet_len);
+ LOG_ERROR("%s dropping injected packet of length %zu", __func__, packet_len);
}
size_t remainder = client->buffer_size - frame_len;
diff --git a/hci/src/hci_layer.c b/hci/src/hci_layer.c
index 69cacdb..7944bd8 100644
--- a/hci/src/hci_layer.c
+++ b/hci/src/hci_layer.c
@@ -20,7 +20,6 @@
#include <assert.h>
#include <cutils/properties.h>
-#include <utils/Log.h>
#include "buffer_allocator.h"
#include "btsnoop.h"
@@ -37,6 +36,7 @@
#include "module.h"
#include "non_repeating_timer.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "packet_fragmenter.h"
#include "reactor.h"
#include "vendor.h"
@@ -158,7 +158,7 @@
// Module lifecycle functions
static future_t *start_up(void) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
// The host is only allowed to send at most one command initially,
// as per the Bluetooth spec, Volume 2, Part E, 4.4 (Command Flow Control)
@@ -177,7 +177,7 @@
startup_timer = non_repeating_timer_new(startup_timeout_ms, startup_timer_expired, NULL);
if (!startup_timer) {
- ALOGE("%s unable to create startup timer.", __func__);
+ LOG_ERROR("%s unable to create startup timer.", __func__);
goto error;
}
@@ -186,37 +186,37 @@
epilog_timer = non_repeating_timer_new(EPILOG_TIMEOUT_MS, epilog_timer_expired, NULL);
if (!epilog_timer) {
- ALOGE("%s unable to create epilog timer.", __func__);
+ LOG_ERROR("%s unable to create epilog timer.", __func__);
goto error;
}
command_response_timer = non_repeating_timer_new(COMMAND_PENDING_TIMEOUT, command_timed_out, NULL);
if (!command_response_timer) {
- ALOGE("%s unable to create command response timer.", __func__);
+ LOG_ERROR("%s unable to create command response timer.", __func__);
goto error;
}
command_queue = fixed_queue_new(SIZE_MAX);
if (!command_queue) {
- ALOGE("%s unable to create pending command queue.", __func__);
+ LOG_ERROR("%s unable to create pending command queue.", __func__);
goto error;
}
packet_queue = fixed_queue_new(SIZE_MAX);
if (!packet_queue) {
- ALOGE("%s unable to create pending packet queue.", __func__);
+ LOG_ERROR("%s unable to create pending packet queue.", __func__);
goto error;
}
thread = thread_new("hci_thread");
if (!thread) {
- ALOGE("%s unable to create thread.", __func__);
+ LOG_ERROR("%s unable to create thread.", __func__);
goto error;
}
commands_pending_response = list_new(NULL);
if (!commands_pending_response) {
- ALOGE("%s unable to create list for commands pending response.", __func__);
+ LOG_ERROR("%s unable to create list for commands pending response.", __func__);
goto error;
}
@@ -241,7 +241,7 @@
int power_state = BT_VND_PWR_OFF;
#if (defined (BT_CLEAN_TURN_ON_DISABLED) && BT_CLEAN_TURN_ON_DISABLED == TRUE)
- ALOGW("%s not turning off the chip before turning on.", __func__);
+ LOG_WARN("%s not turning off the chip before turning on.", __func__);
// So apparently this hack was needed in the past because a Wingray kernel driver
// didn't handle power off commands in a powered off state correctly.
@@ -256,7 +256,7 @@
vendor->send_command(VENDOR_CHIP_POWER_CONTROL, &power_state);
startup_future = future_new();
- ALOGD("%s starting async portion", __func__);
+ LOG_DEBUG("%s starting async portion", __func__);
thread_post(thread, event_finish_startup, NULL);
return startup_future;
error:;
@@ -265,7 +265,7 @@
}
static future_t *shut_down() {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
hci_inject->close();
@@ -325,7 +325,7 @@
// Interface functions
static void do_postload() {
- ALOGD("%s posting postload work item", __func__);
+ LOG_DEBUG("%s posting postload work item", __func__);
thread_post(thread, event_postload, NULL);
}
@@ -336,7 +336,7 @@
void *context) {
waiting_command_t *wait_entry = osi_calloc(sizeof(waiting_command_t));
if (!wait_entry) {
- ALOGE("%s couldn't allocate space for wait entry.", __func__);
+ LOG_ERROR("%s couldn't allocate space for wait entry.", __func__);
return;
}
@@ -377,7 +377,7 @@
if (type == MSG_STACK_TO_HC_HCI_CMD) {
// TODO(zachoverflow): eliminate this call
transmit_command((BT_HDR *)data, NULL, NULL, NULL);
- ALOGW("%s legacy transmit of command. Use transmit_command instead.", __func__);
+ LOG_WARN("%s legacy transmit of command. Use transmit_command instead.", __func__);
} else {
fixed_queue_enqueue(packet_queue, data);
}
@@ -386,13 +386,13 @@
// Start up functions
static void event_finish_startup(UNUSED_ATTR void *context) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
hal->open();
vendor->send_async_command(VENDOR_CONFIGURE_FIRMWARE, NULL);
}
static void firmware_config_callback(UNUSED_ATTR bool success) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
firmware_is_configured = true;
non_repeating_timer_cancel(startup_timer);
@@ -401,7 +401,7 @@
}
static void startup_timer_expired(UNUSED_ATTR void *context) {
- ALOGE("%s", __func__);
+ LOG_ERROR("%s", __func__);
future_ready(startup_future, FUTURE_FAIL);
startup_future = NULL;
}
@@ -409,7 +409,7 @@
// Postload functions
static void event_postload(UNUSED_ATTR void *context) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
if(vendor->send_async_command(VENDOR_CONFIGURE_SCO, NULL) == -1) {
// If couldn't configure sco, we won't get the sco configuration callback
// so go pretend to do it now
@@ -419,7 +419,7 @@
}
static void sco_config_callback(UNUSED_ATTR bool success) {
- ALOGI("%s postload finished.", __func__);
+ LOG_INFO("%s postload finished.", __func__);
}
// Epilog functions
@@ -429,12 +429,12 @@
}
static void epilog_finished_callback(UNUSED_ATTR bool success) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
thread_stop(thread);
}
static void epilog_timer_expired(UNUSED_ATTR void *context) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
thread_stop(thread);
}
@@ -491,17 +491,17 @@
pthread_mutex_lock(&commands_pending_response_lock);
if (list_is_empty(commands_pending_response)) {
- ALOGE("%s with no commands pending response", __func__);
+ LOG_ERROR("%s with no commands pending response", __func__);
} else {
waiting_command_t *wait_entry = list_front(commands_pending_response);
pthread_mutex_unlock(&commands_pending_response_lock);
// We shouldn't try to recover the stack from this command timeout.
// If it's caused by a software bug, fix it. If it's a hardware bug, fix it.
- ALOGE("%s hci layer timeout waiting for response to a command. opcode: 0x%x", __func__, wait_entry->opcode);
+ LOG_ERROR("%s hci layer timeout waiting for response to a command. opcode: 0x%x", __func__, wait_entry->opcode);
}
- ALOGE("%s restarting the bluetooth process.", __func__);
+ LOG_ERROR("%s restarting the bluetooth process.", __func__);
usleep(10000);
kill(getpid(), SIGKILL);
}
@@ -536,7 +536,7 @@
incoming->buffer = (BT_HDR *)buffer_allocator->alloc(buffer_size);
if (!incoming->buffer) {
- ALOGE("%s error getting buffer for incoming packet of type %d and size %d", __func__, type, buffer_size);
+ LOG_ERROR("%s error getting buffer for incoming packet of type %d and size %d", __func__, type, buffer_size);
// Can't read any more of this current packet, so jump out
incoming->state = incoming->bytes_remaining == 0 ? BRAND_NEW : IGNORE;
break;
@@ -576,7 +576,7 @@
break;
case FINISHED:
- ALOGE("%s the state machine should not have been left in the finished state.", __func__);
+ LOG_ERROR("%s the state machine should not have been left in the finished state.", __func__);
break;
}
@@ -619,7 +619,7 @@
wait_entry = get_waiting_command(opcode);
if (!wait_entry)
- ALOGW("%s command complete event with no matching command. opcode: 0x%x.", __func__, opcode);
+ LOG_WARN("%s command complete event with no matching command. opcode: 0x%x.", __func__, opcode);
else if (wait_entry->complete_callback)
wait_entry->complete_callback(packet, wait_entry->context);
else if (wait_entry->complete_future)
@@ -636,7 +636,7 @@
wait_entry = get_waiting_command(opcode);
if (!wait_entry)
- ALOGW("%s command status event with no matching command. opcode: 0x%x", __func__, opcode);
+ LOG_WARN("%s command status event with no matching command. opcode: 0x%x", __func__, opcode);
else if (wait_entry->status_callback)
wait_entry->status_callback(status, wait_entry->command, wait_entry->context);
@@ -684,7 +684,7 @@
else if (event == MSG_STACK_TO_HC_HCI_CMD)
return DATA_TYPE_COMMAND;
else
- ALOGE("%s invalid event type, could not translate 0x%x", __func__, event);
+ LOG_ERROR("%s invalid event type, could not translate 0x%x", __func__, event);
return 0;
}
@@ -719,7 +719,7 @@
// there's only one instance of the hci interface.
interface.upward_dispatcher = data_dispatcher_new("hci_layer");
if (!interface.upward_dispatcher) {
- ALOGE("%s could not create upward dispatcher.", __func__);
+ LOG_ERROR("%s could not create upward dispatcher.", __func__);
return;
}
diff --git a/hci/src/low_power_manager.c b/hci/src/low_power_manager.c
index 05ca016..f578021 100644
--- a/hci/src/low_power_manager.c
+++ b/hci/src/low_power_manager.c
@@ -20,11 +20,11 @@
#include <assert.h>
#include <stdint.h>
-#include <utils/Log.h>
#include "alarm.h"
#include "low_power_manager.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "thread.h"
#include "vendor.h"
@@ -83,7 +83,7 @@
idle_alarm = alarm_new();
if (!idle_alarm) {
- ALOGE("%s could not create idle alarm.", __func__);
+ LOG_ERROR("%s could not create idle alarm.", __func__);
}
reset_state();
@@ -97,7 +97,7 @@
static void post_command(low_power_command_t command) {
if (command > LPM_WAKE_DEASSERT) {
- ALOGE("%s unknown low power command %d", __func__, command);
+ LOG_ERROR("%s unknown low power command %d", __func__, command);
return;
}
@@ -132,18 +132,18 @@
static void enable(bool enable) {
if (state == LPM_DISABLING) {
if (enable)
- ALOGE("%s still processing prior disable request, cannot enable.", __func__);
+ LOG_ERROR("%s still processing prior disable request, cannot enable.", __func__);
else
- ALOGW("%s still processing prior disable request, ignoring new request to disable.", __func__);
+ LOG_WARN("%s still processing prior disable request, ignoring new request to disable.", __func__);
} else if (state == LPM_ENABLING) {
if (enable)
- ALOGE("%s still processing prior enable request, ignoring new request to enable.", __func__);
+ LOG_ERROR("%s still processing prior enable request, ignoring new request to enable.", __func__);
else
- ALOGW("%s still processing prior enable request, cannot disable.", __func__);
+ LOG_WARN("%s still processing prior enable request, cannot disable.", __func__);
} else if (state == LPM_ENABLED && enable) {
- ALOGI("%s already enabled.", __func__);
+ LOG_INFO("%s already enabled.", __func__);
} else if (state == LPM_DISABLED && !enable) {
- ALOGI("%s already disabled.", __func__);
+ LOG_INFO("%s already disabled.", __func__);
} else {
uint8_t command = enable ? BT_VND_LPM_ENABLE : BT_VND_LPM_DISABLE;
state = enable ? LPM_ENABLING : LPM_DISABLING;
diff --git a/hci/src/packet_fragmenter.c b/hci/src/packet_fragmenter.c
index 18c81a2..1cee3c1 100644
--- a/hci/src/packet_fragmenter.c
+++ b/hci/src/packet_fragmenter.c
@@ -19,7 +19,6 @@
#define LOG_TAG "hci_packet_fragmenter"
#include <assert.h>
-#include <utils/Log.h>
#include "buffer_allocator.h"
#include "device/include/controller.h"
@@ -29,6 +28,7 @@
#include "hci_layer.h"
#include "packet_fragmenter.h"
#include "osi.h"
+#include "osi/include/log.h"
#define APPLY_CONTINUATION_FLAG(handle) (((handle) & 0xCFFF) | 0x1000)
#define APPLY_START_FLAG(handle) (((handle) & 0xCFFF) | 0x2000)
@@ -138,7 +138,7 @@
if (boundary_flag == START_PACKET_BOUNDARY) {
if (partial_packet) {
- ALOGW("%s found unfinished packet for handle with start packet. Dropping old.", __func__);
+ LOG_WARN("%s found unfinished packet for handle with start packet. Dropping old.", __func__);
hash_map_erase(partial_packets, (void *)(uintptr_t)handle);
buffer_allocator->free(partial_packet);
@@ -147,7 +147,7 @@
uint16_t full_length = l2cap_length + L2CAP_HEADER_SIZE + HCI_ACL_PREAMBLE_SIZE;
if (full_length <= packet->len) {
if (full_length < packet->len)
- ALOGW("%s found l2cap full length %d less than the hci length %d.", __func__, l2cap_length, packet->len);
+ LOG_WARN("%s found l2cap full length %d less than the hci length %d.", __func__, l2cap_length, packet->len);
callbacks->reassembled(packet);
return;
@@ -170,7 +170,7 @@
buffer_allocator->free(packet);
} else {
if (!partial_packet) {
- ALOGW("%s got continuation for unknown packet. Dropping it.", __func__);
+ LOG_WARN("%s got continuation for unknown packet. Dropping it.", __func__);
buffer_allocator->free(packet);
return;
}
@@ -178,7 +178,7 @@
packet->offset = HCI_ACL_PREAMBLE_SIZE;
uint16_t projected_offset = partial_packet->offset + (packet->len - HCI_ACL_PREAMBLE_SIZE);
if (projected_offset > partial_packet->len) { // len stores the expected length
- ALOGW("%s got packet which would exceed expected length of %d. Truncating.", __func__, partial_packet->len);
+ LOG_WARN("%s got packet which would exceed expected length of %d. Truncating.", __func__, partial_packet->len);
packet->len = partial_packet->len - partial_packet->offset;
projected_offset = partial_packet->len;
}
diff --git a/hci/src/vendor.c b/hci/src/vendor.c
index e6ed535..24b739d 100644
--- a/hci/src/vendor.c
+++ b/hci/src/vendor.c
@@ -20,11 +20,11 @@
#include <assert.h>
#include <dlfcn.h>
-#include <utils/Log.h>
#include "buffer_allocator.h"
#include "bt_vendor_lib.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "vendor.h"
#define LAST_VENDOR_OPCODE_VALUE VENDOR_DO_EPILOG
@@ -51,21 +51,21 @@
lib_handle = dlopen(VENDOR_LIBRARY_NAME, RTLD_NOW);
if (!lib_handle) {
- ALOGE("%s unable to open %s: %s", __func__, VENDOR_LIBRARY_NAME, dlerror());
+ LOG_ERROR("%s unable to open %s: %s", __func__, VENDOR_LIBRARY_NAME, dlerror());
goto error;
}
lib_interface = (bt_vendor_interface_t *)dlsym(lib_handle, VENDOR_LIBRARY_SYMBOL_NAME);
if (!lib_interface) {
- ALOGE("%s unable to find symbol %s in %s: %s", __func__, VENDOR_LIBRARY_SYMBOL_NAME, VENDOR_LIBRARY_NAME, dlerror());
+ LOG_ERROR("%s unable to find symbol %s in %s: %s", __func__, VENDOR_LIBRARY_SYMBOL_NAME, VENDOR_LIBRARY_NAME, dlerror());
goto error;
}
- ALOGI("alloc value %p", lib_callbacks.alloc);
+ LOG_INFO("alloc value %p", lib_callbacks.alloc);
int status = lib_interface->init(&lib_callbacks, (unsigned char *)local_bdaddr);
if (status) {
- ALOGE("%s unable to initialize vendor library: %d", __func__, status);
+ LOG_ERROR("%s unable to initialize vendor library: %d", __func__, status);
goto error;
}
@@ -109,7 +109,7 @@
// Called back from vendor library when the firmware configuration
// completes.
static void firmware_config_cb(bt_vendor_op_result_t result) {
- ALOGI("firmware callback");
+ LOG_INFO("firmware callback");
vendor_cb callback = callbacks[VENDOR_CONFIGURE_FIRMWARE];
assert(callback != NULL);
callback(result == BT_VND_OP_RESULT_SUCCESS);
@@ -119,7 +119,7 @@
// SCO configuration request. This should only happen during the
// postload process.
static void sco_config_cb(bt_vendor_op_result_t result) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
vendor_cb callback = callbacks[VENDOR_CONFIGURE_SCO];
assert(callback != NULL);
callback(result == BT_VND_OP_RESULT_SUCCESS);
@@ -128,7 +128,7 @@
// Called back from vendor library to indicate status of previous
// LPM enable/disable request.
static void low_power_mode_cb(bt_vendor_op_result_t result) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
vendor_cb callback = callbacks[VENDOR_SET_LPM_MODE];
assert(callback != NULL);
callback(result == BT_VND_OP_RESULT_SUCCESS);
@@ -149,7 +149,7 @@
{
uint8_t status = (result == BT_VND_OP_RESULT_SUCCESS) ? 0 : 1;
- ALOGI("sco_audiostate_cb(status: %d)",status);
+ LOG_INFO("sco_audiostate_cb(status: %d)",status);
}
// Called by vendor library when it needs an HCI buffer.
@@ -180,7 +180,7 @@
// completed. It is safe to call vendor_interface->cleanup() after
// this callback has been received.
static void epilog_cb(bt_vendor_op_result_t result) {
- ALOGI("%s", __func__);
+ LOG_INFO("%s", __func__);
vendor_cb callback = callbacks[VENDOR_DO_EPILOG];
assert(callback != NULL);
callback(result == BT_VND_OP_RESULT_SUCCESS);
diff --git a/hci/test/hci_hal_h4_test.cpp b/hci/test/hci_hal_h4_test.cpp
index 41114cd..2c4030d 100644
--- a/hci/test/hci_hal_h4_test.cpp
+++ b/hci/test/hci_hal_h4_test.cpp
@@ -25,7 +25,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
-#include <utils/Log.h>
#include "hci_hal.h"
#include "osi.h"
diff --git a/hci/test/hci_hal_mct_test.cpp b/hci/test/hci_hal_mct_test.cpp
index f2c3e29..911aabc 100644
--- a/hci/test/hci_hal_mct_test.cpp
+++ b/hci/test/hci_hal_mct_test.cpp
@@ -25,7 +25,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
-#include <utils/Log.h>
#include "hci_hal.h"
#include "osi.h"
diff --git a/hci/test/hci_layer_test.cpp b/hci/test/hci_layer_test.cpp
index 38ac07f..83ac060 100644
--- a/hci/test/hci_layer_test.cpp
+++ b/hci/test/hci_layer_test.cpp
@@ -22,7 +22,6 @@
extern "C" {
#include <stdint.h>
-#include <utils/Log.h>
#include "allocation_tracker.h"
#include "allocator.h"
diff --git a/hci/test/low_power_manager_test.cpp b/hci/test/low_power_manager_test.cpp
index 2b7acbd..bb18bff 100644
--- a/hci/test/low_power_manager_test.cpp
+++ b/hci/test/low_power_manager_test.cpp
@@ -22,7 +22,6 @@
extern "C" {
#include <stdint.h>
-#include <utils/Log.h>
#include "low_power_manager.h"
#include "osi.h"
diff --git a/hci/test/packet_fragmenter_test.cpp b/hci/test/packet_fragmenter_test.cpp
index a8e2927..765b91e 100644
--- a/hci/test/packet_fragmenter_test.cpp
+++ b/hci/test/packet_fragmenter_test.cpp
@@ -22,7 +22,6 @@
extern "C" {
#include <stdint.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "device/include/controller.h"
diff --git a/main/bte_conf.c b/main/bte_conf.c
index 38607f8..c66f4ab 100644
--- a/main/bte_conf.c
+++ b/main/bte_conf.c
@@ -21,10 +21,10 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
-#include <utils/Log.h>
#include "bta_api.h"
#include "config.h"
+#include "osi/include/log.h"
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
extern int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1];
@@ -32,11 +32,11 @@
{
assert(path != NULL);
- ALOGI("%s attempt to load ble stack conf from %s", __func__, path);
+ LOG_INFO("%s attempt to load ble stack conf from %s", __func__, path);
config_t *config = config_new(path);
if (!config) {
- ALOGI("%s file >%s< not found", __func__, path);
+ LOG_INFO("%s file >%s< not found", __func__, path);
return;
}
@@ -44,7 +44,7 @@
if(*ble_adv_tx_power) {
sscanf(ble_adv_tx_power, "%d,%d,%d,%d,%d", btm_ble_tx_power, btm_ble_tx_power + 1, btm_ble_tx_power + 2,
btm_ble_tx_power + 3, btm_ble_tx_power + 4);
- ALOGI("loaded btm_ble_tx_power: %d, %d, %d, %d, %d", (char)btm_ble_tx_power[0], (char)btm_ble_tx_power[1],
+ LOG_INFO("loaded btm_ble_tx_power: %d, %d, %d, %d, %d", (char)btm_ble_tx_power[0], (char)btm_ble_tx_power[1],
btm_ble_tx_power[2], btm_ble_tx_power[3], btm_ble_tx_power[4]);
}
config_free(config);
@@ -58,7 +58,7 @@
config_t *config = config_new(p_path);
if (!config) {
- ALOGE("%s unable to load DID config '%s'.", __func__, p_path);
+ LOG_ERROR("%s unable to load DID config '%s'.", __func__, p_path);
return;
}
@@ -67,7 +67,7 @@
snprintf(section_name, sizeof(section_name), "DID%d", i);
if (!config_has_section(config, section_name)) {
- ALOGD("%s no section named %s.", __func__, section_name);
+ LOG_DEBUG("%s no section named %s.", __func__, section_name);
break;
}
@@ -83,23 +83,23 @@
if (record.vendor_id_source != DI_VENDOR_ID_SOURCE_BTSIG &&
record.vendor_id_source != DI_VENDOR_ID_SOURCE_USBIF) {
- ALOGE("%s invalid vendor id source %d; ignoring DID record %d.", __func__, record.vendor_id_source, i);
+ LOG_ERROR("%s invalid vendor id source %d; ignoring DID record %d.", __func__, record.vendor_id_source, i);
continue;
}
- ALOGD("Device ID record %d : %s", i, (record.primary_record ? "primary" : "not primary"));
- ALOGD(" vendorId = %04x", record.vendor);
- ALOGD(" vendorIdSource = %04x", record.vendor_id_source);
- ALOGD(" product = %04x", record.product);
- ALOGD(" version = %04x", record.version);
- ALOGD(" clientExecutableURL = %s", record.client_executable_url);
- ALOGD(" serviceDescription = %s", record.service_description);
- ALOGD(" documentationURL = %s", record.documentation_url);
+ LOG_DEBUG("Device ID record %d : %s", i, (record.primary_record ? "primary" : "not primary"));
+ LOG_DEBUG(" vendorId = %04x", record.vendor);
+ LOG_DEBUG(" vendorIdSource = %04x", record.vendor_id_source);
+ LOG_DEBUG(" product = %04x", record.product);
+ LOG_DEBUG(" version = %04x", record.version);
+ LOG_DEBUG(" clientExecutableURL = %s", record.client_executable_url);
+ LOG_DEBUG(" serviceDescription = %s", record.service_description);
+ LOG_DEBUG(" documentationURL = %s", record.documentation_url);
uint32_t record_handle;
tBTA_STATUS status = BTA_DmSetLocalDiRecord(&record, &record_handle);
if (status != BTA_SUCCESS) {
- ALOGE("%s unable to set device ID record %d: error %d.", __func__, i, status);
+ LOG_ERROR("%s unable to set device ID record %d: error %d.", __func__, i, status);
}
}
diff --git a/main/bte_logmsg.c b/main/bte_logmsg.c
index 6d4c9bc..ee99620 100644
--- a/main/bte_logmsg.c
+++ b/main/bte_logmsg.c
@@ -17,7 +17,6 @@
******************************************************************************/
#include <assert.h>
-#include <cutils/log.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -32,6 +31,7 @@
#include "config.h"
#include "gki.h"
#include "l2c_api.h"
+#include "osi/include/log.h"
#include "stack_config.h"
#if (RFCOMM_INCLUDED==TRUE)
@@ -247,7 +247,7 @@
assert(config != NULL);
for (tBTTRC_FUNC_MAP *functions = &bttrc_set_level_map[0]; functions->trc_name; ++functions) {
- ALOGI("BTE_InitTraceLevels -- %s", functions->trc_name);
+ LOG_INFO("BTE_InitTraceLevels -- %s", functions->trc_name);
int value = config_get_int(config, CONFIG_DEFAULT_SECTION, functions->trc_name, -1);
if (value != -1)
functions->trace_level = value;
@@ -260,7 +260,7 @@
static future_t *init(void) {
const stack_config_t *stack_config = stack_config_get_interface();
if (!stack_config->get_trace_config_enabled()) {
- ALOGI("[bttrc] using compile default trace settings");
+ LOG_INFO("[bttrc] using compile default trace settings");
return NULL;
}
diff --git a/main/bte_main.c b/main/bte_main.c
index e0cc3d5..f6d1bdf 100755
--- a/main/bte_main.c
+++ b/main/bte_main.c
@@ -23,6 +23,9 @@
* Description: Contains BTE core stack initialization and shutdown code
*
******************************************************************************/
+
+#define LOG_TAG "bt_main"
+
#include <assert.h>
#include <cutils/properties.h>
#include <fcntl.h>
@@ -31,7 +34,6 @@
#include <signal.h>
#include <stdlib.h>
#include <time.h>
-#include <utils/Log.h>
#include "alarm.h"
#include "bta_api.h"
@@ -50,6 +52,7 @@
#include "hci_layer.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "stack_config.h"
#include "thread.h"
@@ -97,11 +100,11 @@
hci = hci_layer_get_interface();
if (!hci)
- ALOGE("%s could not get hci layer interface.", __func__);
+ LOG_ERROR("%s could not get hci layer interface.", __func__);
btu_hci_msg_queue = fixed_queue_new(SIZE_MAX);
if (btu_hci_msg_queue == NULL) {
- ALOGE("%s unable to allocate hci message queue.", __func__);
+ LOG_ERROR("%s unable to allocate hci message queue.", __func__);
return;
}
diff --git a/main/stack_config.c b/main/stack_config.c
index a568c23..0175c08 100644
--- a/main/stack_config.c
+++ b/main/stack_config.c
@@ -19,10 +19,10 @@
#define LOG_TAG "bt_stack_config"
#include <assert.h>
-#include <utils/Log.h>
#include "future.h"
#include "stack_config.h"
+#include "osi/include/log.h"
const char *BTSNOOP_LOG_PATH_KEY = "BtSnoopFileName";
const char *BTSNOOP_TURNED_ON_KEY = "BtSnoopLogOutput";
@@ -36,11 +36,11 @@
const char *path = "/etc/bluetooth/bt_stack.conf";
assert(path != NULL);
- ALOGI("%s attempt to load stack conf from %s", __func__, path);
+ LOG_INFO("%s attempt to load stack conf from %s", __func__, path);
config = config_new(path);
if (!config) {
- ALOGI("%s file >%s< not found", __func__, path);
+ LOG_INFO("%s file >%s< not found", __func__, path);
return future_new_immediate(FUTURE_FAIL);
}
diff --git a/osi/include/alarm.h b/osi/include/alarm.h
index 7e687ba..965673a 100644
--- a/osi/include/alarm.h
+++ b/osi/include/alarm.h
@@ -18,6 +18,8 @@
#pragma once
+#include <stdint.h>
+
typedef struct alarm_t alarm_t;
typedef uint64_t period_ms_t;
diff --git a/osi/include/array.h b/osi/include/array.h
index 0f6f58d..06b93f6 100644
--- a/osi/include/array.h
+++ b/osi/include/array.h
@@ -20,6 +20,7 @@
#include <stdbool.h>
#include <stddef.h>
+#include <stdint.h>
typedef struct array_t array_t;
diff --git a/osi/include/log.h b/osi/include/log.h
new file mode 100644
index 0000000..a5de1cf
--- /dev/null
+++ b/osi/include/log.h
@@ -0,0 +1,27 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2014 Google, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+#pragma once
+
+#include <cutils/log.h>
+
+#define LOG_VERBOSE(...) ALOGV(__VA_ARGS__)
+#define LOG_DEBUG(...) ALOGD(__VA_ARGS__)
+#define LOG_INFO(...) ALOGI(__VA_ARGS__)
+#define LOG_WARN(...) ALOGW(__VA_ARGS__)
+#define LOG_ERROR(...) ALOGE(__VA_ARGS__)
diff --git a/osi/include/thread.h b/osi/include/thread.h
index 99617d2..53c888a 100644
--- a/osi/include/thread.h
+++ b/osi/include/thread.h
@@ -19,6 +19,7 @@
#pragma once
#include <stdbool.h>
+#include <stdint.h>
#define THREAD_NAME_MAX 16
diff --git a/osi/src/alarm.c b/osi/src/alarm.c
index 9aa6c41..74ebf73 100644
--- a/osi/src/alarm.c
+++ b/osi/src/alarm.c
@@ -23,12 +23,12 @@
#include <hardware/bluetooth.h>
#include <inttypes.h>
#include <time.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "alarm.h"
#include "list.h"
#include "osi.h"
+#include "osi/include/log.h"
struct alarm_t {
// The lock is held while the callback for this alarm is being executed.
@@ -75,7 +75,7 @@
alarm_t *ret = osi_calloc(sizeof(alarm_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for alarm.", __func__);
+ LOG_ERROR("%s unable to allocate memory for alarm.", __func__);
goto error;
}
@@ -83,13 +83,13 @@
// within the callback function of the alarm.
int error = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if (error) {
- ALOGE("%s unable to create a recursive mutex: %s", __func__, strerror(error));
+ LOG_ERROR("%s unable to create a recursive mutex: %s", __func__, strerror(error));
goto error;
}
error = pthread_mutex_init(&ret->callback_lock, &attr);
if (error) {
- ALOGE("%s unable to initialize mutex: %s", __func__, strerror(error));
+ LOG_ERROR("%s unable to initialize mutex: %s", __func__, strerror(error));
goto error;
}
@@ -178,7 +178,7 @@
alarms = list_new(NULL);
if (!alarms) {
- ALOGE("%s unable to allocate alarm list.", __func__);
+ LOG_ERROR("%s unable to allocate alarm list.", __func__);
return false;
}
@@ -190,7 +190,7 @@
struct timespec ts;
if (clock_gettime(CLOCK_ID, &ts) == -1) {
- ALOGE("%s unable to get current time: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to get current time: %s", __func__, strerror(errno));
return 0;
}
@@ -251,7 +251,7 @@
if (next_exp < TIMER_INTERVAL_FOR_WAKELOCK_IN_MS) {
int status = bt_os_callouts->acquire_wake_lock(WAKE_LOCK_ID);
if (status != BT_STATUS_SUCCESS) {
- ALOGE("%s unable to acquire wake lock: %d", __func__, status);
+ LOG_ERROR("%s unable to acquire wake lock: %d", __func__, status);
return;
}
@@ -261,7 +261,7 @@
sigevent.sigev_notify_function = (void (*)(union sigval))timer_callback;
sigevent.sigev_value.sival_ptr = next;
if (timer_create(CLOCK_ID, &sigevent, &timer) == -1) {
- ALOGE("%s unable to create timer: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to create timer: %s", __func__, strerror(errno));
return;
}
@@ -270,14 +270,14 @@
wakeup_time.it_value.tv_sec = (next->deadline / 1000);
wakeup_time.it_value.tv_nsec = (next->deadline % 1000) * 1000000LL;
if (timer_settime(timer, TIMER_ABSTIME, &wakeup_time, NULL) == -1) {
- ALOGE("%s unable to set timer: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to set timer: %s", __func__, strerror(errno));
timer_delete(timer);
return;
}
timer_set = true;
} else {
if (!bt_os_callouts->set_wake_alarm(next_exp, true, timer_callback, next))
- ALOGE("%s unable to set wake alarm for %" PRId64 "ms.", __func__, next_exp);
+ LOG_ERROR("%s unable to set wake alarm for %" PRId64 "ms.", __func__, next_exp);
bt_os_callouts->release_wake_lock(WAKE_LOCK_ID);
}
diff --git a/osi/src/allocation_tracker.c b/osi/src/allocation_tracker.c
index c5971d0..27768a4 100644
--- a/osi/src/allocation_tracker.c
+++ b/osi/src/allocation_tracker.c
@@ -21,13 +21,13 @@
#include <assert.h>
#include <pthread.h>
#include <stdint.h>
-#include <utils/Log.h>
#include "allocation_tracker.h"
#include "allocator.h"
#include "hash_functions.h"
#include "hash_map.h"
#include "osi.h"
+#include "osi/include/log.h"
typedef struct {
uint8_t allocator_id;
@@ -166,7 +166,7 @@
allocation_t *allocation = (allocation_t *)entry->data;
if (!allocation->freed) {
*((size_t *)context) += allocation->size; // Report back the unfreed byte count
- ALOGE("%s found unfreed allocation. address: 0x%x size: %d bytes", __func__, (uintptr_t)allocation->ptr, allocation->size);
+ LOG_ERROR("%s found unfreed allocation. address: 0x%x size: %d bytes", __func__, (uintptr_t)allocation->ptr, allocation->size);
}
return true;
diff --git a/osi/src/array.c b/osi/src/array.c
index 02b8b18..c9416f0 100644
--- a/osi/src/array.c
+++ b/osi/src/array.c
@@ -19,10 +19,10 @@
#define LOG_TAG "bt_array"
#include <assert.h>
-#include <cutils/log.h>
#include "allocator.h"
#include "array.h"
+#include "osi/include/log.h"
struct array_t {
size_t element_size;
@@ -41,7 +41,7 @@
array_t *array = osi_calloc(sizeof(array_t) + element_size * INTERNAL_ELEMENTS);
if (!array) {
- ALOGE("%s unable to allocate memory for array with elements of size %zu.", __func__, element_size);
+ LOG_ERROR("%s unable to allocate memory for array with elements of size %zu.", __func__, element_size);
return NULL;
}
@@ -85,7 +85,7 @@
assert(data != NULL);
if (array->length == array->capacity && !grow(array)) {
- ALOGE("%s unable to grow array past current capacity of %zu elements of size %zu.", __func__, array->capacity, array->element_size);
+ LOG_ERROR("%s unable to grow array past current capacity of %zu elements of size %zu.", __func__, array->capacity, array->element_size);
return false;
}
diff --git a/osi/src/config.c b/osi/src/config.c
index 6b1f86b..256cb0c 100644
--- a/osi/src/config.c
+++ b/osi/src/config.c
@@ -5,11 +5,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "config.h"
#include "list.h"
+#include "osi/include/log.h"
typedef struct {
char *key;
@@ -41,13 +41,13 @@
config_t *config_new_empty(void) {
config_t *config = osi_calloc(sizeof(config_t));
if (!config) {
- ALOGE("%s unable to allocate memory for config_t.", __func__);
+ LOG_ERROR("%s unable to allocate memory for config_t.", __func__);
goto error;
}
config->sections = list_new(section_free);
if (!config->sections) {
- ALOGE("%s unable to allocate list for sections.", __func__);
+ LOG_ERROR("%s unable to allocate list for sections.", __func__);
goto error;
}
@@ -67,7 +67,7 @@
FILE *fp = fopen(filename, "rt");
if (!fp) {
- ALOGE("%s unable to open file '%s': %s", __func__, filename, strerror(errno));
+ LOG_ERROR("%s unable to open file '%s': %s", __func__, filename, strerror(errno));
config_free(config);
return NULL;
}
@@ -233,7 +233,7 @@
FILE *fp = fopen(filename, "wt");
if (!fp) {
- ALOGE("%s unable to write file '%s': %s", __func__, filename, strerror(errno));
+ LOG_ERROR("%s unable to write file '%s': %s", __func__, filename, strerror(errno));
return false;
}
@@ -291,7 +291,7 @@
if (*line_ptr == '[') {
size_t len = strlen(line_ptr);
if (line_ptr[len - 1] != ']') {
- ALOGD("%s unterminated section name on line %d.", __func__, line_num);
+ LOG_DEBUG("%s unterminated section name on line %d.", __func__, line_num);
continue;
}
strncpy(section, line_ptr + 1, len - 2);
@@ -299,7 +299,7 @@
} else {
char *split = strchr(line_ptr, '=');
if (!split) {
- ALOGD("%s no key/value separator found on line %d.", __func__, line_num);
+ LOG_DEBUG("%s no key/value separator found on line %d.", __func__, line_num);
continue;
}
diff --git a/osi/src/data_dispatcher.c b/osi/src/data_dispatcher.c
index 638c18a..b52b4ac 100644
--- a/osi/src/data_dispatcher.c
+++ b/osi/src/data_dispatcher.c
@@ -19,13 +19,13 @@
#define LOG_TAG "bt_osi_data_dispatcher"
#include <assert.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "data_dispatcher.h"
#include "hash_functions.h"
#include "hash_map.h"
#include "osi.h"
+#include "osi/include/log.h"
#define DEFAULT_TABLE_BUCKETS 10
@@ -40,19 +40,19 @@
data_dispatcher_t *ret = osi_calloc(sizeof(data_dispatcher_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for new data dispatcher.", __func__);
+ LOG_ERROR("%s unable to allocate memory for new data dispatcher.", __func__);
goto error;
}
ret->dispatch_table = hash_map_new(DEFAULT_TABLE_BUCKETS, hash_function_naive, NULL, NULL);
if (!ret->dispatch_table) {
- ALOGE("%s unable to create dispatch table.", __func__);
+ LOG_ERROR("%s unable to create dispatch table.", __func__);
goto error;
}
ret->name = osi_strdup(name);
if (!ret->name) {
- ALOGE("%s unable to duplicate provided name.", __func__);
+ LOG_ERROR("%s unable to duplicate provided name.", __func__);
goto error;
}
@@ -100,7 +100,7 @@
if (queue)
fixed_queue_enqueue(queue, data);
else
- ALOGW("%s has no handler for type (%d) in data dispatcher named: %s", __func__, type, dispatcher->name);
+ LOG_WARN("%s has no handler for type (%d) in data dispatcher named: %s", __func__, type, dispatcher->name);
return queue != NULL;
}
diff --git a/osi/src/eager_reader.c b/osi/src/eager_reader.c
index 6bf0d55..5cd7614 100644
--- a/osi/src/eager_reader.c
+++ b/osi/src/eager_reader.c
@@ -22,12 +22,12 @@
#include <errno.h>
#include <stddef.h>
#include <sys/eventfd.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "eager_reader.h"
#include "fixed_queue.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "reactor.h"
#include "thread.h"
@@ -77,7 +77,7 @@
eager_reader_t *ret = osi_calloc(sizeof(eager_reader_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for new eager_reader.", __func__);
+ LOG_ERROR("%s unable to allocate memory for new eager_reader.", __func__);
goto error;
}
@@ -86,7 +86,7 @@
ret->bytes_available_fd = eventfd(0, EFD_SEMAPHORE);
if (ret->bytes_available_fd == INVALID_FD) {
- ALOGE("%s unable to create output reading semaphore.", __func__);
+ LOG_ERROR("%s unable to create output reading semaphore.", __func__);
goto error;
}
@@ -94,13 +94,13 @@
ret->buffers = fixed_queue_new(max_buffer_count);
if (!ret->buffers) {
- ALOGE("%s unable to create buffers queue.", __func__);
+ LOG_ERROR("%s unable to create buffers queue.", __func__);
goto error;
}
ret->inbound_read_thread = thread_new(thread_name);
if (!ret->inbound_read_thread) {
- ALOGE("%s unable to make reading thread.", __func__);
+ LOG_ERROR("%s unable to make reading thread.", __func__);
goto error;
}
@@ -177,7 +177,7 @@
eventfd_t value;
if (eventfd_read(reader->bytes_available_fd, &value) == -1)
- ALOGE("%s unable to read semaphore for output data.", __func__);
+ LOG_ERROR("%s unable to read semaphore for output data.", __func__);
if (!reader->current_buffer)
reader->current_buffer = fixed_queue_dequeue(reader->buffers);
@@ -217,7 +217,7 @@
data_buffer_t *buffer = (data_buffer_t *)reader->allocator->alloc(reader->buffer_size + sizeof(data_buffer_t));
if (!buffer) {
- ALOGE("%s couldn't aquire memory for inbound data buffer.", __func__);
+ LOG_ERROR("%s couldn't aquire memory for inbound data buffer.", __func__);
return;
}
@@ -235,9 +235,9 @@
eventfd_write(reader->bytes_available_fd, bytes_read);
} else {
if (bytes_read == 0)
- ALOGW("%s fd said bytes existed, but none were found.", __func__);
+ LOG_WARN("%s fd said bytes existed, but none were found.", __func__);
else
- ALOGW("%s unable to read from file descriptor: %s", __func__, strerror(errno));
+ LOG_WARN("%s unable to read from file descriptor: %s", __func__, strerror(errno));
reader->allocator->free(buffer);
}
diff --git a/osi/src/fixed_queue.c b/osi/src/fixed_queue.c
index b80f2f2..1a32537 100644
--- a/osi/src/fixed_queue.c
+++ b/osi/src/fixed_queue.c
@@ -19,7 +19,6 @@
#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "fixed_queue.h"
diff --git a/osi/src/future.c b/osi/src/future.c
index d75280a..bfe8db2 100644
--- a/osi/src/future.c
+++ b/osi/src/future.c
@@ -19,11 +19,11 @@
#define LOG_TAG "osi_future"
#include <assert.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "future.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "semaphore.h"
struct future_t {
@@ -37,13 +37,13 @@
future_t *future_new(void) {
future_t *ret = osi_calloc(sizeof(future_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for return value.", __func__);
+ LOG_ERROR("%s unable to allocate memory for return value.", __func__);
goto error;
}
ret->semaphore = semaphore_new(0);
if (!ret->semaphore) {
- ALOGE("%s unable to allocate memory for the semaphore.", __func__);
+ LOG_ERROR("%s unable to allocate memory for the semaphore.", __func__);
goto error;
}
@@ -57,7 +57,7 @@
future_t *future_new_immediate(void *value) {
future_t *ret = osi_calloc(sizeof(future_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for return value.", __func__);
+ LOG_ERROR("%s unable to allocate memory for return value.", __func__);
goto error;
}
diff --git a/osi/src/reactor.c b/osi/src/reactor.c
index 1d1b5be..72a47ec 100644
--- a/osi/src/reactor.c
+++ b/osi/src/reactor.c
@@ -24,10 +24,10 @@
#include <stdlib.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "list.h"
+#include "osi/include/log.h"
#include "reactor.h"
#if !defined(EFD_SEMAPHORE)
@@ -69,20 +69,20 @@
ret->epoll_fd = epoll_create(MAX_EVENTS);
if (ret->epoll_fd == INVALID_FD) {
- ALOGE("%s unable to create epoll instance: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to create epoll instance: %s", __func__, strerror(errno));
goto error;
}
ret->event_fd = eventfd(0, 0);
if (ret->event_fd == INVALID_FD) {
- ALOGE("%s unable to create eventfd: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to create eventfd: %s", __func__, strerror(errno));
goto error;
}
pthread_mutex_init(&ret->list_lock, NULL);
ret->invalidation_list = list_new(NULL);
if (!ret->invalidation_list) {
- ALOGE("%s unable to allocate object invalidation list.", __func__);
+ LOG_ERROR("%s unable to allocate object invalidation list.", __func__);
goto error;
}
@@ -90,7 +90,7 @@
event.events = EPOLLIN;
event.data.ptr = NULL;
if (epoll_ctl(ret->epoll_fd, EPOLL_CTL_ADD, ret->event_fd, &event) == -1) {
- ALOGE("%s unable to register eventfd with epoll set: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to register eventfd with epoll set: %s", __func__, strerror(errno));
goto error;
}
@@ -136,7 +136,7 @@
reactor_object_t *object = (reactor_object_t *)osi_calloc(sizeof(reactor_object_t));
if (!object) {
- ALOGE("%s unable to allocate reactor object: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to allocate reactor object: %s", __func__, strerror(errno));
return NULL;
}
@@ -156,7 +156,7 @@
event.data.ptr = object;
if (epoll_ctl(reactor->epoll_fd, EPOLL_CTL_ADD, fd, &event) == -1) {
- ALOGE("%s unable to register fd %d to epoll set: %s", __func__, fd, strerror(errno));
+ LOG_ERROR("%s unable to register fd %d to epoll set: %s", __func__, fd, strerror(errno));
pthread_mutex_destroy(&object->lock);
osi_free(object);
return NULL;
@@ -179,7 +179,7 @@
event.data.ptr = object;
if (epoll_ctl(object->reactor->epoll_fd, EPOLL_CTL_MOD, object->fd, &event) == -1) {
- ALOGE("%s unable to modify interest set for fd %d: %s", __func__, object->fd, strerror(errno));
+ LOG_ERROR("%s unable to modify interest set for fd %d: %s", __func__, object->fd, strerror(errno));
return false;
}
@@ -197,7 +197,7 @@
reactor_t *reactor = obj->reactor;
if (epoll_ctl(reactor->epoll_fd, EPOLL_CTL_DEL, obj->fd, NULL) == -1)
- ALOGE("%s unable to unregister fd %d from epoll set: %s", __func__, obj->fd, strerror(errno));
+ LOG_ERROR("%s unable to unregister fd %d from epoll set: %s", __func__, obj->fd, strerror(errno));
if (reactor->is_running && pthread_equal(pthread_self(), reactor->run_thread)) {
reactor->object_removed = true;
@@ -243,7 +243,7 @@
} while (ret == -1 && errno == EINTR);
if (ret == -1) {
- ALOGE("%s error in epoll_wait: %s", __func__, strerror(errno));
+ LOG_ERROR("%s error in epoll_wait: %s", __func__, strerror(errno));
reactor->is_running = false;
return REACTOR_STATUS_ERROR;
}
diff --git a/osi/src/semaphore.c b/osi/src/semaphore.c
index 6ccd905..e1fa8a4 100644
--- a/osi/src/semaphore.c
+++ b/osi/src/semaphore.c
@@ -23,10 +23,10 @@
#include <fcntl.h>
#include <string.h>
#include <sys/eventfd.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "semaphore.h"
#if !defined(EFD_SEMAPHORE)
@@ -42,7 +42,7 @@
if (ret) {
ret->fd = eventfd(value, EFD_SEMAPHORE);
if (ret->fd == INVALID_FD) {
- ALOGE("%s unable to allocate semaphore: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to allocate semaphore: %s", __func__, strerror(errno));
osi_free(ret);
ret = NULL;
}
@@ -65,7 +65,7 @@
uint64_t value;
if (eventfd_read(semaphore->fd, &value) == -1)
- ALOGE("%s unable to wait on semaphore: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to wait on semaphore: %s", __func__, strerror(errno));
}
bool semaphore_try_wait(semaphore_t *semaphore) {
@@ -74,11 +74,11 @@
int flags = fcntl(semaphore->fd, F_GETFL);
if (flags == -1) {
- ALOGE("%s unable to get flags for semaphore fd: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to get flags for semaphore fd: %s", __func__, strerror(errno));
return false;
}
if (fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK) == -1) {
- ALOGE("%s unable to set O_NONBLOCK for semaphore fd: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to set O_NONBLOCK for semaphore fd: %s", __func__, strerror(errno));
return false;
}
@@ -87,7 +87,7 @@
return false;
if (fcntl(semaphore->fd, F_SETFL, flags) == -1)
- ALOGE("%s unable to resetore flags for semaphore fd: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to resetore flags for semaphore fd: %s", __func__, strerror(errno));
return true;
}
@@ -96,7 +96,7 @@
assert(semaphore->fd != INVALID_FD);
if (eventfd_write(semaphore->fd, 1ULL) == -1)
- ALOGE("%s unable to post to semaphore: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to post to semaphore: %s", __func__, strerror(errno));
}
int semaphore_get_fd(const semaphore_t *semaphore) {
diff --git a/osi/src/socket.c b/osi/src/socket.c
index 6f41976..8a1a75e 100644
--- a/osi/src/socket.c
+++ b/osi/src/socket.c
@@ -27,10 +27,10 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "reactor.h"
#include "socket.h"
@@ -48,19 +48,19 @@
socket_t *socket_new(void) {
socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for socket.", __func__);
+ LOG_ERROR("%s unable to allocate memory for socket.", __func__);
goto error;
}
ret->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ret->fd == INVALID_FD) {
- ALOGE("%s unable to create socket: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to create socket: %s", __func__, strerror(errno));
goto error;
}
int enable = 1;
if (setsockopt(ret->fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) == -1) {
- ALOGE("%s unable to set SO_REUSEADDR: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to set SO_REUSEADDR: %s", __func__, strerror(errno));
goto error;
}
@@ -78,7 +78,7 @@
socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
if (!ret) {
- ALOGE("%s unable to allocate memory for socket.", __func__);
+ LOG_ERROR("%s unable to allocate memory for socket.", __func__);
return NULL;
}
@@ -103,12 +103,12 @@
addr.sin_addr.s_addr = 0;
addr.sin_port = htons(port);
if (bind(socket->fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- ALOGE("%s unable to bind socket to port %u: %s", __func__, port, strerror(errno));
+ LOG_ERROR("%s unable to bind socket to port %u: %s", __func__, port, strerror(errno));
return false;
}
if (listen(socket->fd, 10) == -1) {
- ALOGE("%s unable to listen on port %u: %s", __func__, port, strerror(errno));
+ LOG_ERROR("%s unable to listen on port %u: %s", __func__, port, strerror(errno));
return false;
}
@@ -120,14 +120,14 @@
int fd = accept(socket->fd, NULL, NULL);
if (fd == INVALID_FD) {
- ALOGE("%s unable to accept socket: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to accept socket: %s", __func__, strerror(errno));
return NULL;
}
socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
if (!ret) {
close(fd);
- ALOGE("%s unable to allocate memory for socket.", __func__);
+ LOG_ERROR("%s unable to allocate memory for socket.", __func__);
return NULL;
}
diff --git a/osi/src/thread.c b/osi/src/thread.c
index e540d64..33c324a 100644
--- a/osi/src/thread.c
+++ b/osi/src/thread.c
@@ -24,10 +24,10 @@
#include <string.h>
#include <sys/prctl.h>
#include <sys/types.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "fixed_queue.h"
+#include "log.h"
#include "reactor.h"
#include "semaphore.h"
#include "thread.h"
@@ -138,7 +138,7 @@
// or when the item is removed from the queue for dispatch.
work_item_t *item = (work_item_t *)osi_malloc(sizeof(work_item_t));
if (!item) {
- ALOGE("%s unable to allocate memory: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to allocate memory: %s", __func__, strerror(errno));
return false;
}
item->func = func;
@@ -176,7 +176,7 @@
assert(thread != NULL);
if (prctl(PR_SET_NAME, (unsigned long)thread->name) == -1) {
- ALOGE("%s unable to set thread name: %s", __func__, strerror(errno));
+ LOG_ERROR("%s unable to set thread name: %s", __func__, strerror(errno));
start->error = errno;
semaphore_post(start->start_sem);
return NULL;
@@ -205,7 +205,7 @@
}
if (count > fixed_queue_capacity(thread->work_queue))
- ALOGD("%s growing event queue on shutdown.", __func__);
+ LOG_DEBUG("%s growing event queue on shutdown.", __func__);
return NULL;
}
diff --git a/osi/test/eager_reader_test.cpp b/osi/test/eager_reader_test.cpp
index f40a748..ad00e17 100644
--- a/osi/test/eager_reader_test.cpp
+++ b/osi/test/eager_reader_test.cpp
@@ -23,7 +23,6 @@
extern "C" {
#include <stdint.h>
#include <unistd.h>
-#include <utils/Log.h>
#include "allocator.h"
#include "eager_reader.h"
diff --git a/osi/test/thread_test.cpp b/osi/test/thread_test.cpp
index d692f5a..e626c73 100644
--- a/osi/test/thread_test.cpp
+++ b/osi/test/thread_test.cpp
@@ -4,7 +4,6 @@
extern "C" {
#include <sys/select.h>
-#include <utils/Log.h>
#include "reactor.h"
#include "semaphore.h"
diff --git a/stack/btm/btm_ble_gap.c b/stack/btm/btm_ble_gap.c
index 8cfb9fa..bdbf1e4 100644
--- a/stack/btm/btm_ble_gap.c
+++ b/stack/btm/btm_ble_gap.c
@@ -45,6 +45,7 @@
#include "gatt_int.h"
#include "btm_ble_int.h"
+#include "osi/include/log.h"
#define BTM_BLE_NAME_SHORT 0x01
#define BTM_BLE_NAME_CMPL 0x02
@@ -1476,7 +1477,7 @@
else
flag &= ~(BTM_BLE_DMT_CONTROLLER_SPT|BTM_BLE_DMT_HOST_SPT);
- BTM_TRACE_DEBUG("disc_mode %04x", disc_mode);
+ LOG_DEBUG("disc_mode %04x", disc_mode);
/* update discoverable flag */
if (disc_mode & BTM_BLE_LIMITED_DISCOVERABLE)
{
diff --git a/stack/btm/btm_devctl.c b/stack/btm/btm_devctl.c
index 5899c1d..61f2391 100644
--- a/stack/btm/btm_devctl.c
+++ b/stack/btm/btm_devctl.c
@@ -28,7 +28,6 @@
#include <string.h>
#include <stdio.h>
#include <stddef.h>
-#include <utils/Log.h>
#include "bt_types.h"
#include "bt_utils.h"
diff --git a/stack/btm/btm_pm.c b/stack/btm/btm_pm.c
index e4a5b56..751cf99 100644
--- a/stack/btm/btm_pm.c
+++ b/stack/btm/btm_pm.c
@@ -30,11 +30,11 @@
#define LOG_TAG "bt_pm"
-#include <cutils/log.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>
+
#include "bt_types.h"
#include "gki.h"
#include "hcimsgs.h"
@@ -44,6 +44,7 @@
#include "l2c_int.h"
#include "hcidefs.h"
#include "bt_utils.h"
+#include "osi/include/log.h"
/*****************************************************************************/
/* to handle different modes */
@@ -623,7 +624,7 @@
BTM_TRACE_DEBUG("btm_pm_snd_md_req state:0x%x, link_ind: %d", p_cb->state, link_ind);
#endif // BTM_PM_DEBUG
- ALOGD("%s switching from %s to %s.", __func__, mode_to_string(p_cb->state), mode_to_string(md_res.mode));
+ LOG_DEBUG("%s switching from %s to %s.", __func__, mode_to_string(p_cb->state), mode_to_string(md_res.mode));
switch(md_res.mode)
{
case BTM_PM_MD_ACTIVE:
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index 1ae399f..cabf87a 100644
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -22,6 +22,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btm_sec"
+
#include <string.h>
#include "bt_types.h"
@@ -31,6 +33,7 @@
#include "btm_int.h"
#include "l2c_int.h"
#include "bt_utils.h"
+#include "osi/include/log.h"
#if (BT_USE_TRACES == TRUE && BT_TRACE_VERBOSE == FALSE)
/* needed for sprintf() */
diff --git a/stack/btu/btu_hcif.c b/stack/btu/btu_hcif.c
index 301920d..340e69f 100644
--- a/stack/btu/btu_hcif.c
+++ b/stack/btu/btu_hcif.c
@@ -25,6 +25,8 @@
*
******************************************************************************/
+#define LOG_TAG "BTLD"
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -39,6 +41,7 @@
#include "btm_int.h"
#include "bt_utils.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "hci_layer.h"
// TODO(zachoverflow): remove this horrible hack
@@ -49,16 +52,6 @@
extern void btm_ble_test_command_complete(UINT8 *p);
// btla-specific ++
-#define LOG_TAG "BTLD"
-#if (defined(ANDROID_APP_INCLUDED) && (ANDROID_APP_INCLUDED == TRUE) && (!defined(LINUX_NATIVE)) )
-#include <cutils/log.h>
-#else
-#define LOGV(format, ...) fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
-#define LOGE(format, ...) fprintf (stderr, LOG_TAG format"\n", ## __VA_ARGS__)
-#define LOGI(format, ...) fprintf (stdout, LOG_TAG format"\n", ## __VA_ARGS__)
-#endif
-
-// btla-specific ++
/* BTE application task */
#if APPL_INCLUDED == TRUE
#include "bte_appl.h"
@@ -213,11 +206,11 @@
btu_hcif_qos_setup_comp_evt (p);
break;
case HCI_COMMAND_COMPLETE_EVT:
- ALOGE("%s should not have received a command complete event. "
+ LOG_ERROR("%s should not have received a command complete event. "
"Someone didn't go through the hci transmit_command function.", __func__);
break;
case HCI_COMMAND_STATUS_EVT:
- ALOGE("%s should not have received a command status event. "
+ LOG_ERROR("%s should not have received a command status event. "
"Someone didn't go through the hci transmit_command function.", __func__);
break;
case HCI_HARDWARE_ERROR_EVT:
diff --git a/stack/btu/btu_init.c b/stack/btu/btu_init.c
index 1f7f0fd..204070f 100644
--- a/stack/btu/btu_init.c
+++ b/stack/btu/btu_init.c
@@ -16,11 +16,11 @@
*
******************************************************************************/
+#define LOG_TAG "bt_task"
+
#include <assert.h>
#include "bt_target.h"
-#define LOG_TAG "bt_task"
-#include <cutils/log.h>
#include <pthread.h>
#include <string.h>
#include "dyn_mem.h"
@@ -35,6 +35,7 @@
#include "sdpint.h"
#include "thread.h"
#include "l2c_int.h"
+#include "osi/include/log.h"
#if (BLE_INCLUDED == TRUE)
#include "gatt_api.h"
@@ -197,7 +198,7 @@
return;
error_exit:;
- ALOGE("%s Unable to allocate resources for bt_workqueue", __func__);
+ LOG_ERROR("%s Unable to allocate resources for bt_workqueue", __func__);
BTU_ShutDown();
}
diff --git a/stack/btu/btu_task.c b/stack/btu/btu_task.c
index b3363e1..04ec8f0 100644
--- a/stack/btu/btu_task.c
+++ b/stack/btu/btu_task.c
@@ -19,7 +19,6 @@
#define LOG_TAG "btu_task"
#include <assert.h>
-#include <cutils/log.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -41,6 +40,7 @@
#include "l2c_int.h"
#include "module.h"
#include "osi.h"
+#include "osi/include/log.h"
#include "sdpint.h"
#include "thread.h"
@@ -285,7 +285,7 @@
BT_TRACE(TRACE_LAYER_BTU, TRACE_TYPE_API,
"btu_task pending for preload complete event");
- ALOGI("Bluetooth chip preload is complete");
+ LOG_INFO("Bluetooth chip preload is complete");
BT_TRACE(TRACE_LAYER_BTU, TRACE_TYPE_API,
"btu_task received preload complete event");
@@ -494,7 +494,7 @@
alarm_t *alarm = hash_map_get(btu_general_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGE("%s Unable to create alarm\n", __func__);
+ LOG_ERROR("%s Unable to create alarm\n", __func__);
return;
}
alarm_cancel(alarm);
@@ -539,7 +539,7 @@
// Get the alarm for the timer list entry.
alarm_t *alarm = hash_map_get(btu_general_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGW("%s Unable to find expected alarm in hashmap\n", __func__);
+ LOG_WARN("%s Unable to find expected alarm in hashmap\n", __func__);
return;
}
alarm_cancel(alarm);
@@ -589,7 +589,7 @@
alarm_t *alarm = hash_map_get(btu_l2cap_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGE("%s Unable to create alarm\n", __func__);
+ LOG_ERROR("%s Unable to create alarm\n", __func__);
return;
}
alarm_cancel(alarm);
@@ -620,7 +620,7 @@
// Get the alarm for the timer list entry.
alarm_t *alarm = hash_map_get(btu_l2cap_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGW("%s Unable to find expected alarm in hashmap\n", __func__);
+ LOG_WARN("%s Unable to find expected alarm in hashmap\n", __func__);
return;
}
alarm_cancel(alarm);
@@ -652,7 +652,7 @@
alarm_t *alarm = hash_map_get(btu_oneshot_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGE("%s Unable to create alarm\n", __func__);
+ LOG_ERROR("%s Unable to create alarm\n", __func__);
return;
}
alarm_cancel(alarm);
@@ -674,7 +674,7 @@
// Get the alarm for the timer list entry.
alarm_t *alarm = hash_map_get(btu_oneshot_alarm_hash_map, p_tle);
if (alarm == NULL) {
- ALOGW("%s Unable to find expected alarm in hashmap\n", __func__);
+ LOG_WARN("%s Unable to find expected alarm in hashmap\n", __func__);
return;
}
alarm_cancel(alarm);
diff --git a/stack/l2cap/l2c_main.c b/stack/l2cap/l2c_main.c
index e866928..daef35e 100755
--- a/stack/l2cap/l2c_main.c
+++ b/stack/l2cap/l2c_main.c
@@ -22,7 +22,6 @@
*
******************************************************************************/
-#include <cutils/log.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -37,6 +36,7 @@
#include "l2c_api.h"
#include "l2c_int.h"
#include "l2cdefs.h"
+#include "osi/include/log.h"
/********************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
@@ -894,7 +894,7 @@
l2cb.rcv_pending_q = list_new(NULL);
if (l2cb.rcv_pending_q == NULL)
- ALOGE("%s unable to allocate memory for link layer control block", __func__);
+ LOG_ERROR("%s unable to allocate memory for link layer control block", __func__);
}
void l2c_free(void) {
diff --git a/stack/rfcomm/port_api.c b/stack/rfcomm/port_api.c
index 7b746e4..bfd68bd 100644
--- a/stack/rfcomm/port_api.c
+++ b/stack/rfcomm/port_api.c
@@ -34,15 +34,15 @@
#include "rfc_int.h"
#include "l2c_api.h"
#include "sdp_api.h"
+#include "osi/include/log.h"
/* duration of break in 200ms units */
#define PORT_BREAK_DURATION 1
-#include <cutils/log.h>
-#define info(fmt, ...) ALOGI ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define debug(fmt, ...) ALOGD ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define error(fmt, ...) ALOGE ("## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__)
-#define asrt(s) if(!(s)) ALOGE ("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
+#define info(fmt, ...) LOG_INFO ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
+#define debug(fmt, ...) LOG_DEBUG ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
+#define error(fmt, ...) LOG_ERROR ("## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__)
+#define asrt(s) if(!(s)) LOG_ERROR ("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
/* Mapping from PORT_* result codes to human readable strings. */
static const char *result_code_strings[] = {
diff --git a/stack/sdp/sdp_api.c b/stack/sdp/sdp_api.c
index fa807b2..890f808 100644
--- a/stack/sdp/sdp_api.c
+++ b/stack/sdp/sdp_api.c
@@ -37,13 +37,6 @@
#include "sdpint.h"
#include "btu.h"
-#include <cutils/log.h>
-#define info(fmt, ...) LOGI ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define debug(fmt, ...) LOGD ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define error(fmt, ...) LOGE ("## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__)
-#define asrt(s) if(!(s)) LOGE ("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
-
-
/**********************************************************************
** C L I E N T F U N C T I O N P R O T O T Y P E S *
***********************************************************************/
diff --git a/utils/src/bt_utils.c b/utils/src/bt_utils.c
index 06f5ac2..d0ee172 100644
--- a/utils/src/bt_utils.c
+++ b/utils/src/bt_utils.c
@@ -25,6 +25,8 @@
*
***********************************************************************************/
+#define LOG_TAG "BT_UTILS"
+
#include <cutils/properties.h>
#include <cutils/sched_policy.h>
#include <errno.h>
@@ -35,13 +37,10 @@
#include <unistd.h>
#include <utils/ThreadDefs.h>
-#define LOG_TAG "BT_UTILS"
-
-#include <utils/Log.h>
-
#include "bt_types.h"
#include "bt_utils.h"
#include "module.h"
+#include "osi/include/log.h"
/*******************************************************************************
** Type definitions for callback functions
@@ -131,7 +130,7 @@
pthread_mutex_unlock(&gIdxLock);
if (rc) {
- ALOGW("failed to change sched policy, tid %d, err: %d", tid, errno);
+ LOG_WARN("failed to change sched policy, tid %d, err: %d", tid, errno);
}
// always use urgent priority for HCI worker thread until we can adjust
@@ -142,7 +141,7 @@
priority = ANDROID_PRIORITY_URGENT_AUDIO;
if (setpriority(PRIO_PROCESS, tid, priority) < 0) {
- ALOGW("failed to change priority tid: %d to %d", tid, priority);
+ LOG_WARN("failed to change priority tid: %d to %d", tid, priority);
}
}
@@ -169,7 +168,7 @@
{
if (setpriority(PRIO_PROCESS, tid, priority) < 0)
{
- ALOGW("failed to change priority tid: %d to %d", tid, priority);
+ LOG_WARN("failed to change priority tid: %d to %d", tid, priority);
}
}
}