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

Commit 80356116 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

L2C_CSM: Send ConfigCfm to user after ConfigInd

This way, users know that a ConfigCfm event with status OK means channel
is established. No need to further keep track of state.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I90295349c53d57aa859c5bb65e6f28a299714b3d
parent 761066bf
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -766,6 +766,10 @@ static void l2c_csm_config(tL2C_CCB* p_ccb, uint16_t event, void* p_data) {
            p_ccb->local_cid, (p_cfg->flags & L2CAP_CFG_FLAGS_MASK_CONT));
        (*p_ccb->p_rcb->api.pL2CA_ConfigInd_Cb)(p_ccb->local_cid, p_cfg);
        l2c_csm_send_config_rsp_ok(p_ccb);
        if (p_ccb->config_done & OB_CFG_DONE) {
          (*p_ccb->p_rcb->api.pL2CA_ConfigCfm_Cb)(
              p_ccb->local_cid, p_ccb->remote_config_rsp_result);
        }
      } else if (cfg_result == L2CAP_PEER_CFG_DISCONNECT) {
        /* Disconnect if channels are incompatible */
        L2CAP_TRACE_EVENT("L2CAP - incompatible configurations disconnect");
@@ -832,7 +836,11 @@ static void l2c_csm_config(tL2C_CCB* p_ccb, uint16_t event, void* p_data) {

      L2CAP_TRACE_API("L2CAP - Calling Config_Rsp_Cb(), CID: 0x%04x",
                      p_ccb->local_cid);
      (*p_ccb->p_rcb->api.pL2CA_ConfigCfm_Cb)(p_ccb->local_cid, p_cfg->result);
      p_ccb->remote_config_rsp_result = p_cfg->result;
      if (p_ccb->config_done & IB_CFG_DONE) {
        (*p_ccb->p_rcb->api.pL2CA_ConfigCfm_Cb)(p_ccb->local_cid,
                                                p_cfg->result);
      }
      break;

    case L2CEVT_L2CAP_CONFIG_RSP_NEG: /* Peer config error rsp */
+1 −1
Original line number Diff line number Diff line
@@ -250,9 +250,9 @@ typedef struct t_l2c_ccb {
#define IB_CFG_DONE 0x01
#define OB_CFG_DONE 0x02
#define RECONFIG_FLAG 0x04 /* True after initial configuration */
#define CFG_DONE_MASK (IB_CFG_DONE | OB_CFG_DONE)

  uint8_t config_done; /* Configuration flag word */
  uint16_t remote_config_rsp_result; /* The config rsp result from remote */
  uint8_t local_id;    /* Transaction ID for local trans */
  uint8_t remote_id;   /* Transaction ID for local */