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

Commit 45661c40 authored by Jack He's avatar Jack He Committed by Gerrit Code Review
Browse files

Merge changes Iee13f611,Iff0818bb,I80347b12

* changes:
  eatt/l2cap: Add upper tester for L2CAP test cases
  Eatt: Improve colision handling
  l2cap: Improve ECOC creation handling
parents 645e6f98 8512f5bb
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -47,13 +47,39 @@ TRC_HID_DEV=2
# Use EATT for the notifications
#PTS_ForceEattForNotifications=true

# PTS L2CAP Ecoc upper tester (hijack eatt)
#PTS_L2capEcocUpperTester=true

# PTS L2CAP initial number of channels
#note: PTS_EnableL2capUpperTester shall be true
#PTS_L2capEcocInitialChanCnt=3

# PTS Min key size for L2CAP ECOC upper tester
# note: PTS_EnableL2capUpperTester shall be true
#PTS_L2capEcocMinKeySize=16

# PTS Send connect request after connect confirmation
# note: PTS_L2capEcocInitialChanCnt shall be less than 5
#PTS_L2capEcocConnectRemaining=true

#PTS L2CAP CoC schedule sending data after connection
# note: PTS_EnableL2capUpperTester shall be true
#PTS_L2capEcocSendNumOfSdu=2

# Start EATT without validation Server Supported Features
# note: PTS_EnableL2capUpperTester shall be true
#PTS_ConnectEattUncondictionally=true

# Trigger reconfiguration after connection
# note: PTS_EnableL2capUpperTester shall be true
#PTS_L2capEcocReconfigure=true

# Start EATT on unecrypted link
# note: PTS_EnableL2capUpperTester shall be true
#PTS_ConnectEattUnencrypted=true

# Force EATT implementation to connect EATT as a peripheral for collision test case
# note: PTS_EnableL2capUpperTester shall be true
#PTS_EattPeripheralCollionSupport=true

# Disable BR/EDR discovery after LE pairing to avoid cross key derivation errors
@@ -68,6 +94,9 @@ TRC_HID_DEV=2
# Start broadcast with unecryption mode
#PTS_BroadcastUnencrypted=true

# Use EATT for all services
#PTS_UseEattForAllServices=true

# SMP Certification Failure Cases
# Set any of the following SMP error values (from smp_api_types.h)
# to induce pairing failues for various PTS SMP test cases.
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,13 @@ typedef struct {
  bool (*get_pts_connect_eatt_before_encryption)(void);
  bool (*get_pts_unencrypt_broadcast)(void);
  bool (*get_pts_eatt_peripheral_collision_support)(void);
  bool (*get_pts_use_eatt_for_all_services)(void);
  bool (*get_pts_l2cap_ecoc_upper_tester)(void);
  int (*get_pts_l2cap_ecoc_min_key_size)(void);
  int (*get_pts_l2cap_ecoc_initial_chan_cnt)(void);
  bool (*get_pts_l2cap_ecoc_connect_remaining)(void);
  int (*get_pts_l2cap_ecoc_send_num_of_sdu)(void);
  bool (*get_pts_l2cap_ecoc_reconfigure)(void);
  config_t* (*get_all)(void);
} stack_config_t;

+49 −0
Original line number Diff line number Diff line
@@ -40,6 +40,13 @@ const char* PTS_CONNECT_EATT_UNENCRYPTED = "PTS_ConnectEattUnencrypted";
const char* PTS_BROADCAST_UNENCRYPTED = "PTS_BroadcastUnencrypted";
const char* PTS_EATT_PERIPHERAL_COLLISION_SUPPORT =
    "PTS_EattPeripheralCollionSupport";
