From 1940ee09101dc1a3c0db5dd7b1bcb098240b0dd4 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Fri, 15 Mar 2019 20:59:55 +0800 Subject: [PATCH] Component/bt: fix build warning when bluedroid disable log --- components/bt/bluedroid/bta/gatt/bta_gattc_act.c | 2 ++ components/bt/bluedroid/bta/gatt/bta_gattc_co.c | 7 +++++++ components/bt/bluedroid/bta/gatt/bta_gattc_utils.c | 3 ++- components/bt/bluedroid/btc/core/btc_ble_storage.c | 2 ++ components/bt/bluedroid/btc/core/btc_dm.c | 3 +++ components/bt/bluedroid/device/interop.c | 5 ++++- components/bt/bluedroid/hci/hci_hal_h4.c | 2 ++ components/bt/bluedroid/stack/btm/btm_ble_gap.c | 2 ++ components/bt/bluedroid/stack/btm/btm_pm.c | 4 ++++ components/bt/bluedroid/stack/btm/btm_sec.c | 4 ++++ components/bt/bluedroid/stack/gap/gap_ble.c | 3 +++ components/bt/bluedroid/stack/gatt/gatt_api.c | 4 ++++ components/bt/bluedroid/stack/gatt/gatt_attr.c | 4 ++++ components/bt/bluedroid/stack/gatt/gatt_utils.c | 5 +++++ components/bt/bluedroid/stack/l2cap/l2c_main.c | 7 ++++++- components/bt/bluedroid/stack/smp/smp_api.c | 4 ++++ components/bt/bluedroid/stack/smp/smp_keys.c | 6 ++++-- 17 files changed, 62 insertions(+), 5 deletions(-) diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_act.c b/components/bt/bluedroid/bta/gatt/bta_gattc_act.c index 690b9c4efc..1f89c17f5b 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_act.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_act.c @@ -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]); diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_co.c b/components/bt/bluedroid/bta/gatt/bta_gattc_co.c index 1a1599af55..37befab805 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_co.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_co.c @@ -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); } diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_utils.c b/components/bt/bluedroid/bta/gatt/bta_gattc_utils.c index fd44375fa8..bf13e55a59 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_utils.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_utils.c @@ -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))); } diff --git a/components/bt/bluedroid/btc/core/btc_ble_storage.c b/components/bt/bluedroid/btc/core/btc_ble_storage.c index 81c67af32a..c8590ce803 100644 --- a/components/bt/bluedroid/btc/core/btc_ble_storage.c +++ b/components/bt/bluedroid/btc/core/btc_ble_storage.c @@ -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); diff --git a/components/bt/bluedroid/btc/core/btc_dm.c b/components/bt/bluedroid/btc/core/btc_dm.c index d7a62c76ad..f3b9caeb42 100644 --- a/components/bt/bluedroid/btc/core/btc_dm.c +++ b/components/bt/bluedroid/btc/core/btc_dm.c @@ -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; diff --git a/components/bt/bluedroid/device/interop.c b/components/bt/bluedroid/device/interop.c index 22c073acf3..f560135434 100644 --- a/components/bt/bluedroid/device/interop.c +++ b/components/bt/bluedroid/device/interop.c @@ -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; diff --git a/components/bt/bluedroid/hci/hci_hal_h4.c b/components/bt/bluedroid/hci/hci_hal_h4.c index e742b6240f..89fba87b5d 100644 --- a/components/bt/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/bluedroid/hci/hci_hal_h4.c @@ -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); diff --git a/components/bt/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/bluedroid/stack/btm/btm_ble_gap.c index a015a3cbb2..14c96b15dc 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_gap.c @@ -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); } diff --git a/components/bt/bluedroid/stack/btm/btm_pm.c b/components/bt/bluedroid/stack/btm/btm_pm.c index 7c3629ca4b..3ea3dfbddd 100644 --- a/components/bt/bluedroid/stack/btm/btm_pm.c +++ b/components/bt/bluedroid/stack/btm/btm_pm.c @@ -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 diff --git a/components/bt/bluedroid/stack/btm/btm_sec.c b/components/bt/bluedroid/stack/btm/btm_sec.c index 2dece0f4c9..7391d24cdd 100644 --- a/components/bt/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/bluedroid/stack/btm/btm_sec.c @@ -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", diff --git a/components/bt/bluedroid/stack/gap/gap_ble.c b/components/bt/bluedroid/stack/gap/gap_ble.c index 5044f08f16..bb5db8c1b1 100644 --- a/components/bt/bluedroid/stack/gap/gap_ble.c +++ b/components/bt/bluedroid/stack/gap/gap_ble.c @@ -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); diff --git a/components/bt/bluedroid/stack/gatt/gatt_api.c b/components/bt/bluedroid/stack/gatt/gatt_api.c index e6ea5b4f04..64f19509f0 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_api.c +++ b/components/bt/bluedroid/stack/gatt/gatt_api.c @@ -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); } diff --git a/components/bt/bluedroid/stack/gatt/gatt_attr.c b/components/bt/bluedroid/stack/gatt/gatt_attr.c index ff75ff11bb..5036241317 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_attr.c +++ b/components/bt/bluedroid/stack/gatt/gatt_attr.c @@ -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); } diff --git a/components/bt/bluedroid/stack/gatt/gatt_utils.c b/components/bt/bluedroid/stack/gatt/gatt_utils.c index b7608f8d92..6d724e6d43 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_utils.c +++ b/components/bt/bluedroid/stack/gatt/gatt_utils.c @@ -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); diff --git a/components/bt/bluedroid/stack/l2cap/l2c_main.c b/components/bt/bluedroid/stack/l2cap/l2c_main.c index 0178f4770d..53d04263a6 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_main.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_main.c @@ -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) diff --git a/components/bt/bluedroid/stack/smp/smp_api.c b/components/bt/bluedroid/stack/smp/smp_api.c index 36811cd245..8c3c3d8bc7 100644 --- a/components/bt/bluedroid/stack/smp/smp_api.c +++ b/components/bt/bluedroid/stack/smp/smp_api.c @@ -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, diff --git a/components/bt/bluedroid/stack/smp/smp_keys.c b/components/bt/bluedroid/stack/smp/smp_keys.c index 94806a5a60..4c523787c1 100644 --- a/components/bt/bluedroid/stack/smp/smp_keys.c +++ b/components/bt/bluedroid/stack/smp/smp_keys.c @@ -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;