From 5933ebc6b62811789f33a7a9cc3831c6c5a4f069 Mon Sep 17 00:00:00 2001 From: Tian Hao Date: Wed, 7 Dec 2016 14:11:40 +0800 Subject: [PATCH] component/bt : cleanup all the "-W-no-xx" and all the warnings 1. cleanup the warnings. 2. fix the some function called in gap 3. fix some code in btc_main --- components/bt/bluedroid/api/esp_gap_ble_api.c | 1 - components/bt/bluedroid/bta/dm/bta_dm_act.c | 67 ++----------------- components/bt/bluedroid/bta/dm/bta_dm_pm.c | 1 - components/bt/bluedroid/bta/sdp/bta_sdp_act.c | 1 - components/bt/bluedroid/btc/core/btc_main.c | 14 ++-- components/bt/bluedroid/btc/core/btc_task.c | 2 +- .../btc/profile/esp/blufi/blufi_prf.c | 9 ++- .../btc/profile/std/gap/btc_gap_ble.c | 56 +++------------- .../btc/profile/std/gatt/btc_gatt_util.c | 2 +- .../btc/profile/std/gatt/btc_gatts.c | 2 - .../profile/std/gatt/include/btc_gatt_util.h | 2 +- .../device/include/interop_database.h | 18 ++--- components/bt/bluedroid/hci/hci_layer.c | 25 ------- components/bt/bluedroid/osi/alarm.c | 6 +- components/bt/bluedroid/stack/btm/btm_ble.c | 58 +--------------- .../bluedroid/stack/btm/btm_ble_adv_filter.c | 2 +- .../bluedroid/stack/btm/btm_ble_cont_energy.c | 2 +- .../bt/bluedroid/stack/btm/btm_ble_gap.c | 7 +- components/bt/bluedroid/stack/btm/btm_dev.c | 1 - .../bt/bluedroid/stack/btm/btm_devctl.c | 3 - components/bt/bluedroid/stack/btm/btm_sec.c | 44 ++---------- components/bt/bluedroid/stack/gap/gap_conn.c | 4 +- .../bt/bluedroid/stack/gatt/gatt_attr.c | 1 - components/bt/bluedroid/stack/gatt/gatt_cl.c | 2 +- components/bt/bluedroid/stack/gatt/gatt_sr.c | 2 +- components/bt/bluedroid/stack/l2cap/l2c_api.c | 8 +-- components/bt/bluedroid/stack/l2cap/l2c_ble.c | 3 - components/bt/bluedroid/stack/l2cap/l2c_fcr.c | 2 +- .../bt/bluedroid/stack/l2cap/l2c_link.c | 2 +- .../bt/bluedroid/stack/l2cap/l2c_utils.c | 6 +- components/bt/bluedroid/stack/sdp/sdp_api.c | 6 ++ components/bt/bluedroid/stack/sdp/sdp_db.c | 2 +- components/bt/bluedroid/stack/smp/smp_cmac.c | 2 +- components/bt/component.mk | 4 +- examples/12_blufi/components/blufi/blufi.c | 6 +- 35 files changed, 83 insertions(+), 290 deletions(-) diff --git a/components/bt/bluedroid/api/esp_gap_ble_api.c b/components/bt/bluedroid/api/esp_gap_ble_api.c index ebe1d81947..0770fcfed5 100644 --- a/components/bt/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/bluedroid/api/esp_gap_ble_api.c @@ -84,7 +84,6 @@ esp_err_t esp_ble_gap_start_scanning(uint32_t duration) esp_err_t esp_ble_gap_stop_scanning(void) { btc_msg_t msg; - btc_ble_gap_args_t arg; msg.sig = BTC_SIG_API_CALL; msg.pid = BTC_PID_GAP_BLE; diff --git a/components/bt/bluedroid/bta/dm/bta_dm_act.c b/components/bt/bluedroid/bta/dm/bta_dm_act.c index 155602fac7..c96c9890ed 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_act.c @@ -62,18 +62,6 @@ static BOOLEAN bta_dm_check_av(UINT16 event); static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data); -#if BLE_INCLUDED == TRUE -static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc, - BD_NAME p_bdn, UINT8 *features, - BOOLEAN is_new, UINT16 handle, - tBT_TRANSPORT transport); -#else -static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc, - BD_NAME p_bdn, UINT8 *features, - BOOLEAN is_new); -#endif - - static void bta_dm_policy_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr); /* Extended Inquiry Response */ @@ -1647,7 +1635,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data) if ( bta_dm_search_cb.p_sdp_db != NULL && bta_dm_search_cb.p_sdp_db->raw_used != 0 && bta_dm_search_cb.p_sdp_db->raw_data != NULL) { APPL_TRACE_DEBUG( - "%s raw_data used = 0x%x raw_data_ptr = 0x%x", __func__, + "%s raw_data used = 0x%x raw_data_ptr = %p", __func__, bta_dm_search_cb.p_sdp_db->raw_used, bta_dm_search_cb.p_sdp_db->raw_data); @@ -1991,7 +1979,6 @@ static void bta_dm_find_services ( BD_ADDR bd_addr) { tSDP_UUID uuid; - UINT16 num_attrs = 1; tBTA_DM_MSG *p_msg; memset (&uuid, 0, sizeof(tSDP_UUID)); @@ -2169,7 +2156,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr) bdcpy(bta_dm_search_cb.peer_bdaddr, remote_bd_addr); - APPL_TRACE_DEBUG("%s name_discover_done = %d p_btm_inq_info 0x%x state = %d, transport=%d", + APPL_TRACE_DEBUG("%s name_discover_done = %d p_btm_inq_info %p state = %d, transport=%d", __func__, bta_dm_search_cb.name_discover_done, bta_dm_search_cb.p_btm_inq_info, @@ -2231,7 +2218,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr) #if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)) if ( bta_dm_search_cb.p_btm_inq_info ) { - APPL_TRACE_DEBUG("%s p_btm_inq_info 0x%x results.device_type 0x%x services_to_search 0x%x", + APPL_TRACE_DEBUG("%s p_btm_inq_info %p results.device_type 0x%x services_to_search 0x%x", __func__, bta_dm_search_cb.p_btm_inq_info, bta_dm_search_cb.p_btm_inq_info->results.device_type, @@ -2956,48 +2943,6 @@ static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data) } -/******************************************************************************* -** -** Function bta_dm_acl_change_cback -** -** Description Callback from btm when acl connection goes up or down -** -** -** Returns void -** -*******************************************************************************/ -#if BLE_INCLUDED == TRUE -static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc, BD_NAME p_bdn, - UINT8 *features, BOOLEAN is_new, UINT16 handle, - tBT_TRANSPORT transport) -#else -static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc, BD_NAME p_bdn, - UINT8 *features, BOOLEAN is_new) -#endif -{ - tBTA_DM_ACL_CHANGE *p_msg = (tBTA_DM_ACL_CHANGE *) GKI_getbuf(sizeof(tBTA_DM_ACL_CHANGE)); - if (p_msg != NULL) { - memset(p_msg, 0, sizeof(tBTA_DM_ACL_CHANGE)); - - bdcpy(p_msg->bd_addr, p_bda); - p_msg->is_new = is_new; -#if BLE_INCLUDED == TRUE - p_msg->handle = handle; - p_msg->transport = transport; -#endif - /* This is collision case */ - if (features != NULL) { - if ((features[0] == 0xFF) && !is_new) { - p_msg->event = BTM_BL_COLLISION_EVT; - } - } - - p_msg->hdr.event = BTA_DM_ACL_CHANGE_EVT; - bta_sys_sendmsg(p_msg); - } -} - - /******************************************************************************* ** ** Function bta_dm_rs_cback @@ -4018,7 +3963,7 @@ void bta_dm_encrypt_cback(BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_ break; } - APPL_TRACE_DEBUG("bta_dm_encrypt_cback status =%d p_callback=0x%x", bta_status, p_callback); + APPL_TRACE_DEBUG("bta_dm_encrypt_cback status =%d p_callback=%p", bta_status, p_callback); if (p_callback) { (*p_callback)(bd_addr, transport, bta_status); @@ -4150,8 +4095,6 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D tBTM_STATUS status = BTM_SUCCESS; tBTA_DM_SEC sec_event; char *p_name = NULL; - UINT8 i; - tBT_DEVICE_TYPE dev_type; if (!bta_dm_cb.p_sec_cback) { return BTM_NOT_AUTHORIZED; @@ -5255,7 +5198,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id) if ( bta_dm_search_cb.ble_raw_used + sizeof(tBTA_GATT_ID) < bta_dm_search_cb.ble_raw_size ) { - APPL_TRACE_DEBUG("ADDING BLE SERVICE uuid=0x%x, ble_ptr = 0x%x, ble_raw_used = 0x%x", + APPL_TRACE_DEBUG("ADDING BLE SERVICE uuid=0x%x, ble_ptr = %p, ble_raw_used = 0x%x", service_id.uuid.uu.uuid16, bta_dm_search_cb.p_ble_rawdata, bta_dm_search_cb.ble_raw_used); if (bta_dm_search_cb.p_ble_rawdata) { diff --git a/components/bt/bluedroid/bta/dm/bta_dm_pm.c b/components/bt/bluedroid/bta/dm/bta_dm_pm.c index 1acb0f46ce..10521ee075 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_pm.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_pm.c @@ -337,7 +337,6 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, { UINT8 i, j; - UINT16 policy_setting; UINT8 *p = NULL; tBTA_DM_PEER_DEVICE *p_dev; diff --git a/components/bt/bluedroid/bta/sdp/bta_sdp_act.c b/components/bt/bluedroid/bta/sdp/bta_sdp_act.c index 944a3ee213..1281b50ab2 100644 --- a/components/bt/bluedroid/bta/sdp/bta_sdp_act.c +++ b/components/bt/bluedroid/bta/sdp/bta_sdp_act.c @@ -298,7 +298,6 @@ static void bta_create_ops_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE static void bta_create_sap_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec) { - tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db; tSDP_DISC_ATTR *p_attr; tSDP_PROTOCOL_ELEM pe; UINT16 pversion = -1; diff --git a/components/bt/bluedroid/btc/core/btc_main.c b/components/bt/bluedroid/btc/core/btc_main.c index 2ca4b5b39b..6fae3af435 100644 --- a/components/bt/bluedroid/btc/core/btc_main.c +++ b/components/bt/bluedroid/btc/core/btc_main.c @@ -39,14 +39,18 @@ static void btc_sec_callback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data) } } -static bt_status_t btc_enable_bluetooth(void) +static void btc_enable_bluetooth(void) { - BTA_EnableBluetooth(btc_sec_callback); + if (BTA_EnableBluetooth(btc_sec_callback) != BTA_SUCCESS) { + future_ready(*btc_main_get_future_p(BTC_MAIN_ENABLE_FUTURE), FUTURE_SUCCESS); + } } -static bt_status_t btc_disable_bluetooth(void) +static void btc_disable_bluetooth(void) { - BTA_DisableBluetooth(); + if (BTA_DisableBluetooth() != BTA_SUCCESS) { + future_ready(*btc_main_get_future_p(BTC_MAIN_DISABLE_FUTURE), FUTURE_SUCCESS); + } } void btc_init_callback(void) @@ -54,7 +58,7 @@ void btc_init_callback(void) future_ready(*btc_main_get_future_p(BTC_MAIN_INIT_FUTURE), FUTURE_SUCCESS); } -static bt_status_t btc_init_bluetooth(void) +static void btc_init_bluetooth(void) { bte_main_boot_entry(btc_init_callback); } diff --git a/components/bt/bluedroid/btc/core/btc_task.c b/components/bt/bluedroid/btc/core/btc_task.c index 842fdd10fe..b4ce0d95ca 100644 --- a/components/bt/bluedroid/btc/core/btc_task.c +++ b/components/bt/bluedroid/btc/core/btc_task.c @@ -56,7 +56,7 @@ static void btc_task(void *arg) for (;;) { if (pdTRUE == xQueueReceive(xBtcQueue, &msg, (portTickType)portMAX_DELAY)) { - LOG_DEBUG("%s msg %u %u %u %08x\n", __func__, msg.sig, msg.pid, msg.act, msg.arg); + LOG_DEBUG("%s msg %u %u %u %p\n", __func__, msg.sig, msg.pid, msg.act, msg.arg); switch (msg.sig) { case BTC_SIG_API_CALL: profile_tab[msg.pid].btc_call(&msg); diff --git a/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c b/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c index c869c0b0f7..8acb9565c8 100644 --- a/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c +++ b/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c @@ -34,8 +34,8 @@ #include "blufi_adv.h" #include "blufi_int.h" -static uint8_t *success_msg = "BLUFI_CONFIG_OK"; -static uint8_t *failed_msg = "BLUFI_CONFIG_FAILED"; +const char success_msg[] = "BLUFI_CONFIG_OK"; +const char failed_msg[] = "BLUFI_CONFIG_FAILED"; #define BTC_BLUFI_CB_TO_APP(_event, _param) ((esp_profile_cb_t)btc_profile_cb_get(BTC_PID_BLUFI))(_event, _param) @@ -145,7 +145,6 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) { tBTA_GATTS_RSP rsp; tBT_UUID uuid = {LEN_UUID_16, {SVC_BLUFI_UUID}}; - UINT8 len = 0; UINT8 *p_rec_data = NULL; tBTA_GATT_STATUS status; @@ -323,13 +322,13 @@ static void blufi_msg_notify(UINT8 *blufi_msg, UINT8 len) static void btc_blufi_config_success(void) { LOG_DEBUG("config success\n"); - blufi_msg_notify(success_msg, strlen(success_msg)); + blufi_msg_notify((uint8_t *)success_msg, strlen(success_msg)); } static void btc_blufi_config_failed(void) { LOG_DEBUG("config faield\n"); - blufi_msg_notify(failed_msg, strlen(failed_msg)); + blufi_msg_notify((uint8_t *)failed_msg, strlen(failed_msg)); } void btc_blufi_cb_handler(btc_msg_t *msg) diff --git a/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c index ba9e962238..4eb60a993a 100644 --- a/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -287,26 +287,7 @@ static void btc_scan_rsp_data_callback(tBTA_STATUS status) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_GAP_BLE; msg.act = ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT; - param.adv_data_cmpl.status = status; - - ret = btc_transfer_context(&msg, ¶m, - sizeof(esp_ble_gap_cb_param_t), NULL); - - if (ret != BT_STATUS_SUCCESS) { - LOG_ERROR("%s btc_transfer_context failed\n", __func__); - } -} - -static void btc_set_scan_param_callback(tGATT_IF client_if, tBTA_STATUS status ) -{ - esp_ble_gap_cb_param_t param; - bt_status_t ret; - btc_msg_t msg; - - msg.sig = BTC_SIG_API_CB; - msg.pid = BTC_PID_GAP_BLE; - msg.act = ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT; - param.adv_data_cmpl.status = status; + param.scan_rsp_data_cmpl.status = status; ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL); @@ -316,37 +297,21 @@ static void btc_set_scan_param_callback(tGATT_IF client_if, tBTA_STATUS status ) } } - - static void btc_ble_set_adv_data(esp_ble_adv_data_t *adv_data, tBTA_SET_ADV_DATA_CMPL_CBACK p_adv_data_cback) { tBTA_BLE_AD_MASK data_mask = 0; - btc_to_bta_adv_data(adv_data, &gl_bta_adv_data, &data_mask); - if (!adv_data->set_scan_rsp) { + btc_to_bta_adv_data(adv_data, &gl_bta_adv_data, &data_mask); BTA_DmBleSetAdvConfig(data_mask, &gl_bta_adv_data, p_adv_data_cback); } else { - BTA_DmBleSetScanRsp(data_mask, &gl_bta_adv_data, p_adv_data_cback); + btc_to_bta_adv_data(adv_data, &gl_bta_scan_rsp_data, &data_mask); + BTA_DmBleSetScanRsp(data_mask, &gl_bta_scan_rsp_data, p_adv_data_cback); } } - -static void btc_ble_set_scan_param(esp_ble_scan_params_t *ble_scan_params, - tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback) -{ - //tBTA_BLE_AD_MASK data_mask = 0; - BTA_DmSetBleScanParams (ESP_DEFAULT_GATT_IF, - ble_scan_params->scan_interval, - ble_scan_params->scan_window, - ble_scan_params->scan_type, - scan_param_setup_cback); - //btc_to_bta_adv_data(scan_rsp_data, &gl_bta_scan_rsp_data, &data_mask); - //BTA_DmBleSetScanRsp(data_mask, &gl_bta_scan_rsp_data, p_scan_rsp_data_cback); -} - -void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params) +static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params) { tBTA_DM_DISC disc_mode = 0; tBTA_DM_CONN conn_mode = 0; @@ -421,20 +386,21 @@ static void btc_scan_params_callback(tGATT_IF gatt_if, tBTM_STATUS status) } } -static void btc_ble_set_scan_params(esp_ble_scan_params_t *scan_params, - tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback) +static void btc_ble_set_scan_params(esp_ble_scan_params_t *scan_params, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback) { if (BLE_ISVALID_PARAM(scan_params->scan_interval, BTM_BLE_SCAN_INT_MIN, BTM_BLE_SCAN_INT_MAX) && BLE_ISVALID_PARAM(scan_params->scan_window, BTM_BLE_SCAN_WIN_MIN, BTM_BLE_SCAN_WIN_MAX) && (scan_params->scan_type == BTM_BLE_SCAN_MODE_ACTI || scan_params->scan_type == BTM_BLE_SCAN_MODE_PASS)) { - BTA_DmSetBleScanFilterParams(0 /*client_if*/, + BTA_DmSetBleScanFilterParams(ESP_DEFAULT_GATT_IF, /*client_if*/ scan_params->scan_interval, scan_params->scan_window, scan_params->scan_type, scan_params->own_addr_type, scan_params->scan_filter_policy, scan_param_setup_cback); - } + } else { + btc_scan_params_callback(ESP_DEFAULT_GATT_IF, BTM_ILLEGAL_VALUE); + } } static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data) @@ -647,7 +613,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg) break; } case BTC_GAP_BLE_ACT_SET_SCAN_PARAM: - btc_ble_set_scan_param(&arg->set_scan_param.scan_params, btc_set_scan_param_callback); + btc_ble_set_scan_params(&arg->set_scan_param.scan_params, btc_scan_params_callback); break; case BTC_GAP_BLE_ACT_START_SCAN: btc_ble_start_scanning(arg->start_scan.duration, btc_search_callback); diff --git a/components/bt/bluedroid/btc/profile/std/gatt/btc_gatt_util.c b/components/bt/bluedroid/btc/profile/std/gatt/btc_gatt_util.c index c19ace2f78..938d2dc409 100644 --- a/components/bt/bluedroid/btc/profile/std/gatt/btc_gatt_util.c +++ b/components/bt/bluedroid/btc/profile/std/gatt/btc_gatt_util.c @@ -59,7 +59,7 @@ int uuidType(unsigned char *p_uuid) return LEN_UUID_128; } -int btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src) +void btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src) { int i = 0; diff --git a/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c b/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c index 8a844f6258..8ef1e9aefd 100644 --- a/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c +++ b/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c @@ -232,8 +232,6 @@ void btc_gatts_call_handler(btc_msg_t *msg) } case BTC_GATTS_ACT_OPEN: { // Ensure device is in inquiry database - int addr_type = 0; - int device_type = 0; tBTA_GATT_TRANSPORT transport = BTA_GATT_TRANSPORT_LE; //TODO : implement address type and device type diff --git a/components/bt/bluedroid/btc/profile/std/gatt/include/btc_gatt_util.h b/components/bt/bluedroid/btc/profile/std/gatt/include/btc_gatt_util.h index 1fa7b59f50..540e118d59 100644 --- a/components/bt/bluedroid/btc/profile/std/gatt/include/btc_gatt_util.h +++ b/components/bt/bluedroid/btc/profile/std/gatt/include/btc_gatt_util.h @@ -21,7 +21,7 @@ #include "esp_gatt_defs.h" #include "esp_gattc_api.h" -int btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src); +void btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src); void btc_to_bta_uuid(tBT_UUID *p_dest, esp_bt_uuid_t *p_src); void btc_to_bta_gatt_id(tBTA_GATT_ID *p_dest, esp_gatt_id_t *p_src); void btc_to_bta_srvc_id(tBTA_GATT_SRVC_ID *p_dest, esp_gatt_srvc_id_t *p_src); diff --git a/components/bt/bluedroid/device/include/interop_database.h b/components/bt/bluedroid/device/include/interop_database.h index 7bc2e8875f..5b9bc934a7 100644 --- a/components/bt/bluedroid/device/include/interop_database.h +++ b/components/bt/bluedroid/device/include/interop_database.h @@ -30,21 +30,21 @@ typedef struct { static const interop_entry_t interop_database[] = { // Nexus Remote (Spike) // Note: May affect other Asus brand devices - {{0x08, 0x62, 0x66, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, - {{0x38, 0x2c, 0x4a, 0xc9, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, - {{0x38, 0x2c, 0x4a, 0xe6, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, - {{0x54, 0xa0, 0x50, 0xd9, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, - {{0xac, 0x9e, 0x17, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, - {{0xf0, 0x79, 0x59, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0x08, 0x62, 0x66, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0x38, 0x2c, 0x4a, 0xc9, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0x38, 0x2c, 0x4a, 0xe6, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0x54, 0xa0, 0x50, 0xd9, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0xac, 0x9e, 0x17, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0xf0, 0x79, 0x59, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, // Motorola Key Link - {{0x1c, 0x96, 0x5a, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0x1c, 0x96, 0x5a, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, // Flic smart button - {{0x80, 0xe4, 0xda, 0x70, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, + {{{0x80, 0xe4, 0xda, 0x70, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS}, // BMW car kits (Harman/Becker) - {{0x9c, 0xdf, 0x03, 0, 0, 0}, 3, INTEROP_AUTO_RETRY_PAIRING} + {{{0x9c, 0xdf, 0x03, 0, 0, 0}}, 3, INTEROP_AUTO_RETRY_PAIRING} }; #endif /*_INTEROP_DATABASE_H_*/ diff --git a/components/bt/bluedroid/hci/hci_layer.c b/components/bt/bluedroid/hci/hci_layer.c index 045b0c359e..3ab78b06d0 100644 --- a/components/bt/bluedroid/hci/hci_layer.c +++ b/components/bt/bluedroid/hci/hci_layer.c @@ -89,11 +89,6 @@ static const packet_fragmenter_callbacks_t packet_fragmenter_callbacks; static int hci_layer_init_env(void); static void hci_layer_deinit_env(void); static void hci_host_thread_handler(void *arg); -static int hci_send_async_command(bt_vendor_opcode_t opcode, void *param); -static void event_finish_startup(void *context); -static void firmware_config_callback(bool success); -static void event_postload(void); -static void sco_config_callback(bool success); static void event_command_ready(fixed_queue_t *queue); static void event_packet_ready(fixed_queue_t *queue); static void restart_comamnd_waiting_response_timer( @@ -320,24 +315,8 @@ static void transmit_downward(uint16_t type, void *data) hci_host_task_post(); } -// Postload functions -static void event_postload(void) -{ - if (hci_send_async_command(BT_VND_OP_SCO_CFG, NULL) == -1) { - // If couldn't configure sco, we won't get the sco configuration callback - // so go pretend to do it now - sco_config_callback(false); - - } -} - -static void sco_config_callback(UNUSED_ATTR bool success) -{ - LOG_INFO("%s postload finished.", __func__); -} // Command/packet transmitting functions - static void event_command_ready(fixed_queue_t *queue) { waiting_command_t *wait_entry = NULL; @@ -594,10 +573,6 @@ static waiting_command_t *get_waiting_command(command_opcode_t opcode) return NULL; } -static int hci_send_async_command(bt_vendor_opcode_t opcode, void *param) -{ -} - static void init_layer_interface() { if (!interface_created) { diff --git a/components/bt/bluedroid/osi/alarm.c b/components/bt/bluedroid/osi/alarm.c index 3dbeb2d455..a5381dc795 100644 --- a/components/bt/bluedroid/osi/alarm.c +++ b/components/bt/bluedroid/osi/alarm.c @@ -28,7 +28,7 @@ #include "freertos/xtensa_api.h" #include "rom/ets_sys.h" -#define RTC_TIMER_TICKS_TO_MS(ticks) ((ticks/625)<<1 + (ticks-(ticks/625)*625)/312) +#define RTC_TIMER_TICKS_TO_MS(ticks) (((ticks/625)<<1) + (ticks-(ticks/625)*625)/312) #define BT_ALARM_START_WAIT_TICKS 100 @@ -49,7 +49,7 @@ static struct alarm_t *alarm_cbs_lookfor_available(void) for (i = 0; i < ALARM_CBS_NUM; i++) { if (alarm_cbs[i].alarm_hdl == NULL) { //available - LOG_DEBUG(">>>> %d %08x<<<<\n", i, &alarm_cbs[i]); + LOG_DEBUG("%s %d %p\n", __func__, i, &alarm_cbs[i]); return &alarm_cbs[i]; } } @@ -67,7 +67,7 @@ static void alarm_cb_handler(TimerHandle_t xTimer) } alarm = pvTimerGetTimerID(xTimer); - LOG_DEBUG("TimerID %08x, Name %s\n", alarm, pcTimerGetTimerName(xTimer)); + LOG_DEBUG("TimerID %p, Name %s\n", alarm, pcTimerGetTimerName(xTimer)); if (alarm->cb) { alarm->cb(alarm->cb_data); } diff --git a/components/bt/bluedroid/stack/btm/btm_ble.c b/components/bt/bluedroid/stack/btm/btm_ble.c index 4e1f151957..17f1d43e24 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/bluedroid/stack/btm/btm_ble.c @@ -651,7 +651,6 @@ void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, tBLE_ADDR BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT transport) { tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(remote_bda); - tACL_CONN *p = btm_bda_to_acl(remote_bda, transport); /* if no device can be located, return */ if (p_dev_rec == NULL) { @@ -1392,58 +1391,6 @@ void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable) gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr); } -/******************************************************************************* -** Function btm_enc_proc_ltk -** Description send LTK reply when it's ready. -*******************************************************************************/ -static void btm_enc_proc_ltk(tSMP_ENC *p) -{ - UINT8 i; - BTM_TRACE_DEBUG ("btm_enc_proc_ltk"); - if (p && p->param_len == BT_OCTET16_LEN) { - for (i = 0; i < (BT_OCTET16_LEN - btm_cb.key_size); i ++) { - p->param_buf[BT_OCTET16_LEN - i - 1] = 0; - } - btsnd_hcic_ble_ltk_req_reply(btm_cb.enc_handle, p->param_buf); - } -} - -/******************************************************************************* -** Function btm_enc_proc_slave_y -** Description calculate LTK when Y is ready -*******************************************************************************/ -static void btm_enc_proc_slave_y(tSMP_ENC *p) -{ - UINT16 div, y; - UINT8 *pp = p->param_buf; - tBTM_CB *p_cb = &btm_cb; - tSMP_ENC output; - tBTM_SEC_DEV_REC *p_dev_rec; - - BTM_TRACE_DEBUG ("btm_enc_proc_slave_y"); - if (p != NULL) { - STREAM_TO_UINT16(y, pp); - - div = p_cb->ediv ^ y; - p_dev_rec = btm_find_dev_by_handle (p_cb->enc_handle); - - if ( p_dev_rec && - p_dev_rec->ble.keys.div == div ) { - BTM_TRACE_DEBUG ("LTK request OK"); - /* calculating LTK , LTK = E er(div) */ - SMP_Encrypt(p_cb->devcb.ble_encryption_key_value, BT_OCTET16_LEN, (UINT8 *)&div, 2, &output); - btm_enc_proc_ltk(&output); - } else { - BTM_TRACE_DEBUG ("LTK request failed - send negative reply"); - btsnd_hcic_ble_ltk_req_neg_reply(p_cb->enc_handle); - if (p_dev_rec) { - btm_ble_link_encrypted(p_dev_rec->bd_addr, 0); - } - - } - } -} - /******************************************************************************* ** ** Function btm_ble_ltk_request_reply @@ -1458,7 +1405,6 @@ void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk) { tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda); tBTM_CB *p_cb = &btm_cb; - tSMP_ENC output; if (p_rec == NULL) { BTM_TRACE_ERROR("btm_ble_ltk_request_reply received for unknown device"); @@ -1855,7 +1801,7 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data) case SMP_COMPLT_EVT: if (btm_cb.api.p_le_callback) { /* the callback function implementation may change the IO capability... */ - BTM_TRACE_DEBUG ("btm_cb.api.p_le_callback=0x%x", btm_cb.api.p_le_callback ); + BTM_TRACE_DEBUG ("btm_cb.api.p_le_callback=%p", btm_cb.api.p_le_callback ); (*btm_cb.api.p_le_callback) (event, bd_addr, (tBTM_LE_EVT_DATA *)p_data); } @@ -1975,7 +1921,7 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len, btm_ble_increment_sign_ctr(bd_addr, TRUE); } - BTM_TRACE_DEBUG("%s p_mac = %d", __func__, p_mac); + BTM_TRACE_DEBUG("%s p_mac = %p", __func__, p_mac); BTM_TRACE_DEBUG("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x", *p_mac, *(p_mac + 1), *(p_mac + 2), *(p_mac + 3)); BTM_TRACE_DEBUG("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x", diff --git a/components/bt/bluedroid/stack/btm/btm_ble_adv_filter.c b/components/bt/bluedroid/stack/btm/btm_ble_adv_filter.c index 1190643f32..78b4a8ed2c 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_adv_filter.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_adv_filter.c @@ -118,7 +118,7 @@ void btm_ble_advfilt_enq_op_q(UINT8 action, UINT8 ocf, tBTM_BLE_FILT_CB_EVT cb_e btm_ble_adv_filt_cb.op_q.p_scan_cfg_cback[btm_ble_adv_filt_cb.op_q.next_idx] = p_cmpl_cback; btm_ble_adv_filt_cb.op_q.p_filt_param_cback[btm_ble_adv_filt_cb.op_q.next_idx] = p_filt_param_cback; - BTM_TRACE_DEBUG("btm_ble_advfilt_enq_op_q: act_ocf:%d, action:%d, ocf:%d,cb_evt;%d, cback:%x", + BTM_TRACE_DEBUG("btm_ble_advfilt_enq_op_q: act_ocf:%d, action:%d, ocf:%d,cb_evt;%d, cback:%p", btm_ble_adv_filt_cb.op_q.action_ocf[btm_ble_adv_filt_cb.op_q.next_idx], action, ocf, cb_evt, p_cmpl_cback); btm_ble_adv_filt_cb.op_q.next_idx = (btm_ble_adv_filt_cb.op_q.next_idx + 1) diff --git a/components/bt/bluedroid/stack/btm/btm_ble_cont_energy.c b/components/bt/bluedroid/stack/btm/btm_ble_cont_energy.c index 5a9629d875..7125100749 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_cont_energy.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_cont_energy.c @@ -59,7 +59,7 @@ void btm_ble_cont_energy_cmpl_cback (tBTM_VSC_CMPL *p_params) STREAM_TO_UINT32(total_idle_time, p); STREAM_TO_UINT32(total_energy_used, p); - BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%ld, rx_t=%ld, ener_used=%ld, idle_t=%ld", + BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%u, rx_t=%u, ener_used=%u, idle_t=%u", status, total_tx_time, total_rx_time, total_energy_used, total_idle_time); if (NULL != ble_energy_info_cb.p_ener_cback) diff --git a/components/bt/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/bluedroid/stack/btm/btm_ble_gap.c index b7311dfd63..98adbf8b5b 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_gap.c @@ -474,6 +474,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start) return status; } +#if BLE_VND_INCLUDED == TRUE /******************************************************************************* ** ** Function btm_vsc_brcm_features_complete @@ -485,7 +486,6 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start) *******************************************************************************/ static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_params) { -#if BLE_VND_INCLUDED == TRUE UINT8 status = 0xFF; UINT8 *p; @@ -549,8 +549,8 @@ static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_ if (p_ctrl_le_feature_rd_cmpl_cback != NULL) { p_ctrl_le_feature_rd_cmpl_cback(status); } -#endif } +#endif /******************************************************************************* ** @@ -1064,7 +1064,6 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max, { tBTM_LE_RANDOM_CB *p_addr_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb; tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var; - tBTM_STATUS status = BTM_SUCCESS; BTM_TRACE_EVENT ("BTM_BleSetAdvParamsStartAdv\n"); @@ -1103,7 +1102,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max, chnl_map, p_cb->afp); - btm_ble_start_adv(); + return btm_ble_start_adv(); } diff --git a/components/bt/bluedroid/stack/btm/btm_dev.c b/components/bt/bluedroid/stack/btm/btm_dev.c index 72a1739025..fc78e1e1bf 100644 --- a/components/bt/bluedroid/stack/btm/btm_dev.c +++ b/components/bt/bluedroid/stack/btm/btm_dev.c @@ -462,7 +462,6 @@ void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec) #if BLE_INCLUDED == TRUE tBTM_SEC_DEV_REC *p_dev_rec = &btm_cb.sec_dev_rec[0]; tBTM_SEC_DEV_REC temp_rec = *p_target_rec; - BD_ADDR dummy_bda = {0}; BTM_TRACE_DEBUG("%s\n", __func__); diff --git a/components/bt/bluedroid/stack/btm/btm_devctl.c b/components/bt/bluedroid/stack/btm/btm_devctl.c index 91851decc2..fe5fca55cc 100644 --- a/components/bt/bluedroid/stack/btm/btm_devctl.c +++ b/components/bt/bluedroid/stack/btm/btm_devctl.c @@ -261,9 +261,6 @@ void btm_dev_timeout (TIMER_LIST_ENT *p_tle) *******************************************************************************/ static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_features) { - UINT8 last; - UINT8 first; - BTM_TRACE_DEBUG ("btm_decode_ext_features_page page: %d", page_number); switch (page_number) { /* Extended (Legacy) Page 0 */ diff --git a/components/bt/bluedroid/stack/btm/btm_sec.c b/components/bt/bluedroid/stack/btm/btm_sec.c index c0eee569d6..364c03f624 100644 --- a/components/bt/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/bluedroid/stack/btm/btm_sec.c @@ -103,10 +103,8 @@ static UINT16 btm_sec_set_serv_level4_flags (UINT16 cur_security, BOOLEAN is_or static BOOLEAN btm_sec_queue_encrypt_request (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SEC_CALLBACK *p_callback, void *p_ref_data); -static void btm_sec_clean_pending_req_queue (BD_ADDR remote_bda, tBT_TRANSPORT transport) ; static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport, UINT8 encr_enable); -static BOOLEAN btm_sec_acceptor_rejects_bonding (tBTM_SEC_DEV_REC *p_dev_rec); static BOOLEAN btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec); static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec); @@ -2050,11 +2048,11 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle is_originator = FALSE; } - BTM_TRACE_DEBUG ("%s() conn_type: 0x%x, 0x%x\n", __func__, conn_type, p_ref_data); + BTM_TRACE_DEBUG ("%s() conn_type: 0x%x, %p\n", __func__, conn_type, p_ref_data); #else is_originator = conn_type; - BTM_TRACE_DEBUG ("%s() is_originator:%d, 0x%x\n", __func__, is_originator, p_ref_data); + BTM_TRACE_DEBUG ("%s() is_originator:%d, %p\n", __func__, is_originator, p_ref_data); #endif /* Find or get oldest record */ @@ -2932,7 +2930,7 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT } if (p_dev_rec) { - BTM_TRACE_EVENT ("Security Manager: rmt_name_complete PairState: %s RemName: %s status: %d State:%d p_dev_rec: 0x%08x \n", + BTM_TRACE_EVENT ("Security Manager: rmt_name_complete PairState: %s RemName: %s status: %d State:%d p_dev_rec: %p \n", btm_pair_state_descr (btm_cb.pairing_state), p_bd_name, status, p_dev_rec->sec_state, p_dev_rec); } else { @@ -2981,7 +2979,7 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT /* If we were delaying asking UI for a PIN because name was not resolved, ask now */ if ( (btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_LOCAL_PIN) && p_bd_addr && (memcmp (btm_cb.pairing_bda, p_bd_addr, BD_ADDR_LEN) == 0) ) { - BTM_TRACE_EVENT ("btm_sec_rmt_name_request_complete() delayed pin now being requested flags:0x%x, (p_pin_callback=0x%p)\n", btm_cb.pairing_flags, btm_cb.api.p_pin_callback); + BTM_TRACE_EVENT ("btm_sec_rmt_name_request_complete() delayed pin now being requested flags:0x%x, (p_pin_callback=%p)\n", btm_cb.pairing_flags, btm_cb.api.p_pin_callback); if (((btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD) == 0) && ((btm_cb.pairing_flags & BTM_PAIR_FLAGS_PIN_REQD) == 0) && @@ -3194,7 +3192,7 @@ void btm_io_capabilities_req (UINT8 *p) p_dev_rec->sm4 |= BTM_SM4_TRUE; - BTM_TRACE_EVENT("%s: State: %s Flags: 0x%04x p_cur_service: 0x%08x\n", + BTM_TRACE_EVENT("%s: State: %s Flags: 0x%04x p_cur_service: %p\n", __FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state), btm_cb.pairing_flags, p_dev_rec->p_cur_service); @@ -4939,7 +4937,7 @@ void btm_sec_pin_code_request (UINT8 *p_bda) || (!p_dev_rec->is_originator && ((p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK) == BTM_COD_MAJOR_PERIPHERAL) && (p_dev_rec->dev_class[2] & BTM_COD_MINOR_KEYBOARD)) ) { - BTM_TRACE_WARNING("btm_sec_pin_code_request(): Pairing disabled:%d; PIN callback:%x, Dev Rec:%x!\n", + BTM_TRACE_WARNING("btm_sec_pin_code_request(): Pairing disabled:%d; PIN callback:%p, Dev Rec:%p!\n", p_cb->pairing_disabled, p_cb->api.p_pin_callback, p_dev_rec); btsnd_hcic_pin_code_neg_reply (p_bda); @@ -5821,36 +5819,6 @@ void btm_sec_set_peer_sec_caps(tACL_CONN *p_acl_cb, tBTM_SEC_DEV_REC *p_dev_rec) } } -/******************************************************************************* -** -** Function btm_sec_clean_pending_req_queue -** -** Description This function cleans up the pending security request when the -** link to the target device dropped. -** -** Returns void -** -*******************************************************************************/ -static void btm_sec_clean_pending_req_queue (BD_ADDR remote_bda, tBT_TRANSPORT transport) -{ - tBTM_SEC_QUEUE_ENTRY *p_e; - BUFFER_Q *bq = &btm_cb.sec_pending_q; - - p_e = (tBTM_SEC_QUEUE_ENTRY *)GKI_getfirst(bq); - - if (p_e != NULL) { - if (memcmp(p_e->bd_addr, remote_bda, BD_ADDR_LEN) == 0 -#if BLE_INCLUDED == TRUE - && p_e->transport == transport -#endif - ) { - (*p_e->p_callback) (remote_bda, transport, p_e->p_ref_data, BTM_ERR_PROCESSING); - GKI_remove_from_queue(bq, (void *)p_e); - } - p_e = (tBTM_SEC_QUEUE_ENTRY *) GKI_getnext ((void *)p_e); - } -} - /******************************************************************************* ** ** Function btm_sec_is_serv_level0 diff --git a/components/bt/bluedroid/stack/gap/gap_conn.c b/components/bt/bluedroid/stack/gap/gap_conn.c index 5ae8a81dc9..7f5e0be39f 100644 --- a/components/bt/bluedroid/stack/gap/gap_conn.c +++ b/components/bt/bluedroid/stack/gap/gap_conn.c @@ -127,7 +127,7 @@ UINT16 GAP_ConnOpen (char *p_serv_name, UINT8 service_id, BOOLEAN is_server, { tGAP_CCB *p_ccb; UINT16 cid; - tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}}; + //tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}}; GAP_TRACE_EVENT ("GAP_CONN - Open Request"); @@ -718,7 +718,7 @@ static void gap_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 psm, UIN { UINT16 xx; tGAP_CCB *p_ccb; - tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}}; + //tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}}; /* See if we have a CCB listening for the connection */ for (xx = 0, p_ccb = gap_cb.conn.ccb_pool; xx < GAP_MAX_CONNECTIONS; xx++, p_ccb++) { diff --git a/components/bt/bluedroid/stack/gatt/gatt_attr.c b/components/bt/bluedroid/stack/gatt/gatt_attr.c index b0aa3f71d1..4968828394 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_attr.c +++ b/components/bt/bluedroid/stack/gatt/gatt_attr.c @@ -477,7 +477,6 @@ static void gatt_cl_start_config_ccc(tGATT_PROFILE_CLCB *p_clcb) *******************************************************************************/ void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSPORT transport) { - UINT16 conn_id = GATT_INVALID_CONN_ID; tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_bd_addr (remote_bda, transport); if (p_clcb == NULL) { diff --git a/components/bt/bluedroid/stack/gatt/gatt_cl.c b/components/bt/bluedroid/stack/gatt/gatt_cl.c index 095b87deee..fab35d5f03 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_cl.c +++ b/components/bt/bluedroid/stack/gatt/gatt_cl.c @@ -920,7 +920,7 @@ void gatt_process_read_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 op_code, gatt_end_operation(p_clcb, GATT_SUCCESS, (void *)p_clcb->p_attr_buf); } } else { /* exception, should not happen */ - GATT_TRACE_ERROR("attr offset = %d p_attr_buf = %d ", offset, p_clcb->p_attr_buf); + GATT_TRACE_ERROR("attr offset = %d p_attr_buf = %p ", offset, p_clcb->p_attr_buf); gatt_end_operation(p_clcb, GATT_NO_RESOURCES, (void *)p_clcb->p_attr_buf); } } diff --git a/components/bt/bluedroid/stack/gatt/gatt_sr.c b/components/bt/bluedroid/stack/gatt/gatt_sr.c index 49ad3a2305..4846d4ad3e 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_sr.c +++ b/components/bt/bluedroid/stack/gatt/gatt_sr.c @@ -96,7 +96,7 @@ void gatt_dequeue_sr_cmd (tGATT_TCB *p_tcb) /* Double check in case any buffers are queued */ GATT_TRACE_DEBUG("gatt_dequeue_sr_cmd" ); if (p_tcb->sr_cmd.p_rsp_msg) { - GATT_TRACE_ERROR("free p_tcb->sr_cmd.p_rsp_msg = %d", p_tcb->sr_cmd.p_rsp_msg); + GATT_TRACE_ERROR("%s free msg %p", __func__, p_tcb->sr_cmd.p_rsp_msg); GKI_freebuf (p_tcb->sr_cmd.p_rsp_msg); } diff --git a/components/bt/bluedroid/stack/l2cap/l2c_api.c b/components/bt/bluedroid/stack/l2cap/l2c_api.c index 6aef4afc08..156757d01d 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_api.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_api.c @@ -228,7 +228,7 @@ UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_ERTM_INFO *p_e tL2C_RCB *p_rcb; //counter_add("l2cap.conn.req", 1); - L2CAP_TRACE_API ("L2CA_ErtmConnectReq() PSM: 0x%04x BDA: %08x%04x p_ertm_info: 0x%08x allowed:0x%x preferred:%d", psm, + L2CAP_TRACE_API ("L2CA_ErtmConnectReq() PSM: 0x%04x BDA: %08x%04x p_ertm_info: %p allowed:0x%x preferred:%d", psm, (p_bd_addr[0] << 24) + (p_bd_addr[1] << 16) + (p_bd_addr[2] << 8) + p_bd_addr[3], (p_bd_addr[4] << 8) + p_bd_addr[5], p_ertm_info, (p_ertm_info) ? p_ertm_info->allowed_modes : 0, @@ -252,7 +252,7 @@ UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_ERTM_INFO *p_e if ( ((p_lcb = l2cu_allocate_lcb (p_bd_addr, FALSE, BT_TRANSPORT_BR_EDR)) == NULL) /* currently use BR/EDR for ERTM mode l2cap connection */ || (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE) ) { - L2CAP_TRACE_WARNING ("L2CAP - conn not started for PSM: 0x%04x p_lcb: 0x%08x", psm, p_lcb); + L2CAP_TRACE_WARNING ("L2CAP - conn not started for PSM: 0x%04x p_lcb: %p", psm, p_lcb); return (0); } } @@ -390,7 +390,7 @@ BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 re tL2C_CCB *p_ccb; //counter_add("l2cap.conn.rsp", 1); - L2CAP_TRACE_API ("L2CA_ErtmConnectRsp() CID: 0x%04x Result: %d Status: %d BDA: %08x%04x p_ertm_info:0x%08x", + L2CAP_TRACE_API ("L2CA_ErtmConnectRsp() CID: 0x%04x Result: %d Status: %d BDA: %08x%04x p_ertm_info:%p", lcid, result, status, (p_bd_addr[0] << 24) + (p_bd_addr[1] << 16) + (p_bd_addr[2] << 8) + p_bd_addr[3], (p_bd_addr[4] << 8) + p_bd_addr[5], p_ertm_info); @@ -1824,7 +1824,7 @@ UINT16 L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush) } if (num_to_flush != L2CAP_FLUSH_CHANS_GET) { - L2CAP_TRACE_API ("L2CA_FlushChannel (FLUSH) CID: 0x%04x NumToFlush: %d QC: %u pFirst: 0x%08x", + L2CAP_TRACE_API ("L2CA_FlushChannel (FLUSH) CID: 0x%04x NumToFlush: %d QC: %u pFirst: %p", lcid, num_to_flush, GKI_queue_length(&p_ccb->xmit_hold_q), GKI_getfirst(&p_ccb->xmit_hold_q)); } else { L2CAP_TRACE_API ("L2CA_FlushChannel (QUERY) CID: 0x%04x", lcid); diff --git a/components/bt/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/bluedroid/stack/l2cap/l2c_ble.c index 3888feb47e..70d2ba75a8 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_ble.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_ble.c @@ -257,7 +257,6 @@ void l2cble_notify_le_connection (BD_ADDR bda) void l2cble_scanner_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type, UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout) { - int i; tL2C_LCB *p_lcb; tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (bda); @@ -358,7 +357,6 @@ void l2cble_scanner_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type, void l2cble_advertiser_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type, UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout) { - int i; tL2C_LCB *p_lcb; tBTM_SEC_DEV_REC *p_dev_rec; UNUSED(type); @@ -456,7 +454,6 @@ void l2cble_conn_comp(UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE typ static void l2cble_start_conn_update (tL2C_LCB *p_lcb) { UINT16 min_conn_int, max_conn_int, slave_latency, supervision_tout; - tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev(p_lcb->remote_bd_addr); tACL_CONN *p_acl_cb = btm_bda_to_acl(p_lcb->remote_bd_addr, BT_TRANSPORT_LE); if (p_lcb->conn_update_mask & L2C_BLE_UPDATE_PENDING) { diff --git a/components/bt/bluedroid/stack/l2cap/l2c_fcr.c b/components/bt/bluedroid/stack/l2cap/l2c_fcr.c index 4ce718f3b0..788d841e15 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_fcr.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_fcr.c @@ -1255,7 +1255,7 @@ static void process_stream_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf) /* Check if tx-sequence is the expected one */ if (tx_seq != p_ccb->fcrb.next_seq_expected) { - L2CAP_TRACE_WARNING ("Rx L2CAP PDU: CID: 0x%04x Lost frames Exp: %u Got: %u p_rx_sdu: 0x%08x", + L2CAP_TRACE_WARNING ("Rx L2CAP PDU: CID: 0x%04x Lost frames Exp: %u Got: %u p_rx_sdu: %p", p_ccb->local_cid, p_ccb->fcrb.next_seq_expected, tx_seq, p_ccb->fcrb.p_rx_sdu); /* Lost one or more packets, so flush the SAR queue */ diff --git a/components/bt/bluedroid/stack/l2cap/l2c_link.c b/components/bt/bluedroid/stack/l2cap/l2c_link.c index e97b13ec8c..ed1787c426 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_link.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_link.c @@ -280,7 +280,7 @@ void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data UNUSED(transport); - L2CAP_TRACE_DEBUG ("l2c_link_sec_comp: %d, 0x%x", status, p_ref_data); + L2CAP_TRACE_DEBUG ("l2c_link_sec_comp: %d, %p", status, p_ref_data); if (status == BTM_SUCCESS_NO_SECURITY) { status = BTM_SUCCESS; diff --git a/components/bt/bluedroid/stack/l2cap/l2c_utils.c b/components/bt/bluedroid/stack/l2cap/l2c_utils.c index 7c5bd8d206..e910d3cfb7 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_utils.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_utils.c @@ -1192,7 +1192,7 @@ void l2cu_enqueue_ccb (tL2C_CCB *p_ccb) } if ( (!p_ccb->in_use) || (p_q == NULL) ) { - L2CAP_TRACE_ERROR ("l2cu_enqueue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: 0x%08x", + L2CAP_TRACE_ERROR ("l2cu_enqueue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: %p", p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb); return; } @@ -1278,7 +1278,7 @@ void l2cu_dequeue_ccb (tL2C_CCB *p_ccb) } if ( (!p_ccb->in_use) || (p_q == NULL) || (p_q->p_first_ccb == NULL) ) { - L2CAP_TRACE_ERROR ("l2cu_dequeue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: 0x%08x p_q: 0x%08x p_q->p_first_ccb: 0x%08x", + L2CAP_TRACE_ERROR ("l2cu_dequeue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: %p p_q: %p p_q->p_first_ccb: %p", p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb, p_q, p_q ? p_q->p_first_ccb : 0); return; } @@ -2423,7 +2423,7 @@ void l2cu_resubmit_pending_sec_req (BD_ADDR p_bda) tL2C_CCB *p_next_ccb; int xx; - L2CAP_TRACE_DEBUG ("l2cu_resubmit_pending_sec_req p_bda: 0x%08x", p_bda); + L2CAP_TRACE_DEBUG ("l2cu_resubmit_pending_sec_req p_bda: %p", p_bda); /* If we are called with a BDA, only resubmit for that BDA */ if (p_bda) { diff --git a/components/bt/bluedroid/stack/sdp/sdp_api.c b/components/bt/bluedroid/stack/sdp/sdp_api.c index 241fb9598c..1f5715913d 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_api.c +++ b/components/bt/bluedroid/stack/sdp/sdp_api.c @@ -398,6 +398,8 @@ BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid) p_attr = p_attr->p_next_attr; } return FALSE; +#else + return FALSE; #endif } @@ -451,6 +453,8 @@ BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid) p_attr = p_attr->p_next_attr; } return FALSE; +#else + return FALSE; #endif } @@ -935,6 +939,7 @@ UINT8 SDP_GetNumDiRecords( tSDP_DISCOVERY_DB *p_db ) #endif } +#if SDP_CLIENT_ENABLED == TRUE /******************************************************************************* ** ** Function SDP_AttrStringCopy @@ -960,6 +965,7 @@ static void SDP_AttrStringCopy(char *dst, tSDP_DISC_ATTR *p_attr, UINT16 dst_siz dst[0] = '\0'; } } +#endif /******************************************************************************* ** diff --git a/components/bt/bluedroid/stack/sdp/sdp_db.c b/components/bt/bluedroid/stack/sdp/sdp_db.c index 264a0d25cf..2d3308ebfe 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_db.c +++ b/components/bt/bluedroid/stack/sdp/sdp_db.c @@ -914,9 +914,9 @@ BOOLEAN SDP_DeleteAttribute (UINT32 handle, UINT16 attr_id) #if (SDP_RAW_DATA_INCLUDED == TRUE) INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len) { - INT32 len = 0; /* Number of bytes in the entry */ INT32 offset = -1; /* default to not found */ #if SDP_SERVER_ENABLED == TRUE + INT32 len = 0; /* Number of bytes in the entry */ tSDP_RECORD *p_rec; UINT16 start = 0; UINT16 end = 0xffff; diff --git a/components/bt/bluedroid/stack/smp/smp_cmac.c b/components/bt/bluedroid/stack/smp/smp_cmac.c index 21939435dd..46f6ab73ea 100644 --- a/components/bt/bluedroid/stack/smp/smp_cmac.c +++ b/components/bt/bluedroid/stack/smp/smp_cmac.c @@ -154,7 +154,7 @@ static BOOLEAN cmac_aes_k_calculate(BT_OCTET16 key, UINT8 *p_signature, UINT16 t p_mac = output.param_buf + (BT_OCTET16_LEN - tlen); memcpy(p_signature, p_mac, tlen); - SMP_TRACE_DEBUG("tlen = %d p_mac = %d", tlen, p_mac); + SMP_TRACE_DEBUG("tlen = %d p_mac = %p", tlen, p_mac); SMP_TRACE_DEBUG("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x", *p_mac, *(p_mac + 1), *(p_mac + 2), *(p_mac + 3)); SMP_TRACE_DEBUG("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x", diff --git a/components/bt/component.mk b/components/bt/component.mk index 0d4f7b280d..8fb7abe29a 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -30,7 +30,7 @@ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \ bluedroid/include \ include -CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -Wno-error=format +CFLAGS += LIBS := btdm_app @@ -70,7 +70,7 @@ COMPONENT_SRCDIRS := bluedroid/bta/dm \ bluedroid \ . -include $(IDF_PATH)/make/component_common.mk +#include $(IDF_PATH)/make/component_common.mk ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) diff --git a/examples/12_blufi/components/blufi/blufi.c b/examples/12_blufi/components/blufi/blufi.c index 34d3857f15..5a1c543b50 100644 --- a/examples/12_blufi/components/blufi/blufi.c +++ b/examples/12_blufi/components/blufi/blufi.c @@ -51,17 +51,17 @@ static void blufi_data_recv(uint8_t *data, int len) char *p = NULL; LOG_DEBUG("the data is:%s\n", data); - p = strstr(data, HEADER_SSID); + p = strstr((char *)data, HEADER_SSID); if (p) { LOG_ERROR("SSID: %s\n", p + strlen(HEADER_SSID) + 1); strcpy(tmp_ssid, p + strlen(HEADER_SSID) + 1); } - p = strstr(data, HEADER_PASSWD); + p = strstr((char *)data, HEADER_PASSWD); if (p) { LOG_ERROR("PASSWORD: %s\n", p + strlen(HEADER_PASSWD) + 1); strcpy(tmp_passwd, p + strlen(HEADER_PASSWD) + 1); } - p = strstr(data, HEADER_CONFIRM); + p = strstr((char *)data, HEADER_CONFIRM); if (p) { LOG_ERROR("CONFIRM\n"); wifi_set_blue_config(tmp_ssid, tmp_passwd); -- 2.40.0