const char* PTS_EATT_USE_FOR_ALL_SERVICES = "PTS_UseEattForAllServices";
const char* PTS_L2CAP_ECOC_UPPER_TESTER = "PTS_L2capEcocUpperTester";
const char* PTS_L2CAP_ECOC_MIN_KEY_SIZE = "PTS_L2capEcocMinKeySize";
const char* PTS_L2CAP_ECOC_INITIAL_CHAN_CNT = "PTS_L2capEcocInitialChanCnt";
const char* PTS_L2CAP_ECOC_CONNECT_REMAINING = "PTS_L2capEcocConnectRemaining";
const char* PTS_L2CAP_ECOC_SEND_NUM_OF_SDU = "PTS_L2capEcocSendNumOfSdu";
const char* PTS_L2CAP_ECOC_RECONFIGURE = "PTS_L2capEcocReconfigure";

static std::unique_ptr<config_t> config;
}  // namespace
@@ -142,6 +149,41 @@ static bool get_pts_eatt_peripheral_collision_support(void) {
                         PTS_EATT_PERIPHERAL_COLLISION_SUPPORT, false);
}

static bool get_pts_use_eatt_for_all_services(void) {
  return config_get_bool(*config, CONFIG_DEFAULT_SECTION,
                         PTS_EATT_USE_FOR_ALL_SERVICES, false);
}

static bool get_pts_l2cap_ecoc_upper_tester(void) {
  return config_get_bool(*config, CONFIG_DEFAULT_SECTION,
                         PTS_L2CAP_ECOC_UPPER_TESTER, false);
}

static int get_pts_l2cap_ecoc_min_key_size(void) {
  return config_get_int(*config, CONFIG_DEFAULT_SECTION,
                        PTS_L2CAP_ECOC_MIN_KEY_SIZE, -1);
}

static int get_pts_l2cap_ecoc_initial_chan_cnt(void) {
  return config_get_int(*config, CONFIG_DEFAULT_SECTION,
                        PTS_L2CAP_ECOC_INITIAL_CHAN_CNT, -1);
}

static bool get_pts_l2cap_ecoc_connect_remaining(void) {
  return config_get_bool(*config, CONFIG_DEFAULT_SECTION,
                         PTS_L2CAP_ECOC_CONNECT_REMAINING, false);
}

static int get_pts_l2cap_ecoc_send_num_of_sdu(void) {
  return config_get_int(*config, CONFIG_DEFAULT_SECTION,
                        PTS_L2CAP_ECOC_SEND_NUM_OF_SDU, -1);
}

static bool get_pts_l2cap_ecoc_reconfigure(void) {
  return config_get_bool(*config, CONFIG_DEFAULT_SECTION,
                         PTS_L2CAP_ECOC_RECONFIGURE, false);
}

static config_t* get_all(void) { return config.get(); }

const stack_config_t interface = {get_trace_config_enabled,
@@ -156,6 +198,13 @@ const stack_config_t interface = {get_trace_config_enabled,
                                  get_pts_connect_eatt_before_encryption,
                                  get_pts_unencrypt_broadcast,
                                  get_pts_eatt_peripheral_collision_support,
                                  get_pts_use_eatt_for_all_services,
                                  get_pts_l2cap_ecoc_upper_tester,
                                  get_pts_l2cap_ecoc_min_key_size,
                                  get_pts_l2cap_ecoc_initial_chan_cnt,
                                  get_pts_l2cap_ecoc_connect_remaining,
                                  get_pts_l2cap_ecoc_send_num_of_sdu,
                                  get_pts_l2cap_ecoc_reconfigure,
                                  get_all};

const stack_config_t* stack_config_get_interface(void) { return &interface; }
+4 −1
Original line number Diff line number Diff line
@@ -60,7 +60,10 @@ const stack_config_t interface = {nullptr, get_pts_avrcp_test,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr};
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr};

void Callback(uint8_t, bool, std::unique_ptr<::bluetooth::PacketBuilder>) {}

+4 −1
Original line number Diff line number Diff line
@@ -56,7 +56,10 @@ const stack_config_t interface = {nullptr, get_pts_avrcp_test,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr};
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr};

// TODO (apanicke): All the tests below are just basic positive unit tests.
// Add more tests to increase code coverage.
Loading