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

Commit 078f3bb8 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Get rid of warning when connecting LE device

We are sending LE fixed channel notification to classic callback. Stop
doing that. This triggers following warning in log output on every
LE connection:
W bt_smp  : smp_br_connect_callback is called on unexpected transport 2

Test: manual with phone, verify warning is gone when connecting over LE
Change-Id: I47597fa03744fb1bff03d287f790ea32fa033cc7
parent 28faf875
Loading
Loading
Loading
Loading
+24 −18
Original line number Diff line number Diff line
@@ -2681,23 +2681,30 @@ void l2cu_process_fixed_chnl_resp(tL2C_LCB* p_lcb) {

  /* Tell all registered fixed channels about the connection */
  for (int xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx++) {
    uint16_t channel_id = xx + L2CAP_FIRST_FIXED_CHNL;

    /* See BT Spec Ver 5.0 | Vol 3, Part A 2.1 table 2.1 and 2.2 */

    /* skip sending LE fix channel callbacks on BR/EDR links */
    if (p_lcb->transport == BT_TRANSPORT_BR_EDR &&
        xx + L2CAP_FIRST_FIXED_CHNL >= L2CAP_ATT_CID &&
        xx + L2CAP_FIRST_FIXED_CHNL <= L2CAP_SMP_CID)
        channel_id >= L2CAP_ATT_CID && channel_id <= L2CAP_SMP_CID)
      continue;

    /* skip sending BR fix channel callbacks on LE links */
    if (p_lcb->transport == BT_TRANSPORT_LE && channel_id == L2CAP_SMP_BR_CID)
      continue;
    if (l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb != NULL) {
      if (p_lcb->peer_chnl_mask[(xx + L2CAP_FIRST_FIXED_CHNL) / 8] &
          (1 << ((xx + L2CAP_FIRST_FIXED_CHNL) % 8))) {

    if (!l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb) continue;

    if (p_lcb->peer_chnl_mask[(channel_id) / 8] & (1 << ((channel_id) % 8))) {
      if (p_lcb->p_fixed_ccbs[xx])
        p_lcb->p_fixed_ccbs[xx]->chnl_state = CST_OPEN;
        (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
                                                 p_lcb->remote_bd_addr, true, 0,
                                                 p_lcb->transport);
      (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(
          channel_id, p_lcb->remote_bd_addr, true, 0, p_lcb->transport);
    } else {
      (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(
            xx + L2CAP_FIRST_FIXED_CHNL, p_lcb->remote_bd_addr, false,
            p_lcb->disc_reason, p_lcb->transport);
          channel_id, p_lcb->remote_bd_addr, false, p_lcb->disc_reason,
          p_lcb->transport);

      if (p_lcb->p_fixed_ccbs[xx]) {
        l2cu_release_ccb(p_lcb->p_fixed_ccbs[xx]);
@@ -2706,7 +2713,6 @@ void l2cu_process_fixed_chnl_resp(tL2C_LCB* p_lcb) {
    }
  }
}
}
#endif

/*******************************************************************************