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

Commit 27175c3a authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Łukasz Rymanowski (xWF)
Browse files

l2cap: Workaround for PTS issue

Android is sending L2CAP_CONFIGURATION_REQ just after connection, which
is fine by spec, however PTS does not catch it sometimes.
Adding 5 sec delay helps. Note that the BT specification allows max
120 sec configuration timeout.

There is issue reported to PTS and once this is fixed on their side,
this can be reverted.

Bug: 371948052
Flag: Exempt, test code befind define
Test: mmm packages/modules/Bluetooth
Test: manual PTS L2CAP/FOC/BV-05-C
Change-Id: Ia0af0ea7777668c41130573cd8fcd89fa2d311c7
parent 3277d8f6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -119,6 +119,12 @@ static uint8_t pts_get_fcs_option(void) {
  log::info("Too many iterations: {}, return fcs = 0x01", fcs_opt_iter);
  return 1;
}

static void l2c_csm_send_config_req(tL2C_CCB* p_ccb);
static void l2c_ccb_pts_delay_config_timeout(void* data) {
  tL2C_CCB* p_ccb = (tL2C_CCB*)data;
  l2c_csm_send_config_req(p_ccb);
}
#endif

static uint8_t get_fcs_option(void) {
@@ -569,7 +575,13 @@ static void l2c_csm_term_w4_sec_comp(tL2C_CCB* p_ccb, tL2CEVT event, void* p_dat
        if (p_ccb->p_lcb->transport != BT_TRANSPORT_LE) {
          log::debug("Not LE connection, sending configure request");
          l2c_csm_send_connect_rsp(p_ccb);
#if (L2CAP_CONFORMANCE_TESTING == TRUE)
          // TODO: when b/374014194 is solved on PTS side, revert change adding this delay.
          alarm_set_on_mloop(p_ccb->pts_config_delay_timer, 5000, l2c_ccb_pts_delay_config_timeout,
                             p_ccb);
#else
          l2c_csm_send_config_req(p_ccb);
#endif
        } else {
          if (p_ccb->ecoc) {
            /* Handle Credit Based Connection */
+5 −0
Original line number Diff line number Diff line
@@ -282,6 +282,11 @@ struct tL2C_CCB {

  alarm_t* l2c_ccb_timer; /* CCB Timer Entry */

#if (L2CAP_CONFORMANCE_TESTING == TRUE)
  alarm_t* pts_config_delay_timer; /* Used to delay sending CONFIGURATION_REQ to overcome PTS issue
                                    */
#endif

  tL2C_RCB* p_rcb; /* Registration CB for this Channel */

#define IB_CFG_DONE 0x01
+10 −0
Original line number Diff line number Diff line
@@ -1466,6 +1466,11 @@ tL2C_CCB* l2cu_allocate_ccb(tL2C_LCB* p_lcb, uint16_t cid, bool is_eatt) {
  alarm_free(p_ccb->l2c_ccb_timer);
  p_ccb->l2c_ccb_timer = alarm_new("l2c.l2c_ccb_timer");

#if (L2CAP_CONFORMANCE_TESTING == TRUE)
  alarm_free(p_ccb->pts_config_delay_timer);
  p_ccb->pts_config_delay_timer = alarm_new("pts.delay");
#endif

  l2c_link_adjust_chnl_allocation();

  if (p_lcb != NULL) {
@@ -1575,6 +1580,11 @@ void l2cu_release_ccb(tL2C_CCB* p_ccb) {
  alarm_free(p_ccb->l2c_ccb_timer);
  p_ccb->l2c_ccb_timer = NULL;

#if (L2CAP_CONFORMANCE_TESTING == TRUE)
  alarm_free(p_ccb->pts_config_delay_timer);
  p_ccb->pts_config_delay_timer = NULL;
#endif

  fixed_queue_free(p_ccb->xmit_hold_q, osi_free);
  p_ccb->xmit_hold_q = NULL;