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

Commit ec12489c authored by Henri Chataing's avatar Henri Chataing
Browse files

Root-Canal: Use kReservedHandle for invalid SCO handles

- Used handle 0 as invalid SCO handle instead of kReservedHandle,
  caused asserts to fail in ACL disconnect following SCO disconnect
- Fix bug in SCO link parameter negotiation which caused parameter
  sets using the fukk bandwidth to be rejected

Test: PTS test HFP/HF/ACS/BV-07-I against Eiffel stack
Change-Id: Ieb227a8a940e8e86138e349bece94a26092b3c65
parent 83c130f9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -500,7 +500,7 @@ uint16_t AclConnectionHandler::GetScoHandle(bluetooth::hci::Address addr) const
      return std::get<0>(pair);
    }
  }
  return 0;
  return kReservedHandle;
}

ScoConnectionParameters AclConnectionHandler::GetScoConnectionParameters(
+2 −2
Original line number Diff line number Diff line
@@ -1559,7 +1559,7 @@ void LinkLayerController::IncomingScoDisconnect(
           static_cast<unsigned>(reason),
           incoming.GetSourceAddress().ToString().c_str());

  if (handle != 0) {
  if (handle != kReservedHandle) {
    connections_.Disconnect(handle);
    SendDisconnectionCompleteEvent(handle, reason);
  }
@@ -2771,7 +2771,7 @@ ErrorCode LinkLayerController::Disconnect(uint16_t handle, uint8_t reason) {
             remote.ToString().c_str());

    uint16_t sco_handle = connections_.GetScoHandle(remote.GetAddress());
    if (sco_handle != 0) {
    if (sco_handle != kReservedHandle) {
      SendLinkLayerPacket(model::packets::ScoDisconnectBuilder::Create(
          properties_.GetAddress(), remote.GetAddress(), reason));

+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ std::optional<ScoLinkParameters> ScoConnectionParameters::GetLinkParameters() {
      double bandwidth_usage =
        (double)transmission_window / (double)transmission_interval;

      if (bandwidth_usage < best_bandwidth_usage) {
      if (bandwidth_usage <= best_bandwidth_usage) {
        LOG_INFO("Valid combination!");

        uint16_t tx_packet_length =