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

Commit 3e83d3bb authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge changes Ic0b6c00e,I9ef60eeb,I9d1deb1b,I49799870,I95e5d984, ... into main

* changes:
  stack::l2cap [19/19] L2CA_UseLatencyMode
  stack::l2cap [18/19] L2CA_UpdateBleConnParams
  stack::l2cap [17/19] L2CA_SubrateRequest
  stack::l2cap [16/19] L2CA_SetTxPriority
  stack::l2cap [15/19] L2CA_SetIdleTimeoutByBdAddr
  stack::l2cap [14/19] L2CA_SetChnlFlushability
  stack::l2cap [13/19] L2CA_SetAclPriority
  stack::l2cap [12/19] L2CA_SetAclLatency
  stack::l2cap [11/19] L2CA_SendFixedChnlData
  stack::l2cap [10/19] L2CA_RemoveFixedChnl
parents a725e2ed 2f9da83c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -708,7 +708,9 @@ void bta_ag_rfc_data(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) {
void bta_ag_start_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
  /* Take the link out of sniff and set L2C idle time to 0 */
  bta_dm_pm_active(p_scb->peer_addr);
  L2CA_SetIdleTimeoutByBdAddr(p_scb->peer_addr, 0, BT_TRANSPORT_BR_EDR);
  if (!L2CA_SetIdleTimeoutByBdAddr(p_scb->peer_addr, 0, BT_TRANSPORT_BR_EDR)) {
    log::warn("Unable to set idle timeout peer:{}", p_scb->peer_addr);
  }

  /* if SCO is open close SCO and wait on RFCOMM close */
  if (bta_ag_sco_is_open(p_scb)) {
+8 −2
Original line number Diff line number Diff line
@@ -1218,8 +1218,14 @@ void bta_av_str_opened(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
               p_scb->stream_mtu);

  /* Set the media channel as high priority */
  L2CA_SetTxPriority(p_scb->l2c_cid, L2CAP_CHNL_PRIORITY_HIGH);
  L2CA_SetChnlFlushability(p_scb->l2c_cid, true);
  if (!L2CA_SetTxPriority(p_scb->l2c_cid, L2CAP_CHNL_PRIORITY_HIGH)) {
    log::warn("Unable to set L2CAP flush peer:{} cid:{}", p_scb->PeerAddress(),
              p_scb->l2c_cid);
  }
  if (!L2CA_SetChnlFlushability(p_scb->l2c_cid, true)) {
    log::warn("Unable to set L2CAP flush peer:{} cid:{}", p_scb->PeerAddress(),
              p_scb->l2c_cid);
  }

  bta_sys_conn_open(BTA_ID_AV, p_scb->app_id, p_scb->PeerAddress());
  memset(&p_scb->q_info, 0, sizeof(tBTA_AV_Q_INFO));
+16 −4
Original line number Diff line number Diff line
@@ -1214,10 +1214,16 @@ void bta_av_stream_chg(tBTA_AV_SCB* p_scb, bool started) {

  if (started) {
    /* Let L2CAP know this channel is processed with high priority */
    L2CA_SetAclPriority(p_scb->PeerAddress(), L2CAP_PRIORITY_HIGH);
    if (!L2CA_SetAclPriority(p_scb->PeerAddress(), L2CAP_PRIORITY_HIGH)) {
      log::warn("Unable to set L2CAP acl high priority peer:{}",
                p_scb->PeerAddress());
    }
  } else {
    /* Let L2CAP know this channel is processed with low priority */
    L2CA_SetAclPriority(p_scb->PeerAddress(), L2CAP_PRIORITY_NORMAL);
    if (!L2CA_SetAclPriority(p_scb->PeerAddress(), L2CAP_PRIORITY_NORMAL)) {
      log::warn("Unable to set L2CAP acl normal priority peer:{}",
                p_scb->PeerAddress());
    }
  }
}

@@ -1464,7 +1470,10 @@ void bta_av_api_disconnect(tBTA_AV_DATA* p_data) {
 *
 ******************************************************************************/
void bta_av_set_use_latency_mode(tBTA_AV_SCB* p_scb, bool use_latency_mode) {
  L2CA_UseLatencyMode(p_scb->PeerAddress(), use_latency_mode);
  if (!L2CA_UseLatencyMode(p_scb->PeerAddress(), use_latency_mode)) {
    log::warn("Unable to set L2CAP latenty mode peer:{} use_latency_mode:{}",
              p_scb->PeerAddress(), use_latency_mode);
  }
}

/*******************************************************************************
@@ -1483,7 +1492,10 @@ void bta_av_api_set_latency(tBTA_AV_DATA* p_data) {
  tL2CAP_LATENCY latency = p_data->api_set_latency.is_low_latency
                               ? L2CAP_LATENCY_LOW
                               : L2CAP_LATENCY_NORMAL;
  L2CA_SetAclLatency(p_scb->PeerAddress(), latency);
  if (!L2CA_SetAclLatency(p_scb->PeerAddress(), latency)) {
    log::warn("Unable to set L2CAP latenty mode peer:{} use_latency_mode:{}",
              p_scb->PeerAddress(), latency);
  }
}

/**
+14 −4
Original line number Diff line number Diff line
@@ -306,8 +306,16 @@ void BTA_dm_on_hw_on() {
void bta_dm_disable() {
  /* Set l2cap idle timeout to 0 (so BTE immediately disconnects ACL link after
   * last channel is closed) */
  L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_BR_EDR);
  L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_LE);
  if (!L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_BR_EDR)) {
    log::warn(
        "Unable to set L2CAP idle timeout peer:{} transport:{} timeout:{}",
        RawAddress::kAny, BT_TRANSPORT_BR_EDR, 0);
  }
  if (!L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_LE)) {
    log::warn(
        "Unable to set L2CAP idle timeout peer:{} transport:{} timeout:{}",
        RawAddress::kAny, BT_TRANSPORT_LE, 0);
  }

  /* disable all active subsystems */
  bta_sys_disable();
@@ -1701,8 +1709,10 @@ void bta_dm_ble_subrate_request(const RawAddress& bd_addr, uint16_t subrate_min,
                                uint16_t subrate_max, uint16_t max_latency,
                                uint16_t cont_num, uint16_t timeout) {
    // Logging done in l2c_ble.cc
    L2CA_SubrateRequest(bd_addr, subrate_min, subrate_max, max_latency,
                        cont_num, timeout);
    if (!L2CA_SubrateRequest(bd_addr, subrate_min, subrate_max, max_latency,
                             cont_num, timeout)) {
      log::warn("Unable to set L2CAP ble subrating peer:{}", bd_addr);
    }
}

namespace bluetooth {
+6 −2
Original line number Diff line number Diff line
@@ -440,8 +440,12 @@ class HearingAidImpl : public HearingAid {
    log::info(
        "L2CA_UpdateBleConnParams for device {} min_ce_len:{} max_ce_len:{}",
        address, min_ce_len, max_ce_len);
    L2CA_UpdateBleConnParams(address, connection_interval, connection_interval,
                             0x000A, 0x0064 /*1s*/, min_ce_len, max_ce_len);
    if (!L2CA_UpdateBleConnParams(address, connection_interval,
                                  connection_interval, 0x000A, 0x0064 /*1s*/,
                                  min_ce_len, max_ce_len)) {
      log::warn("Unable to update L2CAP ble connection parameters peer:{}",
                address);
    }
    return connection_interval;
  }

Loading