Loading system/stack/fuzzers/sdp_fuzzer.cc +1 −1 Original line number Original line Diff line number Diff line Loading @@ -75,7 +75,7 @@ public: [](uint16_t psm, const RawAddress& raw_address) { return kDummyCID; }; [](uint16_t psm, const RawAddress& raw_address) { return kDummyCID; }; test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity.body = test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity.body = [](uint16_t psm, const RawAddress& p_bd_addr, uint16_t sec_level) { [](uint16_t psm, const RawAddress& p_bd_addr, uint16_t sec_level) { return L2CA_ConnectReq(psm, p_bd_addr); return bluetooth::stack::l2cap::get_interface().L2CA_ConnectReq(psm, p_bd_addr); }; }; test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t cid, test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t cid, BT_HDR* p_data) -> tL2CAP_DW_RESULT { BT_HDR* p_data) -> tL2CAP_DW_RESULT { Loading system/stack/sdp/sdp_discovery.cc +6 −3 Original line number Original line Diff line number Diff line Loading @@ -176,7 +176,8 @@ static void sdp_snd_service_search_req(tCONN_CB* p_ccb, uint8_t cont_len, uint8_ /* Set the length of the SDP data in the buffer */ /* Set the length of the SDP data in the buffer */ p_cmd->len = (uint16_t)(p - p_start); p_cmd->len = (uint16_t)(p - p_start); if (L2CA_DataWrite(p_ccb->connection_id, p_cmd) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_cmd) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_cmd->len); p_ccb->connection_id, p_cmd->len); } } Loading Loading @@ -693,7 +694,8 @@ static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, /* Set the length of the SDP data in the buffer */ /* Set the length of the SDP data in the buffer */ p_msg->len = p - p_start; p_msg->len = p - p_start; if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_msg->len); p_ccb->connection_id, p_msg->len); } } Loading Loading @@ -861,7 +863,8 @@ static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, uint8_t* /* Set the length of the SDP data in the buffer */ /* Set the length of the SDP data in the buffer */ p_msg->len = (uint16_t)(p - p_start); p_msg->len = (uint16_t)(p - p_start); if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_msg->len); p_ccb->connection_id, p_msg->len); } } Loading system/stack/sdp/sdp_main.cc +8 −7 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,6 @@ #include "stack/include/bt_hdr.h" #include "stack/include/bt_hdr.h" #include "stack/include/bt_psm_types.h" #include "stack/include/bt_psm_types.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/l2c_api.h" #include "stack/include/l2cdefs.h" #include "stack/include/l2cdefs.h" #include "stack/include/sdp_status.h" #include "stack/include/sdp_status.h" #include "stack/sdp/sdpint.h" #include "stack/sdp/sdpint.h" Loading Loading @@ -286,7 +285,8 @@ tCONN_CB* sdp_conn_originate(const RawAddress& bd_addr) { /* Transition to the next appropriate state, waiting for connection confirm */ /* Transition to the next appropriate state, waiting for connection confirm */ if (cid == 0) { if (cid == 0) { p_ccb->con_state = tSDP_STATE::CONN_SETUP; p_ccb->con_state = tSDP_STATE::CONN_SETUP; cid = L2CA_ConnectReqWithSecurity(BT_PSM_SDP, bd_addr, BTM_SEC_NONE); cid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity(BT_PSM_SDP, bd_addr, BTM_SEC_NONE); } else { } else { p_ccb->con_state = tSDP_STATE::CONN_PEND; p_ccb->con_state = tSDP_STATE::CONN_PEND; log::warn("SDP already active for peer {}. cid={:#0x}", bd_addr, cid); log::warn("SDP already active for peer {}. cid={:#0x}", bd_addr, cid); Loading Loading @@ -323,7 +323,7 @@ void sdp_disconnect(tCONN_CB* p_ccb, tSDP_REASON reason) { sdpu_release_ccb(ccb); sdpu_release_ccb(ccb); return; return; } else { } else { if (!L2CA_DisconnectReq(ccb.connection_id)) { if (!stack::l2cap::get_interface().L2CA_DisconnectReq(ccb.connection_id)) { log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, ccb.connection_id); ccb.connection_id); } } Loading Loading @@ -381,7 +381,7 @@ void sdp_conn_timer_timeout(void* data) { log::verbose("SDP - CCB timeout in state: {} CID: 0x{:x}", sdp_state_text(ccb.con_state), log::verbose("SDP - CCB timeout in state: {} CID: 0x{:x}", sdp_state_text(ccb.con_state), ccb.connection_id); ccb.connection_id); if (!L2CA_DisconnectReq(ccb.connection_id)) { if (!stack::l2cap::get_interface().L2CA_DisconnectReq(ccb.connection_id)) { log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, ccb.connection_id); log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, ccb.connection_id); } } Loading Loading @@ -424,14 +424,15 @@ void sdp_init(void) { sdp_cb.reg_info.pL2CA_Error_Cb = sdp_on_l2cap_error; sdp_cb.reg_info.pL2CA_Error_Cb = sdp_on_l2cap_error; /* Now, register with L2CAP */ /* Now, register with L2CAP */ if (!L2CA_RegisterWithSecurity(BT_PSM_SDP, sdp_cb.reg_info, true /* enable_snoop */, nullptr, if (!stack::l2cap::get_interface().L2CA_RegisterWithSecurity(BT_PSM_SDP, sdp_cb.reg_info, true /* enable_snoop */, nullptr, SDP_MTU_SIZE, 0, BTM_SEC_NONE)) { SDP_MTU_SIZE, 0, BTM_SEC_NONE)) { log::error("SDP Registration failed"); log::error("SDP Registration failed"); } } } } void sdp_free(void) { void sdp_free(void) { L2CA_Deregister(BT_PSM_SDP); stack::l2cap::get_interface().L2CA_Deregister(BT_PSM_SDP); for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) { for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) { alarm_free(sdp_cb.ccb[i].sdp_conn_timer); alarm_free(sdp_cb.ccb[i].sdp_conn_timer); sdp_cb.ccb[i].sdp_conn_timer = NULL; sdp_cb.ccb[i].sdp_conn_timer = NULL; Loading system/stack/sdp/sdp_server.cc +6 −3 Original line number Original line Diff line number Diff line Loading @@ -297,7 +297,8 @@ static void process_service_search(tCONN_CB* p_ccb, uint16_t trans_num, uint16_t p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); p_ccb->connection_id, p_buf->len); } } Loading Loading @@ -560,7 +561,8 @@ static void process_service_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, uint16 p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); p_ccb->connection_id, p_buf->len); } } Loading Loading @@ -916,7 +918,8 @@ static void process_service_search_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); p_ccb->connection_id, p_buf->len); } } Loading system/stack/sdp/sdp_utils.cc +13 −6 Original line number Original line Diff line number Diff line Loading @@ -48,6 +48,7 @@ #include "stack/include/bt_types.h" #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" #include "stack/include/bt_uuid16.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/l2cap_interface.h" #include "stack/include/sdpdefs.h" #include "stack/include/sdpdefs.h" #include "stack/include/stack_metrics_logging.h" #include "stack/include/stack_metrics_logging.h" #include "stack/sdp/internal/sdp_api.h" #include "stack/sdp/internal/sdp_api.h" Loading Loading @@ -522,7 +523,8 @@ bool sdpu_process_pend_ccb_new_cid(const tCONN_CB& ccb) { if (!new_conn) { if (!new_conn) { // Only change state of the first ccb // Only change state of the first ccb p_ccb->con_state = tSDP_STATE::CONN_SETUP; p_ccb->con_state = tSDP_STATE::CONN_SETUP; new_cid = L2CA_ConnectReqWithSecurity(BT_PSM_SDP, p_ccb->device_address, BTM_SEC_NONE); new_cid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity( BT_PSM_SDP, p_ccb->device_address, BTM_SEC_NONE); new_conn = true; new_conn = true; } } // Check if L2CAP started the connection process // Check if L2CAP started the connection process Loading Loading @@ -732,7 +734,8 @@ void sdpu_build_n_send_error(tCONN_CB* p_ccb, uint16_t trans_num, tSDP_STATUS er p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data cid:{}", p_ccb->connection_id); log::warn("Unable to write L2CAP data cid:{}", p_ccb->connection_id); } } } } Loading Loading @@ -1536,7 +1539,9 @@ void sdpu_set_avrc_target_version(const tSDP_ATTRIBUTE* p_attr, const RawAddress } } if (iop_version != 0) { if (iop_version != 0) { log::info("device={} is in IOP database. Reply AVRC Target version {:x} instead of {:x}.", log::info( "device={} is in IOP database. Reply AVRC Target version {:x} instead " "of {:x}.", *bdaddr, iop_version, avrcp_version); *bdaddr, iop_version, avrcp_version); uint8_t* p_version = p_attr->value_ptr + 6; uint8_t* p_version = p_attr->value_ptr + 6; UINT16_TO_BE_FIELD(p_version, iop_version); UINT16_TO_BE_FIELD(p_version, iop_version); Loading Loading @@ -1638,7 +1643,9 @@ void sdpu_set_avrc_target_features(const tSDP_ATTRIBUTE* p_attr, const RawAddres bool browsing_supported = ((AVRCP_FEAT_BRW_BIT & avrcp_peer_features) == AVRCP_FEAT_BRW_BIT); bool browsing_supported = ((AVRCP_FEAT_BRW_BIT & avrcp_peer_features) == AVRCP_FEAT_BRW_BIT); bool coverart_supported = ((AVRCP_FEAT_CA_BIT & avrcp_peer_features) == AVRCP_FEAT_CA_BIT); bool coverart_supported = ((AVRCP_FEAT_CA_BIT & avrcp_peer_features) == AVRCP_FEAT_CA_BIT); log::info("SDP AVRCP DB Version 0x{:x}, browse supported {}, cover art supported {}", log::info( "SDP AVRCP DB Version 0x{:x}, browse supported {}, cover art supported " "{}", avrcp_peer_features, browsing_supported, coverart_supported); avrcp_peer_features, browsing_supported, coverart_supported); if (avrcp_version < AVRC_REV_1_4 || !browsing_supported) { if (avrcp_version < AVRC_REV_1_4 || !browsing_supported) { log::info("Reset Browsing Feature"); log::info("Reset Browsing Feature"); Loading Loading
system/stack/fuzzers/sdp_fuzzer.cc +1 −1 Original line number Original line Diff line number Diff line Loading @@ -75,7 +75,7 @@ public: [](uint16_t psm, const RawAddress& raw_address) { return kDummyCID; }; [](uint16_t psm, const RawAddress& raw_address) { return kDummyCID; }; test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity.body = test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity.body = [](uint16_t psm, const RawAddress& p_bd_addr, uint16_t sec_level) { [](uint16_t psm, const RawAddress& p_bd_addr, uint16_t sec_level) { return L2CA_ConnectReq(psm, p_bd_addr); return bluetooth::stack::l2cap::get_interface().L2CA_ConnectReq(psm, p_bd_addr); }; }; test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t cid, test::mock::stack_l2cap_api::L2CA_DataWrite.body = [](uint16_t cid, BT_HDR* p_data) -> tL2CAP_DW_RESULT { BT_HDR* p_data) -> tL2CAP_DW_RESULT { Loading
system/stack/sdp/sdp_discovery.cc +6 −3 Original line number Original line Diff line number Diff line Loading @@ -176,7 +176,8 @@ static void sdp_snd_service_search_req(tCONN_CB* p_ccb, uint8_t cont_len, uint8_ /* Set the length of the SDP data in the buffer */ /* Set the length of the SDP data in the buffer */ p_cmd->len = (uint16_t)(p - p_start); p_cmd->len = (uint16_t)(p - p_start); if (L2CA_DataWrite(p_ccb->connection_id, p_cmd) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_cmd) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_cmd->len); p_ccb->connection_id, p_cmd->len); } } Loading Loading @@ -693,7 +694,8 @@ static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, /* Set the length of the SDP data in the buffer */ /* Set the length of the SDP data in the buffer */ p_msg->len = p - p_start; p_msg->len = p - p_start; if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_msg->len); p_ccb->connection_id, p_msg->len); } } Loading Loading @@ -861,7 +863,8 @@ static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, uint8_t* /* Set the length of the SDP data in the buffer */ /* Set the length of the SDP data in the buffer */ p_msg->len = (uint16_t)(p - p_start); p_msg->len = (uint16_t)(p - p_start); if (L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_msg) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_msg->len); p_ccb->connection_id, p_msg->len); } } Loading
system/stack/sdp/sdp_main.cc +8 −7 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,6 @@ #include "stack/include/bt_hdr.h" #include "stack/include/bt_hdr.h" #include "stack/include/bt_psm_types.h" #include "stack/include/bt_psm_types.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/l2c_api.h" #include "stack/include/l2cdefs.h" #include "stack/include/l2cdefs.h" #include "stack/include/sdp_status.h" #include "stack/include/sdp_status.h" #include "stack/sdp/sdpint.h" #include "stack/sdp/sdpint.h" Loading Loading @@ -286,7 +285,8 @@ tCONN_CB* sdp_conn_originate(const RawAddress& bd_addr) { /* Transition to the next appropriate state, waiting for connection confirm */ /* Transition to the next appropriate state, waiting for connection confirm */ if (cid == 0) { if (cid == 0) { p_ccb->con_state = tSDP_STATE::CONN_SETUP; p_ccb->con_state = tSDP_STATE::CONN_SETUP; cid = L2CA_ConnectReqWithSecurity(BT_PSM_SDP, bd_addr, BTM_SEC_NONE); cid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity(BT_PSM_SDP, bd_addr, BTM_SEC_NONE); } else { } else { p_ccb->con_state = tSDP_STATE::CONN_PEND; p_ccb->con_state = tSDP_STATE::CONN_PEND; log::warn("SDP already active for peer {}. cid={:#0x}", bd_addr, cid); log::warn("SDP already active for peer {}. cid={:#0x}", bd_addr, cid); Loading Loading @@ -323,7 +323,7 @@ void sdp_disconnect(tCONN_CB* p_ccb, tSDP_REASON reason) { sdpu_release_ccb(ccb); sdpu_release_ccb(ccb); return; return; } else { } else { if (!L2CA_DisconnectReq(ccb.connection_id)) { if (!stack::l2cap::get_interface().L2CA_DisconnectReq(ccb.connection_id)) { log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, ccb.connection_id); ccb.connection_id); } } Loading Loading @@ -381,7 +381,7 @@ void sdp_conn_timer_timeout(void* data) { log::verbose("SDP - CCB timeout in state: {} CID: 0x{:x}", sdp_state_text(ccb.con_state), log::verbose("SDP - CCB timeout in state: {} CID: 0x{:x}", sdp_state_text(ccb.con_state), ccb.connection_id); ccb.connection_id); if (!L2CA_DisconnectReq(ccb.connection_id)) { if (!stack::l2cap::get_interface().L2CA_DisconnectReq(ccb.connection_id)) { log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, ccb.connection_id); log::warn("Unable to disconnect L2CAP peer:{} cid:{}", ccb.device_address, ccb.connection_id); } } Loading Loading @@ -424,14 +424,15 @@ void sdp_init(void) { sdp_cb.reg_info.pL2CA_Error_Cb = sdp_on_l2cap_error; sdp_cb.reg_info.pL2CA_Error_Cb = sdp_on_l2cap_error; /* Now, register with L2CAP */ /* Now, register with L2CAP */ if (!L2CA_RegisterWithSecurity(BT_PSM_SDP, sdp_cb.reg_info, true /* enable_snoop */, nullptr, if (!stack::l2cap::get_interface().L2CA_RegisterWithSecurity(BT_PSM_SDP, sdp_cb.reg_info, true /* enable_snoop */, nullptr, SDP_MTU_SIZE, 0, BTM_SEC_NONE)) { SDP_MTU_SIZE, 0, BTM_SEC_NONE)) { log::error("SDP Registration failed"); log::error("SDP Registration failed"); } } } } void sdp_free(void) { void sdp_free(void) { L2CA_Deregister(BT_PSM_SDP); stack::l2cap::get_interface().L2CA_Deregister(BT_PSM_SDP); for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) { for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) { alarm_free(sdp_cb.ccb[i].sdp_conn_timer); alarm_free(sdp_cb.ccb[i].sdp_conn_timer); sdp_cb.ccb[i].sdp_conn_timer = NULL; sdp_cb.ccb[i].sdp_conn_timer = NULL; Loading
system/stack/sdp/sdp_server.cc +6 −3 Original line number Original line Diff line number Diff line Loading @@ -297,7 +297,8 @@ static void process_service_search(tCONN_CB* p_ccb, uint16_t trans_num, uint16_t p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); p_ccb->connection_id, p_buf->len); } } Loading Loading @@ -560,7 +561,8 @@ static void process_service_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, uint16 p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); p_ccb->connection_id, p_buf->len); } } Loading Loading @@ -916,7 +918,8 @@ static void process_service_search_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, log::warn("Unable to write L2CAP data peer:{} cid:{} len:{}", p_ccb->device_address, p_ccb->connection_id, p_buf->len); p_ccb->connection_id, p_buf->len); } } Loading
system/stack/sdp/sdp_utils.cc +13 −6 Original line number Original line Diff line number Diff line Loading @@ -48,6 +48,7 @@ #include "stack/include/bt_types.h" #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" #include "stack/include/bt_uuid16.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/l2cap_interface.h" #include "stack/include/sdpdefs.h" #include "stack/include/sdpdefs.h" #include "stack/include/stack_metrics_logging.h" #include "stack/include/stack_metrics_logging.h" #include "stack/sdp/internal/sdp_api.h" #include "stack/sdp/internal/sdp_api.h" Loading Loading @@ -522,7 +523,8 @@ bool sdpu_process_pend_ccb_new_cid(const tCONN_CB& ccb) { if (!new_conn) { if (!new_conn) { // Only change state of the first ccb // Only change state of the first ccb p_ccb->con_state = tSDP_STATE::CONN_SETUP; p_ccb->con_state = tSDP_STATE::CONN_SETUP; new_cid = L2CA_ConnectReqWithSecurity(BT_PSM_SDP, p_ccb->device_address, BTM_SEC_NONE); new_cid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity( BT_PSM_SDP, p_ccb->device_address, BTM_SEC_NONE); new_conn = true; new_conn = true; } } // Check if L2CAP started the connection process // Check if L2CAP started the connection process Loading Loading @@ -732,7 +734,8 @@ void sdpu_build_n_send_error(tCONN_CB* p_ccb, uint16_t trans_num, tSDP_STATUS er p_buf->len = p_rsp - p_rsp_start; p_buf->len = p_rsp - p_rsp_start; /* Send the buffer through L2CAP */ /* Send the buffer through L2CAP */ if (L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { if (stack::l2cap::get_interface().L2CA_DataWrite(p_ccb->connection_id, p_buf) != tL2CAP_DW_RESULT::SUCCESS) { log::warn("Unable to write L2CAP data cid:{}", p_ccb->connection_id); log::warn("Unable to write L2CAP data cid:{}", p_ccb->connection_id); } } } } Loading Loading @@ -1536,7 +1539,9 @@ void sdpu_set_avrc_target_version(const tSDP_ATTRIBUTE* p_attr, const RawAddress } } if (iop_version != 0) { if (iop_version != 0) { log::info("device={} is in IOP database. Reply AVRC Target version {:x} instead of {:x}.", log::info( "device={} is in IOP database. Reply AVRC Target version {:x} instead " "of {:x}.", *bdaddr, iop_version, avrcp_version); *bdaddr, iop_version, avrcp_version); uint8_t* p_version = p_attr->value_ptr + 6; uint8_t* p_version = p_attr->value_ptr + 6; UINT16_TO_BE_FIELD(p_version, iop_version); UINT16_TO_BE_FIELD(p_version, iop_version); Loading Loading @@ -1638,7 +1643,9 @@ void sdpu_set_avrc_target_features(const tSDP_ATTRIBUTE* p_attr, const RawAddres bool browsing_supported = ((AVRCP_FEAT_BRW_BIT & avrcp_peer_features) == AVRCP_FEAT_BRW_BIT); bool browsing_supported = ((AVRCP_FEAT_BRW_BIT & avrcp_peer_features) == AVRCP_FEAT_BRW_BIT); bool coverart_supported = ((AVRCP_FEAT_CA_BIT & avrcp_peer_features) == AVRCP_FEAT_CA_BIT); bool coverart_supported = ((AVRCP_FEAT_CA_BIT & avrcp_peer_features) == AVRCP_FEAT_CA_BIT); log::info("SDP AVRCP DB Version 0x{:x}, browse supported {}, cover art supported {}", log::info( "SDP AVRCP DB Version 0x{:x}, browse supported {}, cover art supported " "{}", avrcp_peer_features, browsing_supported, coverart_supported); avrcp_peer_features, browsing_supported, coverart_supported); if (avrcp_version < AVRC_REV_1_4 || !browsing_supported) { if (avrcp_version < AVRC_REV_1_4 || !browsing_supported) { log::info("Reset Browsing Feature"); log::info("Reset Browsing Feature"); Loading