diff options
author | 2025-01-23 09:45:04 -0800 | |
---|---|---|
committer | 2025-01-23 09:45:04 -0800 | |
commit | 5c0f57afd1090339f22197c218b5dba69041446c (patch) | |
tree | 5a693cd606b8f0396dc32075dd2d9ce4ad6bf5b9 | |
parent | cc60e27e7b5476c6af6766385789052ee4942412 (diff) | |
parent | 2bcb71b9354a33e7d085e2d7f3c39d0d2e4e9860 (diff) |
Merge "RFCOMM Logs: slot_id and port_handle" into main
-rw-r--r-- | system/bta/jv/bta_jv_act.cc | 95 | ||||
-rw-r--r-- | system/btif/src/btif_sock_rfc.cc | 85 | ||||
-rw-r--r-- | system/stack/rfcomm/port_rfc.cc | 2 | ||||
-rw-r--r-- | system/stack/rfcomm/rfc_port_fsm.cc | 30 |
4 files changed, 106 insertions, 106 deletions
diff --git a/system/bta/jv/bta_jv_act.cc b/system/bta/jv/bta_jv_act.cc index 7c3cb13d47..ffe1756943 100644 --- a/system/bta/jv/bta_jv_act.cc +++ b/system/bta/jv/bta_jv_act.cc @@ -233,7 +233,7 @@ tBTA_JV_RFC_CB* bta_jv_alloc_rfc_cb(uint16_t port_handle, tBTA_JV_PCB** pp_pcb) p_cb->rfc_hdl[j] = 0; } p_cb->rfc_hdl[0] = port_handle; - log::verbose("port_handle={}, handle=0x{:x}", port_handle, p_cb->handle); + log::verbose("port_handle={}, jv_handle=0x{:x}", port_handle, p_cb->handle); p_pcb = &bta_jv_cb.port_cb[port_handle - 1]; p_pcb->handle = p_cb->handle; @@ -307,7 +307,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pc log::error("p_cb or p_pcb cannot be null"); return tBTA_JV_STATUS::FAILURE; } - log::verbose("max_sess={}, curr_sess={}, p_pcb={}, user={}, state={}, jv handle=0x{:x}", + log::verbose("max_sess={}, curr_sess={}, p_pcb={}, user={}, state={}, jv_handle=0x{:x}", p_cb->max_sess, p_cb->curr_sess, std::format_ptr(p_pcb), p_pcb->rfcomm_slot_id, p_pcb->state, p_pcb->handle); @@ -341,7 +341,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pc break; default: log::warn( - "failed, ignore port state= {}, scn={}, p_pcb= {}, jv handle=0x{:x}, " + "failed, ignore port state= {}, scn={}, p_pcb= {}, jv_handle=0x{:x}, " "port_handle={}, user_data={}", p_pcb->state, p_cb->scn, std::format_ptr(p_pcb), p_pcb->handle, p_pcb->port_handle, p_pcb->rfcomm_slot_id); @@ -359,7 +359,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pc if (port_status != PORT_SUCCESS) { status = tBTA_JV_STATUS::FAILURE; log::warn( - "Remove jv handle=0x{:x}, state={}, port_status={}, port_handle={}, close_pending={}", + "Remove jv_handle=0x{:x}, state={}, port_status={}, port_handle={}, close_pending={}", p_pcb->handle, p_pcb->state, port_status, p_pcb->port_handle, close_pending); } } @@ -470,8 +470,8 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(uint32_t jv_handle) { } } - log::verbose("jv_handle=0x{:x}, idx={}app_id={}, bd_counter={}, appid_counter={}", jv_handle, - i, bta_jv_cb.pm_cb[i].app_id, bd_counter, appid_counter); + log::verbose("jv_handle=0x{:x}, idx={}, app_id={}, bd_counter={}, appid_counter={}", + jv_handle, i, bta_jv_cb.pm_cb[i].app_id, bd_counter, appid_counter); if (bd_counter > 1) { bta_jv_pm_conn_idle(&bta_jv_cb.pm_cb[i]); } @@ -559,7 +559,7 @@ static tBTA_JV_PM_CB* bta_jv_alloc_set_pm_profile_cb(uint32_t jv_handle, tBTA_JV } } } - log::verbose("handle=0x{:x}, app_id={}, idx={}, BTA_JV_PM_MAX_NUM={}, pp_cb={}", jv_handle, + log::verbose("jv_handle=0x{:x}, app_id={}, idx={}, BTA_JV_PM_MAX_NUM={}, pp_cb={}", jv_handle, app_id, i, BTA_JV_PM_MAX_NUM, std::format_ptr(pp_cb)); break; } @@ -573,7 +573,7 @@ static tBTA_JV_PM_CB* bta_jv_alloc_set_pm_profile_cb(uint32_t jv_handle, tBTA_JV bta_jv_cb.pm_cb[i].state = BTA_JV_PM_IDLE_ST; return &bta_jv_cb.pm_cb[i]; } - log::warn("handle=0x{:x}, app_id={}, return NULL", jv_handle, app_id); + log::warn("jv_handle=0x{:x}, app_id={}, return NULL", jv_handle, app_id); return NULL; } @@ -954,7 +954,7 @@ void bta_jv_delete_record(uint32_t handle) { if (handle) { /* this is a record created by btif layer*/ if (!get_legacy_stack_sdp_api()->handle.SDP_DeleteRecord(handle)) { - log::warn("Unable to delete SDP record handle:{}", handle); + log::warn("Unable to delete SDP record handle:{}", handle); } } } @@ -997,7 +997,7 @@ static void bta_jv_l2cap_client_cback(uint16_t gap_handle, uint16_t event, tGAP_ if (GAP_GetLeChannelInfo(gap_handle, &remote_mtu, &local_mps, &remote_mps, &local_credit, &remote_credit, &local_cid, &remote_cid, &acl_handle) != PORT_SUCCESS) { - log::warn("Unable to get GAP channel info handle:{}", gap_handle); + log::warn("Unable to get GAP channel info gap_handle:{}", gap_handle); } evt_data.l2c_open.tx_mtu = remote_mtu; evt_data.l2c_open.local_coc_mps = local_mps; @@ -1426,10 +1426,10 @@ static void bta_jv_port_mgmt_cl_cback(const tPORT_RESULT code, uint16_t port_han return; } - log::verbose("code={}, port_handle={}, handle={}", code, port_handle, p_cb->handle); + log::verbose("code={}, port_handle={}, rfc_handle={}", code, port_handle, p_cb->handle); if (PORT_CheckConnection(port_handle, &rem_bda, &lcid) != PORT_SUCCESS) { - log::warn("Unable to check RFCOMM connection peer:{} handle:{}", rem_bda, port_handle); + log::warn("Unable to check RFCOMM connection peer:{} port_handle:{}", rem_bda, port_handle); } if (code == PORT_SUCCESS) { @@ -1448,7 +1448,7 @@ static void bta_jv_port_mgmt_cl_cback(const tPORT_RESULT code, uint16_t port_han &evt_data.rfc_open.dlci, &evt_data.rfc_open.max_frame_size, &evt_data.rfc_open.acl_handle, &evt_data.rfc_open.mux_initiator) != PORT_SUCCESS) { - log::warn("Unable to get RFCOMM channel info peer:{} handle:{}", rem_bda, port_handle); + log::warn("Unable to get RFCOMM channel info peer:{} port_handle:{}", rem_bda, port_handle); } } p_pcb->state = BTA_JV_ST_CL_OPEN; @@ -1490,7 +1490,7 @@ static void bta_jv_port_event_cl_cback(uint32_t code, uint16_t port_handle) { return; } - log::verbose("code=0x{:x}, port_handle={}, handle={}", code, port_handle, p_cb->handle); + log::verbose("code=0x{:x}, port_handle={}, rfc_handle={}", code, port_handle, p_cb->handle); if (code & PORT_EV_RXCHAR) { evt_data.data_ind.handle = p_cb->handle; p_cb->p_cback(BTA_JV_RFCOMM_DATA_IND_EVT, &evt_data, p_pcb->rfcomm_slot_id); @@ -1550,23 +1550,23 @@ void bta_jv_rfcomm_connect(tBTA_SEC sec_mask, uint8_t remote_scn, const RawAddre bta_jv.rfc_cl_init.use_co = true; if (PORT_SetAppUid(handle, app_uid) != PORT_SUCCESS) { - log::warn("Unable to set app_uid for port handle:{}", handle); + log::warn("Unable to set app_uid for port_handle:{}", handle); } if (PORT_SetEventMaskAndCallback(handle, event_mask, bta_jv_port_event_cl_cback) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM client event mask and callback handle:{}", handle); + log::warn("Unable to set RFCOMM client event mask and callback port_handle:{}", handle); } if (PORT_SetDataCOCallback(handle, bta_jv_port_data_co_cback) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM client data callback handle:{}", handle); + log::warn("Unable to set RFCOMM client data callback port_handle:{}", handle); } if (PORT_GetSettings(handle, &port_settings) != PORT_SUCCESS) { - log::warn("Unable to get RFCOMM client state handle:{}", handle); + log::warn("Unable to get RFCOMM client state port_handle:{}", handle); } port_settings.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT); if (PORT_SetSettings(handle, &port_settings) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM client state handle:{}", handle); + log::warn("Unable to set RFCOMM client state port_handle:{}", handle); } bta_jv.rfc_cl_init.handle = p_cb->handle; @@ -1580,7 +1580,7 @@ void bta_jv_rfcomm_connect(tBTA_SEC sec_mask, uint8_t remote_scn, const RawAddre if (bta_jv.rfc_cl_init.status == tBTA_JV_STATUS::FAILURE) { if (handle) { if (RFCOMM_RemoveConnection(handle) != PORT_SUCCESS) { - log::warn("Unable to remove RFCOMM connection handle:{}", handle); + log::warn("Unable to remove RFCOMM connection port_handle:{}", handle); } } } @@ -1597,7 +1597,7 @@ static int find_rfc_pcb(uint32_t rfcomm_slot_id, tBTA_JV_RFC_CB** cb, tBTA_JV_PC *pcb = &bta_jv_cb.port_cb[i]; *cb = &bta_jv_cb.rfc_cb[rfc_handle - 1]; log::verbose( - "FOUND rfc_cb_handle=0x{:x}, port.jv_handle=0x{:x}, state={}, rfc_cb->handle=0x{:x}", + "FOUND rfc_handle=0x{:x}, port.jv_handle=0x{:x}, state={}, rfc_cb->handle=0x{:x}", rfc_handle, (*pcb)->handle, (*pcb)->state, (*cb)->handle); return 1; } @@ -1609,11 +1609,11 @@ static int find_rfc_pcb(uint32_t rfcomm_slot_id, tBTA_JV_RFC_CB** cb, tBTA_JV_PC /* Close an RFCOMM connection */ void bta_jv_rfcomm_close(uint32_t handle, uint32_t rfcomm_slot_id) { if (!handle) { - log::error("rfc handle is null"); + log::error("rfc_handle is null"); return; } - log::verbose("rfc handle={}", handle); + log::verbose("rfc_handle={}", handle); tBTA_JV_RFC_CB* p_cb = NULL; tBTA_JV_PCB* p_pcb = NULL; @@ -1647,7 +1647,7 @@ static void bta_jv_port_mgmt_sr_cback(const tPORT_RESULT code, uint16_t port_han return; } uint32_t rfcomm_slot_id = p_pcb->rfcomm_slot_id; - log::verbose("code={}, port_handle=0x{:x}, handle=0x{:x}, p_pcb{}, user={}", code, port_handle, + log::verbose("code={}, port_handle=0x{:x}, jv_handle=0x{:x}, p_pcb{}, user={}", code, port_handle, p_cb->handle, std::format_ptr(p_pcb), p_pcb->rfcomm_slot_id); int status = PORT_CheckConnection(port_handle, &rem_bda, &lcid); @@ -1668,7 +1668,7 @@ static void bta_jv_port_mgmt_sr_cback(const tPORT_RESULT code, uint16_t port_han &evt_data.rfc_srv_open.dlci, &evt_data.rfc_srv_open.max_frame_size, &evt_data.rfc_srv_open.acl_handle, &evt_data.rfc_srv_open.mux_initiator) != PORT_SUCCESS) { - log::warn("Unable to get RFCOMM channel info peer:{} handle:{}", rem_bda, port_handle); + log::warn("Unable to get RFCOMM channel info peer:{} port_handle:{}", rem_bda, port_handle); } } tBTA_JV_PCB* p_pcb_new_listen = bta_jv_add_rfc_port(p_cb, p_pcb); @@ -1729,7 +1729,7 @@ static void bta_jv_port_event_sr_cback(uint32_t code, uint16_t port_handle) { return; } - log::verbose("code=0x{:x}, port_handle={}, handle={}", code, port_handle, p_cb->handle); + log::verbose("code=0x{:x}, port_handle={}, rfc_handle={}", code, port_handle, p_cb->handle); uint32_t user_data = p_pcb->rfcomm_slot_id; if (code & PORT_EV_RXCHAR) { @@ -1779,7 +1779,8 @@ static tBTA_JV_PCB* bta_jv_add_rfc_port(tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pcb } else { log::error( - "open pcb not matching listen one, count={}, listen pcb handle={}, open pcb={}", + "open pcb not matching listen one, count={}, listen port_handle={}, open " + "pcb={}", listen, p_pcb->port_handle, p_pcb_open->handle); return NULL; } @@ -1809,24 +1810,25 @@ static tBTA_JV_PCB* bta_jv_add_rfc_port(tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pcb p_pcb->rfcomm_slot_id = p_pcb_open->rfcomm_slot_id; if (PORT_ClearKeepHandleFlag(p_pcb->port_handle) != PORT_SUCCESS) { - log::warn("Unable to clear RFCOMM server keep handle flag handle:{}", p_pcb->port_handle); + log::warn("Unable to clear RFCOMM server keep handle flag port_handle:{}", + p_pcb->port_handle); } if (PORT_SetEventMaskAndCallback(p_pcb->port_handle, event_mask, bta_jv_port_event_sr_cback) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM server event mask and callback handle:{}", + log::warn("Unable to set RFCOMM server event mask and callback port_handle:{}", p_pcb->port_handle); } if (PORT_SetDataCOCallback(p_pcb->port_handle, bta_jv_port_data_co_cback) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM server data callback handle:{}", p_pcb->port_handle); + log::warn("Unable to set RFCOMM server data callback port_handle:{}", p_pcb->port_handle); } if (PORT_GetSettings(p_pcb->port_handle, &port_settings) != PORT_SUCCESS) { - log::warn("Unable to get RFCOMM server state handle:{}", p_pcb->port_handle); + log::warn("Unable to get RFCOMM server state port_handle:{}", p_pcb->port_handle); } port_settings.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT); if (PORT_SetSettings(p_pcb->port_handle, &port_settings) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM server state handle:{}", p_pcb->port_handle); + log::warn("Unable to set RFCOMM server state port_handle:{}", p_pcb->port_handle); } p_pcb->handle = BTA_JV_RFC_H_S_TO_HDL(p_cb->handle, si); log::verbose("p_pcb->handle=0x{:x}, curr_sess={}", p_pcb->handle, p_cb->curr_sess); @@ -1881,23 +1883,23 @@ void bta_jv_rfcomm_start_server(tBTA_SEC sec_mask, uint8_t local_scn, uint8_t ma evt_data.use_co = true; if (PORT_SetAppUid(handle, app_uid) != PORT_SUCCESS) { - log::warn("Unable to set app_uid for port handle:{}", handle); + log::warn("Unable to set app_uid for port_handle:{}", handle); } if (PORT_ClearKeepHandleFlag(handle) != PORT_SUCCESS) { - log::warn("Unable to clear RFCOMM server keep handle flag handle:{}", handle); + log::warn("Unable to clear RFCOMM server keep handle flag port_handle:{}", handle); } if (PORT_SetEventMaskAndCallback(handle, event_mask, bta_jv_port_event_sr_cback) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM server event mask and callback handle:{}", handle); + log::warn("Unable to set RFCOMM server event mask and callback port_handle:{}", handle); } if (PORT_GetSettings(handle, &port_settings) != PORT_SUCCESS) { - log::warn("Unable to get RFCOMM server state handle:{}", handle); + log::warn("Unable to get RFCOMM server state port_handle:{}", handle); } port_settings.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT); if (PORT_SetSettings(handle, &port_settings) != PORT_SUCCESS) { - log::warn("Unable to set RFCOMM port state handle:{}", handle); + log::warn("Unable to set RFCOMM port state port_handle:{}", handle); } } while (0); @@ -1906,12 +1908,12 @@ void bta_jv_rfcomm_start_server(tBTA_SEC sec_mask, uint8_t local_scn, uint8_t ma p_cback(BTA_JV_RFCOMM_START_EVT, &bta_jv, rfcomm_slot_id); if (bta_jv.rfc_start.status == tBTA_JV_STATUS::SUCCESS) { if (PORT_SetDataCOCallback(handle, bta_jv_port_data_co_cback) != PORT_SUCCESS) { - log::error("Unable to set RFCOMM server data callback handle:{}", handle); + log::error("Unable to set RFCOMM server data callback port_handle:{}", handle); } } else { if (handle) { if (RFCOMM_RemoveConnection(handle) != PORT_SUCCESS) { - log::warn("Unable to remote RFCOMM server connection handle:{}", handle); + log::warn("Unable to remote RFCOMM server connection port_handle:{}", handle); } } } @@ -1920,7 +1922,7 @@ void bta_jv_rfcomm_start_server(tBTA_SEC sec_mask, uint8_t local_scn, uint8_t ma /* stops an RFCOMM server */ void bta_jv_rfcomm_stop_server(uint32_t handle, uint32_t rfcomm_slot_id) { if (!handle) { - log::error("jv handle is null"); + log::error("jv_handle is null"); return; } @@ -1971,23 +1973,24 @@ void bta_jv_rfcomm_write(uint32_t handle, uint32_t req_id, tBTA_JV_RFC_CB* p_cb, /* Set or free power mode profile for a JV application */ void bta_jv_set_pm_profile(uint32_t handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_STATE init_st) { - log::verbose("handle=0x{:x}, app_id={}, init_st={}", handle, app_id, + log::verbose("jv_handle=0x{:x}, app_id={}, init_st={}", handle, app_id, bta_jv_conn_state_text(init_st)); /* clear PM control block */ if (app_id == BTA_JV_PM_ID_CLEAR) { tBTA_JV_STATUS status = bta_jv_free_set_pm_profile_cb(handle); if (status != tBTA_JV_STATUS::SUCCESS) { - log::warn("Unable to free a power mode profile handle:0x:{:x} app_id:{} state:{} status:{}", - handle, app_id, init_st, bta_jv_status_text(status)); + log::warn( + "Unable to free a power mode profile jv_handle:0x:{:x} app_id:{} state:{} status:{}", + handle, app_id, init_st, bta_jv_status_text(status)); } } else { /* set PM control block */ tBTA_JV_PM_CB* p_cb = bta_jv_alloc_set_pm_profile_cb(handle, app_id); if (p_cb) { bta_jv_pm_state_change(p_cb, init_st); } else { - log::warn("Unable to allocate a power mode profile handle:0x:{:x} app_id:{} state:{}", handle, - app_id, init_st); + log::warn("Unable to allocate a power mode profile jv_handle:0x:{:x} app_id:{} state:{}", + handle, app_id, init_st); } } } @@ -2038,7 +2041,7 @@ static void bta_jv_pm_conn_idle(tBTA_JV_PM_CB* p_cb) { * ******************************************************************************/ static void bta_jv_pm_state_change(tBTA_JV_PM_CB* p_cb, const tBTA_JV_CONN_STATE state) { - log::verbose("p_cb={}, handle=0x{:x}, busy/idle_state={}, app_id={}, conn_state={}", + log::verbose("p_cb={}, jv_handle=0x{:x}, busy/idle_state={}, app_id={}, conn_state={}", std::format_ptr(p_cb), p_cb->handle, p_cb->state, p_cb->app_id, bta_jv_conn_state_text(state)); diff --git a/system/btif/src/btif_sock_rfc.cc b/system/btif/src/btif_sock_rfc.cc index de091e8b05..d23f012249 100644 --- a/system/btif/src/btif_sock_rfc.cc +++ b/system/btif/src/btif_sock_rfc.cc @@ -196,7 +196,7 @@ static rfc_slot_t* find_rfc_slot_by_pending_sdp(void) { static bool is_requesting_sdp(void) { for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i) { if (rfc_slots[i].id && rfc_slots[i].f.doing_sdp_request) { - log::info("slot id {} is doing sdp request", rfc_slots[i].id); + log::info("slot_id {} is doing sdp request", rfc_slots[i].id); return true; } } @@ -467,7 +467,7 @@ bt_status_t btsock_rfc_connect(const RawAddress* bd_addr, const Uuid* service_uu } if (!send_app_scn(slot)) { - log::error("send_app_scn() failed, closing slot->id:{}", slot->id); + log::error("send_app_scn() failed, closing slot_id:{}", slot->id); cleanup_rfc_slot(slot); return BT_STATUS_SOCKET_ERROR; } @@ -536,7 +536,7 @@ static void cleanup_rfc_slot(rfc_slot_t* slot) { close(slot->fd); log::info( "disconnected from RFCOMM socket connections for device: {}, scn: {}, " - "app_uid: {}, id: {}, socket_id: {}", + "app_uid: {}, slot_id: {}, socket_id: {}", slot->addr, slot->scn, slot->app_uid, slot->id, slot->socket_id); btif_sock_connection_logger( slot->addr, slot->id, BTSOCK_RFCOMM, SOCKET_CONNECTION_STATE_DISCONNECTED, @@ -586,7 +586,7 @@ static bool send_app_scn(rfc_slot_t* slot) { // already sent, just return success. return true; } - log::debug("Sending scn for slot {}. bd_addr:{}", slot->id, slot->addr); + log::debug("Sending scn for slot_id {}. bd_addr:{}", slot->id, slot->addr); slot->scn_notified = true; return sock_send_all(slot->fd, (const uint8_t*)&slot->scn, sizeof(slot->scn)) == sizeof(slot->scn); @@ -615,10 +615,10 @@ static void on_cl_rfc_init(tBTA_JV_RFCOMM_CL_INIT* p_init, uint32_t id) { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found. p_init->status={}", id, + log::error("RFCOMM slot_id {} not found. p_init->status={}", id, bta_jv_status_text(p_init->status)); } else if (p_init->status != tBTA_JV_STATUS::SUCCESS) { - log::warn("INIT unsuccessful, status {}. Cleaning up slot with id {}", + log::warn("INIT unsuccessful, status {}. Cleaning up slot_id {}", bta_jv_status_text(p_init->status), slot->id); cleanup_rfc_slot(slot); } else { @@ -630,10 +630,10 @@ static void on_srv_rfc_listen_started(tBTA_JV_RFCOMM_START* p_start, uint32_t id std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found", id); + log::error("RFCOMM slot_id {} not found", id); return; } else if (p_start->status != tBTA_JV_STATUS::SUCCESS) { - log::warn("START unsuccessful, status {}. Cleaning up slot with id {}", + log::warn("START unsuccessful, status {}. Cleaning up slot_id {}", bta_jv_status_text(p_start->status), slot->id); cleanup_rfc_slot(slot); return; @@ -702,7 +702,7 @@ static uint32_t on_srv_rfc_connect(tBTA_JV_RFCOMM_SRV_OPEN* p_open, uint32_t id) rfc_slot_t* accept_rs; rfc_slot_t* srv_rs = find_rfc_slot_by_id(id); if (!srv_rs) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return 0; } @@ -719,7 +719,7 @@ static uint32_t on_srv_rfc_connect(tBTA_JV_RFCOMM_SRV_OPEN* p_open, uint32_t id) log::info( "connected to RFCOMM socket connections for device: {}, scn: {}, " - "app_uid: {}, id: {}, socket_id: {}", + "app_uid: {}, slot_id: {}, socket_id: {}", accept_rs->addr, accept_rs->scn, accept_rs->app_uid, id, accept_rs->socket_id); btif_sock_connection_logger(accept_rs->addr, accept_rs->id, BTSOCK_RFCOMM, SOCKET_CONNECTION_STATE_CONNECTED, @@ -779,12 +779,12 @@ static void on_cli_rfc_connect(tBTA_JV_RFCOMM_OPEN* p_open, uint32_t id) { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return; } if (p_open->status != tBTA_JV_STATUS::SUCCESS) { - log::warn("CONNECT unsuccessful, status {}. Cleaning up slot with id {}", + log::warn("CONNECT unsuccessful, status {}. Cleaning up slot_id {}", bta_jv_status_text(p_open->status), slot->id); cleanup_rfc_slot(slot); return; @@ -906,7 +906,7 @@ static void on_rfc_close(tBTA_JV_RFCOMM_CLOSE* /* p_close */, uint32_t id) { static void on_rfc_write_done(tBTA_JV_RFCOMM_WRITE* p, uint32_t id) { if (p->status != tBTA_JV_STATUS::SUCCESS) { - log::error("error writing to RFCOMM socket with slot {}.", p->req_id); + log::error("error writing to RFCOMM socket, req_id:{}.", p->req_id); return; } @@ -915,7 +915,7 @@ static void on_rfc_write_done(tBTA_JV_RFCOMM_WRITE* p, uint32_t id) { rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return; } app_uid = slot->app_uid; @@ -931,7 +931,7 @@ static void on_rfc_outgoing_congest(tBTA_JV_RFCOMM_CONG* p, uint32_t id) { rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return; } @@ -946,39 +946,39 @@ static uint32_t rfcomm_cback(tBTA_JV_EVT event, tBTA_JV* p_data, uint32_t rfcomm switch (event) { case BTA_JV_RFCOMM_START_EVT: - log::info("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::info("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); on_srv_rfc_listen_started(&p_data->rfc_start, rfcomm_slot_id); break; case BTA_JV_RFCOMM_CL_INIT_EVT: - log::info("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::info("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); on_cl_rfc_init(&p_data->rfc_cl_init, rfcomm_slot_id); break; case BTA_JV_RFCOMM_OPEN_EVT: - log::info("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::info("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); BTA_JvSetPmProfile(p_data->rfc_open.handle, BTA_JV_PM_ID_1, BTA_JV_CONN_OPEN); on_cli_rfc_connect(&p_data->rfc_open, rfcomm_slot_id); break; case BTA_JV_RFCOMM_SRV_OPEN_EVT: - log::info("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::info("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); BTA_JvSetPmProfile(p_data->rfc_srv_open.handle, BTA_JV_PM_ALL, BTA_JV_CONN_OPEN); id = on_srv_rfc_connect(&p_data->rfc_srv_open, rfcomm_slot_id); break; case BTA_JV_RFCOMM_CLOSE_EVT: - log::info("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::info("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); on_rfc_close(&p_data->rfc_close, rfcomm_slot_id); break; case BTA_JV_RFCOMM_WRITE_EVT: - log::verbose("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::verbose("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); on_rfc_write_done(&p_data->rfc_write, rfcomm_slot_id); break; case BTA_JV_RFCOMM_CONG_EVT: - log::verbose("handling {}, rfcomm_slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); + log::verbose("handling {}, slot_id:{}", bta_jv_event_text(event), rfcomm_slot_id); on_rfc_outgoing_congest(&p_data->rfc_cong, rfcomm_slot_id); break; @@ -987,20 +987,20 @@ static uint32_t rfcomm_cback(tBTA_JV_EVT event, tBTA_JV* p_data, uint32_t rfcomm break; default: - log::warn("unhandled event {}, slot id: {}", bta_jv_event_text(event), rfcomm_slot_id); + log::warn("unhandled event {}, slot_id: {}", bta_jv_event_text(event), rfcomm_slot_id); break; } return id; } static void jv_dm_cback(tBTA_JV_EVT event, tBTA_JV* p_data, uint32_t id) { - log::info("handling event:{}, id:{}", bta_jv_event_text(event), id); + log::info("handling event:{}, slot_id:{}", bta_jv_event_text(event), id); switch (event) { case BTA_JV_GET_SCN_EVT: { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* rs = find_rfc_slot_by_id(id); if (!rs) { - log::error("RFCOMM slot with id {} not found. event:{}", id, bta_jv_event_text(event)); + log::error("RFCOMM slot with slot_id {} not found. event:{}", id, bta_jv_event_text(event)); break; } if (p_data->scn == 0) { @@ -1061,7 +1061,7 @@ static void jv_dm_cback(tBTA_JV_EVT event, tBTA_JV* p_data, uint32_t id) { rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found. event:{}", id, bta_jv_event_text(event)); + log::error("RFCOMM slot_id {} not found. event:{}", id, bta_jv_event_text(event)); break; } @@ -1104,7 +1104,7 @@ static void jv_dm_cback(tBTA_JV_EVT event, tBTA_JV* p_data, uint32_t id) { } default: - log::debug("unhandled event:{}, slot id:{}", bta_jv_event_text(event), id); + log::debug("unhandled event:{}, slot_id:{}", bta_jv_event_text(event), id); break; } } @@ -1112,18 +1112,18 @@ static void jv_dm_cback(tBTA_JV_EVT event, tBTA_JV* p_data, uint32_t id) { static void handle_discovery_comp(tBTA_JV_STATUS status, int scn, uint32_t id) { rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found. event: BTA_JV_DISCOVERY_COMP_EVT", id); + log::error("RFCOMM slot_id {} not found. event: BTA_JV_DISCOVERY_COMP_EVT", id); return; } if (!slot->f.doing_sdp_request) { - log::error("SDP response returned but RFCOMM slot {} did not request SDP record.", id); + log::error("SDP response returned but RFCOMM slot_id {} did not request SDP record.", id); return; } if (status != tBTA_JV_STATUS::SUCCESS || !scn) { log::error( - "SDP service discovery completed for slot id: {} with the result " + "SDP service discovery completed for slot_id: {} with the result " "status: {}, scn: {}", id, bta_jv_status_text(status), scn); cleanup_rfc_slot(slot); @@ -1146,10 +1146,7 @@ static void handle_discovery_comp(tBTA_JV_STATUS status, int scn, uint32_t id) { if (BTA_JvRfcommConnect(slot->security, scn, slot->addr, rfcomm_cback, slot->id, cfg, slot->app_uid) != tBTA_JV_STATUS::SUCCESS) { - log::warn( - "BTA_JvRfcommConnect() returned BTA_JV_FAILURE for RFCOMM slot with " - "id: {}", - id); + log::warn("BTA_JvRfcommConnect() returned BTA_JV_FAILURE for RFCOMM slot_id:{}", id); cleanup_rfc_slot(slot); return; } @@ -1158,7 +1155,7 @@ static void handle_discovery_comp(tBTA_JV_STATUS status, int scn, uint32_t id) { slot->f.doing_sdp_request = false; if (!send_app_scn(slot)) { - log::warn("send_app_scn() failed, closing slot->id {}", slot->id); + log::warn("send_app_scn() failed, closing slot_id {}", slot->id); cleanup_rfc_slot(slot); return; } @@ -1233,7 +1230,7 @@ static bool flush_incoming_que_on_wr_signal(rfc_slot_t* slot) { static bool btsock_rfc_read_signaled_on_connected_socket(int /* fd */, int flags, uint32_t /* id */, rfc_slot_t* slot) { if (!slot->f.connected) { - log::error("socket signaled for read while disconnected, slot: {}, channel: {}", slot->id, + log::error("socket signaled for read while disconnected, slot_id: {}, channel: {}", slot->id, slot->scn); return false; } @@ -1260,7 +1257,7 @@ static bool btsock_rfc_read_signaled_on_listen_socket(int fd, int /* flags */, u return false; } slot->is_accepting = accept_signal.is_accepting; - log::info("Server socket: {}, is_accepting: {}", slot->id, slot->is_accepting); + log::info("Server socket slot_id: {}, is_accepting: {}", slot->id, slot->is_accepting); } return true; } @@ -1270,7 +1267,7 @@ static void btsock_rfc_signaled_flagged(int fd, int flags, uint32_t id) { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::warn("RFCOMM slot with id {} not found.", id); + log::warn("RFCOMM slot_id {} not found.", id); return; } @@ -1294,7 +1291,7 @@ static void btsock_rfc_signaled_flagged(int fd, int flags, uint32_t id) { if (!slot->f.connected || !flush_incoming_que_on_wr_signal(slot)) { log::error( "socket signaled for write while disconnected (or write failure), " - "slot: {}, channel: {}", + "slot_id: {}, channel: {}", slot->id, slot->scn); need_close = true; } @@ -1335,7 +1332,7 @@ void btsock_rfc_signaled(int fd, int flags, uint32_t id) { BTA_JvRfcommWrite(slot->rfc_handle, slot->id); } } else { - log::error("socket signaled for read while disconnected, slot: {}, channel: {}", slot->id, + log::error("socket signaled for read while disconnected, slot_id: {}, channel: {}", slot->id, slot->scn); need_close = true; } @@ -1346,7 +1343,7 @@ void btsock_rfc_signaled(int fd, int flags, uint32_t id) { if (!slot->f.connected || !flush_incoming_que_on_wr_signal(slot)) { log::error( "socket signaled for write while disconnected (or write failure), " - "slot: {}, channel: {}", + "slot_id: {}, channel: {}", slot->id, slot->scn); need_close = true; } @@ -1372,7 +1369,7 @@ int bta_co_rfc_data_incoming(uint32_t id, BT_HDR* p_buf) { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return 0; } @@ -1412,7 +1409,7 @@ int bta_co_rfc_data_outgoing_size(uint32_t id, int* size) { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return false; } @@ -1430,7 +1427,7 @@ int bta_co_rfc_data_outgoing(uint32_t id, uint8_t* buf, uint16_t size) { std::unique_lock<std::recursive_mutex> lock(slot_lock); rfc_slot_t* slot = find_rfc_slot_by_id(id); if (!slot) { - log::error("RFCOMM slot with id {} not found.", id); + log::error("RFCOMM slot_id {} not found.", id); return false; } diff --git a/system/stack/rfcomm/port_rfc.cc b/system/stack/rfcomm/port_rfc.cc index e7813a240f..14a9cb5bf0 100644 --- a/system/stack/rfcomm/port_rfc.cc +++ b/system/stack/rfcomm/port_rfc.cc @@ -1052,7 +1052,7 @@ void port_rfc_closed(tPORT* p_port, uint8_t res) { p_port->rfc.sm_cb.state = RFC_STATE_CLOSED; log::info( - "RFCOMM connection closed, index={}, state={}, reason={}[{}], " + "RFCOMM connection closed, port_handle={}, state={}, reason={}[{}], " "UUID=0x{:x}, bd_addr={}, is_server={}", p_port->handle, p_port->state, PORT_GetResultString(res), res, p_port->uuid, p_port->bd_addr, p_port->is_server); diff --git a/system/stack/rfcomm/rfc_port_fsm.cc b/system/stack/rfcomm/rfc_port_fsm.cc index 040315d276..be47e22617 100644 --- a/system/stack/rfcomm/rfc_port_fsm.cc +++ b/system/stack/rfcomm/rfc_port_fsm.cc @@ -452,12 +452,12 @@ void rfc_port_sm_orig_wait_sec_check(tPORT* p_port, tRFC_PORT_EVENT event, void* void rfc_port_sm_opened(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) { switch (event) { case RFC_PORT_EVENT_OPEN: - log::error("RFC_PORT_EVENT_OPEN bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::error("RFC_PORT_EVENT_OPEN bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); return; case RFC_PORT_EVENT_CLOSE: - log::info("RFC_PORT_EVENT_CLOSE bd_addr:{}, handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::info("RFC_PORT_EVENT_CLOSE bd_addr:{}, port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); rfc_port_timer_start(p_port, RFC_DISC_TIMEOUT); rfc_send_disc(p_port->rfc.p_mcb, p_port->dlci); @@ -466,7 +466,7 @@ void rfc_port_sm_opened(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) { return; case RFC_PORT_EVENT_CLEAR: - log::warn("RFC_PORT_EVENT_CLEAR bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::warn("RFC_PORT_EVENT_CLEAR bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); rfc_port_closed(p_port); return; @@ -475,7 +475,7 @@ void rfc_port_sm_opened(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) { // Send credits in the frame. Pass them in the layer specific member of the hdr. // There might be an initial case when we reduced rx_max and credit_rx is still bigger. // Make sure that we do not send 255 - log::verbose("RFC_PORT_EVENT_DATA bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::verbose("RFC_PORT_EVENT_DATA bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); if ((p_port->rfc.p_mcb->flow == PORT_FC_CREDIT) && (((BT_HDR*)p_data)->len < p_port->peer_mtu) && (!p_port->rx.user_fc) && @@ -490,25 +490,25 @@ void rfc_port_sm_opened(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) { return; case RFC_PORT_EVENT_UA: - log::verbose("RFC_PORT_EVENT_UA bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::verbose("RFC_PORT_EVENT_UA bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); return; case RFC_PORT_EVENT_SABME: - log::verbose("RFC_PORT_EVENT_SABME bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::verbose("RFC_PORT_EVENT_SABME bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); rfc_send_ua(p_port->rfc.p_mcb, p_port->dlci); return; case RFC_PORT_EVENT_DM: - log::info("RFC_EVENT_DM bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, - p_port->dlci, p_port->scn); + log::info("RFC_EVENT_DM bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, + p_port->handle, p_port->dlci, p_port->scn); PORT_DlcReleaseInd(p_port->rfc.p_mcb, p_port->dlci); rfc_port_closed(p_port); return; case RFC_PORT_EVENT_DISC: - log::info("RFC_PORT_EVENT_DISC bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::info("RFC_PORT_EVENT_DISC bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); p_port->rfc.sm_cb.state = RFC_STATE_CLOSED; rfc_send_ua(p_port->rfc.p_mcb, p_port->dlci); @@ -522,19 +522,19 @@ void rfc_port_sm_opened(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data) { return; case RFC_PORT_EVENT_UIH: - log::verbose("RFC_PORT_EVENT_UIH bd_addr:{}, handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::verbose("RFC_PORT_EVENT_UIH bd_addr:{}, port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); rfc_port_uplink_data(p_port, (BT_HDR*)p_data); return; case RFC_PORT_EVENT_TIMEOUT: PORT_TimeOutCloseMux(p_port->rfc.p_mcb); - log::error("RFC_PORT_EVENT_TIMEOUT bd_addr:{} handle:{} dlci:{} scn:{}", p_port->bd_addr, + log::error("RFC_PORT_EVENT_TIMEOUT bd_addr:{} port_handle:{} dlci:{} scn:{}", p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); return; default: - log::error("Received unexpected event:{} bd_addr:{} handle:{} dlci:{} scn:{}", + log::error("Received unexpected event:{} bd_addr:{} port_handle:{} dlci:{} scn:{}", rfcomm_port_event_text(event), p_port->bd_addr, p_port->handle, p_port->dlci, p_port->scn); break; @@ -560,7 +560,7 @@ void rfc_port_sm_disc_wait_ua(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data return; case RFC_PORT_EVENT_CLEAR: - log::warn("RFC_PORT_EVENT_CLEAR, handle:{}", p_port->handle); + log::warn("RFC_PORT_EVENT_CLEAR, port_handle:{}", p_port->handle); rfc_port_closed(p_port); return; @@ -573,7 +573,7 @@ void rfc_port_sm_disc_wait_ua(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data FALLTHROUGH_INTENDED; /* FALLTHROUGH */ case RFC_PORT_EVENT_DM: - log::warn("RFC_EVENT_DM|RFC_EVENT_UA[{}], handle:{}", event, p_port->handle); + log::warn("RFC_EVENT_DM|RFC_EVENT_UA[{}], port_handle:{}", event, p_port->handle); if (com::android::bluetooth::flags::rfcomm_always_disc_initiator_in_disc_wait_ua()) { // If we got a DM in RFC_STATE_DISC_WAIT_UA, it's likely that both ends // attempt to DISC at the same time and both get a DM. @@ -602,7 +602,7 @@ void rfc_port_sm_disc_wait_ua(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data return; case RFC_PORT_EVENT_TIMEOUT: - log::error("RFC_EVENT_TIMEOUT, handle:{}", p_port->handle); + log::error("RFC_EVENT_TIMEOUT, port_handle:{}", p_port->handle); rfc_port_closed(p_port); return; default: |