Merge branch 'bugfix/btdm_fix_build_warning_when_bluedroid_disable_log' into 'master'

Component/bt: fix build warning when bluedroid disable log

See merge request idf/esp-idf!4524
This commit is contained in:
Jiang Jiang Jian 2019-03-20 21:09:59 +08:00
commit c5fb88c2e2
17 changed files with 62 additions and 5 deletions

View File

@ -531,7 +531,9 @@ void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg
if (bta_gattc_mark_bg_conn(p_data->client_if, p_data->remote_bda, TRUE, FALSE)) {
/* always call open to hold a connection */
if (!GATT_Connect(p_data->client_if, p_data->remote_bda, p_data->remote_addr_type, FALSE, p_data->transport)) {
#if (!CONFIG_BT_STACK_NO_LOG)
uint8_t *bda = (uint8_t *)p_data->remote_bda;
#endif
status = BTA_GATT_ERROR;
APPL_TRACE_ERROR("%s unable to connect to remote bd_addr:%02x:%02x:%02x:%02x:%02x:%02x",
__func__, bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);

View File

@ -261,14 +261,18 @@ tBTA_GATT_STATUS bta_gattc_co_cache_open(BD_ADDR server_bda, BOOLEAN to_save, UI
*******************************************************************************/
tBTA_GATT_STATUS bta_gattc_co_cache_load(tBTA_GATTC_NV_ATTR *attr, UINT8 index)
{
#if (!CONFIG_BT_STACK_NO_LOG)
UINT16 num_attr = 0;
#endif
tBTA_GATT_STATUS status = BTA_GATT_ERROR;
size_t length = 0;
// Read the size of memory space required for blob
nvs_get_blob(cache_env.cache_addr[index].cache_fp, cache_key, NULL, &length);
// Read previously saved blob if available
esp_err_t err_code = nvs_get_blob(cache_env.cache_addr[index].cache_fp, cache_key, attr, &length);
#if (!CONFIG_BT_STACK_NO_LOG)
num_attr = length / sizeof(tBTA_GATTC_NV_ATTR);
#endif
status = (err_code == ESP_OK && length != 0) ? BTA_GATT_OK : BTA_GATT_ERROR;
APPL_TRACE_DEBUG("%s() - read=%d, status=%d, err_code = %d",
__func__, num_attr, status, err_code);
@ -323,6 +327,9 @@ void bta_gattc_co_cache_save (BD_ADDR server_bda, UINT16 num_attr,
status = BTA_GATT_ERROR;
}
#if CONFIG_BT_STACK_NO_LOG
(void) status;
#endif
APPL_TRACE_DEBUG("%s() wrote hash_key = %x%x%x%x, num_attr = %d, status = %d.", __func__, hash_key[0], hash_key[1], hash_key[2], hash_key[3], num_attr, status);
}

View File

@ -637,8 +637,9 @@ BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda
}
if (!add) {
if (remote_bda_ptr) {
// bdstr_t bdstr = {0};
#if (!CONFIG_BT_STACK_NO_LOG)
char bdstr[18] = {0};
#endif
APPL_TRACE_ERROR("%s unable to find the bg connection mask for: %s", __func__,
bdaddr_to_string((bt_bdaddr_t *)remote_bda_ptr, bdstr, sizeof(bdstr)));
}

View File

@ -750,7 +750,9 @@ static void _btc_read_le_key(const uint8_t key_type, const size_t key_len, bt_bd
*device_added = true;
}
#if (!CONFIG_BT_STACK_NO_LOG)
char bd_str[20] = {0};
#endif
BTC_TRACE_DEBUG("%s() Adding key type %d for %s", __func__,
key_type, bdaddr_to_string(&bd_addr, bd_str, sizeof(bd_str)));
BTA_DmAddBleKey(bta_bd_addr, (tBTA_LE_KEY_VALUE *)buffer, key_type);

View File

@ -290,6 +290,9 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
}
#if (CONFIG_BT_STACK_NO_LOG)
(void) status;
#endif
BTC_TRACE_DEBUG("%s, authentication status = %x", __func__, status);
return;

View File

@ -27,6 +27,7 @@
#define CASE_RETURN_STR(const) case const: return #const;
#if (SMP_INCLUDED == TRUE)
#if (!CONFIG_BT_STACK_NO_LOG)
static const char *interop_feature_string(const interop_feature_t feature)
{
switch (feature) {
@ -36,7 +37,7 @@ static const char *interop_feature_string(const interop_feature_t feature)
return "UNKNOWN";
}
#endif // (!CONFIG_BT_STACK_NO_LOG)
// Interface functions
bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
{
@ -47,7 +48,9 @@ bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
for (size_t i = 0; i != db_size; ++i) {
if (feature == interop_database[i].feature &&
memcmp(addr, &interop_database[i].addr, interop_database[i].len) == 0) {
#if (!CONFIG_BT_STACK_NO_LOG)
char bdstr[20] = {0};
#endif
LOG_WARN("%s() Device %s is a match for interop workaround %s", __func__,
bdaddr_to_string(addr, bdstr, sizeof(bdstr)), interop_feature_string(feature));
return true;

View File

@ -277,8 +277,10 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
packet->offset++;
packet->len--;
if (type == HCI_BLE_EVENT) {
#if (!CONFIG_BT_STACK_NO_LOG)
uint8_t len = 0;
STREAM_TO_UINT8(len, stream);
#endif
HCI_TRACE_ERROR("Workround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
packet->len, len);
osi_free(packet);

View File

@ -756,6 +756,7 @@ extern void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_c
void BTM_VendorHciEchoCmdCallback(tBTM_VSC_CMPL *p1)
{
#if (!CONFIG_BT_STACK_NO_LOG)
if (!p1) {
return;
}
@ -763,6 +764,7 @@ void BTM_VendorHciEchoCmdCallback(tBTM_VSC_CMPL *p1)
uint8_t status, echo;
STREAM_TO_UINT8 (status, p);
STREAM_TO_UINT8 (echo, p);
#endif
BTM_TRACE_DEBUG("%s status 0x%x echo 0x%x", __func__, status, echo);
}

View File

@ -78,7 +78,9 @@ const UINT8 btm_pm_md_comp_matrix[BTM_PM_NUM_SET_MODES * BTM_PM_NUM_SET_MODES] =
/* function prototype */
static int btm_pm_find_acl_ind(BD_ADDR remote_bda);
static tBTM_STATUS btm_pm_snd_md_req( UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode );
#if (!CONFIG_BT_STACK_NO_LOG)
static const char *mode_to_string(tBTM_PM_MODE mode);
#endif
/*
#ifdef BTM_PM_DEBUG
@ -950,6 +952,7 @@ tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void)
}
}
#if (!CONFIG_BT_STACK_NO_LOG)
static const char *mode_to_string(tBTM_PM_MODE mode)
{
switch (mode) {
@ -960,3 +963,4 @@ static const char *mode_to_string(tBTM_PM_MODE mode)
default: return "UNKNOWN";
}
}
#endif

View File

@ -949,7 +949,9 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
{
tBTM_SEC_DEV_REC *p_dev_rec;
tBTM_STATUS status;
#if (!CONFIG_BT_STACK_NO_LOG)
UINT8 *p_features;
#endif
UINT8 ii;
tACL_CONN *p = btm_bda_to_acl(bd_addr, transport);
BTM_TRACE_API ("btm_sec_bond_by_transport BDA: %02x:%02x:%02x:%02x:%02x:%02x\n",
@ -1042,7 +1044,9 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
}
for (ii = 0; ii <= HCI_EXT_FEATURES_PAGE_MAX; ii++) {
#if (!CONFIG_BT_STACK_NO_LOG)
p_features = p_dev_rec->features[ii];
#endif
BTM_TRACE_EVENT(" remote_features page[%1d] = %02x-%02x-%02x-%02x\n",
ii, p_features[0], p_features[1], p_features[2], p_features[3]);
BTM_TRACE_EVENT(" %02x-%02x-%02x-%02x\n",

View File

@ -437,6 +437,9 @@ void gap_attr_db_init(void)
memset (&app_uuid.uu.uuid128, 0x81, LEN_UUID_128);
status = GATTS_StartService(gap_cb.gatt_if, service_handle, GAP_TRANSPORT_SUPPORTED );
#if (CONFIG_BT_STACK_NO_LOG)
(void) status;
#endif
GAP_TRACE_EVENT ("GAP App gatt_if: %d s_hdl = %d start_status=%d",
gap_cb.gatt_if, service_handle, status);

View File

@ -1169,6 +1169,10 @@ void GATT_SetIdleTimeout (BD_ADDR bd_addr, UINT16 idle_tout, tBT_TRANSPORT trans
}
}
#if (CONFIG_BT_STACK_NO_LOG)
(void) status;
#endif
GATT_TRACE_API ("GATT_SetIdleTimeout idle_tout=%d status=%d(1-OK 0-not performed)",
idle_tout, status);
}

View File

@ -374,6 +374,10 @@ void gatt_profile_db_init (void)
*/
status = GATTS_StartService (gatt_cb.gatt_if, service_handle, GATTP_TRANSPORT_SUPPORTED );
#if (CONFIG_BT_STACK_NO_LOG)
(void) status;
#endif
GATT_TRACE_DEBUG ("gatt_profile_db_init: gatt_if=%d start status%d\n",
gatt_cb.gatt_if, status);
}

View File

@ -2140,7 +2140,9 @@ void gatt_end_operation(tGATT_CLCB *p_clcb, tGATT_STATUS status, void *p_data)
UINT8 op = p_clcb->operation, disc_type = GATT_DISC_MAX;
tGATT_DISC_CMPL_CB *p_disc_cmpl_cb = (p_clcb->p_reg) ? p_clcb->p_reg->app_cb.p_disc_cmpl_cb : NULL;
UINT16 conn_id;
#if (!CONFIG_BT_STACK_NO_LOG)
UINT8 operation;
#endif
GATT_TRACE_DEBUG ("gatt_end_operation status=%d op=%d subtype=%d",
status, p_clcb->operation, p_clcb->op_subtype);
@ -2182,7 +2184,10 @@ void gatt_end_operation(tGATT_CLCB *p_clcb, tGATT_STATUS status, void *p_data)
osi_free(p_clcb->p_attr_buf);
}
#if !CONFIG_BT_STACK_NO_LOG
operation = p_clcb->operation;
#endif
conn_id = p_clcb->conn_id;
btu_stop_timer(&p_clcb->rsp_timer_ent);

View File

@ -123,7 +123,10 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
UINT8 pkt_type;
tL2C_LCB *p_lcb;
tL2C_CCB *p_ccb = NULL;
UINT16 l2cap_len, rcv_cid, psm;
UINT16 l2cap_len, rcv_cid;
#if (!CONFIG_BT_STACK_NO_LOG)
UINT16 psm;
#endif
UINT16 credit;
/* Extract the handle */
@ -228,7 +231,9 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
//counter_add("l2cap.ch2.rx.bytes", l2cap_len);
//counter_add("l2cap.ch2.rx.pkts", 1);
/* process_connectionless_data (p_lcb); */
#if !CONFIG_BT_STACK_NO_LOG
STREAM_TO_UINT16 (psm, p);
#endif
L2CAP_TRACE_DEBUG( "GOT CONNECTIONLESS DATA PSM:%d", psm ) ;
#if (L2CAP_UCD_INCLUDED == TRUE)

View File

@ -586,14 +586,18 @@ void SMP_KeypressNotification (BD_ADDR bd_addr, UINT8 value)
BOOLEAN SMP_CreateLocalSecureConnectionsOobData (tBLE_BD_ADDR *addr_to_send_to)
{
tSMP_CB *p_cb = &smp_cb;
#if (!CONFIG_BT_STACK_NO_LOG)
UINT8 *bd_addr;
#endif
if (addr_to_send_to == NULL) {
SMP_TRACE_ERROR ("%s addr_to_send_to is not provided", __FUNCTION__);
return FALSE;
}
#if (!CONFIG_BT_STACK_NO_LOG)
bd_addr = addr_to_send_to->bda;
#endif
SMP_TRACE_EVENT ("%s addr type: %u, BDA: %08x%04x, state: %u, br_state: %u",
__FUNCTION__, addr_to_send_to->type,

View File

@ -1151,9 +1151,10 @@ void smp_calculate_local_commitment(tSMP_CB *p_cb)
switch (p_cb->selected_association_model) {
case SMP_MODEL_SEC_CONN_JUSTWORKS:
case SMP_MODEL_SEC_CONN_NUM_COMP:
if (p_cb->role == HCI_ROLE_MASTER)
if (p_cb->role == HCI_ROLE_MASTER) {
SMP_TRACE_WARNING ("local commitment calc on master is not expected \
for Just Works/Numeric Comparison models\n");
}
smp_calculate_f4(p_cb->loc_publ_key.x, p_cb->peer_publ_key.x, p_cb->rand, 0,
p_cb->commitment);
break;
@ -1196,9 +1197,10 @@ void smp_calculate_peer_commitment(tSMP_CB *p_cb, BT_OCTET16 output_buf)
switch (p_cb->selected_association_model) {
case SMP_MODEL_SEC_CONN_JUSTWORKS:
case SMP_MODEL_SEC_CONN_NUM_COMP:
if (p_cb->role == HCI_ROLE_SLAVE)
if (p_cb->role == HCI_ROLE_SLAVE) {
SMP_TRACE_WARNING ("peer commitment calc on slave is not expected \
for Just Works/Numeric Comparison models\n");
}
smp_calculate_f4(p_cb->peer_publ_key.x, p_cb->loc_publ_key.x, p_cb->rrand, 0,
output_buf);
break;