summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorSharvil Nanavati <sharvil@google.com>2014-12-23 23:08:58 -0800
committerAndre Eisenbach <eisenbach@google.com>2015-03-16 16:51:40 -0700
commit44802768c447ab480d4227b3a852a97d923b816d (patch)
tree52f2bdda1fa934f89af3b2161a26cb47170f8567 /main
parent3b24dfb998e76b389b9c850f53e0c8016383f2b8 (diff)
downloadandroid_system_bt-44802768c447ab480d4227b3a852a97d923b816d.tar.gz
android_system_bt-44802768c447ab480d4227b3a852a97d923b816d.tar.bz2
android_system_bt-44802768c447ab480d4227b3a852a97d923b816d.zip
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.
Diffstat (limited to 'main')
-rw-r--r--main/bte_conf.c32
-rw-r--r--main/bte_logmsg.c6
-rwxr-xr-xmain/bte_main.c9
-rw-r--r--main/stack_config.c6
4 files changed, 28 insertions, 25 deletions
diff --git a/main/bte_conf.c b/main/bte_conf.c
index 38607f889..c66f4ab0e 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 @@ void bte_load_ble_conf(const char* path)
{
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 @@ void bte_load_ble_conf(const char* path)
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 @@ void bte_load_did_conf(const char *p_path) {
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 @@ void bte_load_did_conf(const char *p_path) {
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 @@ void bte_load_did_conf(const char *p_path) {
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 6d4c9bcde..ee99620d0 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 @@ static void load_levels_from_config(const config_t *config) {
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 void load_levels_from_config(const config_t *config) {
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 e0cc3d50b..f6d1bdfd8 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 @@ void bte_main_boot_entry(void)
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 a568c23e2..0175c085b 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 @@ static future_t *init() {
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);
}