build: Fix LOG_TAG define breakage, macro usage
Fixes build breakages related to r.android.com/156982
Change-Id: Ib1143c41fe05a17c296226998afdb41a8cb6294a
diff --git a/system/audio_a2dp_hw/audio_a2dp_hw.c b/system/audio_a2dp_hw/audio_a2dp_hw.c
index 1e0b289..0f8c5e2 100644
--- a/system/audio_a2dp_hw/audio_a2dp_hw.c
+++ b/system/audio_a2dp_hw/audio_a2dp_hw.c
@@ -24,6 +24,8 @@
*
*****************************************************************************/
+#define LOG_TAG "bt_a2dp_hw"
+
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
@@ -56,8 +58,6 @@
#define CASE_RETURN_STR(const) case const: return #const;
-#define LOG_TAG "bt_a2dp_hw"
-
#define FNLOG() LOG_VERBOSE(LOG_TAG, "%s", __FUNCTION__);
#define DEBUG(fmt, ...) LOG_VERBOSE(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define INFO(fmt, ...) LOG_INFO(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
diff --git a/system/bta/av/bta_av_main.c b/system/bta/av/bta_av_main.c
index e7dd551..ad371a8 100644
--- a/system/bta/av/bta_av_main.c
+++ b/system/bta/av/bta_av_main.c
@@ -22,6 +22,8 @@
*
******************************************************************************/
+#define LOG_TAG "bta_av"
+
#include <assert.h>
#include <string.h>
@@ -43,8 +45,6 @@
** Constants and types
*****************************************************************************/
-#define LOG_TAG "bta_av"
-
/* AVDTP protocol timeout values */
#define BTIF_AVK_SERVICE_NAME "Advanced Audio Sink"
diff --git a/system/bta/dm/bta_dm_act.c b/system/bta/dm/bta_dm_act.c
index d1160ee..f687f42 100644
--- a/system/bta/dm/bta_dm_act.c
+++ b/system/bta/dm/bta_dm_act.c
@@ -23,6 +23,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_bta_dm"
+
#include <string.h>
#include "bt_target.h"
@@ -46,8 +48,6 @@
#include "gap_api.h"
#endif
-#define LOG_TAG "bt_bta_dm"
-
static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_cmpl_cb (void * p_result);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
diff --git a/system/bta/gatt/bta_gattc_act.c b/system/bta/gatt/bta_gattc_act.c
index b47b4e1..f647cc6 100755
--- a/system/bta/gatt/bta_gattc_act.c
+++ b/system/bta/gatt/bta_gattc_act.c
@@ -23,6 +23,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_bta_gattc"
+
#include <string.h>
#include "bt_target.h"
@@ -39,8 +41,6 @@
#include "bta_hh_int.h"
#endif
-#define LOG_TAG "bt_bta_gattc"
-
#if BTA_GATT_INCLUDED && BLE_INCLUDED == TRUE
/*****************************************************************************
diff --git a/system/bta/gatt/bta_gattc_cache.c b/system/bta/gatt/bta_gattc_cache.c
index 908a165..6a4b9bf 100644
--- a/system/bta/gatt/bta_gattc_cache.c
+++ b/system/bta/gatt/bta_gattc_cache.c
@@ -23,6 +23,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_bta_gattc"
+
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
@@ -44,8 +46,6 @@
#define BTA_GATT_SDP_DB_SIZE 4096
-#define LOG_TAG "bt_bta_gattc"
-
/*****************************************************************************
** Constants
*****************************************************************************/
diff --git a/system/bta/gatt/bta_gattc_utils.c b/system/bta/gatt/bta_gattc_utils.c
index bffbc4c..d38aa09 100644
--- a/system/bta/gatt/bta_gattc_utils.c
+++ b/system/bta/gatt/bta_gattc_utils.c
@@ -22,6 +22,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_bta_gattc"
+
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
@@ -32,8 +34,6 @@
#include "bta_sys.h"
#include "bta_gattc_int.h"
#include "l2c_api.h"
-
-#define LOG_TAG "bt_bta_gattc"
/*****************************************************************************
** Constants
*****************************************************************************/
diff --git a/system/bta/hh/bta_hh_le.c b/system/bta/hh/bta_hh_le.c
index dd77cd7..787b85e 100644
--- a/system/bta/hh/bta_hh_le.c
+++ b/system/bta/hh/bta_hh_le.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_bta_hh"
+
#include "bta_api.h"
#include "bta_hh_int.h"
@@ -33,8 +35,6 @@
#include "srvc_api.h"
#include "utl.h"
-#define LOG_TAG "bt_bta_hh"
-
#ifndef BTA_HH_LE_RECONN
#define BTA_HH_LE_RECONN TRUE
#endif
diff --git a/system/bta/sys/bta_sys_main.c b/system/bta/sys/bta_sys_main.c
index 4c4f984..85d2933 100644
--- a/system/bta/sys/bta_sys_main.c
+++ b/system/bta/sys/bta_sys_main.c
@@ -22,6 +22,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_bta_sys_main"
+
#include <assert.h>
#include <pthread.h>
#include <string.h>
@@ -44,8 +46,6 @@
#include "bta_ar_api.h"
#endif
-#define LOG_TAG "bt_bta_sys_main"
-
/* system manager control block definition */
#if BTA_DYNAMIC_MEMORY == FALSE
tBTA_SYS_CB bta_sys_cb;
diff --git a/system/btif/src/btif_config.c b/system/btif/src/btif_config.c
index 260b87d..d926f8a 100644
--- a/system/btif/src/btif_config.c
+++ b/system/btif/src/btif_config.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btif_config"
+
#include <assert.h>
#include <ctype.h>
#include <pthread.h>
@@ -36,8 +38,6 @@
#include "osi/include/log.h"
#include "osi/include/osi.h"
-#define LOG_TAG "bt_btif_config"
-
static const char *CONFIG_FILE_PATH = "/data/misc/bluedroid/bt_config.conf";
static const char *LEGACY_CONFIG_FILE_PATH = "/data/misc/bluedroid/bt_config.xml";
static const period_ms_t CONFIG_SETTLE_PERIOD_MS = 3000;
diff --git a/system/btif/src/btif_core.c b/system/btif/src/btif_core.c
index dcf981e..7ff8163 100644
--- a/system/btif/src/btif_core.c
+++ b/system/btif/src/btif_core.c
@@ -26,6 +26,8 @@
*
***********************************************************************************/
+#define LOG_TAG "bt_btif_core"
+
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
@@ -76,8 +78,6 @@
#define BTE_DID_CONF_FILE "/etc/bluetooth/bt_did.conf"
#endif
-#define LOG_TAG "bt_btif_core"
-
/************************************************************************************
** Local type definitions
************************************************************************************/
diff --git a/system/btif/src/btif_dm.c b/system/btif/src/btif_dm.c
index 4607ef8..c4df4a6 100644
--- a/system/btif/src/btif_dm.c
+++ b/system/btif/src/btif_dm.c
@@ -25,6 +25,8 @@
*
***********************************************************************************/
+#define LOG_TAG "bt_btif_dm"
+
#include <assert.h>
#include <signal.h>
#include <stdio.h>
@@ -60,8 +62,6 @@
#include "osi/include/log.h"
#include "stack_config.h"
-#define LOG_TAG "bt_btif_dm"
-
/******************************************************************************
** Device specific workarounds
******************************************************************************/
diff --git a/system/btif/src/btif_gatt_client.c b/system/btif/src/btif_gatt_client.c
index 3ba95de..8daf544 100644
--- a/system/btif/src/btif_gatt_client.c
+++ b/system/btif/src/btif_gatt_client.c
@@ -25,6 +25,8 @@
*
*******************************************************************************/
+#define LOG_TAG "bt_btif_gattc"
+
#include <hardware/bluetooth.h>
#include <stdio.h>
#include <stdlib.h>
@@ -55,8 +57,6 @@
** Constants & Macros
********************************************************************************/
-#define LOG_TAG "bt_btif_gattc"
-
#define CHECK_BTGATT_INIT() if (bt_gatt_callbacks == NULL)\
{\
LOG_WARN(LOG_TAG, "%s: BTGATT not initialized", __FUNCTION__);\
diff --git a/system/btif/src/btif_gatt_server.c b/system/btif/src/btif_gatt_server.c
index 0776238..1f9e7ae 100644
--- a/system/btif/src/btif_gatt_server.c
+++ b/system/btif/src/btif_gatt_server.c
@@ -38,6 +38,8 @@
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
+#define LOG_TAG "bt_btif_gatt"
+
#include "bta_api.h"
#include "bta_gatt_api.h"
#include "btif_config.h"
@@ -52,8 +54,6 @@
** Constants & Macros
************************************************************************************/
-#define LOG_TAG "bt_btif_gatt"
-
#define CHECK_BTGATT_INIT() if (bt_gatt_callbacks == NULL)\
{\
LOG_WARN(LOG_TAG, "%s: BTGATT not initialized", __FUNCTION__);\
diff --git a/system/btif/src/btif_gatt_test.c b/system/btif/src/btif_gatt_test.c
index f38e52a..447819f 100644
--- a/system/btif/src/btif_gatt_test.c
+++ b/system/btif/src/btif_gatt_test.c
@@ -30,6 +30,8 @@
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
+#define LOG_TAG "bt_btif_gatt"
+
#include "bta_api.h"
#include "bta_gatt_api.h"
#include "bte_appl.h"
@@ -40,8 +42,6 @@
#include "gatt_api.h"
#include "osi/include/log.h"
-#define LOG_TAG "bt_btif_gatt"
-
/*******************************************************************************
* Typedefs & Macros
*******************************************************************************/
diff --git a/system/btif/src/btif_gatt_util.c b/system/btif/src/btif_gatt_util.c
index 35e70ba..246d9fd 100644
--- a/system/btif/src/btif_gatt_util.c
+++ b/system/btif/src/btif_gatt_util.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btif_gatt"
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -37,8 +39,6 @@
#include "btif_util.h"
#include "gki.h"
-#define LOG_TAG "bt_btif_gatt"
-
#if BTA_GATT_INCLUDED == TRUE
#define GATTC_READ_VALUE_TYPE_VALUE 0x0000 /* Attribute value itself */
diff --git a/system/btif/src/btif_hh.c b/system/btif/src/btif_hh.c
index 96980a3..3817358 100644
--- a/system/btif/src/btif_hh.c
+++ b/system/btif/src/btif_hh.c
@@ -25,6 +25,8 @@
*
***********************************************************************************/
+#define LOG_TAG "bt_btif_hh"
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -44,8 +46,6 @@
#include "l2c_api.h"
#include "osi/include/log.h"
-#define LOG_TAG "bt_btif_hh"
-
#define BTIF_HH_APP_ID_MI 0x01
#define BTIF_HH_APP_ID_KB 0x02
diff --git a/system/btif/src/btif_media_task.c b/system/btif/src/btif_media_task.c
index 16fd655..70546c0 100644
--- a/system/btif/src/btif_media_task.c
+++ b/system/btif/src/btif_media_task.c
@@ -26,6 +26,8 @@
**
******************************************************************************/
+#define LOG_TAG "bt_btif_media"
+
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
@@ -74,8 +76,6 @@
#include "oi_status.h"
#endif
-#define LOG_TAG "bt_btif_media"
-
#if (BTA_AV_SINK_INCLUDED == TRUE)
OI_CODEC_SBC_DECODER_CONTEXT context;
OI_UINT32 contextData[CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS)];
diff --git a/system/btif/src/btif_pan.c b/system/btif/src/btif_pan.c
index ad47735..13ada4e 100644
--- a/system/btif/src/btif_pan.c
+++ b/system/btif/src/btif_pan.c
@@ -24,6 +24,9 @@
*
*
***********************************************************************************/
+
+#define LOG_TAG "bt_btif_pan"
+
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -63,8 +66,6 @@
#include "osi/include/log.h"
#include "osi/include/osi.h"
-#define LOG_TAG "bt_btif_pan"
-
#define FORWARD_IGNORE 1
#define FORWARD_SUCCESS 0
#define FORWARD_FAILURE (-1)
diff --git a/system/btif/src/btif_profile_queue.c b/system/btif/src/btif_profile_queue.c
index 66aeefd..32a399c 100644
--- a/system/btif/src/btif_profile_queue.c
+++ b/system/btif/src/btif_profile_queue.c
@@ -24,6 +24,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btif_queue"
+
#include <assert.h>
#include <string.h>
@@ -36,8 +38,6 @@
#include "osi/include/list.h"
#include "stack_manager.h"
-#define LOG_TAG "bt_btif_queue"
-
/*******************************************************************************
** Local type definitions
*******************************************************************************/
diff --git a/system/btif/src/btif_sdp.c b/system/btif/src/btif_sdp.c
index b14d6cb..f953327 100644
--- a/system/btif/src/btif_sdp.c
+++ b/system/btif/src/btif_sdp.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
-#define LOG_TAG "BTIF_SDP"
+#define LOG_TAG "bt_btif_sdp"
#include "btif_common.h"
#include "btif_util.h"
#include "btif_profile_queue.h"
diff --git a/system/btif/src/btif_sdp_server.c b/system/btif/src/btif_sdp_server.c
index 1f44e93..b159eb5 100644
--- a/system/btif/src/btif_sdp_server.c
+++ b/system/btif/src/btif_sdp_server.c
@@ -31,7 +31,7 @@
#include <string.h>
#include <pthread.h>
-#define LOG_TAG "BTIF_SDP_SERVER"
+#define LOG_TAG "bt_btif_sdp_server"
#include "btif_common.h"
#include "btif_util.h"
#include "bta_sdp_api.h"
diff --git a/system/btif/src/btif_sock.c b/system/btif/src/btif_sock.c
index 346e2d6..4ffbb45 100644
--- a/system/btif/src/btif_sock.c
+++ b/system/btif/src/btif_sock.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btif_sock"
+
#include <assert.h>
#include <hardware/bluetooth.h>
@@ -31,8 +33,6 @@
#include "btif_util.h"
#include "osi/include/thread.h"
-#define LOG_TAG "bt_btif_sock"
-
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);
static bt_status_t btsock_connect(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t *uuid, int channel, int *sock_fd, int flags);
diff --git a/system/btif/src/btif_sock_l2cap.c b/system/btif/src/btif_sock_l2cap.c
index d2895fd..abf930c 100644
--- a/system/btif/src/btif_sock_l2cap.c
+++ b/system/btif/src/btif_sock_l2cap.c
@@ -26,7 +26,7 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_sock.h>
-#define LOG_TAG "BTIF_SOCK"
+#define LOG_TAG "bt_btif_sock"
#include "osi/include/allocator.h"
#include "osi/include/log.h"
diff --git a/system/btif/src/btif_sock_rfc.c b/system/btif/src/btif_sock_rfc.c
index 2723038..43d6eac 100644
--- a/system/btif/src/btif_sock_rfc.c
+++ b/system/btif/src/btif_sock_rfc.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btif_sock_rfcomm"
+
#include <assert.h>
#include <errno.h>
#include <features.h>
@@ -54,9 +56,6 @@
* L2CAP functions from this file. */
#include "btif_sock_l2cap.h"
-#define LOG_TAG "bt_btif_sock_rfcomm"
-
-
#define MAX_RFC_CHANNEL 30 // Maximum number of RFCOMM channels (1-30 inclusive).
#define MAX_RFC_SESSION 7 // Maximum number of devices we can have an RFCOMM connection with.
diff --git a/system/btif/src/btif_sock_sco.c b/system/btif/src/btif_sock_sco.c
index 28d6e33..359a85e 100644
--- a/system/btif/src/btif_sock_sco.c
+++ b/system/btif/src/btif_sock_sco.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_btif_sock_sco"
+
#include <assert.h>
#include <errno.h>
#include <pthread.h>
@@ -35,8 +37,6 @@
#include "osi/include/socket.h"
#include "osi/include/thread.h"
-#define LOG_TAG "bt_btif_sock_sco"
-
// This module provides a socket abstraction for SCO connections to a higher
// layer. It returns file descriptors representing two types of sockets:
// listening (server) and connected (client) sockets. No SCO data is
diff --git a/system/btif/src/btif_storage.c b/system/btif/src/btif_storage.c
index 25d084d..079ecf0 100644
--- a/system/btif/src/btif_storage.c
+++ b/system/btif/src/btif_storage.c
@@ -28,6 +28,8 @@
*
*/
+#define LOG_TAG "bt_btif_storage"
+
#include <alloca.h>
#include <assert.h>
#include <ctype.h>
@@ -55,8 +57,6 @@
** Constants & Macros
************************************************************************************/
-#define LOG_TAG "bt_btif_storage"
-
#define BTIF_STORAGE_PATH_BLUEDROID "/data/misc/bluedroid"
//#define BTIF_STORAGE_PATH_ADAPTER_INFO "adapter_info"
diff --git a/system/btif/src/stack_manager.c b/system/btif/src/stack_manager.c
index fcd373c..fd2046f 100644
--- a/system/btif/src/stack_manager.c
+++ b/system/btif/src/stack_manager.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_stack_manager"
+
#include <hardware/bluetooth.h>
#include "btcore/include/module.h"
@@ -34,8 +36,6 @@
#include "btif_profile_queue.h"
#include "bt_utils.h"
-#define LOG_TAG "bt_stack_manager"
-
static thread_t *management_thread;
// If initialized, any of the bluetooth API functions can be called.
diff --git a/system/hci/src/btsnoop.c b/system/hci/src/btsnoop.c
index f1dcab8..46de2ee 100644
--- a/system/hci/src/btsnoop.c
+++ b/system/hci/src/btsnoop.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_snoop"
+
#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
@@ -37,8 +39,6 @@
#include "osi/include/log.h"
#include "stack_config.h"
-#define LOG_TAG "bt_snoop"
-
typedef enum {
kCommandPacket = 1,
kAclPacket = 2,
diff --git a/system/hci/src/hci_hal_h4.c b/system/hci/src/hci_hal_h4.c
index 89bcb08..ad04423 100644
--- a/system/hci/src/hci_hal_h4.c
+++ b/system/hci/src/hci_hal_h4.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci_h4"
+
#include <assert.h>
#include <errno.h>
#include <string.h>
@@ -28,8 +30,6 @@
#include "osi/include/reactor.h"
#include "vendor.h"
-#define LOG_TAG "bt_hci_h4"
-
#define HCI_HAL_SERIAL_BUFFER_SIZE 1026
// Our interface and modules we import
diff --git a/system/hci/src/hci_hal_mct.c b/system/hci/src/hci_hal_mct.c
index 0f5b230..33d0251 100644
--- a/system/hci/src/hci_hal_mct.c
+++ b/system/hci/src/hci_hal_mct.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci_mct"
+
#include <assert.h>
#include <errno.h>
#include <string.h>
@@ -29,8 +31,6 @@
#include "osi/include/reactor.h"
#include "vendor.h"
-#define LOG_TAG "bt_hci_mct"
-
#define HCI_HAL_SERIAL_BUFFER_SIZE 1026
// Our interface and modules we import
diff --git a/system/hci/src/hci_inject.c b/system/hci/src/hci_inject.c
index 7bf6ebb..a41517f 100644
--- a/system/hci/src/hci_inject.c
+++ b/system/hci/src/hci_inject.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci_inject"
+
#include <assert.h>
#include <errno.h>
#include <string.h>
@@ -31,8 +33,6 @@
#include "osi/include/socket.h"
#include "osi/include/thread.h"
-#define LOG_TAG "bt_hci_inject"
-
typedef enum {
HCI_PACKET_COMMAND = 1,
HCI_PACKET_ACL_DATA = 2,
diff --git a/system/hci/src/hci_layer.c b/system/hci/src/hci_layer.c
index cdbb939..d1b5dae 100644
--- a/system/hci/src/hci_layer.c
+++ b/system/hci/src/hci_layer.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci"
+
#include <assert.h>
#include <pthread.h>
#include <signal.h>
@@ -50,8 +52,6 @@
#include "packet_fragmenter.h"
#include "vendor.h"
-#define LOG_TAG "bt_hci"
-
// TODO(zachoverflow): remove this hack extern
#include <hardware/bluetooth.h>
bt_bdaddr_t btif_local_bd_addr;
diff --git a/system/hci/src/hci_packet_parser.c b/system/hci/src/hci_packet_parser.c
index 2e2f2a59..8470c3f 100644
--- a/system/hci/src/hci_packet_parser.c
+++ b/system/hci/src/hci_packet_parser.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci"
+
#include "hci_packet_parser.h"
#include <assert.h>
@@ -25,8 +27,6 @@
#include "hcimsgs.h"
#include "osi/include/log.h"
-#define LOG_TAG "bt_hci"
-
static const command_opcode_t NO_OPCODE_CHECKING = 0;
static const allocator_t *buffer_allocator;
diff --git a/system/hci/src/low_power_manager.c b/system/hci/src/low_power_manager.c
index 5cbece7..ff5ce9b 100644
--- a/system/hci/src/low_power_manager.c
+++ b/system/hci/src/low_power_manager.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_low_power_manager"
+
#include "low_power_manager.h"
#include <assert.h>
@@ -27,8 +29,6 @@
#include "osi/include/thread.h"
#include "vendor.h"
-#define LOG_TAG "bt_low_power_manager"
-
typedef enum {
LPM_DISABLED = 0,
LPM_ENABLED,
diff --git a/system/hci/src/packet_fragmenter.c b/system/hci/src/packet_fragmenter.c
index be554e4..acc45ca 100644
--- a/system/hci/src/packet_fragmenter.c
+++ b/system/hci/src/packet_fragmenter.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci_packet_fragmenter"
+
#include "packet_fragmenter.h"
#include <assert.h>
@@ -30,8 +32,6 @@
#include "osi/include/log.h"
#include "osi/include/osi.h"
-#define LOG_TAG "bt_hci_packet_fragmenter"
-
#define APPLY_CONTINUATION_FLAG(handle) (((handle) & 0xCFFF) | 0x1000)
#define APPLY_START_FLAG(handle) (((handle) & 0xCFFF) | 0x2000)
#define SUB_EVENT(event) ((event) & MSG_SUB_EVT_MASK)
diff --git a/system/main/bte_logmsg.c b/system/main/bte_logmsg.c
index 26444f6..c56e22d 100644
--- a/system/main/bte_logmsg.c
+++ b/system/main/bte_logmsg.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bte_logmsg"
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -56,8 +58,6 @@
#include "smp_api.h"
#endif
-#define LOG_TAG "bte_logmsg"
-
#ifndef DEFAULT_CONF_TRACE_LEVEL
#define DEFAULT_CONF_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
diff --git a/system/main/bte_main.c b/system/main/bte_main.c
index 43dcf8b..f165f52 100644
--- a/system/main/bte_main.c
+++ b/system/main/bte_main.c
@@ -24,6 +24,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_main"
+
#include <assert.h>
#include <fcntl.h>
#include <pthread.h>
@@ -58,8 +60,6 @@
** Constants & Macros
*******************************************************************************/
-#define LOG_TAG "bt_main"
-
/* Run-time configuration file for BLE*/
#ifndef BTE_BLE_STACK_CONF_FILE
#define BTE_BLE_STACK_CONF_FILE "/etc/bluetooth/ble_stack.conf"
diff --git a/system/main/stack_config.c b/system/main/stack_config.c
index 979a1ec..53dda72 100644
--- a/system/main/stack_config.c
+++ b/system/main/stack_config.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_stack_config"
+
#include "stack_config.h"
#include <assert.h>
@@ -23,8 +25,6 @@
#include "osi/include/future.h"
#include "osi/include/log.h"
-#define LOG_TAG "bt_stack_config"
-
const char *BTSNOOP_LOG_PATH_KEY = "BtSnoopFileName";
const char *BTSNOOP_TURNED_ON_KEY = "BtSnoopLogOutput";
const char *BTSNOOP_SHOULD_SAVE_LAST_KEY = "BtSnoopSaveLog";
diff --git a/system/service/a2dp_source.cpp b/system/service/a2dp_source.cpp
index e8ff8a9..ea01188 100644
--- a/system/service/a2dp_source.cpp
+++ b/system/service/a2dp_source.cpp
@@ -15,7 +15,7 @@
//
#include "a2dp_source.h"
-#define LOG_TAG "A2dpSource"
+#define LOG_TAG "bt_a2dp_source"
#include "osi/include/log.h"
#include "core_stack.h"
diff --git a/system/service/core_stack.cpp b/system/service/core_stack.cpp
index 2b8c64b..0b77b4a 100644
--- a/system/service/core_stack.cpp
+++ b/system/service/core_stack.cpp
@@ -23,7 +23,7 @@
#include <mutex>
#include <string>
-#define LOG_TAG "BluetoothBase"
+#define LOG_TAG "bt_bluetooth_base"
#include "osi/include/log.h"
#include "hardware/bluetooth.h"
@@ -38,13 +38,13 @@
bool instantiated = false;
void AdapterStateChangedCallback(bt_state_t state) {
- LOG_INFO("Bluetooth state:%s", BtStateText(state));
+ LOG_INFO(LOG_TAG, "Bluetooth state:%s", BtStateText(state));
if (state == BT_STATE_ON)
synchronize.notify_one();
}
void CallbackThreadCallback(bt_cb_thread_evt evt) {
- LOG_INFO("%s: %s", __func__, BtEventText(evt));
+ LOG_INFO(LOG_TAG, "%s: %s", __func__, BtEventText(evt));
}
// TODO(icoolidge): Audit how these os callouts should be
@@ -96,7 +96,7 @@
}
if (!remote_address) {
- LOG_INFO("Local adapter properties:");
+ LOG_INFO(LOG_TAG, "%s", "Local adapter properties:");
}
for (int i = 0; i < num_properties; ++i) {
@@ -105,26 +105,26 @@
case BT_PROPERTY_BDADDR: {
std::string text =
BtAddrString(reinterpret_cast<bt_bdaddr_t *>(prop->val));
- LOG_INFO("%s: %s", BtPropertyText(prop->type), text.c_str());
+ LOG_INFO(LOG_TAG, "%s: %s", BtPropertyText(prop->type), text.c_str());
break;
}
case BT_PROPERTY_ADAPTER_SCAN_MODE: {
bt_scan_mode_t *mode = reinterpret_cast<bt_scan_mode_t *>(prop->val);
- LOG_INFO("%s: %s", BtPropertyText(prop->type), BtScanModeText(*mode));
+ LOG_INFO(LOG_TAG, "%s: %s", BtPropertyText(prop->type), BtScanModeText(*mode));
std::lock_guard<std::mutex> lock(mutex);
synchronize.notify_one();
break;
}
case BT_PROPERTY_BDNAME: {
bt_bdname_t *name = reinterpret_cast<bt_bdname_t *>(prop->val);
- LOG_INFO("%s: %s", BtPropertyText(prop->type),
+ LOG_INFO(LOG_TAG, "%s: %s", BtPropertyText(prop->type),
reinterpret_cast<char *>(name->name));
std::lock_guard<std::mutex> lock(mutex);
synchronize.notify_one();
break;
}
default:
- LOG_INFO("%s: %s", __func__, BtPropertyText(prop->type));
+ LOG_INFO(LOG_TAG, "%s: %s", __func__, BtPropertyText(prop->type));
break;
}
}
@@ -138,7 +138,7 @@
}
std::string text = BtAddrString(remote_bd_addr);
- LOG_INFO("%s: %s: %s", __func__, text.c_str(), BtAclText(state));
+ LOG_INFO(LOG_TAG, "%s: %s: %s", __func__, text.c_str(), BtAclText(state));
}
void LocalAdapterPropertiesCallback(bt_status_t status, int num_properties,
@@ -223,7 +223,7 @@
}
synchronize.wait(lock);
- LOG_INFO("CoreStack::Initialize success");
+ LOG_INFO(LOG_TAG, "%s", "CoreStack::Initialize success");
return true;
}
diff --git a/system/service/gatt_server.cpp b/system/service/gatt_server.cpp
index 03b31f6..98ed0fe 100644
--- a/system/service/gatt_server.cpp
+++ b/system/service/gatt_server.cpp
@@ -30,7 +30,7 @@
#include <unordered_map>
#include <vector>
-#define LOG_TAG "GattServer"
+#define LOG_TAG "bt_gatt_server"
#include "osi/include/log.h"
#include "core_stack.h"
@@ -103,7 +103,7 @@
/** Callback invoked in response to register_server */
void RegisterServerCallback(int status, int server_if, bt_uuid_t *app_uuid) {
- LOG_INFO("%s: status:%d server_if:%d app_uuid:%p", __func__, status,
+ LOG_INFO(LOG_TAG, "%s: status:%d server_if:%d app_uuid:%p", __func__, status,
server_if, app_uuid);
internal->server_if = server_if;
@@ -119,7 +119,7 @@
void ServiceAddedCallback(int status, int server_if, btgatt_srvc_id_t *srvc_id,
int srvc_handle) {
- LOG_INFO("%s: status:%d server_if:%d gatt_srvc_id:%u srvc_handle:%d",
+ LOG_INFO(LOG_TAG, "%s: status:%d server_if:%d gatt_srvc_id:%u srvc_handle:%d",
__func__, status, server_if, srvc_id->id.inst_id, srvc_handle);
std::lock_guard<std::mutex> lock(internal->lock);
@@ -150,7 +150,7 @@
const size_t attribute_size = std::min(kMaxGattAttributeSize, blob_remaining);
std::string addr(BtAddrString(bda));
- LOG_INFO(
+ LOG_INFO(LOG_TAG,
"%s: connection:%d (%s) reading attr:%d attribute_offset_octets:%d "
"blob_section:%u (is_long:%u)",
__func__, conn_id, addr.c_str(), attr_handle, attribute_offset_octets,
@@ -176,7 +176,7 @@
int attr_handle, int attribute_offset, int length,
bool need_rsp, bool is_prep, uint8_t *value) {
std::string addr(BtAddrString(bda));
- LOG_INFO(
+ LOG_INFO(LOG_TAG,
"%s: connection:%d (%s:trans:%d) write attr:%d attribute_offset:%d "
"length:%d "
"need_resp:%u is_prep:%u",
@@ -195,8 +195,8 @@
// If this is a control attribute, adjust offset of the target blob.
if (target_blob != internal->controlled_blobs.end() && ch.blob.size() == 1u) {
internal->characteristics[target_blob->second].blob_section = ch.blob[0];
- LOG_INFO("%s: updating attribute %d blob_section to %u", __func__,
- target_blob->second, ch.blob[0]);
+ LOG_INFO(LOG_TAG, "%s: updating attribute %d blob_section to %u", __func__,
+ target_blob->second, ch.blob[0]);
} else if (!is_prep) {
// This is a single frame characteristic write.
// Notify upwards because we're done now.
@@ -225,8 +225,8 @@
void RequestExecWriteCallback(int conn_id, int trans_id, bt_bdaddr_t *bda,
int exec_write) {
std::string addr(BtAddrString(bda));
- LOG_INFO("%s: connection:%d (%s:trans:%d) exec_write:%d", __func__, conn_id,
- addr.c_str(), trans_id, exec_write);
+ LOG_INFO(LOG_TAG, "%s: connection:%d (%s:trans:%d) exec_write:%d", __func__,
+ conn_id, addr.c_str(), trans_id, exec_write);
if (!exec_write)
return;
@@ -243,8 +243,8 @@
void ConnectionCallback(int conn_id, int server_if, int connected,
bt_bdaddr_t *bda) {
std::string addr(BtAddrString(bda));
- LOG_INFO("%s: connection:%d server_if:%d connected:%d addr:%s", __func__,
- conn_id, server_if, connected, addr.c_str());
+ LOG_INFO(LOG_TAG, "%s: connection:%d server_if:%d connected:%d addr:%s",
+ __func__, conn_id, server_if, connected, addr.c_str());
if (connected == 1) {
internal->connections.insert(conn_id);
} else if (connected == 0) {
@@ -254,8 +254,9 @@
void CharacteristicAddedCallback(int status, int server_if, bt_uuid_t *uuid,
int srvc_handle, int char_handle) {
- LOG_INFO("%s: status:%d server_if:%d service_handle:%d char_handle:%d",
- __func__, status, server_if, srvc_handle, char_handle);
+ LOG_INFO(LOG_TAG,
+ "%s: status:%d server_if:%d service_handle:%d char_handle:%d", __func__,
+ status, server_if, srvc_handle, char_handle);
bluetooth::Uuid id(*uuid);
@@ -271,15 +272,15 @@
void DescriptorAddedCallback(int status, int server_if, bt_uuid_t *uuid,
int srvc_handle, int descr_handle) {
- LOG_INFO(
+ LOG_INFO(LOG_TAG,
"%s: status:%d server_if:%d service_handle:%d uuid[0]:%u "
"descr_handle:%d",
__func__, status, server_if, srvc_handle, uuid->uu[0], descr_handle);
}
void ServiceStartedCallback(int status, int server_if, int srvc_handle) {
- LOG_INFO("%s: status:%d server_if:%d srvc_handle:%d", __func__, status,
- server_if, srvc_handle);
+ LOG_INFO(LOG_TAG, "%s: status:%d server_if:%d srvc_handle:%d", __func__,
+ status, server_if, srvc_handle);
// The UUID provided here is unimportant, and is only used to satisfy
// BlueDroid.
@@ -294,8 +295,8 @@
}
void RegisterClientCallback(int status, int client_if, bt_uuid_t *app_uuid) {
- LOG_INFO("%s: status:%d client_if:%d uuid[0]:%u", __func__, status,
- client_if, app_uuid->uu[0]);
+ LOG_INFO(LOG_TAG, "%s: status:%d client_if:%d uuid[0]:%u", __func__, status,
+ client_if, app_uuid->uu[0]);
internal->client_if = client_if;
// Setup our advertisement. This has no callback.
@@ -322,15 +323,15 @@
}
void ListenCallback(int status, int client_if) {
- LOG_INFO("%s: status:%d client_if:%d", __func__, status, client_if);
+ LOG_INFO(LOG_TAG, "%s: status:%d client_if:%d", __func__, status, client_if);
// This terminates a Start call.
std::lock_guard<std::mutex> lock(internal->lock);
internal->api_synchronize.notify_one();
}
void ServiceStoppedCallback(int status, int server_if, int srvc_handle) {
- LOG_INFO("%s: status:%d server_if:%d srvc_handle:%d", __func__, status,
- server_if, srvc_handle);
+ LOG_INFO(LOG_TAG, "%s: status:%d server_if:%d srvc_handle:%d", __func__,
+ status, server_if, srvc_handle);
// This terminates a Stop call.
// TODO(icoolidge): make this symmetric with start
std::lock_guard<std::mutex> lock(internal->lock);
@@ -347,15 +348,15 @@
void ClientConnectCallback(int conn_id, int status, int client_if,
bt_bdaddr_t *bda) {
std::string addr(BtAddrString(bda));
- LOG_INFO("%s: conn_id:%d status:%d client_if:%d %s", __func__, conn_id,
- status, client_if, addr.c_str());
+ LOG_INFO(LOG_TAG, "%s: conn_id:%d status:%d client_if:%d %s", __func__,
+ conn_id, status, client_if, addr.c_str());
}
void ClientDisconnectCallback(int conn_id, int status, int client_if,
bt_bdaddr_t *bda) {
std::string addr(BtAddrString(bda));
- LOG_INFO("%s: conn_id:%d status:%d client_if:%d %s", __func__, conn_id,
- status, client_if, addr.c_str());
+ LOG_INFO(LOG_TAG, "%s: conn_id:%d status:%d client_if:%d %s", __func__,
+ conn_id, status, client_if, addr.c_str());
}
void IndicationSentCallback(UNUSED_ATTR int conn_id,
@@ -512,7 +513,7 @@
}
*gatt_pipe = internal_->pipefd[kPipeReadEnd];
- LOG_INFO("Server Initialize succeeded");
+ LOG_INFO(LOG_TAG, "Server Initialize succeeded");
return true;
}
diff --git a/system/service/host.cpp b/system/service/host.cpp
index a2db15b..4359d63 100644
--- a/system/service/host.cpp
+++ b/system/service/host.cpp
@@ -26,7 +26,7 @@
#include <algorithm>
-#define LOG_TAG "BluetoothHost"
+#define LOG_TAG "bt_bluetooth_host"
#include "osi/include/log.h"
#include "base/base64.h"
diff --git a/system/service/main.cpp b/system/service/main.cpp
index 529b9ac..cb536eb 100644
--- a/system/service/main.cpp
+++ b/system/service/main.cpp
@@ -17,7 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
-#define LOG_TAG "BtHost"
+#define LOG_TAG "bt_host"
// For system properties
// TODO(icoolidge): abstraction or non-cutils stub.
#include <cutils/properties.h>
@@ -38,7 +38,7 @@
char disable_value[PROPERTY_VALUE_MAX];
int status = property_get(kDisableProperty, disable_value, nullptr);
if (status && !strcmp(disable_value, "1")) {
- LOG_INFO("service disabled");
+ LOG_INFO(LOG_TAG, "%s", "service disabled");
return EXIT_SUCCESS;
}
@@ -65,7 +65,7 @@
return EXIT_FAILURE;
}
- LOG_INFO("client connected: %d", client_socket);
+ LOG_INFO(LOG_TAG, "client connected: %d", client_socket);
bluetooth::Host bluetooth_host(client_socket, &bt);
bluetooth_host.EventLoop();
}
diff --git a/system/stack/l2cap/l2c_main.c b/system/stack/l2cap/l2c_main.c
index 03e1541..f719527 100644
--- a/system/stack/l2cap/l2c_main.c
+++ b/system/stack/l2cap/l2c_main.c
@@ -22,6 +22,8 @@
*
******************************************************************************/
+#define LOG_TAG "l2c_main"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -38,8 +40,6 @@
#include "l2cdefs.h"
#include "osi/include/log.h"
-#define LOG_TAG "l2c_main"
-
/********************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
/********************************************************************************/
diff --git a/system/stack/rfcomm/port_api.c b/system/stack/rfcomm/port_api.c
index 75c3de6..bb05018 100644
--- a/system/stack/rfcomm/port_api.c
+++ b/system/stack/rfcomm/port_api.c
@@ -22,6 +22,8 @@
*
******************************************************************************/
+#define LOG_TAG "port_api"
+
#include <string.h>
#include "bt_target.h"
#include "btcore/include/counter.h"
@@ -39,8 +41,6 @@
/* duration of break in 200ms units */
#define PORT_BREAK_DURATION 1
-#define LOG_TAG "port_api"
-
#define info(fmt, ...) LOG_INFO(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define debug(fmt, ...) LOG_DEBUG(LOG_TAG, "%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
#define error(fmt, ...) LOG_ERROR(LOG_TAG, "## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__)