PTS: Allow disabling connection updates
Use Case: Certification test case requiring LE secure pairing
with PTS.
Failure:
LE pairing test cases follow the host behavior where
connection parameters are switched to fast parameters
for SMP and service discovery and switched back to the
default values after SMP/LE discovery is complete.
PTS disconnects to these series of connection updates.
Fix:
This change disables connection updates based on run time
flag "PTS_DisableConnUpdates" fetched from bt_stack.conf
Bug: 27852645
Change-Id: I1da213fd143ccfcb0ac82c7049a94094d2716ff1
diff --git a/conf/bt_stack.conf b/conf/bt_stack.conf
index a965ba9..7e7d64f 100644
--- a/conf/bt_stack.conf
+++ b/conf/bt_stack.conf
@@ -44,3 +44,6 @@
# Secure connections only mode.
# PTS_SecurePairOnly=true
+
+# Disable LE Connection updates
+#PTS_DisableConnUpdates=true
diff --git a/include/stack_config.h b/include/stack_config.h
index c249ad8..00395f4 100644
--- a/include/stack_config.h
+++ b/include/stack_config.h
@@ -35,6 +35,7 @@
bool (*get_btsnoop_should_save_last)(void);
bool (*get_trace_config_enabled)(void);
bool (*get_pts_secure_only_mode)(void);
+ bool (*get_pts_conn_updates_disabled)(void);
config_t *(*get_all)(void);
} stack_config_t;
diff --git a/main/stack_config.c b/main/stack_config.c
index 9df9bb8..1b86a37 100644
--- a/main/stack_config.c
+++ b/main/stack_config.c
@@ -30,6 +30,7 @@
const char *BTSNOOP_SHOULD_SAVE_LAST_KEY = "BtSnoopSaveLog";
const char *TRACE_CONFIG_ENABLED_KEY = "TraceConf";
const char *PTS_SECURE_ONLY_MODE = "PTS_SecurePairOnly";
+const char *PTS_LE_CONN_UPDATED_DISABLED = "PTS_DisableConnUpdates";
static config_t *config;
@@ -93,6 +94,10 @@
return config_get_bool(config, CONFIG_DEFAULT_SECTION, PTS_SECURE_ONLY_MODE, false);
}
+static bool get_pts_conn_updates_disabled(void) {
+ return config_get_bool(config, CONFIG_DEFAULT_SECTION, PTS_LE_CONN_UPDATED_DISABLED, false);
+}
+
static config_t *get_all(void) {
return config;
}
@@ -103,6 +108,7 @@
get_btsnoop_should_save_last,
get_trace_config_enabled,
get_pts_secure_only_mode,
+ get_pts_conn_updates_disabled,
get_all
};
diff --git a/stack/l2cap/l2c_ble.c b/stack/l2cap/l2c_ble.c
index 68d9845..4e7ad83 100644
--- a/stack/l2cap/l2c_ble.c
+++ b/stack/l2cap/l2c_ble.c
@@ -31,6 +31,7 @@
#include "btm_int.h"
#include "hcimsgs.h"
#include "device/include/controller.h"
+#include "stack_config.h"
#if (BLE_INCLUDED == TRUE)
@@ -151,6 +152,9 @@
*******************************************************************************/
BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable)
{
+ if (stack_config_get_interface()->get_pts_conn_updates_disabled())
+ return false;
+
tL2C_LCB *p_lcb;
/* See if we have a link control block for the remote device */