From cc8ef3660a3c59f347421926eaea6c9e1b593e04 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Wed, 17 Mar 2021 14:51:03 +0800 Subject: [PATCH] components/bt: shorten some log messages for bluedroid --- .../host/bluedroid/bta/gatt/bta_gattc_act.c | 5 +- .../host/bluedroid/stack/btm/btm_ble_5_gap.c | 59 +++++++------------ .../bt/host/bluedroid/stack/btu/btu_hcif.c | 10 +++- .../bt/host/bluedroid/stack/l2cap/l2c_ble.c | 6 +- 4 files changed, 33 insertions(+), 47 deletions(-) diff --git a/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c b/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c index 85e9d4b549..87c1a9a0bd 100644 --- a/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c +++ b/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c @@ -1683,8 +1683,7 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id, tBTA_GATTC_DATA *p_buf; if (reason != 0) { - APPL_TRACE_WARNING("%s() - cif=%d connected=%d conn_id=%d reason=0x%04x", - __FUNCTION__, gattc_if, connected, conn_id, reason); + APPL_TRACE_WARNING("gattc_conn_cb: if=%d st=%d id=%d rsn=0x%x", gattc_if, connected, conn_id, reason); } bt_bdaddr_t bdaddr; @@ -1702,7 +1701,7 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id, p_buf->int_conn.conn_params.latency = p_lcb->current_used_conn_latency; p_buf->int_conn.conn_params.timeout = p_lcb->current_used_conn_timeout; } else { - APPL_TRACE_WARNING("%s not found connection parameters of the device ", __func__); + APPL_TRACE_WARNING("gattc_conn_cb: conn params not found"); } } p_buf->int_conn.hdr.layer_specific = conn_id; diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c index de83aa18bf..dd66fc74fd 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c @@ -341,8 +341,7 @@ tBTM_STATUS BTM_BleSetExtendedAdvParams(UINT8 instance, tBTM_BLE_GAP_EXT_ADV_PAR params->peer_addr, params->filter_policy, params->tx_power, params->primary_phy, params->max_skip, params->secondary_phy, params->sid, params->scan_req_notif)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE EA SetParams: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; goto end; } @@ -390,14 +389,12 @@ tBTM_STATUS BTM_BleConfigExtendedAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance, } if (!is_scan_rsp) { if ((err = btsnd_hcic_ble_set_ext_adv_data(instance, operation, 0, send_data_len, &data[data_offset])) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, line %d, fail to send the hci command, the error code = %s", - __func__, __LINE__, btm_ble_hci_status_to_str(err)); + BTM_TRACE_ERROR("LE EA SetAdvData: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } } else { if ((err = btsnd_hcic_ble_set_ext_adv_scan_rsp_data(instance, operation, 0, send_data_len, &data[data_offset])) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, line %d, fail to send the hci command, the error code = %s(0x%x)", - __func__, __LINE__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE EA SetScanRspData: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } } @@ -452,8 +449,7 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_ if ((err = btsnd_hcic_ble_ext_adv_enable(enable, num, instance, duration, max_events)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE EA En=%d: cmd err=0x%x", enable, err); status = BTM_ILLEGAL_VALUE; } @@ -464,9 +460,8 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_ // enable = false, num == 0 or ext_adv = NULL if ((err = btsnd_hcic_ble_ext_adv_enable(enable, num, NULL, NULL, NULL)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); - status = BTM_ILLEGAL_VALUE; + BTM_TRACE_ERROR("LE EA En=%d: cmd err=0x%x", enable, err); + status = BTM_ILLEGAL_VALUE; } goto end; } @@ -504,8 +499,7 @@ tBTM_STATUS BTM_BleExtAdvSetRemove(UINT8 instance) } if ((err = btsnd_hcic_ble_remove_adv_set(instance)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE EAS Rm: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -527,8 +521,7 @@ tBTM_STATUS BTM_BleExtAdvSetClear(void) tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; if ((err = btsnd_hcic_ble_clear_adv_set()) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE EAS Clr: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -559,15 +552,14 @@ tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Pa extend_adv_cb.inst[instance].connetable || extend_adv_cb.inst[instance].legacy_pdu) { BTM_TRACE_ERROR("%s, instance = %d, Before set the periodic adv parameters, please configure the the \ - extend adv to nonscannable and nonconnectable fisrt, and it shouldn't include the legacy bit.", __func__, instance); + extend adv to nonscannable and nonconnectable first, and it shouldn't include the legacy bit.", __func__, instance); status = BTM_ILLEGAL_VALUE; goto end; } if ((err= btsnd_hcic_ble_set_periodic_adv_params(instance, params->interval_min, params->interval_max, params->properties)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA SetParams: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -619,8 +611,7 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data } if ((err = btsnd_hcic_ble_set_periodic_adv_data(instance, operation, send_data_len, &data[data_offset])) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA SetData: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } rem_len -= send_data_len; @@ -643,14 +634,13 @@ tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, BOOLEAN enable) tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; if (instance >= MAX_BLE_ADV_INSTANCE) { - BTM_TRACE_ERROR("%s, invalid insatnce %d", __func__, instance); + BTM_TRACE_ERROR("%s, invalid instance %d", __func__, instance); status = BTM_ILLEGAL_VALUE; goto end; } if ((err = btsnd_hcic_ble_periodic_adv_enable(enable, instance)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA En=%d: cmd err=0x%x", enable, err); status = BTM_ILLEGAL_VALUE; } @@ -688,7 +678,7 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params) if (!btsnd_hcic_ble_periodic_adv_create_sync(params->filter_policy, params->sid, params->addr_type, params->addr, params->sync_timeout, 0)) { - BTM_TRACE_ERROR("%s, send cmd failed", __func__); + BTM_TRACE_ERROR("LE PA CreateSync cmd failed"); status = BTM_ILLEGAL_VALUE; } @@ -749,8 +739,7 @@ tBTM_STATUS BTM_BlePeriodicAdvSyncCancel(void) tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; if ((err = btsnd_hcic_ble_periodic_adv_create_sync_cancel()) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA SyncCancel, cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -770,8 +759,7 @@ tBTM_STATUS BTM_BlePeriodicAdvSyncTerm(UINT16 sync_handle) tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; if (( err = btsnd_hcic_ble_periodic_adv_term_sync(sync_handle)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA SyncTerm: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -797,8 +785,7 @@ tBTM_STATUS BTM_BlePeriodicAdvAddDevToList(tBLE_ADDR_TYPE addr_type, BD_ADDR add } if ((err = btsnd_hcic_ble_add_dev_to_periodic_adv_list(addr_type, addr, sid)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA AddDevToList: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -824,8 +811,7 @@ tBTM_STATUS BTM_BlePeriodicAdvRemoveDevFromList(tBLE_ADDR_TYPE addr_type, BD_ADD } if ((err = btsnd_hcic_ble_rm_dev_from_periodic_adv_list(addr_type, addr, sid)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA RmDevFromList: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -845,8 +831,7 @@ tBTM_STATUS BTM_BlePeriodicAdvClearDev(void) tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; if ((err = btsnd_hcic_ble_clear_periodic_adv_list()) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE PA ClrDev: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -894,8 +879,7 @@ tBTM_STATUS BTM_BleSetExtendedScanParams(tBTM_BLE_EXT_SCAN_PARAMS *params) if ((err = btsnd_hcic_ble_set_ext_scan_params(params->own_addr_type, params->filter_policy, phy_mask, phy_count, hci_params)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE ES SetParams: cmd err=0x%x", err); status = BTM_ILLEGAL_VALUE; } @@ -923,8 +907,7 @@ tBTM_STATUS BTM_BleExtendedScan(BOOLEAN enable, UINT16 duration, UINT16 period) } if ((err = btsnd_hcic_ble_ext_scan_enable(enable, extend_adv_cb.scan_duplicate, duration, period)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)", - __func__, btm_ble_hci_status_to_str(err), err); + BTM_TRACE_ERROR("LE ES En=%d: cmd err=0x%x", enable, err); status = BTM_ILLEGAL_VALUE; } diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index f30e5aa744..4212ba6cc9 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -707,6 +707,10 @@ static void btu_hcif_disconnection_comp_evt (UINT8 *p) handle = HCID_GET_HANDLE (handle); + if (reason != HCI_ERR_PEER_USER && reason != HCI_ERR_CONN_CAUSE_LOCAL_HOST) { + HCI_TRACE_WARNING("DiscCmpl evt: hdl=%d, rsn=0x%x", handle, reason); + } + #if BTM_SCO_INCLUDED == TRUE /* If L2CAP doesn't know about it, send it to SCO */ if (!l2c_link_hci_disc_comp (handle, reason)) { @@ -1126,7 +1130,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l uint8_t status; STREAM_TO_UINT8 (status, p); if(status != HCI_SUCCESS) { - HCI_TRACE_ERROR("%s opcode 0x%x status 0x%x", __func__, opcode, status); + HCI_TRACE_ERROR("CC evt: op=0x%x, status=0x%x", opcode, status); } break; } @@ -1259,7 +1263,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c { uint8_t btm_status = BTM_SUCCESS; if(status != HCI_SUCCESS) { - HCI_TRACE_ERROR("%s, Create sync error, the error code = 0x%x", __func__, status); + HCI_TRACE_ERROR("CS evt: LE PA CreateSync status=0x%x", status); btm_status = BTM_ILLEGAL_VALUE; } btm_create_sync_callback(btm_status); @@ -1269,7 +1273,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c { uint8_t btm_status = BTM_SUCCESS; if(status != HCI_SUCCESS) { - HCI_TRACE_ERROR("%s, Set phy error, the error code = 0x%x", __func__, status); + HCI_TRACE_ERROR("CS evt: LE SetPhy status=0x%x", status); btm_status = BTM_ILLEGAL_VALUE; } btm_set_phy_callback(btm_status); diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c index 4aec7b67da..2507d6a275 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c @@ -591,7 +591,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in /* See if we have a link control block for the remote device */ p_lcb = l2cu_find_lcb_by_handle(handle); if (!p_lcb) { - L2CAP_TRACE_WARNING("l2cble_process_conn_update_evt: Invalid handle: %d", handle); + L2CAP_TRACE_WARNING("le con upd: inv hdl=%d", handle); return; } if (status == HCI_SUCCESS){ @@ -599,7 +599,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in p_lcb->current_used_conn_latency = conn_latency; p_lcb->current_used_conn_timeout = conn_timeout; }else{ - L2CAP_TRACE_WARNING("l2cble_process_conn_update_evt: Error status: %d", status); + L2CAP_TRACE_WARNING("le con upd: err_stat=0x%x", status); } p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PENDING; @@ -617,7 +617,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in btu_stop_timer (&p_lcb->timer_entry); - L2CAP_TRACE_DEBUG("l2cble_process_conn_update_evt: conn_update_mask=%d", p_lcb->conn_update_mask); + L2CAP_TRACE_DEBUG("le con upd: conn_update_mask=%d", p_lcb->conn_update_mask); } /*******************************************************************************