Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b363c584 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

L2cap shim: Add role switch am: 069082cb

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1489355

Change-Id: I71e9b334e3a659c64362c3ac6ac65b3c75934167
parents 945dc9c7 069082cb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -837,3 +837,8 @@ uint8_t bluetooth::shim::L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
             MakeUniquePacket(data, len)) *
         len;
}

void bluetooth::shim::L2CA_SwitchRoleToCentral(const RawAddress& addr) {
  bluetooth::shim::GetAclManager()->SwitchRole(ToGdAddress(addr),
                                               bluetooth::hci::Role::CENTRAL);
}
+1 −0
Original line number Diff line number Diff line
@@ -515,5 +515,6 @@ void L2CA_SetBondingState(const RawAddress& p_bd_addr, bool is_bonding);
// Indicated by shim stack manager that GD L2cap is enabled but Security is not
void L2CA_UseLegacySecurityModule();

void L2CA_SwitchRoleToCentral(const RawAddress& addr);
}  // namespace shim
}  // namespace bluetooth
+5 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "include/l2cap_hci_link_interface.h"
#include "main/shim/acl_api.h"
#include "main/shim/btm_api.h"
#include "main/shim/l2c_api.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "stack/acl/acl.h"
@@ -468,6 +469,10 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role) {
 *
 ******************************************************************************/
tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    bluetooth::shim::L2CA_SwitchRoleToCentral(remote_bd_addr);
    return BTM_SUCCESS;
  }
  if (!controller_get_interface()->supports_central_peripheral_role_switch()) {
    LOG_INFO("Local controller does not support role switching");
    return BTM_MODE_UNSUPPORTED;