Merge pull request #577 from vrahane/mcumgr_changes

apps: Make corresponding MCUmgr changes
diff --git a/README.md b/README.md
index 07808b4..a6f4d04 100644
--- a/README.md
+++ b/README.md
@@ -109,7 +109,7 @@
 [developers mailing list](mailto:dev@mynewt.apache.org).
 
 Although not a formal channel, you can also find a number of core developers
-on the #mynewt channel on Freenode IRC or #general channel on [Mynewt Slack](https://join.slack.com/mynewt/shared_invite/MTkwMTg1ODM1NTg5LTE0OTYxNzQ4NzQtZTU1YmNhYjhkMg)
+on the #mynewt channel on Freenode IRC or #general channel on [Mynewt Slack](https://mynewt.slack.com/join/shared_invite/enQtNjA1MTg0NzgyNzg3LTcyMmZiOGQzOGMxM2U4ODFmMTIwNjNmYTE5Y2UwYjQwZWIxNTE0MTUzY2JmMTEzOWFjYWZkNGM0YmM4MzAxNWQ)
 
 Also, be sure to checkout the [Frequently Asked Questions](https://mynewt.apache.org/faq/answers)
 for some help troubleshooting first.
diff --git a/apps/btshell/src/cmd.c b/apps/btshell/src/cmd.c
index 6053b8d..317c530 100644
--- a/apps/btshell/src/cmd.c
+++ b/apps/btshell/src/cmd.c
@@ -154,8 +154,6 @@
     { NULL }
 };
 
-static bool adv_instances[BLE_ADV_INSTANCES];
-
 static int
 cmd_advertise_configure(int argc, char **argv)
 {
@@ -175,11 +173,6 @@
         return rc;
     }
 
-    if (adv_instances[instance]) {
-        console_printf("instance already configured\n");
-        return rc;
-    }
-
     memset(&params, 0, sizeof(params));
 
     params.legacy_pdu = parse_arg_bool_dflt("legacy", 0, &rc);
@@ -320,8 +313,6 @@
     console_printf("Instance %u configured (selected tx power: %d)\n",
                    instance, selected_tx_power);
 
-    adv_instances[instance] = true;
-
     return 0;
 }
 
@@ -343,11 +334,6 @@
         return rc;
     }
 
-    if (!adv_instances[instance]) {
-        console_printf("instance not configured\n");
-        return rc;
-    }
-
     rc = parse_arg_mac("addr", addr.val);
     if (rc != 0) {
         console_printf("invalid 'addr' parameter\n");
@@ -385,11 +371,6 @@
         return rc;
     }
 
-    if (!adv_instances[instance]) {
-        console_printf("instance not configured\n");
-        return rc;
-    }
-
     duration = parse_arg_uint16_dflt("duration", 0, &rc);
     if (rc != 0) {
         console_printf("invalid 'duration' parameter\n");
@@ -434,11 +415,6 @@
         return rc;
     }
 
-    if (!adv_instances[instance]) {
-        console_printf("instance not configured\n");
-        return rc;
-    }
-
     rc = btshell_ext_adv_stop(instance);
     if (rc) {
         console_printf("failed to stop advertising instance\n");
@@ -465,19 +441,12 @@
         return rc;
     }
 
-    if (!adv_instances[instance]) {
-        console_printf("instance not configured\n");
-        return rc;
-    }
-
     rc = ble_gap_ext_adv_remove(instance);
     if (rc) {
         console_printf("failed to remove advertising instance\n");
         return rc;
     }
 
-    adv_instances[instance] = false;
-
     return 0;
 }
 
@@ -1575,11 +1544,6 @@
         console_printf("invalid instance\n");
         return rc;
     }
-
-    if (!adv_instances[instance]) {
-        console_printf("instance not configured\n");
-        return rc;
-    }
 #endif
 
     tmp = parse_arg_uint8("flags", &rc);
diff --git a/apps/bttester/src/mesh.c b/apps/bttester/src/mesh.c
index 6bac3cc..e18a2a4 100644
--- a/apps/bttester/src/mesh.c
+++ b/apps/bttester/src/mesh.c
@@ -125,7 +125,7 @@
 	.relay = BT_MESH_RELAY_ENABLED,
 	.beacon = BT_MESH_BEACON_ENABLED,
 #if MYNEWT_VAL(BLE_MESH_FRIEND)
-	.frnd = BT_MESH_FRIEND_DISABLED,
+	.frnd = BT_MESH_FRIEND_ENABLED,
 #else
 	.frnd = BT_MESH_FRIEND_NOT_SUPPORTED,
 #endif
diff --git a/nimble/controller/include/controller/ble_ll.h b/nimble/controller/include/controller/ble_ll.h
index 6d5dac9..a854362 100644
--- a/nimble/controller/include/controller/ble_ll.h
+++ b/nimble/controller/include/controller/ble_ll.h
@@ -199,6 +199,7 @@
     STATS_SECT_ENTRY(aux_scan_rsp_err)
     STATS_SECT_ENTRY(aux_chain_cnt)
     STATS_SECT_ENTRY(aux_chain_err)
+    STATS_SECT_ENTRY(aux_scan_drop)
     STATS_SECT_ENTRY(adv_evt_dropped)
     STATS_SECT_ENTRY(scan_timer_stopped)
     STATS_SECT_ENTRY(scan_timer_restarted)
@@ -567,7 +568,7 @@
 extern uint32_t g_bletest_IVs;
 #endif
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 void ble_ll_dtm_init(void);
 #endif
 
diff --git a/nimble/controller/include/controller/ble_ll_scan.h b/nimble/controller/include/controller/ble_ll_scan.h
index e1f8197..5f36384 100644
--- a/nimble/controller/include/controller/ble_ll_scan.h
+++ b/nimble/controller/include/controller/ble_ll_scan.h
@@ -119,6 +119,7 @@
     uint8_t evt_type;
     struct ble_ll_sched_item sch;
     struct ble_ll_ext_adv_report *evt;
+    struct ble_npl_event ev;
 };
 
 struct ble_ll_scan_pdu_data {
diff --git a/nimble/controller/include/controller/ble_ll_sched.h b/nimble/controller/include/controller/ble_ll_sched.h
index 39955eb..4ad306d 100644
--- a/nimble/controller/include/controller/ble_ll_sched.h
+++ b/nimble/controller/include/controller/ble_ll_sched.h
@@ -214,7 +214,7 @@
 void ble_ll_sched_rfclk_chk_restart(void);
 #endif
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 int ble_ll_sched_dtm(struct ble_ll_sched_item *sch);
 #endif
 
diff --git a/nimble/controller/include/controller/ble_phy.h b/nimble/controller/include/controller/ble_phy.h
index 4638162..dd5250c 100644
--- a/nimble/controller/include/controller/ble_phy.h
+++ b/nimble/controller/include/controller/ble_phy.h
@@ -243,7 +243,7 @@
     return phy_mode;
 }
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 void ble_phy_enable_dtm(void);
 void ble_phy_disable_dtm(void);
 #endif
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 7992175..4afb1a0 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -45,7 +45,7 @@
 #include "controller/ble_ll_sync.h"
 #include "ble_ll_conn_priv.h"
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 #include "ble_ll_dtm_priv.h"
 #endif
 
@@ -205,6 +205,7 @@
     STATS_NAME(ble_ll_stats, aux_scan_rsp_err)
     STATS_NAME(ble_ll_stats, aux_chain_cnt)
     STATS_NAME(ble_ll_stats, aux_chain_err)
+    STATS_NAME(ble_ll_stats, aux_scan_drop)
     STATS_NAME(ble_ll_stats, adv_evt_dropped)
     STATS_NAME(ble_ll_stats, scan_timer_stopped)
     STATS_NAME(ble_ll_stats, scan_timer_restarted)
@@ -228,12 +229,7 @@
 #if MYNEWT
 
 /* The BLE LL task data structure */
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-/* TODO: This is for testing. Check it we really need it */
-#define BLE_LL_STACK_SIZE   (128)
-#else
 #define BLE_LL_STACK_SIZE   (90)
-#endif
 
 struct os_task g_ble_ll_task;
 
@@ -617,7 +613,7 @@
         case BLE_LL_STATE_INITIATING:
             ble_ll_conn_init_wfr_timer_exp();
             break;
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
         case BLE_LL_STATE_DTM:
             ble_ll_dtm_wfr_timer_exp();
             break;
@@ -717,7 +713,7 @@
     crcok = BLE_MBUF_HDR_CRC_OK(hdr);
     connection_data = (BLE_MBUF_HDR_RX_STATE(hdr) == BLE_LL_STATE_CONNECTION);
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     /* Reuse connection stats for DTM */
     connection_data = (BLE_MBUF_HDR_RX_STATE(hdr) == BLE_LL_STATE_DTM);
 #endif
@@ -794,7 +790,7 @@
         case BLE_LL_STATE_INITIATING:
             ble_ll_init_rx_pkt_in(pdu_type, rxbuf, ble_hdr);
             break;
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
         case BLE_LL_STATE_DTM:
             ble_ll_dtm_rx_pkt_in(m, ble_hdr);
             break;
@@ -930,7 +926,7 @@
     case BLE_LL_STATE_SCANNING:
         rc = ble_ll_scan_rx_isr_start(pdu_type, &rxhdr->rxinfo.flags);
         break;
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     case BLE_LL_STATE_DTM:
         rc = ble_ll_dtm_rx_isr_start(rxhdr, ble_phy_access_addr_get());
         break;
@@ -983,7 +979,7 @@
     ble_ll_trace_u32x3(BLE_LL_TRACE_ID_RX_END, pdu_type, len,
                        rxhdr->rxinfo.flags);
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     if (BLE_MBUF_HDR_RX_STATE(rxhdr) == BLE_LL_STATE_DTM) {
         rc = ble_ll_dtm_rx_isr_end(rxbuf, rxhdr);
         return rc;
@@ -1318,7 +1314,7 @@
     /* Stop any advertising */
     ble_ll_adv_reset();
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     ble_ll_dtm_reset();
 #endif
 
@@ -1628,7 +1624,7 @@
                             "ble_ll");
     SYSINIT_PANIC_ASSERT(rc == 0);
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     ble_ll_dtm_init();
 #endif
 
diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index 416b340..30bb3d9 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -811,7 +811,7 @@
 
     if (connsm->csmflags.cfbit.terminate_ind_rxd) {
         /* We just received terminate indication.
-         * Just sent empty packet as an ACK
+         * Just send empty packet as an ACK
          */
         CONN_F_EMPTY_PDU_TXD(connsm) = 1;
         goto conn_tx_pdu;
@@ -918,8 +918,7 @@
      * Set the more data data flag if we have more data to send and we
      * have not been asked to terminate
      */
-    if ((nextpkthdr || ((cur_offset + cur_txlen) < pktlen)) &&
-         !connsm->csmflags.cfbit.terminate_ind_rxd) {
+    if (nextpkthdr || ((cur_offset + cur_txlen) < pktlen)) {
         /* Get next event time */
         next_event_time = ble_ll_conn_get_next_sched_time(connsm);
 
diff --git a/nimble/controller/src/ble_ll_dtm.c b/nimble/controller/src/ble_ll_dtm.c
index c78a4b2..b0da5f9 100644
--- a/nimble/controller/src/ble_ll_dtm.c
+++ b/nimble/controller/src/ble_ll_dtm.c
@@ -20,7 +20,7 @@
 #include "syscfg/syscfg.h"
 #include "sysinit/sysinit.h"
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 
 #include <assert.h>
 #include "os/os.h"
@@ -49,6 +49,9 @@
     uint8_t itvl_rem_usec;
     uint16_t num_of_packets;
     uint32_t itvl_ticks;
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+    uint16_t num_of_packets_max;
+#endif
     int active;
     uint8_t rf_channel;
     uint8_t phy_mode;
@@ -140,6 +143,8 @@
 #define BLE_DTM_SYNC_WORD          (0x71764129)
 #define BLE_DTM_CRC                (0x555555)
 
+static void ble_ll_dtm_ctx_free(struct dtm_ctx * ctx);
+
 static void
 ble_ll_dtm_set_next(struct dtm_ctx *ctx)
 {
@@ -169,6 +174,18 @@
     }
     OS_EXIT_CRITICAL(sr);
 
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+    if (g_ble_ll_dtm_ctx.num_of_packets_max &&
+        (g_ble_ll_dtm_ctx.num_of_packets == g_ble_ll_dtm_ctx.num_of_packets_max)) {
+        /*
+         * XXX do not send more packets, but also do not stop DTM - it shall be
+         * stopped as usual by HCI command since there is no standard way to
+         * signal end of test to host.
+         */
+        return;
+    }
+#endif
+
     ble_ll_dtm_set_next(ctx);
     rc = ble_ll_sched_dtm(&ctx->sch);
     BLE_LL_ASSERT(rc == 0);
@@ -194,6 +211,8 @@
         return;
     }
 
+    g_ble_ll_dtm_ctx.num_of_packets++;
+
     /* Reschedule event in LL context */
     ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &ctx->evt);
 
@@ -249,7 +268,8 @@
 }
 
 static void
-ble_ll_dtm_calculate_itvl(struct dtm_ctx *ctx, uint8_t len, int phy_mode)
+ble_ll_dtm_calculate_itvl(struct dtm_ctx *ctx, uint8_t len,
+                          uint16_t cmd_interval, int phy_mode)
 {
     uint32_t l;
     uint32_t itvl_usec;
@@ -259,6 +279,12 @@
     l = ble_ll_pdu_tx_time_get(len + BLE_LL_PDU_HDR_LEN, phy_mode);
     itvl_usec = ((l + 249 + 624) / 625) * 625;
 
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+    if (cmd_interval > itvl_usec) {
+        itvl_usec = cmd_interval;
+    }
+#endif
+
     itvl_ticks = os_cputime_usecs_to_ticks(itvl_usec);
     ctx->itvl_rem_usec = (itvl_usec - os_cputime_ticks_to_usecs(itvl_ticks));
     if (ctx->itvl_rem_usec == 31) {
@@ -270,7 +296,8 @@
 
 static int
 ble_ll_dtm_tx_create_ctx(uint8_t packet_payload, uint8_t len,
-                         uint8_t rf_channel, uint8_t phy_mode)
+                         uint8_t rf_channel, uint8_t phy_mode,
+                         uint16_t cmd_interval, uint16_t cmd_pkt_count)
 {
     int rc = 0;
     uint8_t byte_pattern;
@@ -285,6 +312,10 @@
 
     g_ble_ll_dtm_ctx.phy_mode = phy_mode;
     g_ble_ll_dtm_ctx.rf_channel = rf_channel;
+    g_ble_ll_dtm_ctx.num_of_packets = 0;
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+    g_ble_ll_dtm_ctx.num_of_packets_max = cmd_pkt_count;
+#endif
 
     /* Set BLE transmit header */
     ble_hdr = BLE_MBUF_HDR_PTR(m);
@@ -344,7 +375,7 @@
     ble_npl_event_init(&g_ble_ll_dtm_ctx.evt, ble_ll_dtm_ev_tx_resched_cb,
                        &g_ble_ll_dtm_ctx);
 
-    ble_ll_dtm_calculate_itvl(&g_ble_ll_dtm_ctx, len, phy_mode);
+    ble_ll_dtm_calculate_itvl(&g_ble_ll_dtm_ctx, len, cmd_interval, phy_mode);
 
     /* Set some start point for TX packets */
     rc = ble_ll_sched_dtm(sch);
@@ -373,8 +404,7 @@
 #endif
 
     OS_ENTER_CRITICAL(sr);
-    rc = ble_phy_rx_set_start_time(os_cputime_get32() +
-                                   g_ble_ll_sched_offset_ticks, 0);
+    rc = ble_phy_rx_set_start_time(os_cputime_get32(), 0);
     OS_EXIT_CRITICAL(sr);
     if (rc && rc != BLE_PHY_ERR_RX_LATE) {
         return rc;
@@ -441,17 +471,28 @@
 }
 
 int
-ble_ll_dtm_tx_test(uint8_t *cmdbuf, bool enhanced)
+ble_ll_dtm_tx_test(uint8_t *cmdbuf, uint8_t cmdlen, bool enhanced)
 {
+    uint8_t cmdlen_valid;
     uint8_t tx_chan = cmdbuf[0];
     uint8_t len = cmdbuf[1];
     uint8_t packet_payload = cmdbuf[2];
     uint8_t phy_mode = BLE_PHY_MODE_1M;
+    uint16_t interval = 0;
+    uint16_t pkt_count = 0;
 
     if (g_ble_ll_dtm_ctx.active) {
         return BLE_ERR_CTLR_BUSY;
     }
 
+    cmdlen_valid = enhanced ? BLE_HCI_LE_ENH_TX_TEST_LEN : BLE_HCI_TX_TEST_LEN;
+
+#if !MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+    if (cmdlen != cmdlen_valid) {
+        return BLE_ERR_INV_HCI_CMD_PARMS;
+    }
+#endif
+
     if (enhanced) {
         switch (cmdbuf[3]) {
         case BLE_HCI_LE_PHY_1M:
@@ -479,7 +520,17 @@
         return BLE_ERR_INV_HCI_CMD_PARMS;
     }
 
-    if (ble_ll_dtm_tx_create_ctx(packet_payload, len, tx_chan, phy_mode)) {
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+    if (cmdlen == cmdlen_valid + 4) {
+        interval = get_le16(cmdbuf + cmdlen_valid );
+        pkt_count = get_le16(cmdbuf + cmdlen_valid  + 2);
+    } else if (cmdlen != cmdlen_valid) {
+        return BLE_ERR_INV_HCI_CMD_PARMS;
+    }
+#endif
+
+    if (ble_ll_dtm_tx_create_ctx(packet_payload, len, tx_chan, phy_mode,
+                                 interval, pkt_count)) {
         return BLE_ERR_UNSPECIFIED;
     }
 
diff --git a/nimble/controller/src/ble_ll_dtm_priv.h b/nimble/controller/src/ble_ll_dtm_priv.h
index 5341cd2..d6633f1 100644
--- a/nimble/controller/src/ble_ll_dtm_priv.h
+++ b/nimble/controller/src/ble_ll_dtm_priv.h
@@ -24,7 +24,7 @@
 #include <stdbool.h>
 #include "nimble/ble.h"
 
-int ble_ll_dtm_tx_test(uint8_t *cmdbuf, bool enhanced);
+int ble_ll_dtm_tx_test(uint8_t *cmdbuf, uint8_t cmdlen, bool enhanced);
 int ble_ll_dtm_rx_test(uint8_t *cmdbuf, bool enhanced);
 int ble_ll_dtm_end_test(uint8_t *rsp, uint8_t *rsplen);
 
diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index 18daf53..817d863 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -38,7 +38,7 @@
 #include "hal/hal_gpio.h"
 #endif
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 #include "ble_ll_dtm_priv.h"
 #endif
 
@@ -980,11 +980,9 @@
             rc = ble_ll_hci_le_read_supp_states(rspbuf, rsplen);
         }
         break;
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     case BLE_HCI_OCF_LE_TX_TEST:
-        if (len == BLE_HCI_TX_TEST_LEN) {
-            rc = ble_ll_dtm_tx_test(cmdbuf, false);
-        }
+        rc = ble_ll_dtm_tx_test(cmdbuf, len, false);
         break;
     case BLE_HCI_OCF_LE_RX_TEST:
         if (len == BLE_HCI_RX_TEST_LEN) {
@@ -1090,16 +1088,14 @@
         }
         break;
 #endif
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
     case BLE_HCI_OCF_LE_ENH_RX_TEST:
         if (len == BLE_HCI_LE_ENH_RX_TEST_LEN) {
             rc = ble_ll_dtm_rx_test(cmdbuf, true);
         }
         break;
     case BLE_HCI_OCF_LE_ENH_TX_TEST:
-        if (len == BLE_HCI_LE_ENH_TX_TEST_LEN) {
-            rc = ble_ll_dtm_tx_test(cmdbuf, true);
-        }
+        rc = ble_ll_dtm_tx_test(cmdbuf, len, true);
         break;
 #endif
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 36de954..4333881 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -169,19 +169,39 @@
 
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
 #if MYNEWT_VAL(BLE_LL_EXT_ADV_AUX_PTR_CNT) != 0
-static os_membuf_t ext_adv_mem[ OS_MEMPOOL_SIZE(
+static os_membuf_t ext_scan_aux_mem[ OS_MEMPOOL_SIZE(
                     MYNEWT_VAL(BLE_LL_EXT_ADV_AUX_PTR_CNT),
                     sizeof (struct ble_ll_aux_data))
 ];
 #else
-#define ext_adv_mem NULL
+#define ext_scan_aux_mem NULL
 #endif
 
-static struct os_mempool ext_adv_pool;
+static struct os_mempool ext_scan_aux_pool;
 
 static int ble_ll_scan_start(struct ble_ll_scan_sm *scansm,
                              struct ble_ll_sched_item *sch);
 
+static void
+ble_ll_aux_scan_drop_event_cb(struct ble_npl_event *ev)
+{
+    struct ble_ll_aux_data *aux_data = ble_npl_event_get_arg(ev);
+
+    ble_ll_scan_end_adv_evt(aux_data);
+    ble_ll_scan_aux_data_unref(aux_data);
+}
+
+static void
+ble_ll_aux_scan_drop(struct ble_ll_aux_data *aux_data)
+{
+    BLE_LL_ASSERT(aux_data);
+
+    STATS_INC(ble_ll_stats, aux_scan_drop);
+
+    ble_npl_event_init(&aux_data->ev, ble_ll_aux_scan_drop_event_cb, aux_data);
+    ble_ll_event_send(&aux_data->ev);
+}
+
 static int
 ble_ll_aux_scan_cb(struct ble_ll_sched_item *sch)
 {
@@ -195,14 +215,14 @@
      * just drop the scheduled item
      */
     if (!scansm->scan_enabled || scansm->cur_aux_data) {
-        ble_ll_scan_aux_data_unref(sch->cb_arg);
+        ble_ll_aux_scan_drop(sch->cb_arg);
         sch->cb_arg = NULL;
         goto done;
     }
 
     /* Check if there is no aux connect sent. If so drop the sched item */
     if (lls == BLE_LL_STATE_INITIATING && ble_ll_conn_init_pending_aux_conn_rsp()) {
-        ble_ll_scan_aux_data_unref(sch->cb_arg);
+        ble_ll_aux_scan_drop(sch->cb_arg);
         sch->cb_arg = NULL;
         goto done;
     }
@@ -245,7 +265,7 @@
 {
     struct ble_ll_aux_data *e;
 
-    e = os_memblock_get(&ext_adv_pool);
+    e = os_memblock_get(&ext_scan_aux_pool);
     if (!e) {
         return -1;
     }
@@ -518,7 +538,7 @@
     struct ble_ll_scan_sm *scansm = &g_ble_ll_scan_sm;
 
     /* If scanner was reading aux ptr, we need to clean it up */
-    if (scansm && scansm->cur_aux_data) {
+    if (scansm->cur_aux_data) {
         ble_ll_scan_end_adv_evt(scansm->cur_aux_data);
         ble_ll_scan_aux_data_unref(scansm->cur_aux_data);
         scansm->cur_aux_data = NULL;
@@ -1123,7 +1143,7 @@
             ble_hci_trans_buf_free((uint8_t *)aux_data->evt);
             aux_data->evt = NULL;
         }
-        os_memblock_put(&ext_adv_pool, aux_data);
+        os_memblock_put(&ext_scan_aux_pool, aux_data);
         STATS_INC(ble_ll_stats, aux_freed);
     }
 }
@@ -3940,7 +3960,7 @@
 
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     /* clear memory pool for AUX scan results */
-    os_mempool_clear(&ext_adv_pool);
+    os_mempool_clear(&ext_scan_aux_pool);
 #endif
 
     /* Call the common init function again */
@@ -3959,10 +3979,10 @@
     os_error_t err;
 
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    err = os_mempool_init(&ext_adv_pool,
+    err = os_mempool_init(&ext_scan_aux_pool,
                           MYNEWT_VAL(BLE_LL_EXT_ADV_AUX_PTR_CNT),
                           sizeof (struct ble_ll_aux_data),
-                          ext_adv_mem,
+                          ext_scan_aux_mem,
                           "ble_ll_aux_scan_pool");
     BLE_LL_ASSERT(err == 0);
 #endif
diff --git a/nimble/controller/src/ble_ll_sched.c b/nimble/controller/src/ble_ll_sched.c
index fa9b013..29742c2 100644
--- a/nimble/controller/src/ble_ll_sched.c
+++ b/nimble/controller/src/ble_ll_sched.c
@@ -1793,7 +1793,7 @@
 }
 #endif
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 int ble_ll_sched_dtm(struct ble_ll_sched_item *sch)
 {
     int rc;
diff --git a/nimble/controller/src/ble_ll_supp_cmd.c b/nimble/controller/src/ble_ll_supp_cmd.c
index 74ad601..8f62ed3 100644
--- a/nimble/controller/src/ble_ll_supp_cmd.c
+++ b/nimble/controller/src/ble_ll_supp_cmd.c
@@ -137,7 +137,7 @@
 #endif
 #define BLE_SUPP_CMD_LE_READ_SUPP_STATES    (1 << 3)
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 #define BLE_SUPP_CMD_LE_RX_TEST             (1 << 4)
 #define BLE_SUPP_CMD_LE_TX_TEST             (1 << 5)
 #define BLE_SUPP_CMD_LE_TEST_END            (1 << 6)
@@ -233,7 +233,7 @@
 #define BLE_SUPP_CMD_LE_SET_PHY             (0 << 6)
 #endif
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 #define BLE_SUPP_CMD_LE_ENHANCED_RX_TEST    (1 << 7)
 #else
 #define BLE_SUPP_CMD_LE_ENHANCED_RX_TEST    (0 << 7)
@@ -252,7 +252,7 @@
 )
 
 /* Octet 36 */
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 #define BLE_SUPP_CMD_LE_ENHANCED_TX_TEST    (1 << 0)
 #else
 #define BLE_SUPP_CMD_LE_ENHANCED_TX_TEST    (0 << 0)
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index 40b2e0f..5c834c2 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -292,9 +292,27 @@
             be used.
         value: "(uint8_t[6]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
 
-    BLE_LL_DIRECT_TEST_MODE:
+    BLE_LL_DTM:
         description: >
              Enables HCI Test commands needed for Bluetooth SIG certification
+        value: MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+    BLE_LL_DTM_EXTENSIONS:
+        description: >
+             Enables non-standard extensions to HCI test commands. Once enabled,
+             HCI_LE_Transmitter_Test accepts extra parameters in addition to
+             those defined in Core specification
+               interval (2 octets)   interval between packets (usecs), overrides
+                                     standard interval
+               pkt_count (2 octets)  number of packets to transmit, controller
+                                     will automatically stop sending packets
+                                     after given number of packets was sent
+             Setting either of these parameters to 0 will configure for default
+             behavior, as per Core specification.
+             If specified interval is shorter then allowed by specification it
+             will be ignored.
+             Extended parameters shall immediately follow standard parameters.
+             Controller can accept both standard and extended version of command
+             depending on specified HCI command length.
         value: 0
 
     BLE_LL_VND_EVENT_ON_ASSERT:
@@ -322,6 +340,12 @@
             was sent from controller.
         value: -1
 
+# deprecated settings (to be defunct/removed eventually)
+    BLE_LL_DIRECT_TEST_MODE:
+        description: use BLE_LL_DTM instead
+        value: 0
+        deprecated: 1
+
 # defunct settings (to be removed eventually)
     BLE_DEVICE:
         description: Superseded by BLE_CONTROLLER
diff --git a/nimble/drivers/nrf52/src/ble_phy.c b/nimble/drivers/nrf52/src/ble_phy.c
index a08ca88..3b62660 100644
--- a/nimble/drivers/nrf52/src/ble_phy.c
+++ b/nimble/drivers/nrf52/src/ble_phy.c
@@ -2061,7 +2061,7 @@
 }
 #endif
 
-#if MYNEWT_VAL(BLE_LL_DIRECT_TEST_MODE)
+#if MYNEWT_VAL(BLE_LL_DTM)
 void ble_phy_enable_dtm(void)
 {
     /* When DTM is enabled we need to disable whitening as per
diff --git a/nimble/host/pts/pts-gap.txt b/nimble/host/pts/pts-gap.txt
index e7770e3..29ed244 100644
--- a/nimble/host/pts/pts-gap.txt
+++ b/nimble/host/pts/pts-gap.txt
@@ -1,7 +1,7 @@
 PTS test results for GAP
 
-PTS version: 7.0
-Tested: 18-Jul-2017
+PTS version: 7.5.0
+Tested: 27-Sept-2019
 
 Results:
 PASS	test passed
@@ -12,417 +12,356 @@
 -------------------------------------------------------------------------------
 Test Name		Result	Notes
 -------------------------------------------------------------------------------
-TC_MOD_NDIS_BV_01_C	N/A
-TC_MOD_LDIS_BV_01_C	N/A
-TC_MOD_LDIS_BV_02_C	N/A
-TC_MOD_LDIS_BV_03_C	N/A
-TC_MOD_GDIS_BV_01_C	N/A
-TC_MOD_GDIS_BV_02_C	N/A
-TC_MOD_NCON_BV_01_C	N/A
-TC_MOD_CON_BV_01_C	N/A
--------------------------------------------------------------------------------
 
-TC_BROB_BCST_BV_01_C	PASS	b adv conn=non
-TC_BROB_BCST_BV_02_C	PASS	b adv conn=non
-TC_BROB_BCST_BV_03_C	PASS	b set irk=<IRK> e.g: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:11
+GAP/BROB/BCST/BV-01-C	PASS	advertise-configure legacy=1 connectable=0 scannable=0
+GAP/BROB/BCST/BV-02-C	PASS	advertise-configure legacy=1 connectable=0 scannable=0
+
+GAP/BROB/BCST/BV-03-C	PASS	set irk=<IRK> e.g: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:11
 				Note: in PTS IXIT please set:
 				TSPX_iut_device_IRK_for_resolvable_privacy_address_generation_procedure=11000000000000000000000000000000
-				b set adv_data flags=4
-				b adv conn=non disc=non own_addr_type=rpa_pub
-TC_BROB_BCST_BV_04_C	PASS
-				TSPX_advertising_data=07086E696D626C65
-				set-adv-data name=nimble
-                set addr_type=random addr=01:3e:56:f7:46:21
-				advertise conn=non own_addr_type=random
-TC_BROB_BCST_BV_05_C	PASS
-				TSPX_advertising_data=07086E696D626C65
-				TSPX_iut_device_IRK_for_resolvable_privacy_address_generation_procedure=11000000000000000000000000000000
-				set-adv-data name=nimble
-				set irk=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:11
-				advertise conn=non own_addr_type=rpa_pub
-TC_BROB_OBSV_BV_01_C	PASS	b scan passive
-TC_BROB_OBSV_BV_02_C	PASS	b scan
-TC_BROB_OBSV_BV_03_C	N/A
-TC_BROB_OBSV_BV_04_C	N/A
-TC_BROB_OBSV_BV_05_C	N/A
-TC_BROB_OBSV_BV_06_C	N/A
+				set advertise-set-adv-data name=<name> flags=4
+				advertise-configure connectable=0 scannable=0 own_addr_type=rpa_pub
+GAP/BROB/BCST/BV-04-C	PASS    TSPX_advertising_data=07086E696D626C65
+				advertise-set-adv-data name=nimble
+				set addr_type=random addr=01:3e:56:f7:46:21
+				advertise-configure connectable=0 scannable=0 own_addr_type=random
+GAP/BROB/BCST/BV-05-C	N/A
+GAP/BROB/OBSV/BV-01-C	PASS	scan passive
+GAP/BROB/OBSV/BV-02-C	PASS	scan
+GAP/BROB/OBSV/BV-03-C	PASS	scan
+GAP/BROB/OBSV/BV-04-C	PASS	connect peer_addr=<addr>
+				security-set-data bonding=1
+				security-pair conn=<handle>
+				<OK>
+				<OK>
+GAP/BROB/OBSV/BV-05-C	PASS	scan own_addr_type=rpa_pub
+GAP/BROB/OBSV/BV-06-C	PASS	scan own_addr_type=rpa_pub
 -------------------------------------------------------------------------------
 
-TC_DISC_NONM_BV_01_C	PASS	b adv conn=non disc=non
-TC_DISC_NONM_BV_02_C	PASS	b adv conn=und disc=non
-TC_DISC_LIMM_BV_01_C	N/A
-TC_DISC_LIMM_BV_02_C	N/A
-TC_DISC_LIMM_BV_03_C	PASS	b set adv_data flags=5
-				b adv conn=non disc=ltd
-TC_DISC_LIMM_BV_04_C	PASS	b set adv_data flags=5
-				b adv conn=und disc=ltd
-TC_DISC_GENM_BV_01_C	N/A
-TC_DISC_GENM_BV_02_C	N/A
-TC_DISC_GENM_BV_03_C	PASS	b set adv_data flags=6
-				b adv conn=non disc=gen
-TC_DISC_GENM_BV_04_C	PASS	b set adv_data flags=6
-				b adv conn=und disc=gen
-TC_DISC_LIMP_BV_01_C	PASS	b scan ltd=1 nodups=1
-TC_DISC_LIMP_BV_02_C	PASS	b scan ltd=1 nodups=1
-TC_DISC_LIMP_BV_03_C	PASS	b scan ltd=1 nodups=1
-TC_DISC_LIMP_BV_04_C	PASS	b scan ltd=1 nodups=1
-TC_DISC_LIMP_BV_05_C	PASS	b scan ltd=1 nodups=1
-TC_DISC_GENP_BV_01_C	PASS	b scan nodups=1
-TC_DISC_GENP_BV_02_C	PASS	b scan nodups=1
-TC_DISC_GENP_BV_03_C	PASS    b scan nodups=1
-				verify that PTS has note: "Non discoverable mode"
-TC_DISC_GENP_BV_04_C	PASS	b scan nodups=1
-				verify that PTS has note: "Non discoverable mode"
-TC_DISC_GENP_BV_05_C	PASS	b scan nodups=1
-				verify that advertising event has: "Connection directed advertising event"
-TC_DISC_RPA_BV_01_C	N/A
+GAP/DISC/NONM/BV-01-C	PASS	advertise-configure connectable=0 legacy=1 adverdise=non
+GAP/DISC/NONM/BV-02-C	PASS	advertise-configure connectable=0
+
+GAP/DISC/LIMM/BV-01-C	N/A
+GAP/DISC/LIMM/BV-02-C	N/A
+GAP/DISC/LIMM/BV-03-C	PASS	advertise-configure legacy=1 connectable=0
+				advertise-set-adv-data flags=5
+				advertise-start duration= e.g.3000
+GAP/DISC/LIMM/BV-04-C	PASS	advertise-configure legacy=1 connectable=0
+				advertise-set-adv-data flags=5
+				advertising-start duration=<e.g.3000>
+GAP/DISC/GENM/BV-01-C	N/A
+GAP/DISC/GENM/BV-02-C	N/A
+GAP/DISC/GENM/BV-03-C	PASS	advertise-configure legacy=1 connectable=0
+				advertise-set-adv-data flags=6
+				advertise-start
+GAP/DISC/GENM/BV-04-C	PASS	advertise-configure legacy=1 connectable=0
+				advertise-set-adv-data flags=6
+				advertising-start
+
+GAP/DISC/LIMP/BV-01-C	PASS	scan limited=1 nodups=1
+GAP/DISC/LIMP/BV-02-C	PASS	scan limited=1 nodups=1
+GAP/DISC/LIMP/BV-03-C	PASS	scan limited=1 nodups=1
+GAP/DISC/LIMP/BV-04-C	PASS	scan limited=1 nodups=1
+GAP/DISC/LIMP/BV-05-C	PASS	scan limited=1 nodups=1
+
+GAP/DISC/GENP/BV-01-C	PASS	scan nodups=1
+GAP/DISC/GENP/BV-02-C	PASS	scan nodups=1
+GAP/DISC/GENP/BV-03-C	PASS	scan nodups=1
+				<OK>
+GAP/DISC/GENP/BV-04-C	PASS	scan nodups=1
+				<OK>
+GAP/DISC/GENP/BV-05-C	PASS	scan nodups=1
+
+GAP/DISC/RPA/BV-01-C	N/A		scan nodups=1
 -------------------------------------------------------------------------------
 
-TC_IDLE_GIN_BV_01_C	N/A
-TC_IDLE_LIN_BV_01_C	N/A
-TC_IDLE_NAMP_BV_01_C	PASS	<answer NO to role question>
-				b adv
-				b disc svc conn=<handle>
-				b show chr
+GAP/IDLE/GIN/BV-01-C	N/A
+GAP/IDLE/GIN/BV-02-C	N/A
+GAP/IDLE/NAMP/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertising-start
+				gatt-discover-full conn=<handle>
+				gatt-show
 				<check start end handle for 0x1800>
-				b read conn=<handle> uuid=0x2a00 start=<start> end=<end>
-				b term conn=<handle>
-TC_IDLE_NAMP_BV_02_C	PASS	<answer NO to role question>
-				b adv
+				gatt-read conn=<handle> uuid=0x2a00 start=<start> end=<end>
+				disconnect conn=<handle>
+GAP/IDLE/NAMP/BV-02-C	PASS	<answer NO to role question>
+				advertise-configure connectable=1 legacy=1
+				advertising-start
+GAP/IDLE/DED/BV-01-C	N/A
+GAP/IDLE/DED/BV-02-C	N/A
 -------------------------------------------------------------------------------
 
-TC_CONN_NCON_BV_01_C	PASS	b adv conn=non
-TC_CONN_NCON_BV_02_C	PASS	b set adv_data flags=6
-				b adv conn=non disc=gen
-TC_CONN_NCON_BV_03_C	PASS	b set adv_data flags=5
-				b adv conn=non disc=ltd
-TC_CONN_DCON_BV_01_C	PASS	b adv conn=dir peer_addr_type=public peer_addr=<addr>
-TC_CONN_DCON_BV_02_C	N/A
-TC_CONN_DCON_BV_03_C	N/A
-TC_CONN_UCON_BV_01_C	PASS	b adv conn=und disc=non
-TC_CONN_UCON_BV_02_C	PASS	b adv conn=und disc=gen
-TC_CONN_UCON_BV_03_C	PASS	b adv conn=und disc=ltd
-TC_CONN_UCON_BV_04_C	N/A
-TC_CONN_UCON_BV_05_C	N/A
-TC_CONN_UCON_BV_06_C	PASS	b set adv_data flags=6
-				b set sm_data bonding=1 our_key_dist=7 their_key_dist=7
-				b set irk=<IRK> e.g: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:11
-				Note: in PTS IXIT please set:
-				TSPX_iut_device_IRK=11000000000000000000000000000000
-				TSPX_iut_private_address_interval=5000
-				set BLE_RPA_TIMEOUT: 5 in syscfg.yml
-				b adv own_addr_type=rpa_pub
-                <wait for 5 seconds>
-				b adv own_addr_type=rpa_pub
-TC_CONN_ACEP_BV_01_C	PASS	b wl addr=<addr> addr_type=public
-				b conn addr_type=wl
-				b term conn=<handle>
-TC_CONN_ACEP_BV_02_C	PASS
-				set addr_type=random addr=<NRPA> e.g: 01:3e:56:f7:46:21
-				white-list addr=<PTS-ADDR> addr_type=public
+GAP/CONN/NCON/BV-01-C	PASS	advertise-configure connectable=0 legacy=1
+				advertising-start
+GAP/CONN/NCON/BV-02-C	PASS	advertise-configure connectable=0 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+GAP/CONN/NCON/BV-03-C	PASS	advertise-configure connectable=0 legacy=1
+				advertise-set-adv-data flags=5
+				advertise-start
+
+GAP/CONN/DCON/BV-01-C	PASS	advertise-configure connectable=0 directed=1 peer_addr=<addr>
+				advertise-start
+GAP/CONN/DCON/BV-02-C	N/A
+GAP/CONN/DCON/BV-03-C	N/A
+
+GAP/CONN/UCON/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=4
+				advertise-start
+GAP/CONN/UCON/BV-02_C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=5
+				advertise-start
+GAP/CONN/UCON/BV-03_C	PASS	adbertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+GAP/CONN/UCON/BV-04_C	N/A
+GAP/CONN/UCON/BV-05_C	N/A
+GAP/CONN/UCON/BV-06_C	N/A
+
+GAP/CONN/ACEP/BV-01-C	PASS	white-list addr_type=public addr=<addr>
 				connect
-				Note: Discover Reconnect Address Characteristic and use value handle
-				gatt-write conn=1 attr=7 value=21:46:f7:56:3e:01
+				disconnect conn=<handle>
+GAP/CONN/ACEP/BV-02-C	N/A
+
+GAP/CONN/GCEP/BV-01-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+GAP/CONN/GCEP/BV-02-C	PASS	connect peer_addr=<addr>
+GAP/CONN/GCEP/BV-03-C	PASS	set irk=<irk>
+				connect peer_addr=<addr> own_addr_type=rpa_pub
+				security-set-data bonding=1 our_key_dist=7 their_key_dist=7
+				security-pair conn=<handle>
+				connect peer_addr=<addr>
 				disconnect conn=1
-				white-list addr=01:3e:56:f7:46:21 addr_type=random
-				connect own_addr_type=random
-TC_CONN_ACEP_BV_03_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_ACEP_BV_04_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_GCEP_BV_01_C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-TC_CONN_GCEP_BV_02_C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-TC_CONN_GCEP_BV_03_C	N/A
-TC_CONN_GCEP_BV_04_C	N/A
-TC_CONN_GCEP_BV_05_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_GCEP_BV_06_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_SCEP_BV_01_C	PASS	b wl addr=<addr> addr_type=public
-				b conn addr_type=wl
-				b term conn=<handle>
-TC_CONN_SCEP_BV_02_C	N/A
-TC_CONN_SCEP_BV_03_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_DCEP_BV_01_C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-TC_CONN_DCEP_BV_02_C	N/A
-TC_CONN_DCEP_BV_03_C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-TC_CONN_DCEP_BV_04_C	N/A
-TC_CONN_DCEP_BV_05_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_DCEP_BV_06_C	INCONC
-				PTS 7.3.0 requires IUT to be able to add PTS's Identity
-				to resolv list without pairing
-TC_CONN_CPUP_BV_01_C	PASS	b adv
-				b l2cap update conn=<handle>
-TC_CONN_CPUP_BV_02_C	PASS	b adv
-				b l2cap update conn=<handle>
-TC_CONN_CPUP_BV_03_C	PASS	b adv
-				b l2cap update conn=<handle>
-TC_CONN_CPUP_BV_04_C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-TC_CONN_CPUP_BV_05_C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-TC_CONN_TERM_BV_01_C	PASS	<answer NO to role question>
-				b adv conn=und disc=non
-				b term conn=1
-TC_CONN_PRDA_BV_01_C	PASS	b set adv_data flags=6
-				b set sm_data bonding=1 our_key_dist=7 their_key_dist=7
-				b set irk=<IRK> e.g: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:11
-				Note: in PTS IXIT please set:
-					TSPX_uit_device_IRK=11000000000000000000000000000000
-				b adv
-				b term conn=<handle>
-				b adv own_addr_type=rpa_pub
-				b term conn=<handle>
-				b adv own_addr_type=rpa_pub
-				b term conn=<handle>
-TC_CONN_PRDA_BV_02_C	N/A
+GAP/CONN/GCEP/BV-04-C	N/A
+GAP/CONN/SCEP/BV-01-C	PASS	white-list addr_type=public addr=<addr>
+				connect
+				disconnect conn=<handle>
+GAP/CONN/SCEP/BV-02-C	INC
+GAP/CONN/DCEP/BV-01-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+GAP/CONN/DCEP/BV-02-C	INC
+GAP/CONN/DCEP/BV-03-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+GAP/CONN/DCEP/BV-04-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+
+GAP/CONN/CPUP/BV-01-C	PASS	advertise-start
+				conn-update-params conn=<handle>
+GAP/CONN/CPUP/BV-02-C	PASS	advertise-start
+				conn-update-params conn=<handle>
+GAP/CONN/CPUP/BV-03-C	PASS	advertise-start
+				conn-update-params conn=<handle>
+GAP/CONN/CPUP/BV-04-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+GAP/CONN/CPUP/BV-05-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+GAP/CONN/CPUP/BV-06-C	PASS	conect peer_addr=<addr>
+				conn-update-params conn=<handle> eg.latency=20
+				disconnect conn=<handle>
+GAP/CONN/CPUP/BV-08-C	PASS	advertise-configure legacy=1 connectable=1
+				advertise-set-data name=<name>
+				advertise-start
+
+GAP/CONN/TERM/BV-01-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+GAP/CONN/PRDA/BV-01-C	N/A
+GAP/CONN/PRDA/BV-02-C	N/A
+-------------------------------------------------------------------------------
+GAP/BOND/NBON/BV-01-C	PASS	security-set-data bonding=0
+				connect peer_addr=<addr>
+				<ok>
+				connect peer_addr=<addr>
+				<ok>
+GAP/BOND/NBON/BV-02-C	PASS	security-set-data bonding=0
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				<ok>
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				<ok>
+GAP/BOND/NBON/BV-03-C	PASS	security-set-data bonding=0
+				advertise-configure legacy=1 connectable=1
+				advertise-set-data name=<name>
+				advertise-start
+				<ok>
+
+GAP/BOND/BON/BV-01-C	PASS	security-set-data bonding=1 sc=1 our_key_dist=7 their_key_dist=7
+				advertise-configure legacy=1 connectable=1
+				advertise-start
+				security-start conn=<handle>
+				<ok>
+				advertise-start
+				<ok>
+GAP/BOND/BON/BV-02-C	PASS	security-set-data bonding=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				<ok>
+				connect peer_addr=<addr>
+				seccurity-pair conn=<handle>
+				<ok>
+GAP/BOND/BON/BV-03-C	PASS	security-set-sm-data bonding=1 our_key_dist=7 their_key_dist=7
+				advertise-configure legacy=1 connectable=1
+				advertise-start
+				<ok>
+				advertise-start
+				<ok>
+GAP/BOND/BON/BV-04-C	PASS	security-set-data bonding=1
+				connect-peer_addr=<addr>
+				disconnect conn=<handle>
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-TC_BOND_NBON_BV_01_C	PASS	b set sm_data bonding=0
-				b conn peer_addr=<addr>
-				<ok>
-				b conn peer_addr=<addr>
-				<ok>
-TC_BOND_NBON_BV_02_C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				<ok>
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				<ok>
-TC_BOND_NBON_BV_03_C	PASS	b adv conn=und
-				<ok>
-TC_BOND_BON_BV_01_C	PASS	b set sm_data bonding=1
-				b adv
-				b sec start conn=<handle>
-                <ok>
-				b adv
-				<ok>
-TC_BOND_BON_BV_02_C	PASS	b set sm_data bonding=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-                <ok>
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-                <ok>
-TC_BOND_BON_BV_03_C	PASS	b set sm_data bonding=1 our_key_dist=7 their_key_dist=7
-				b adv
-				<ok>
-				b adv
-				<ok>
-TC_BOND_BON_BV_04_C	PASS	b set sm_data bonding=1
-				b conn peer_addr=<addr>
-				b term conn=<handle>
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				b term conn=<handle>
--------------------------------------------------------------------------------
-
-TC_SEC_AUT_BV_11_C	PASS	b set sm_data io_capabilities=1
-				b adv
+GAP/SEC/AUT/BV-11-C	PASS	security-set-data io_capabilities=1 sc=1
+				advertise-configure legacy=1 connectable=1
+				advertising-start
+				Note: in PTS enter handle for characteristics
+				      value which requires encryption for read (gatt-show-local)
+				auth-passkey conn=<handle> action=3 key=123456
+				Note: enter '123456' passkey in PTS
+GAP/SEC/AUT/BV-12-C	PASS	security-set-data io_capabilities=1 bonding=1 mitm_flag=1 sc=1 our_key_dist=7 their_key_dist=7
+				connect peer_addr=<addr>
+				gatt-show-local
 				Note: in PTS enter handle for characteristics
 				      value which requires encryption for read
-				b passkey conn=<handle> action=3 key=123456
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter '123456' passkey in PTS
-TC_SEC_AUT_BV_12_C	PASS	b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
-				b disc svc conn=<handle>
+GAP/SEC/AUT/BV-13-C	PASS	Note: in PTS confirm that IUT supports GATT Server
+				security-set-data io_capabilities=1 bonding=1 mitm_flag=1 sc=1 our_key_dist=7 their_key_dist=7
+				connect peer_addr=<addr>
+				gatt-show-local
 				Note: in PTS enter handle for characteristics
-				      value which requires encryption for read
-TC_SEC_AUT_BV_13_C	PASS	Note: in PTS confirm that IUT supports GATT Server
-				b set sm_data mitm_flag=1
-				b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
-				b disc svc conn=<handle>
-				Note: in PTS enter handle for characteristics
-				      value which requires authenticated
-				      pairing for read
-				b passkey conn=<handle> action=3 key=123456
+				      value which requires authenticated pairing for read
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter '123456' passkey in PTS
-TC_SEC_AUT_BV_14_C	PASS	b set sm_data io_capabilities=1
-				b adv
+GAP/SEC/AUT/BV-14-C	PASS	security-set-data io_capabilities=1
+				advertise-configure legacy=1 connectable=1
+				advertise-start
+				gatt-show-local
 				Note: in PTS enter handle for characteristics
-				      value which requires authenticated
-				      pairing for read
-				b passkey conn=<handle> action=3 key=123456
+				      value which requires authenticated pairing for read
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter '123456' passkey in PTS
-				Note: enter handle for characteristics value which
-				      requires authentication
-TC_SEC_AUT_BV_15_C	N/A
-TC_SEC_AUT_BV_16_C	N/A
-TC_SEC_AUT_BV_17_C	PASS	b conn peer_addr=<addr>
-				b disc full conn=<handle>
-				b read conn=<handle> attr=<val_handle>
-				b set sm_data bonding=1
-				b sec pair conn=<handle>
-                b term conn=1
-TC_SEC_AUT_BV_18_C	PASS	b adv
-				b disc full conn=<handle>
-				b read conn=<handle> attr=<val_handle>
-				b sec start conn=<handle>
-				b read conn=<handle> attr=<val_handle>
-TC_SEC_AUT_BV_19_C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				<ok>
-				b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				b sec pair conn=<handle>
-				b read conn=<handle> attr=<val_handle>
-				b term conn=<handle>
-TC_SEC_AUT_BV_20_C	PASS	b adv
-				<ok>
-				b adv
-				b read conn=<handle> attr=<val_handle>
-				b set sm_data bonding=1
-				b sec start conn=<handle>
-				b read conn=<handle> attr=<val_handle>
-TC_SEC_AUT_BV_21_C	PASS	b set sm_data bonding=1
-				b set sm_data our_key_dist=1
-				b set sm_data their_key_dist=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				<ok>
-				b conn peer_addr=<addr>
-				b sec start conn=<handle>
-				b term conn=<handle>
-TC_SEC_AUT_BV_22_C	PASS	b set sm_data bonding=1
-				b set sm_data our_key_dist=1
-				b set sm_data their_key_dist=1
-				b adv
-				<ok>
-				b adv
-				b sec start conn=1
-				<ok>
-TC_SEC_AUT_BV_23_C	PASS	b set sm_data bonding=1
-				b set sm_data our_key_dist=1
-				b set sm_data their_key_dist=1
-				b adv
-				b adv
+GAP/SEC/AUT/BV-15-C	N/A	security-set-data bonding=1 io_capabilities=4 mitm_flag=1 sc=1 our_key_dist=7 their_key_dist=7
+				advertise-configure legacy=1 connectable=1
+				advertise-start
+				auth-passkey conn=<handle> action=2 key=<key>
+				advertise-start
+				gatt-show-local
 				Note: in PTS enter handle for characteristics
-				      value which requires encryption for read
-TC_SEC_AUT_BV_24_C	PASS	b set sm_data bonding=1
-				b set sm_data our_key_dist=1
-				b set sm_data their_key_dist=1
-				b conn peer_addr=<addr>
-				b term conn=<handle>
-				b conn peer_addr=<addr>
+				      value which requires authenticated pairing for read
+GAP/SEC/AUT/BV-16-C	N/A	security-set-data io_capabilities=1 bonding=1 mitm_flag=1 sc=1 our_key_dist=7 their_key_dist=7
+				connect peer_addr=<addr>
+				auth-passkey conn=<handle> action=3 key=123456
+				Note: enter '123456' passkey in PTS
+				connect peer_addr=<addr>
+				gatt-show-local
 				Note: in PTS enter handle for characteristics
-				      value which requires encryption for read
-TC_SEC_CSIGN_BV_01_C	N/A
-TC_SEC_CSIGN_BV_02_C	N/A
-TC_SEC_CSIGN_BI_01_C	N/A
-TC_SEC_CSIGN_BI_02_C	N/A
-TC_SEC_CSIGN_BI_03_C	N/A
-TC_SEC_CSIGN_BI_04_C	N/A
+				      value which requires authenticated pairing for read
+GAP/SEC/AUT/BV-17-C	N/A
+GAP/SEC/AUT/BV-18-C	N/A
+GAP/SEC/AUT/BV-19-C	N/A
+GAP/SEC/AUT/BV-20-C	N/A
+GAP/SEC/AUT/BV-21-C	N/A
+GAP/SEC/AUT/BV-22-C	N/A
+GAP/SEC/AUT/BV-23-C	N/A
+GAP/SEC/AUT/BV-24-C	N/A
+
+GAP/SEC/CSIGN/BV-01-C	N/A
+GAP/SEC/CSIGN/BV-02-C	N/A
+
+GAP/SEC/CSIGN/BI-01-C	N/A
+GAP/SEC/CSIGN/BI-02-C	N/A
+GAP/SEC/CSIGN/BI-03-C	N/A
+GAP/SEC/CSIGN/BI-04-C	N/A
 -------------------------------------------------------------------------------
 
-TC_PRIV_CONN_BV_01_C	N/A
-TC_PRIV_CONN_BV_02_C	N/A
-TC_PRIV_CONN_BV_03_C	N/A
-TC_PRIV_CONN_BV_04_C	N/A
-TC_PRIV_CONN_BV_05_C	N/A
-TC_PRIV_CONN_BV_06_C	N/A
-TC_PRIV_CONN_BV_07_C	N/A
-TC_PRIV_CONN_BV_08_C	N/A
-TC_PRIV_CONN_BV_09_C	N/A
-TC_PRIV_CONN_BV_10_C	PASS
-				b set adv_data flags=6
-				b set sm_data io_capabilities=1 mitm_flag=1
-				b set sm_data bonding=1 our_key_dist=7 their_key_dist=7
-				b set irk=<IRK> e.g: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:11
-				Note: in PTS IXIT please set:
-					TSPX_uit_device_IRK=11000000000000000000000000000000
-				TSPX_iut_private_address_interval=5000
-				set BLE_RPA_TIMEOUT: 5 in syscfg.yml
-				b adv
-				b passkey conn=<handle> action=3 key=123456
-				Note: enter '123456' passkey in PTS
-				b term conn=<handle>
-				b adv own_addr_type=rpa_pub
-                <wait for 5 seconds>
-				b adv own_addr_type=rpa_pub
-				b term conn=<handle>
-TC_PRIV_CONN_BV_11_C	N/A
+GAP/PRIV/CONN/BV-01-C	N/A
+GAP/PRIV/CONN/BV-02-C	N/A
+GAP/PRIV/CONN/BV-03-C	N/A
+GAP/PRIV/CONN/BV-04-C	INC
+GAP/PRIV/CONN/BV-05-C	N/A
+GAP/PRIV/CONN/BV-06-C	N/A
+GAP/PRIV/CONN/BV-07-C	N/A
+GAP/PRIV/CONN/BV-08-C	N/A
+GAP/PRIV/CONN/BV-09-C	N/A
+GAP/PRIV/CONN/BV-10-C	N/A
+GAP/PRIV/CONN/BV-11-C	N/A
 -------------------------------------------------------------------------------
 
-TC_ADV_BV_01_C		PASS	b set adv_data uuid16=0x1802
-				b adv
-                                b adv stop
-TC_ADV_BV_02_C		PASS	b set adv_data name=nimble
-				b adv
-                                b adv stop
-TC_ADV_BV_03_C		PASS	b set adv_data flags=6
-				b adv
-                                b adv stop
-TC_ADV_BV_04_C		PASS	b set adv_data mfg_data=ff:ff
-				b adv
-                                b adv stop
-TC_ADV_BV_05_C		PASS	b set adv_data tx_pwr_lvl=10
-				b adv
-                                b adv stop
-TC_ADV_BV_08_C		PASS	b set adv_data slave_itvl_range=00:00:ff:ff
-				b adv
-                                b adv stop
-TC_ADV_BV_09_C		N/A
-TC_ADV_BV_10_C		PASS	b set adv_data svc_data_uuid16=18:02:ff:ff
-				b adv
-                                b adv stop
-TC_ADV_BV_11_C		PASS	b set adv_data appearance=12
-				b adv
-                                b adv stop
-TC_ADV_BV_12_C		PASS	b set adv_data public_tgt_addr=<addr>
-				b adv
-                                b adv stop
-TC_ADV_BV_13_C		N/A
-TC_ADV_BV_14_C		PASS	b set adv_data adv_itvl=2
-				b adv
-                                b adv stop
-TC_ADV_BV_15_C		N/A
-TC_ADV_BV_16_C		N/A
-TC_ADV_BV_17_C		PASS
- 				TSPX_URI=<bytes>
- 				set-adv-data uri=<bytes>
- 				advertise
+GAP/ADV/BV-01-C		PASS	advertise-set-adv_data uuid16=0x1802
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-02-C		PASS	advertise-set-adv_data name=<name>
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-03-C		PASS	advertise-set-adv_data flags=6
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-04-C		PASS	advertise-set-adv_data mfg_data=ff:ff
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-05-C		PASS	advertise-set-adv_data tx_pwr_lvl=10
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-08-C		N/A
+GAP/ADV/BV-09-C		N/A
+GAP/ADV/BV-10-C		PASS	advetrise-set-adv_data service_data_uuid16=18:02:ff:ff
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-11-C		PASS	advertise-set -dv_data appearance=12
+				advertise-start
+				advertise-stop
+GAP/ADV/BV-12-C		N/A
+GAP/ADV/BV-13-C		N/A
+GAP/ADV/BV-14-C		N/A
+GAP/ADV/BV-15-C		N/A
+GAP/ADV/BV-16-C		N/A
+GAP/ADV/BV-17-C		PASS	In PTS: TSPX_URI=<bytes>
+				set-adv-data uri=<bytes>
+				advertise-start
+				advertise-stop
 -------------------------------------------------------------------------------
 
-TC_GAT_BV_01_C		PASS	<answer NO to role question>
-				b adv
-TC_GAT_BV_02_C		N/A
-TC_GAT_BV_03_C		N/A
-TC_GAT_BV_04_C		N/A
-TC_GAT_BV_05_C		N/A
-TC_GAT_BV_06_C		N/A
-TC_GAT_BV_07_C		N/A
-TC_GAT_BV_08_C		N/A
+GAP/GAT/BV-01-C		PASS	<if NO>
+				advertising-start
+				<if YES>
+				connect peer_addr=<addr>
+GAP/GAT/BV-02-C		N/A
+GAP/GAT/BV-03-C		N/A
+GAP/GAT/BV-04-C		PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GAP/GAT/BV-05-C		N/A
+GAP/GAT/BV-06-C		N/A
+GAP/GAT/BV-07-C		N/A
+GAP/GAT/BV-08-C		N/A
+----------------------------------------------------------------------------
+
+GAP/DM/NCON/BV-01-C	N/A
+GAP/DM/CON/BV-01-C	N/A
+GAP/DM/NBON/BV-01-C	N/A
+GAP/DM/BON/BV-01-C	N/A
+GAP/DM/GIN/BV-01-C	N/A
+GAP/DM/LIN/BV-01-C	N/A
+GAP/DM/NAD/BV-01-C	N/A
+GAP/DM/NAD/BV-02-C	N/A
+GAP/DM/LEP/BV-01-C	N/A
+GAP/DM/LEP/BV-02-C	N/A
+GAP/DM/LEP/BV-04-C	N/A
+GAP/DM/LEP/BV-05-C	N/A
+GAP/DM/LEP/BV-06-C	N/A
+GAP/DM/LEP/BV-07-C	N/A
+GAP/DM/LEP/BV-08-C	N/A
+GAP/DM/LEP/BV-09-C	N/A
+GAP/DM/LEP/BV-10-C	N/A
+GAP/DM/LEP/BV-11-C	N/A
 -------------------------------------------------------------------------------
 
-TC_DM_NCON_BV_01_C	N/A
-TC_DM_CON_BV_01_C	N/A
-TC_DM_NBON_BV_01_C	N/A
-TC_DM_BON_BV_01_C	N/A
-TC_DM_GIN_BV_01_C	N/A
-TC_DM_LIN_BV_01_C	N/A
-TC_DM_NAD_BV_01_C	N/A
-TC_DM_NAD_BV_02_C	N/A
-TC_DM_LEP_BV_01_C	N/A	PTS Errata 15174
-TC_DM_LEP_BV_02_C	N/A
-TC_DM_LEP_BV_04_C	N/A
-TC_DM_LEP_BV_05_C	N/A
-TC_DM_LEP_BV_06_C	N/A
-TC_DM_LEP_BV_07_C	N/A
-TC_DM_LEP_BV_08_C	N/A
-TC_DM_LEP_BV_09_C	N/A
-TC_DM_LEP_BV_10_C	N/A
-TC_DM_LEP_BV_11_C	N/A
--------------------------------------------------------------------------------
+GAP/MOD/NDIS/BV-01-C	N/A
+GAP/MOD/LDIS/BV-01-C	N/A
+GAP/MOD/LDIS/BV-02-C	N/A
+GAP/MOD/LDIS/BV-03-C	N/A
+GAP/MOD/GDIS/BV-01-C	N/A
+GAP/MOD/GDIS/BV-02-C	N/A
+GAP/MOD/NCON/BV-01-C	N/A
+GAP/MOD/CON/BV-01-C	N/A
\ No newline at end of file
diff --git a/nimble/host/pts/pts-gatt.txt b/nimble/host/pts/pts-gatt.txt
index c8713e6..74c0a2e 100644
--- a/nimble/host/pts/pts-gatt.txt
+++ b/nimble/host/pts/pts-gatt.txt
@@ -1,7 +1,7 @@
 PTS test results for GATT
 
-PTS version: 7.0
-Tested: 18-Jul-2017
+PTS version: 7.5.0
+Tested: 27-Sept-2019
 
 Results:
 PASS	test passed
@@ -12,349 +12,245 @@
 -------------------------------------------------------------------------------
 Test Name		Result	Notes
 -------------------------------------------------------------------------------
-GATT/CL/GAC/BV-01-C	PASS	b conn peer_addr=<addr>
-				b mtu conn=<handle>
-				b write conn=<handle> long=1 attr=<val_handle> value=<xx:...>
-				b term conn=<handle>
+GATT/CL/GAC/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-exchanche-mtu conn=<handle>
+				gatt-write conn=<handle> long=1 attr=<val_handle> value=<xx:...>
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-GATT/CL/GAD/BV-01-C	PASS	b conn peer_addr=<addr>
-				b disc svc conn=<handle>
-				b show chr
+GATT/CL/GAD/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-discover-service conn=<handle>
+				gatt-show
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 				<repeat>
-GATT/CL/GAD/BV-02-C	PASS	b conn peer_addr=<addr>
-				b disc svc conn=<handle> uuid=<uuid>
-				b show chr
+GATT/CL/GAD/BV-02-C	PASS	connect peer_addr=<addr>
+				gatt-discover-service conn=<handle> uuid=<uuid>
+				gatt-show
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 				<repeat>
-GATT/CL/GAD/BV-03-C	PASS	b conn peer_addr=<addr>
-				b find inc_svcs conn=<handle> start=1 end=0xffff
+GATT/CL/GAD/BV-03-C	PASS	connect peer_addr=<addr>
+				gatt-find-included-services conn=<handle> start=1 end=0xffff
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 				<repeat>
-GATT/CL/GAD/BV-04-C	PASS	b conn peer_addr=<addr>
-				b disc svc conn=<handle> uuid=<uuid>
-				b disc chr conn=<handle> start=<start hdl> end=<end hdl>
-				b show chr
+GATT/CL/GAD/BV-04-C	PASS	connect peer_addr=<addr>
+				gatt-discover-service conn=<handle> uuid=<uuid>
+				gatt-discover-characteristic conn=<handle> start=<start hdl> end=<end hdl>
+				gatt-show
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 				<repeat>
-GATT/CL/GAD/BV-05-C	PASS	b conn peer_addr=<addr>
-				b disc svc conn=<handle>
-				b disc chr conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
-				b show chr
+GATT/CL/GAD/BV-05-C	PASS	connect peer_addr=<addr>
+				gatt-discover-service conn=<handle>
+				gatt-discover-characteristic conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
+				gatt-show
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 				<repeat>
-GATT/CL/GAD/BV-06-C	PASS	b conn peer_addr=<addr>
-				b disc svc conn=<handle>
-				b disc chr conn=<handle> start=<start-hdl> end=<end-hdl>
-				b disc dsc conn=<handle> start=<start-hdl> end=<end-hdl>
+GATT/CL/GAD/BV-06-C	PASS	connect peer_addr=<addr>
+				gatt-discover-service conn=<handle>
+				gatt-discover-characteristic conn=<handle> start=<start-hdl> end=<end-hdl>
+				gatt-discover-descriptor conn=<handle> start=<start-hdl> end=<end-hdl>
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 				<repeat>
 GATT/CL/GAD/BV-07-C	N/A
 GATT/CL/GAD/BV-08-C	N/A
 -------------------------------------------------------------------------------
 
-GATT/CL/GAR/BV-01-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
+GATT/CL/GAR/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-01-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-01-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-02-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-02-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-03-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				b term conn=<handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-03-C	N/A
+
+GATT/CL/GAR/BI-04-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
+				disconnect conn=<handle>
 				<answer YES>
-GATT/CL/GAR/BI-04-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				b term conn=<handle>
+GATT/CL/GAR/BI-05-C	PASS    connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
 				<answer YES>
-GATT/CL/GAR/BI-05-C	PASS    b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BV-03-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> uuid=<uuid> start=1 end=0xffff
+				disconnect conn=<handle>
+GATT/CL/GAR/BV-03-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> uuid=<uuid> start=1 end=0xffff
 				<answer YES>
 				<repeat>
-				b term conn=<handle>
-GATT/CL/GAR/BI-06-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
-				b term conn=<handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-06-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
+				disconnect conn=<handle>
 				<answer YES>
-GATT/CL/GAR/BI-07-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
-				b term conn=<handle>
+GATT/CL/GAR/BI-07-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
+				disconnect conn=<handle>
 				<answer YES>
-GATT/CL/GAR/BI-09-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
+GATT/CL/GAR/BI-09-C	N/A
+GATT/CL/GAR/BI-10-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
+				disconnect conn=<handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-10-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> uuid=<uuid> start=<start hdl> end=<end hdl>
-				b term conn=<handle>
+GATT/CL/GAR/BI-11-C	PASS    connect perr_addr=<addr>
+				gatt-read conn=<handle> start=<start_hdl> end=<end_hdl>
+				disconnect conn=<handle>
 				<answer YES>
-GATT/CL/GAR/BI-11-C	PASS    b conn perr_addr=<addr>
-				b read conn=<handle> start=<start_hdl> end=<end_hdl>
-				b term conn=<handle>
-				<answer YES>
-GATT/CL/GAR/BV-04-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
+GATT/CL/GAR/BV-04-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
 				<answer YES>
 				<repeat>
-				b term conn=<handle>
-GATT/CL/GAR/BI-12-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-12-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-13-C	PASS	b conn_peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle> offset=<offset>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-13-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle> offset=<offset>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-14-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				b term conn=<handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-14-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
+				disconnect conn=<handle>
 				<answer YES>
-GATT/CL/GAR/BI-15-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
+GATT/CL/GAR/BI-15-C	N/A
+
+GATT/CL/GAR/BI-16-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
+				disconnect conn=<handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-16-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				b term conn=<handle>
+GATT/CL/GAR/BI-17-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
 				<answer YES>
-GATT/CL/GAR/BI-17-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BV-05-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle1> attr=<val_handle2>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-18-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle1> attr=<val_handle2>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BV-05-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle1> attr=<val_handle2>
-				b term conn=<handle>
-GATT/CL/GAR/BI-18-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle1> attr=<val_handle2>
+				disconnect conn=<handle>
+GATT/CL/GAR/BI-19-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle1> attr=<val_handle2>
+				disconnect conn=<handle>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-19-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle1> attr=<val_handle2>
-				b term conn=<handle>
+GATT/CL/GAR/BI-20-C	N/A
+
+GATT/CL/GAR/BI-21-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle1> attr=<val_handle2>
+				disconnect conn=<handle>
 				<answer YES>
-GATT/CL/GAR/BI-20-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle1> attr=<val_handle2>
+GATT/CL/GAR/BI-22-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle1> attr=<val_handle2>
 				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-21-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle1> attr=<val_handle2>
-				b term conn=<handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BV-06-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
 				<answer YES>
-GATT/CL/GAR/BI-22-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle1> attr=<val_handle2>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BV-06-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-23-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-24-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-25-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-26-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				b term conn=<handle>
-				<answer YES>
-GATT/CL/GAR/BI-27-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BV-07-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
+				disconnect conn=<handle>
+GATT/CL/GAR/BV-07-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
 				<answer YES>
 				<repeat>
-				b term conn=<handle>
-GATT/CL/GAR/BI-28-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-29-C	PASS	b conn_peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle> offset=<offset>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-30-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				b term conn=<handle>
-				<answer YES>
-GATT/CL/GAR/BI-31-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
-GATT/CL/GAR/BI-32-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				b term conn=<handle>
-				<answer YES>
-GATT/CL/GAR/BI-33-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
-				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 GATT/CL/GAR/BI-34-C	N/A
-GATT/CL/GAR/BI-35-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> long=1 attr=<val_handle>
+GATT/CL/GAR/BI-35-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> long=1 attr=<val_handle>
 				<answer YES>
-				b term conn=<handle>
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-GATT/CL/GAW/BV-01-C	PASS	b conn peer_addr=<addr>
-				b write no_rsp=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
+GATT/CL/GAW/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-write no_rsp=1 conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
 GATT/CL/GAW/BV-02-C	N/A
-GATT/CL/GAW/BV-03-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-02-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-03-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-04-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-05-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-06-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BV-05-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-07-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-08-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-09-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val> offset=<offset>
-				b term conn=1
-GATT/CL/GAW/BI-11-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-12-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-13-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BV-06-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-14-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-15-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-17-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-18-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-19-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BV-08-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-20-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-21-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-22-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-23-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-24-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BV-09-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-25-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-26-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-27-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val> offset=<offset>
-				b term conn=1
-GATT/CL/GAW/BI-29-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-30-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-31-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=aa
-				b term conn=<handle>
-GATT/CL/GAW/BI-32-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val> attr=<val_handle> value=<val>
-GATT/CL/GAW/BI-33-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-34-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-35-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
-GATT/CL/GAW/BI-36-C	PASS	b conn peer_addr=<addr>
-				b write long=1 conn=<handle> attr=<val_handle> value=<val>
-				b term conn=<handle>
+
+GATT/CL/GAW/BV-03-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-02-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-03-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-04-C	N/A
+
+GATT/CL/GAW/BI-05-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-06-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BV-05-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-07-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+				disocnnect conn=<handle>
+GATT/CL/GAW/BI-08-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+				diconnect conn=<handle>
+GATT/CL/GAW/BI-09-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val> offset=<offset>
+				diconnect conn=1
+GATT/CL/GAW/BI-11-C	N/A
+
+GATT/CL/GAW/BI-12-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-13-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+				diconnect conn=<handle>
+GATT/CL/GAW/BV-06-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+
+GAAT/CL/GAW/BV-08-C	PASS	connect peer_addr=<addr>
+				gat-write conn=<handle> attr=<val_handle> value=<val>
+
+GATT/CL/GAW/BV-09-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+
+GATT/CL/GAW/BI-32-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-33-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+GATT/CL/GAW/BI-34-C	PASS	connect peer_addr=<addr>
+				gatt-write long=1 conn=<handle> attr=<val_handle> value=<val>
+				disconnect conn=<handle>
+
 -------------------------------------------------------------------------------
 
-GATT/CL/GAN/BV-01-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=01:00
+GATT/CL/GAN/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=01:00
 				Note: verify that the notification was received
-				b term conn=<handle>
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-GATT/CL/GAI/BV-01-C	PASS	b adv
-                                b chrup attr=<val_handle>
+GATT/CL/GAI/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=01:00
+				Note: verify that the notification was received
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-GATT/CL/GAS/BV-01-C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
+GATT/CL/GAS/BV-01-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-GATT/CL/GAT/BV-01-C	PASS	b conn peer_addr=<addr>
-				b read conn=<handle> attr=<val_handle>
-GATT/CL/GAT/BV-02-C	PASS	b conn peer_addr=<addr>
-				b write conn=<handle> attr=<val_handle> value=<val>
+GATT/CL/GAT/BV-01-C	PASS	connect peer_addr=<addr>
+				gatt-read conn=<handle> attr=<val_handle>
+GATT/CL/GAT/BV-02-C	PASS	connect peer_addr=<addr>
+				gatt-write conn=<handle> attr=<val_handle> value=<val>
 -------------------------------------------------------------------------------
 
 GATT/CL/GPA/BV-01-C	N/A
@@ -369,153 +265,225 @@
 GATT/CL/GPA/BV-12-C	N/A
 -------------------------------------------------------------------------------
 
-GATT/SR/GAC/BV-01-C	PASS	b set mtu=25
-				b adv
-				b adv
+GATT/SR/GAC/BV-01-C	PASS	set mtu=25
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				advertise-start
 -------------------------------------------------------------------------------
 
-GATT/SR/GAD/BV-01-C	PASS	b adv
-GATT/SR/GAD/BV-02-C	PASS	b adv
-GATT/SR/GAD/BV-03-C	PASS	b adv
-GATT/SR/GAD/BV-04-C	PASS	b adv
+GATT/SR/GAD/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				gatt-show-local
+				<YES>
+GATT/SR/GAD/BV-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				gatt-show-local
+				<YES>
+GATT/SR/GAD/BV-03-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				gatt-show-local
+				<YES>
+GATT/SR/GAD/BV-04-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<confirm handles range for services>
-GATT/SR/GAD/BV-05-C	PASS	b adv
-GATT/SR/GAD/BV-06-C	PASS	b adv
+GATT/SR/GAD/BV-05-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAD/BV-06-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 GATT/SR/GAD/BV-07-C	N/A
 GATT/SR/GAD/BV-08-C	N/A
 -------------------------------------------------------------------------------
 
-GATT/SR/GAR/BV-01-C	PASS	b adv
-GATT/SR/GAR/BI-01-C	PASS	b adv
-GATT/SR/GAR/BI-02-C	PASS	b adv
+GATT/SR/GAR/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
 GATT/SR/GAR/BI-03-C	N/A
-GATT/SR/GAR/BI-04-C	PASS	b adv
-GATT/SR/GAR/BI-05-C	PASS	b adv
-GATT/SR/GAR/BV-03-C	PASS	b adv
-GATT/SR/GAR/BI-06-C	PASS	b adv
+GATT/SR/GAR/BI-04-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-05-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BV-03-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-06-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				gatt-show-local
 				<enter uuid without READ flag>
 				<enter value handle>
-GATT/SR/GAR/BI-07-C	PASS	b adv
+GATT/SR/GAR/BI-07-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
-GATT/SR/GAR/BI-08-C	PASS	b adv
+GATT/SR/GAR/BI-08-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 GATT/SR/GAR/BI-09-C	N/A
-GATT/SR/GAR/BI-10-C	PASS	b adv
-				<enter characteristic with READ|READ_AUTH flags>
-GATT/SR/GAR/BI-11-C	PASS	b adv
+GATT/SR/GAR/BI-10-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-11-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter characteristic wit READ|READ_ENC flags>
-GATT/SR/GAR/BV-04-C	PASS	b adv
-GATT/SR/GAR/BI-12-C	PASS	b adv
+GATT/SR/GAR/BV-04-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-12-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter long value handle without READ flag>
-GATT/SR/GAR/BI-13-C	PASS	b adv
-GATT/SR/GAR/BI-14-C	PASS	b adv
+GATT/SR/GAR/BI-13-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-14-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
 GATT/SR/GAR/BI-15-C	N/A
-GATT/SR/GAR/BI-16-C	PASS	b adv
-GATT/SR/GAR/BI-17-C	PASS	b adv
-GATT/SR/GAR/BV-05-C	PASS	b adv
-GATT/SR/GAR/BI-18-C	PASS	b adv
+GATT/SR/GAR/BI-16-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-17-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BV-05-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-18-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter value handle without READ flag>
-GATT/SR/GAR/BI-19-C	PASS	b adv
+GATT/SR/GAR/BI-19-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
 GATT/SR/GAR/BI-20-C	N/A
-GATT/SR/GAR/BI-21-C	PASS	b adv
-GATT/SR/GAR/BI-22-C	PASS	b adv
-GATT/SR/GAR/BV-06-C	PASS	b adv
-GATT/SR/GAR/BI-23-C	PASS	b adv
-				<enter value handle without READ flag>
-GATT/SR/GAR/BI-24-C	PASS	b adv
-				<enter ffff>
+GATT/SR/GAR/BI-21-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-22-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-startt
+GATT/SR/GAR/BV-06-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-23-C	N/A
+GATT/SR/GAR/BI-24-C	N/A
 GATT/SR/GAR/BI-25-C	N/A
-GATT/SR/GAR/BI-26-C	PASS	b adv
-GATT/SR/GAR/BI-27-C	PASS	b adv
-GATT/SR/GAR/BV-07-C	PASS	b adv
-GATT/SR/GAR/BV-08-C	PASS	b adv
-GATT/SR/GAR/BI-28-C	PASS	b adv
-				<enter desc value handle without READ flag>
-GATT/SR/GAR/BI-29-C	PASS	b adv
-GATT/SR/GAR/BI-30-C	PASS	b adv
-				<enter ffff>
+GATT/SR/GAR/BI-26-C	N/A
+GATT/SR/GAR/BI-27-C	N/A
+GATT/SR/GAR/BV-07-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BV-08-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAR/BI-28-C	N/A
+GATT/SR/GAR/BI-29-C	N/A
+GATT/SR/GAR/BI-30-C	N/A
 GATT/SR/GAR/BI-31-C	N/A
-GATT/SR/GAR/BI-32-C	PASS	b adv
-GATT/SR/GAR/BI-33-C	PASS	b adv
+GATT/SR/GAR/BI-32-C	N/A
+GATT/SR/GAR/BI-33-C	N/A
 GATT/SR/GAR/BI-34-C	N/A
 GATT/SR/GAR/BI-35-C	N/A
 -------------------------------------------------------------------------------
 
-GATT/SR/GAW/BV-01-C	PASS	b adv
+GATT/SR/GAW/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 GATT/SR/GAW/BV-02-C	N/A
 GATT/SR/GAW/BI-01-C	N/A
-GATT/SR/GAW/BV-03-C	PASS	b adv
-GATT/SR/GAW/BI-02-C	PASS	b adv
+GATT/SR/GAW/BV-03-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
-GATT/SR/GAW/BI-03-C	PASS	b adv
+GATT/SR/GAW/BI-03-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 GATT/SR/GAW/BI-04-C	N/A
-GATT/SR/GAW/BI-05-C	PASS	b adv
-GATT/SR/GAW/BI-06-C	PASS	b adv
-GATT/SR/GAW/BV-05-C	PASS	b adv
-GATT/SR/GAW/BI-07-C	PASS	b adv
+GATT/SR/GAW/BI-05-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-06-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-05-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-07-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
-GATT/SR/GAW/BI-08-C	PASS	b adv
+GATT/SR/GAW/BI-08-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter long value handle without WRITE flag>
-GATT/SR/GAW/BI-09-C	PASS	b adv
+GATT/SR/GAW/BI-09-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 GATT/SR/GAW/BI-11-C	N/A
-GATT/SR/GAW/BI-12-C	PASS	b adv
-GATT/SR/GAW/BI-13-C	PASS	b adv
-GATT/SR/GAW/BV-06-C	PASS	b adv
-GATT/SR/GAW/BV-10-C	PASS	b adv
-GATT/SR/GAW/BI-14-C	PASS	b adv
+GATT/SR/GAW/BI-12-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-13-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-06-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-10-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-14-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
-GATT/SR/GAW/BI-15-C	PASS	b adv
+GATT/SR/GAW/BI-15-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter value handle without WRITE flag>
 GATT/SR/GAW/BI-17-C	N/A
-GATT/SR/GAW/BI-18-C	PASS	b adv
-GATT/SR/GAW/BI-19-C	PASS	b adv
-GATT/SR/GAW/BV-11-C	PASS	b adv
-GATT/SR/GAW/BV-07-C	PASS	b adv
-GATT/SR/GAW/BV-08-C	INCONC	b adv   Errata 15358
-GATT/SR/GAW/BI-20-C	PASS	b adv
+GATT/SR/GAW/BI-18-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-19-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-11-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-07-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-08-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-20-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
-GATT/SR/GAW/BI-21-C	PASS	b adv
+GATT/SR/GAW/BI-21-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter dsc value handle without WRITE flag>
 GATT/SR/GAW/BI-22-C	N/A
-GATT/SR/GAW/BI-23-C	PASS	b adv
-GATT/SR/GAW/BI-24-C	PASS	b adv
-GATT/SR/GAW/BV-09-C	PASS	b adv
-GATT/SR/GAW/BI-25-C	PASS	b adv
+GATT/SR/GAW/BI-23-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-24-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BV-09-C	PASS	advertise-configure connectable=1 legacy=1q
+				advertise-start
+GATT/SR/GAW/BI-25-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter ffff>
-GATT/SR/GAW/BI-26-C	PASS	b adv
+GATT/SR/GAW/BI-26-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 				<enter dsc value handle without WRITE flag>
-GATT/SR/GAW/BI-27-C	PASS	b adv
+GATT/SR/GAW/BI-27-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 GATT/SR/GAW/BI-29-C	N/A
-GATT/SR/GAW/BI-30-C	PASS	b adv
-GATT/SR/GAW/BI-31-C	PASS	b adv
-GATT/SR/GAW/BI-32-C	PASS	b adv
-GATT/SR/GAW/BI-33-C	PASS	b adv
-GATT/SR/GAW/BI-34-C	PASS	b adv
-GATT/SR/GAW/BI-35-C	PASS	b adv
--------------------------------------------------------------------------------
+GATT/SR/GAW/BI-30-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-31-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-32-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-33-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-34-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/GAW/BI-35-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+------------------------------------------------------------------------------
 
-GATT/SR/GAN/BV-01-C	PASS	b adv
-				b chrup attr=<val_handle>
--------------------------------------------------------------------------------
+GATT/SR/GAN/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				gatt-notify attr=<val_handle>
+------------------------------------------------------------------------------
 
-GATT/SR/GAI/BV-01-C	PASS	b adv
-				b write conn=<handle> value=02:00 attr=<val_handle>
+GATT/SR/GAI/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				gatt-notify attr=<val_handle>
 -------------------------------------------------------------------------------
 
 GATT/SR/GAS/BV-01-C	PASS	Note: set TSPX_security_enabled to TRUE
-				b set sm_data bonding=1 our_key_dist=7 their_key_dist=7
-				b adv
+				security-set-data bonding=1 our_key_dist=7 their_key_dist=7
+				advertise-configure connectable=1 legacy=1
+				advertise-start
 				<click OK>
-				b svcchg start=1 end=0xffff
-				b adv
-				b sec start conn=<handle>
+				gatt-service-changed start=1 end=0xffff
+				advertise-start
+				security-start conn=<handle>
 -------------------------------------------------------------------------------
 
-GATT/SR/GAT/BV-01-C	PASS	b adv
-				b chrup attr=<val_handle>
--------------------------------------------------------------------------------
+GATT/SR/GAT/BV-01-C	PASS	advertise-start
+				gatt-notify attr=0x0008
+------------------------------------------------------------------------------
 
 GATT/SR/GPA/BV-01-C	N/A
 GATT/SR/GPA/BV-02-C	N/A
@@ -528,3 +496,13 @@
 GATT/SR/GPA/BV-11-C	N/A
 GATT/SR/GPA/BV-12-C	N/A
 -------------------------------------------------------------------------------
+
+GATT/SR/UNS/BI-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+GATT/SR/UNS/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+
+--------------------------------------------------------------------------------
+
+GATT/SR/GPM/BV-01-C	N/A
+
diff --git a/nimble/host/pts/pts-l2cap.txt b/nimble/host/pts/pts-l2cap.txt
index 62a6f49..c09add9 100644
--- a/nimble/host/pts/pts-l2cap.txt
+++ b/nimble/host/pts/pts-l2cap.txt
@@ -1,7 +1,18 @@
 PTS test results for L2CAP
 
-PTS version: 7.0
-Tested: 18-Jul-2017
+PTS version: 7.5.0
+Tested: 07-Oct-2019
+
+syscfg.vals:
+    BLE_EXT_ADV: 1
+    BLE_PUBLIC_DEV_ADDR: "((uint8_t[6]){0x01, 0xff, 0xff, 0xc0, 0xde, 0xc0})"
+    BLE_SM_LEGACY: 1
+    BLE_SM_SC: 1
+    BLE_L2CAP_COC_MAX_NUM: 5
+    BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL: 9
+    BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL: 30
+    BLE_SVC_GAP_PPCP_SUPERVISION_TMO: 2000
+    CONSOLE_HISTORY_SIZE: 10
 
 Results:
 PASS   test passed
@@ -44,11 +55,30 @@
 L2CAP/COS/ECH/BV-02-C	N/A
 -------------------------------------------------------------------------------
 
-L2CAP/COS/CFC/BV-01-C	N/A
-L2CAP/COS/CFC/BV-02-C	N/A
-L2CAP/COS/CFC/BV-03-C	N/A
-L2CAP/COS/CFC/BV-04-C	N/A
-L2CAP/COS/CFC/BV-05-C	N/A
+L2CAP/COS/CFC/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+				l2cap-send conn=<handle> idx=0 bytes=15
+				<YES>
+L2CAP/COS/CFC/BV-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+				l2cap-send conn=<handle> idx=0 bytes=15
+				<YES>
+L2CAP/COS/CFC/BV-03-C	PASS	NOTE: #define BTSHELL_COC_MTU = 512
+				advertise-configure connectable=1 legacy=1
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+L2CAP/COS/CFC/BV-04-C	PASS	advertise-configure connectable=1 legacy=1
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+L2CAP/COS/CFC/BV-05-C	PASS	advertise-configure connectable=1 legacy=1
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+				l2cap-connect conn=<handle> psm=<your psm>
+				l2cap-connect conn=<handle> psm=<2nd psm>
 -------------------------------------------------------------------------------
 
 L2CAP/CLS/CLR/BV-01-C	N/A
@@ -181,75 +211,91 @@
 L2CAP/ECF/BV-08-C		N/A
 -------------------------------------------------------------------------------
 
-L2CAP/LE/CPU/BV-01-C	PASS	b set adv_data flags=6
-				b adv
-				b l2cap update conn=<handle>
-L2CAP/LE/CPU/BV-02-C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-L2CAP/LE/CPU/BI-01-C	PASS	b conn peer_addr=<addr>
-				b term conn=<handle>
-L2CAP/LE/CPU/BI-02-C	PASS	b set adv_data flags=6
-				b adv
+L2CAP/LE/CPU/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-update conn=<handle>
+L2CAP/LE/CPU/BV-02-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+L2CAP/LE/CPU/BI-01-C	PASS	connect peer_addr=<addr>
+				disconnect conn=<handle>
+L2CAP/LE/CPU/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
 -------------------------------------------------------------------------------
 
-L2CAP/LE/REJ/BI-01-C	PASS	b set adv_data flags=6
-				b adv
-L2CAP/LE/REJ/BI-02-C	PASS	b set adv_data flags=6
-				b adv
-				b term conn=<handle>
+L2CAP/LE/REJ/BI-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+L2CAP/LE/REJ/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				disconnect conn=<handle>
 -------------------------------------------------------------------------------
 
-L2CAP/LE/CFC/BV-01-C	PASS	b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=90
-L2CAP/LE/CFC/BV-02-C	PASS	b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=90
-L2CAP/LE/CFC/BV-03-C	PASS	b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-				b l2cap send conn=<handle> idx=0 bytes=15
-L2CAP/LE/CFC/BV-04-C	PASS	b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=<not suppported psm from ixit>
-L2CAP/LE/CFC/BV-05-C	PASS	b set adv_data flags=6
-				b adv
-L2CAP/LE/CFC/BV-06-C	PASS	b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-				b l2cap send conn=<handle> idx=0 bytes=15
-L2CAP/LE/CFC/BV-07-C	PASS	b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-L2CAP/LE/CFC/BI-01-C	PASS	b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-L2CAP/LE/CFC/BV-08-C	PASS	b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-				b l2cap disconnect conn=<handle> idx=0
-L2CAP/LE/CFC/BV-09-C	PASS	b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-L2CAP/LE/CFC/BV-16-C	PASS    b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=90
+L2CAP/LE/CFC/BV-01-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+L2CAP/LE/CFC/BV-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-connect conn=<handle> psm=90
+L2CAP/LE/CFC/BV-03-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+				l2cap-send conn=<handle> idx=0 bytes=15
+				<YES>
+L2CAP/LE/CFC/BV-04-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-connect conn=<handle> psm=<unsuppported psm from ixit>
+L2CAP/LE/CFC/BV-05-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+L2CAP/LE/CFC/BV-06-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+				l2cap-send conn=<handle> idx=0 bytes=15
+L2CAP/LE/CFC/BV-07-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+L2CAP/LE/CFC/BI-01-C	PASS	advertise-configure connectable=1 legacy=1
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+L2CAP/LE/CFC/BV-08-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<your psm>
+				advertise-start
+				l2cap-disconnect conn=<handle> idx=0
+L2CAP/LE/CFC/BV-09-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+L2CAP/LE/CFC/BV-16-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-connect conn=<handle> psm=90
 L2CAP/LE/CFC/BV-17-C	N/A
-L2CAP/LE/CFC/BV-18-C	PASS    b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=90
-L2CAP/LE/CFC/BV-19-C	PASS    NOTE: TSPC_L2CAP_3_16 (multiple channel support) must be checked
-				b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=90
+L2CAP/LE/CFC/BV-18-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-connect conn=<handle> psm=90
+L2CAP/LE/CFC/BV-19-C	PASS	NOTE: TSPC_L2CAP_3_16 (multiple channel support) must be checked
+				advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-connect conn=<handle> psm=90
 L2CAP/LE/CFC/BV-20-C	PASS	NOTE: TSPC_L2CAP_3_16 (multiple channel support) must be checked
-				b set adv_data flags=6
-				b l2cap create_srv psm=<your psm>
-				b adv
-				b term conn=<handle>
-L2CAP/LE/CFC/BV-21-C	PASS	b set adv_data flags=6
-				b adv
-				b l2cap connect conn=<handle> psm=90
+				advertise-configure connectable=1 legacy=1
+				l2cap-create-server psm=<TSPX_le_psm from ixit>
+				advertise-start
+L2CAP/LE/CFC/BV-21-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-set-adv-data flags=6
+				advertise-start
+				l2cap-connect conn=<handle> psm=90
 -------------------------------------------------------------------------------
 
 L2CAP/LE/CID/BV-01-C	N/A
diff --git a/nimble/host/pts/pts-sm.txt b/nimble/host/pts/pts-sm.txt
index f2e3cd1..ac26db7 100644
--- a/nimble/host/pts/pts-sm.txt
+++ b/nimble/host/pts/pts-sm.txt
@@ -1,160 +1,310 @@
 PTS test results for SM
 
-PTS version: 7.0
-Tested: 18-Jul-2017
+PTS version: 7.5.0
+Tested: 07-Oct-2019
+
+syscfg.vals:
+    BLE_EXT_ADV: 1
+    BLE_PUBLIC_DEV_ADDR: "((uint8_t[6]){0x01, 0xff, 0xff, 0xc0, 0xde, 0xc0})"
+    BLE_SM_LEGACY: 1
+    BLE_SM_SC: 1
+    BLE_L2CAP_COC_MAX_NUM: 5
+    BLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL: 9
+    BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL: 30
+    BLE_SVC_GAP_PPCP_SUPERVISION_TMO: 2000
+    CONSOLE_HISTORY_SIZE: 10
 
 Results:
 PASS	test passed
 FAIL	test failed
-INC	test is inconclusive
-N/A	test is disabled due to PICS setup
+INC		test is inconclusive
+N/A		test is disabled due to PICS setup
 NONE	test result is none
 
 -------------------------------------------------------------------------------
 Test Name		Result	Notes
 -------------------------------------------------------------------------------
 
-SM/MAS/PROT/BV-01-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
+SM/MAS/PROT/BV-01-C	PASS	connect peer_addr=<addr>
+				security-set-data bonding=1 sc=1 our_key_dist=7 their_key_dist=7
+				security-pair conn=<handle>
 -------------------------------------------------------------------------------
 
-SM/MAS/JW/BV-01-C		N/A
-SM/MAS/JW/BV-05-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				b term conn=<handle>
+SM/MAS/JW/BV-01-C	N/A
+SM/MAS/JW/BV-05-C	PASS	connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=<handle>
                                 <repeat>
-SM/MAS/JW/BI-01-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-SM/MAS/JW/BI-04-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
+SM/MAS/JW/BI-01-C	PASS	connect peer_addr=<addr>
+				security-pair conn=<handle>
+SM/MAS/JW/BI-04-C	PASS	connect peer_addr=<addr>
+				security-set-data bonding=1 sc=1
+				security-pair conn=<handle>
 -------------------------------------------------------------------------------
 
-SM/MAS/PKE/BV-01-C	PASS	b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
+SM/MAS/PKE/BV-01-C	PASS	security-set-data io_capabilities=1
+				connect peer_addr=<addr>
 				b sec pair conn=<handle>
 				b passkey conn=<handle> action=3 key=123456
 				Note: enter '123456' passkey in PTS
-SM/MAS/PKE/BV-04-C	PASS	b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-SM/MAS/PKE/BI-01-C	PASS	b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				b passkey conn=<handle> action=3 key=123456
+SM/MAS/PKE/BV-04-C	PASS	security-set-data bonding=1 oob_flag=0
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=<handle>
+SM/MAS/PKE/BI-01-C	PASS	ecurity-set-data io_capabilities=1 oob_flag=0
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter invalid passkey
-SM/MAS/PKE/BI-02-C	PASS	b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				b passkey conn=<handle> action=3 key=123456
+SM/MAS/PKE/BI-02-C	PASS	security-set-data io_capabilities=1 oob_flag=0
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter '123456' passkey in PTS
 -------------------------------------------------------------------------------
 
-SM/MAS/OOB/BV-01-C		N/A
-SM/MAS/OOB/BV-03-C		N/A
-SM/MAS/OOB/BV-05-C	PASS	b set sm_data io_capabilities=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-				b passkey conn=<handle> action=3 key=123456
+SM/MAS/OOB/BV-01-C	N/A
+SM/MAS/OOB/BV-03-C	N/A
+SM/MAS/OOB/BV-05-C	PASS	security-set-data io_capabilities=1 oob_flag=0
+				connect-peer_addr=<addr>
+				security-pair conn=<handle>
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter '123456' passkey in PTS
-SM/MAS/OOB/BV-07-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-SM/MAS/OOB/BV-09-C		N/A
-SM/MAS/OOB/BI-01-C		N/A
+				disconnect conn=1
+SM/MAS/OOB/BV-07-C	PASS	ecurity-set-data io_capabilities=1 oob_flag=0
+				connect-peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/OOB/BV-09-C	N/A
+SM/MAS/OOB/BI-01-C	N/A
 -------------------------------------------------------------------------------
 
-SM/MAS/EKS/BV-01-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-SM/MAS/EKS/BI-01-C	PASS	b conn peer_addr=<addr>
-				b sec pair conn=<handle>
+SM/MAS/EKS/BV-01-C	PASS	connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/EKS/BI-01-C	PASS	connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
 -------------------------------------------------------------------------------
 
-SM/MAS/SIGN/BV-01-C		N/A
-SM/MAS/SIGN/BV-03-C		N/A
-SM/MAS/SIGN/BI-01-C		N/A
+SM/MAS/SIGN/BV-01-C	N/A
+SM/MAS/SIGN/BV-03-C	N/A
+SM/MAS/SIGN/BI-01-C	N/A
 -------------------------------------------------------------------------------
 
-SM/MAS/KDU/BV-04-C	PASS	b set sm_data our_key_dist=4
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-SM/MAS/KDU/BV-05-C	PASS	b set sm_data our_key_dist=2
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
-SM/MAS/KDU/BV-06-C	PASS	b set sm_data our_key_dist=1
-				b conn peer_addr=<addr>
-				b sec pair conn=<handle>
+SM/MAS/KDU/BV-04-C	PASS	security-set-data our_key_dist=4
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/KDU/BV-05-C	PASS	security-set-data our_key_dist=2
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/KDU/BV-06-C	PASS	security-set-data our_key_dist=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/KDU/BV-10-C	PASS	security-set-data our_key_dist=2 sc=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/KDU/BV-11-C	PASS	security-set-data our_key_dist=2 sc=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/KDU/BI-01-C	PASS	connect peer_addr=<addr>
+				disconnect conn=1
+				reset device
+				<OK>
+				<repeat>
 -------------------------------------------------------------------------------
 
-SM/MAS/SIP/BV-02-C	PASS	b set sm_data io_capabilities=2
-				b conn peer_addr=<addr>
+SM/MAS/SIP/BV-02-C	PASS	security-set-data io_capabilities=4
+				connect peer_addr=<addr>
+				disconnect conn=1
+-------------------------------------------------------------------------------
+SM/MAS/SCJW/BV-01-C	PASS	security-set-data sc=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/SCJW/BV-04-C	PASS	security-set-data sc=1 io_capabilities=1 our_key_dist=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+SM/MAS/SCJW/BI-01-C	PASS	security-set-data sc=1 io_capabilities=4
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+				<repeat>
+				<confirm key number with PTS>
 -------------------------------------------------------------------------------
 
-SM/SLA/PROT/BV-02-C	PASS	b adv
-				b adv
-				b sec start conn=<handle>
--------------------------------------------------------------------------------
-
-SM/MAS/JW/BV-02-C	PASS	b adv
-SM/SLA/JW/BI-02-C	PASS	b adv
-SM/SLA/JW/BI-03-C	PASS	b adv
--------------------------------------------------------------------------------
-
-SM/SLA/PKE/BV-02-C	PASS	b set sm_data io_capabilities=1
-				b adv
-				b passkey conn=<handle> action=3 key=123456
+SM/MAS/SCPK/BV-01-C	PASS	security-set-data sc=1 io_capabilities=2
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				auth_passkey conn=1 action=2 key=123456
 				Note: enter '123456' passkey in PTS
-SM/SLA/PKE/BV-05-C	PASS	b set sm_data io_capabilities=1
-				b set sm_data mitm_flag=1
-				b adv
-SM/SLA/PKE/BI-03-C	PASS	b set sm_data io_capabilities=1
-				b adv
-				b passkey conn=<handle> action=3 key=123456
+				disconnect conn=1
+SM/MAS/SCPK/BV-04-C	PASS	security-set-data io_capabilities=4 oob_flag=0 our_key_dist=1 their_key_dist=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				auth_passkey conn=1 action=2 key=123456
+				Note: enter '123456' passkey in PTS
+				disconnect conn=1
+SM/MAS/SCPK/BI-01-C	PASS	security-set-data io_capabilities=4 oob_flag=0 sc=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				disconnect conn=1
+				<repeat>
+				auth_passkey conn=1 action=2 key=123456
+				Note: enter '123456' passkey in PTS
+				disconnect conn=1
+SM/MAS/SCPK/BI-02-C	PASS	security-set-data io_capabilities=2 oob_flag=0 bonding=1 sc=1
+				connect peer_addr=<addr>
+				security-pair conn=<handle>
+				auth_passkey conn=1 action=2 key=123456
+				Note: enter '123456' passkey in PTS
+				disconnect conn=1
+-------------------------------------------------------------------------------
+
+SM/MAS/SCOB/BV-01-C	N/A
+SM/MAS/SCOB/BI-04-C	N/A
+SM/MAS/SCOB/BV-01-C	N/A
+SM/MAS/SCOB/BI-04-C	N/A
+-------------------------------------------------------------------------------
+
+SM/MAS/SCCT/BV-01-C	N/A
+SM/MAS/SCCT/BV-03-C	N/A
+SM/MAS/SCCT/BV-05-C	N/A
+SM/MAS/SCCT/BV-07-C	N/A
+SM/MAS/SCCT/BV-09-C	N/A
+-------------------------------------------------------------------------------
+
+SM/SLA/PROT/BV-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+				<wait>
+-------------------------------------------------------------------------------
+
+SM/MAS/JW/BV-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/JW/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/JW/BI-03-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+-------------------------------------------------------------------------------
+
+SM/SLA/PKE/BV-02-C	PASS	security-set-data io_capabilities=4
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				auth-passkey conn=<handle> action=2 key=<key>
+				<OK>
+SM/SLA/PKE/BV-05-C	PASS	security-set-data io_capabilities=4
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/PKE/BI-03-C	PASS	security-set-data io_capabilities=4
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				auth-passkey conn=<handle> action=3 key=123456
 				Note: enter invalid passkey
 -------------------------------------------------------------------------------
 
-SM/SLA/OOB/BV-02-C		N/A
-SM/SLA/OOB/BV-04-C		N/A
-SM/SLA/OOB/BV-06-C	PASS	b set sm_data io_capabilities=1
-				b adv
-				b passkey conn=<handle> action=3 key=123456
-				Note: enter '123456' passkey in PTS
-SM/SLA/OOB/BV-08-C	PASS	b adv
-SM/SLA/OOB/BV-10-C		N/A
-SM/SLA/OOB/BI-02-C		N/A
+SM/SLA/OOB/BV-02-C	N/A
+SM/SLA/OOB/BV-04-C	N/A
+SM/SLA/OOB/BV-06-C	PASS	security-set-data io_capabilities=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				auth-passkey conn=<handle> action=3 key=<key>
+SM/SLA/OOB/BV-08-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/OOB/BV-10-C	N/A
+SM/SLA/OOB/BI-02-C	N/A
 -------------------------------------------------------------------------------
 
-SM/SLA/EKS/BV-02-C	PASS	b adv
-				b passkey conn=<handle> action=3 key=123456
-				Note: enter '123456' passkey in PTS
-SM/SLA/EKS/BI-02-C	PASS	b adv
+SM/SLA/EKS/BV-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/EKS/BI-02-C	PASS	advertise-configure connectable=1 legacy=1
+				advertise-start
 -------------------------------------------------------------------------------
 
-SM/SLA/KDU/BV-01-C	PASS	b set sm_data our_key_dist=1
-				b adv
-				b passkey conn=<handle> action=3 key=123456
+SM/SLA/KDU/BV-01-C	PASS	security-set-data io_capabilities=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/KDU/BV-02-C	PASS	security-set-data io_capabilities=2
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/KDU/BV-03-C	PASS	security-set-data io_capabilities=4
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/KDU/BV-07-C	PASS	security-set-data our_key_dist=1 bonding=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/KDU/BV-08-C	PASS	security-set-data our_key_dist=2 sc=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/KDU/BV-09-C	PASS	security-set-data our_key_dist=4 bonding=0
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/KDU/BI-01-C	PASS	advertise-configure connectable=1 legacy=1
+				security-set-data sc=1
+				advertise-start
+				<reset device>
+				<repeat>
+-------------------------------------------------------------------------------
+
+SM/SLA/SIP/BV-01-C	PASS	security-set-data io_capabilities=4
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				security-start conn=<handle>
+-------------------------------------------------------------------------------
+
+SM/SLA/SIE/BV-01-C	PASS	security-set-data io_capabilities=3 bonding=1 our_key_dist=1 their_key_dist=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				advertise-start
+				security-start conn=<handle>
+-------------------------------------------------------------------------------
+
+SM/SLA/SCJW/BV-02-C	PASS	security-set-data io_capabilities=4 oob_flag=0 bonding=0 mitm_flag=0 sc=1 our_key_dist=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/SCJW/BV-03-C	PASS	security-set-data io_capabilities=1 our_key_dist=1 oob_flag=0
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+SM/SLA/SCJW/BI-02-C	PASS	security-set-data io_capabilities=1 oob_flag=0 bonding=1 sc=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+-------------------------------------------------------------------------------
+
+SM/SLA/SCPK/BV-02-C	PASS	security-set-data io_capabilities=1 oob_flag=0 sc=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				auth-passkey conn=1 action=4 key=186900 yesno=yy
+SM/SLA/SCPK/BV-03-C	PASS	security-set-data io_capabilities=2 oob_flag=0 our_key_dist=1 their_key_dist=1 sc=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				auth-passkey conn=1 action=2 key=123456
 				Note: enter '123456' passkey in PTS
-SM/SLA/KDU/BV-02-C	PASS	b set sm_data our_key_dist=2
-				b adv
-				b passkey conn=<handle> action=3 key=123456
+SM/SLA/SCPK/BI-03-C	PASS	security-set-data io_capabilities=2 oob_flag=0 sc=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				auth-passkey conn=1 action=2 key=123456 oob=<xx:xx:xx...>
 				Note: enter '123456' passkey in PTS
-SM/SLA/KDU/BV-03-C	PASS	b set sm_data our_key_dist=4
-				b adv
-				b passkey conn=<handle> action=3 key=123456
-				Note: enter '123456' passkey in PTS
-SM/SLA/KDU/BV-07-C	PASS	b set sm_data our_key_dist=1
-				b adv
-				b adv
-				b passkey conn=<handle> action=3 key=123456
+SM/SLA/SCPK/BI-04-C	PASS	security-set-data io_capabilities=2 oob_flag=0 mitm_flag=1 sc=1
+				advertise-configure connectable=1 legacy=1
+				advertise-start
+				<repeat>
+				auth-passkey conn=1 action=2 key=123456
 				Note: enter '123456' passkey in PTS
 -------------------------------------------------------------------------------
 
-SM/SLA/SIP/BV-01-C	PASS	b set sm_data io_capabilities=2
-				b adv
-				b sec start conn=<handle>
-				b passkey conn=<handle> action=2 key=<passkey>
+SM/SLA/SCOB/BV-02-C	N/A
+SM/SLA/SCOB/BI-03-C	N/A
+SM/SLA/SCOB/BV-02-C	N/A
+SM/SLA/SCOB/BI-03-C	N/A
 -------------------------------------------------------------------------------
 
-SM/SLA/SIE/BV-01-C	PASS	b set sm_data bonding=1 our_key_dist=7 their_key_dist=7
-				b adv
-				b adv
-				b sec start conn=<handle>
--------------------------------------------------------------------------------
+SM/SLA/SCCT/BV-02-C	N/A
+SM/SLA/SCCT/BV-04-C	N/A
+SM/SLA/SCCT/BV-06-C	N/A
+SM/SLA/SCCT/BV-08-C	N/A
+SM/SLA/SCCT/BV-10-C	N/A
\ No newline at end of file
diff --git a/nimble/host/src/ble_att_clt.c b/nimble/host/src/ble_att_clt.c
index b33f837..09fc9ea 100644
--- a/nimble/host/src/ble_att_clt.c
+++ b/nimble/host/src/ble_att_clt.c
@@ -43,8 +43,6 @@
 
     rsp = (struct ble_att_error_rsp *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "error rsp", conn_handle, ble_att_error_rsp_log, rsp);
-
     ble_gattc_rx_err(conn_handle, le16toh(rsp->baep_handle),
                      le16toh(rsp->baep_error_code));
 
@@ -96,8 +94,6 @@
         return rc;
     }
 
-    BLE_ATT_LOG_CMD(1, "mtu req", conn_handle, ble_att_mtu_cmd_log, req);
-
     ble_hs_lock();
 
     rc = ble_att_conn_chan_find(conn_handle, &conn, &chan);
@@ -124,8 +120,6 @@
     if (rc == 0) {
         cmd = (struct ble_att_mtu_cmd *)(*rxom)->om_data;
 
-        BLE_ATT_LOG_CMD(0, "mtu rsp", conn_handle, ble_att_mtu_cmd_log, cmd);
-
         ble_hs_lock();
 
         rc = ble_att_conn_chan_find(conn_handle, NULL, &chan);
@@ -172,9 +166,6 @@
     req->bafq_start_handle = htole16(start_handle);
     req->bafq_end_handle = htole16(end_handle);
 
-    BLE_ATT_LOG_CMD(1, "find info req", conn_handle,
-                    ble_att_find_info_req_log, req);
-
     return ble_att_tx(conn_handle, txom);
 }
 
@@ -247,9 +238,6 @@
 
     rsp = (struct ble_att_find_info_rsp *)(*om)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "find info rsp", conn_handle, ble_att_find_info_rsp_log,
-                    rsp);
-
     /* Strip the response base from the front of the mbuf. */
     os_mbuf_adj((*om), sizeof(*rsp));
 
@@ -306,9 +294,6 @@
     req->bavq_attr_type = htole16(attribute_type);
     memcpy(req->bavq_value, attribute_value, value_len);
 
-    BLE_ATT_LOG_CMD(1, "find type value req", conn_handle,
-                    ble_att_find_type_value_req_log, req);
-
     return ble_att_tx(conn_handle, txom);
 }
 
@@ -344,8 +329,6 @@
     struct ble_att_find_type_value_hinfo hinfo;
     int rc;
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "find type value rsp", conn_handle);
-
     /* Parse the Handles-Information-List field, passing each entry to GATT. */
     rc = 0;
     while (OS_MBUF_PKTLEN(*rxom) > 0) {
@@ -393,9 +376,6 @@
 
     ble_uuid_flat(uuid, req->uuid);
 
-    BLE_ATT_LOG_CMD(1, "read type req", conn_handle,
-                    ble_att_read_type_req_log, req);
-
     return ble_att_tx(conn_handle, txom);
 }
 
@@ -419,9 +399,6 @@
 
     rsp = (struct ble_att_read_type_rsp *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "read type rsp", conn_handle, ble_att_read_type_rsp_log,
-                    rsp);
-
     data_len = rsp->batp_length;
 
     /* Strip the response base from the front of the mbuf. */
@@ -487,8 +464,6 @@
         return rc;
     }
 
-    BLE_ATT_LOG_CMD(1, "read req", conn_handle, ble_att_read_req_log, req);
-
     return 0;
 }
 
@@ -499,8 +474,6 @@
     return BLE_HS_ENOTSUP;
 #endif
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "read rsp", conn_handle);
-
     /* Pass the Attribute Value field to GATT. */
     ble_gattc_rx_read_rsp(conn_handle, 0, rxom);
     return 0;
@@ -538,9 +511,6 @@
         return rc;
     }
 
-    BLE_ATT_LOG_CMD(1, "read blob req", conn_handle,
-                    ble_att_read_blob_req_log, req);
-
     return 0;
 }
 
@@ -551,8 +521,6 @@
     return BLE_HS_ENOTSUP;
 #endif
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "read blob rsp", conn_handle);
-
     /* Pass the Attribute Value field to GATT. */
     ble_gattc_rx_read_blob_rsp(conn_handle, 0, rxom);
     return 0;
@@ -573,8 +541,6 @@
     struct os_mbuf *txom;
     int i;
 
-    BLE_ATT_LOG_EMPTY_CMD(1, "reqd mult req", conn_handle);
-
     if (num_handles < 1) {
         return BLE_HS_EINVAL;
     }
@@ -600,8 +566,6 @@
     return BLE_HS_ENOTSUP;
 #endif
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "read mult rsp", conn_handle);
-
     /* Pass the Attribute Value field to GATT. */
     ble_gattc_rx_read_mult_rsp(conn_handle, 0, rxom);
     return 0;
@@ -637,9 +601,6 @@
     req->bagq_end_handle = htole16(end_handle);
     ble_uuid_flat(uuid, req->uuid);
 
-    BLE_ATT_LOG_CMD(1, "read group type req", conn_handle,
-                    ble_att_read_group_type_req_log, req);
-
     return ble_att_tx(conn_handle, txom);
 }
 
@@ -686,9 +647,6 @@
 
     rsp = (struct ble_att_read_group_type_rsp *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "read group type rsp", conn_handle,
-                    ble_att_read_group_type_rsp_log, rsp);
-
     len = rsp->bagp_length;
 
     /* Strip the base from the front of the response. */
@@ -735,8 +693,6 @@
     req->bawq_handle = htole16(handle);
     os_mbuf_concat(txom2, txom);
 
-    BLE_ATT_LOG_CMD(1, "write req", conn_handle, ble_att_write_req_log, req);
-
     return ble_att_tx(conn_handle, txom2);
 }
 
@@ -774,8 +730,6 @@
     cmd->handle = htole16(handle);
     os_mbuf_concat(txom2, txom);
 
-    BLE_ATT_LOG_CMD(1, "write cmd", conn_handle, ble_att_write_cmd_log, cmd);
-
     return ble_att_tx(conn_handle, txom2);
 }
 
@@ -786,8 +740,6 @@
     return BLE_HS_ENOTSUP;
 #endif
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "write rsp", conn_handle);
-
     /* No payload. */
     ble_gattc_rx_write_rsp(conn_handle);
     return 0;
@@ -835,9 +787,6 @@
     req->bapc_offset = htole16(offset);
     os_mbuf_concat(txom2, txom);
 
-    BLE_ATT_LOG_CMD(1, "prep write req", conn_handle,
-                    ble_att_prep_write_cmd_log, req);
-
     return ble_att_tx(conn_handle, txom2);
 
 err:
@@ -866,8 +815,6 @@
     }
 
     rsp = (struct ble_att_prep_write_cmd *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "prep write rsp", conn_handle,
-                    ble_att_prep_write_cmd_log, rsp);
 
     handle = le16toh(rsp->bapc_handle);
     offset = le16toh(rsp->bapc_offset);
@@ -908,9 +855,6 @@
         return rc;
     }
 
-    BLE_ATT_LOG_CMD(1, "exec write req", conn_handle,
-                    ble_att_exec_write_req_log, req);
-
     return 0;
 }
 
@@ -921,8 +865,6 @@
     return BLE_HS_ENOTSUP;
 #endif
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "exec write rsp", conn_handle);
-
     ble_gattc_rx_exec_write_rsp(conn_handle, 0);
     return 0;
 }
@@ -957,8 +899,6 @@
     req->banq_handle = htole16(handle);
     os_mbuf_concat(txom2, txom);
 
-    BLE_ATT_LOG_CMD(1, "notify req", conn_handle, ble_att_notify_req_log, req);
-
     return ble_att_tx(conn_handle, txom2);
 
 err:
@@ -996,9 +936,6 @@
     req->baiq_handle = htole16(handle);
     os_mbuf_concat(txom2, txom);
 
-    BLE_ATT_LOG_CMD(1, "indicate req", conn_handle, ble_att_indicate_req_log,
-                    req);
-
     return ble_att_tx(conn_handle, txom2);
 
 err:
@@ -1013,8 +950,6 @@
     return BLE_HS_ENOTSUP;
 #endif
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "indicate rsp", conn_handle);
-
     /* No payload. */
     ble_gattc_rx_indicate_rsp(conn_handle);
     return 0;
diff --git a/nimble/host/src/ble_att_cmd.c b/nimble/host/src/ble_att_cmd.c
index 999f57a..a123c85 100644
--- a/nimble/host/src/ble_att_cmd.c
+++ b/nimble/host/src/ble_att_cmd.c
@@ -137,13 +137,6 @@
 }
 
 void
-ble_att_error_rsp_log(const struct ble_att_error_rsp *cmd)
-{
-    BLE_HS_LOG(DEBUG, "req_op=%d handle=0x%04x error_code=%d",
-               cmd->baep_req_op, cmd->baep_handle, cmd->baep_error_code);
-}
-
-void
 ble_att_mtu_req_parse(const void *payload, int len,
                       struct ble_att_mtu_cmd *dst)
 {
@@ -191,12 +184,6 @@
 }
 
 void
-ble_att_mtu_cmd_log(const struct ble_att_mtu_cmd *cmd)
-{
-    BLE_HS_LOG(DEBUG, "mtu=%d", cmd->bamc_mtu);
-}
-
-void
 ble_att_find_info_req_parse(const void *payload, int len,
                             struct ble_att_find_info_req *dst)
 {
@@ -223,13 +210,6 @@
 }
 
 void
-ble_att_find_info_req_log(const struct ble_att_find_info_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x",
-               cmd->bafq_start_handle, cmd->bafq_end_handle);
-}
-
-void
 ble_att_find_info_rsp_parse(const void *payload, int len,
                             struct ble_att_find_info_rsp *dst)
 {
@@ -254,12 +234,6 @@
 }
 
 void
-ble_att_find_info_rsp_log(const struct ble_att_find_info_rsp *cmd)
-{
-    BLE_HS_LOG(DEBUG, "format=%d", cmd->bafp_format);
-}
-
-void
 ble_att_find_type_value_req_parse(const void *payload, int len,
                                   struct ble_att_find_type_value_req *dst)
 {
@@ -288,14 +262,6 @@
 }
 
 void
-ble_att_find_type_value_req_log(const struct ble_att_find_type_value_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x attr_type=%d",
-               cmd->bavq_start_handle, cmd->bavq_end_handle,
-               cmd->bavq_attr_type);
-}
-
-void
 ble_att_read_type_req_parse(const void *payload, int len,
                             struct ble_att_read_type_req *dst)
 {
@@ -322,13 +288,6 @@
 }
 
 void
-ble_att_read_type_req_log(const struct ble_att_read_type_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x",
-               cmd->batq_start_handle, cmd->batq_end_handle);
-}
-
-void
 ble_att_read_type_rsp_parse(const void *payload, int len,
                             struct ble_att_read_type_rsp *dst)
 {
@@ -353,12 +312,6 @@
 }
 
 void
-ble_att_read_type_rsp_log(const struct ble_att_read_type_rsp *cmd)
-{
-    BLE_HS_LOG(DEBUG, "length=%d", cmd->batp_length);
-}
-
-void
 ble_att_read_req_parse(const void *payload, int len,
                        struct ble_att_read_req *dst)
 {
@@ -383,12 +336,6 @@
 }
 
 void
-ble_att_read_req_log(const struct ble_att_read_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->barq_handle);
-}
-
-void
 ble_att_read_blob_req_parse(const void *payload, int len,
                             struct ble_att_read_blob_req *dst)
 {
@@ -415,13 +362,6 @@
 }
 
 void
-ble_att_read_blob_req_log(const struct ble_att_read_blob_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x offset=%d", cmd->babq_handle,
-               cmd->babq_offset);
-}
-
-void
 ble_att_read_mult_req_parse(const void *payload, int len)
 {
     ble_att_init_parse(BLE_ATT_OP_READ_MULT_REQ, payload,
@@ -476,13 +416,6 @@
 }
 
 void
-ble_att_read_group_type_req_log(const struct ble_att_read_group_type_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "start_handle=0x%04x end_handle=0x%04x",
-               cmd->bagq_start_handle, cmd->bagq_end_handle);
-}
-
-void
 ble_att_read_group_type_rsp_parse(const void *payload, int len,
                                   struct ble_att_read_group_type_rsp *dst)
 {
@@ -507,12 +440,6 @@
 }
 
 void
-ble_att_read_group_type_rsp_log(const struct ble_att_read_group_type_rsp *cmd)
-{
-    BLE_HS_LOG(DEBUG, "length=%d", cmd->bagp_length);
-}
-
-void
 ble_att_write_req_parse(const void *payload, int len,
                         struct ble_att_write_req *dst)
 {
@@ -558,18 +485,6 @@
 }
 
 void
-ble_att_write_cmd_log(const struct ble_att_write_cmd *cmd)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->handle);
-}
-
-void
-ble_att_write_req_log(const struct ble_att_write_req *req)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x", req->bawq_handle);
-}
-
-void
 ble_att_prep_write_req_parse(const void *payload, int len,
                              struct ble_att_prep_write_cmd *dst)
 {
@@ -622,13 +537,6 @@
 }
 
 void
-ble_att_prep_write_cmd_log(const struct ble_att_prep_write_cmd *cmd)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x offset=%d", cmd->bapc_handle,
-               cmd->bapc_offset);
-}
-
-void
 ble_att_exec_write_req_parse(const void *payload, int len,
                              struct ble_att_exec_write_req *dst)
 {
@@ -653,12 +561,6 @@
 }
 
 void
-ble_att_exec_write_req_log(const struct ble_att_exec_write_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "flags=0x%02x", cmd->baeq_flags);
-}
-
-void
 ble_att_exec_write_rsp_parse(const void *payload, int len)
 {
     ble_att_init_parse(BLE_ATT_OP_EXEC_WRITE_RSP, payload,
@@ -697,12 +599,6 @@
 }
 
 void
-ble_att_notify_req_log(const struct ble_att_notify_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->banq_handle);
-}
-
-void
 ble_att_indicate_req_parse(const void *payload, int len,
                            struct ble_att_indicate_req *dst)
 {
@@ -727,12 +623,6 @@
 }
 
 void
-ble_att_indicate_req_log(const struct ble_att_indicate_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "handle=0x%04x", cmd->baiq_handle);
-}
-
-void
 ble_att_indicate_rsp_parse(const void *payload, int len)
 {
     ble_att_init_parse(BLE_ATT_OP_INDICATE_RSP, payload,
diff --git a/nimble/host/src/ble_att_cmd_priv.h b/nimble/host/src/ble_att_cmd_priv.h
index ddc952b..70f3326 100644
--- a/nimble/host/src/ble_att_cmd_priv.h
+++ b/nimble/host/src/ble_att_cmd_priv.h
@@ -357,7 +357,6 @@
                              struct ble_att_error_rsp *rsp);
 void ble_att_error_rsp_write(void *payload, int len,
                              const struct ble_att_error_rsp *rsp);
-void ble_att_error_rsp_log(const struct ble_att_error_rsp *cmd);
 void ble_att_mtu_req_parse(const void *payload, int len,
                            struct ble_att_mtu_cmd *cmd);
 void ble_att_mtu_req_write(void *payload, int len,
@@ -366,43 +365,34 @@
                            struct ble_att_mtu_cmd *cmd);
 void ble_att_mtu_rsp_write(void *payload, int len,
                            const struct ble_att_mtu_cmd *cmd);
-void ble_att_mtu_cmd_log(const struct ble_att_mtu_cmd *cmd);
 void ble_att_find_info_req_parse(const void *payload, int len,
                                  struct ble_att_find_info_req *req);
 void ble_att_find_info_req_write(void *payload, int len,
                                  const struct ble_att_find_info_req *req);
-void ble_att_find_info_req_log(const struct ble_att_find_info_req *cmd);
 void ble_att_find_info_rsp_parse(const void *payload, int len,
                                  struct ble_att_find_info_rsp *rsp);
 void ble_att_find_info_rsp_write(void *payload, int len,
                                  const struct ble_att_find_info_rsp *rsp);
-void ble_att_find_info_rsp_log(const struct ble_att_find_info_rsp *cmd);
 void ble_att_find_type_value_req_parse(
     const void *payload, int len, struct ble_att_find_type_value_req *req);
 void ble_att_find_type_value_req_write(
     void *payload, int len, const struct ble_att_find_type_value_req *req);
-void ble_att_find_type_value_req_log(
-    const struct ble_att_find_type_value_req *cmd);
 void ble_att_read_type_req_parse(const void *payload, int len,
                                  struct ble_att_read_type_req *req);
 void ble_att_read_type_req_write(void *payload, int len,
                                  const struct ble_att_read_type_req *req);
-void ble_att_read_type_req_log(const struct ble_att_read_type_req *cmd);
 void ble_att_read_type_rsp_parse(const void *payload, int len,
                                  struct ble_att_read_type_rsp *rsp);
 void ble_att_read_type_rsp_write(void *payload, int len,
                                  const struct ble_att_read_type_rsp *rsp);
-void ble_att_read_type_rsp_log(const struct ble_att_read_type_rsp *cmd);
 void ble_att_read_req_parse(const void *payload, int len,
                             struct ble_att_read_req *req);
 void ble_att_read_req_write(void *payload, int len,
                             const struct ble_att_read_req *req);
-void ble_att_read_req_log(const struct ble_att_read_req *cmd);
 void ble_att_read_blob_req_parse(const void *payload, int len,
                                  struct ble_att_read_blob_req *req);
 void ble_att_read_blob_req_write(void *payload, int len,
                                  const struct ble_att_read_blob_req *req);
-void ble_att_read_blob_req_log(const struct ble_att_read_blob_req *cmd);
 void ble_att_read_mult_req_parse(const void *payload, int len);
 void ble_att_read_mult_req_write(void *payload, int len);
 void ble_att_read_mult_rsp_parse(const void *payload, int len);
@@ -411,14 +401,10 @@
     const void *payload, int len, struct ble_att_read_group_type_req *req);
 void ble_att_read_group_type_req_write(
     void *payload, int len, const struct ble_att_read_group_type_req *req);
-void ble_att_read_group_type_req_log(
-    const struct ble_att_read_group_type_req *cmd);
 void ble_att_read_group_type_rsp_parse(
     const void *payload, int len, struct ble_att_read_group_type_rsp *rsp);
 void ble_att_read_group_type_rsp_write(
     void *payload, int len, const struct ble_att_read_group_type_rsp *rsp);
-void ble_att_read_group_type_rsp_log(
-    const struct ble_att_read_group_type_rsp *cmd);
 void ble_att_write_req_parse(const void *payload, int len,
                              struct ble_att_write_req *req);
 void ble_att_write_req_write(void *payload, int len,
@@ -427,20 +413,16 @@
                              struct ble_att_write_req *req);
 void ble_att_write_cmd_write(void *payload, int len,
                              const struct ble_att_write_req *req);
-void ble_att_write_cmd_log(const struct ble_att_write_cmd *cmd);
-void ble_att_write_req_log(const struct ble_att_write_req *req);
 void ble_att_prep_write_req_parse(const void *payload, int len,
                                   struct ble_att_prep_write_cmd *cmd);
 void ble_att_prep_write_req_write(void *payload, int len,
                                   const struct ble_att_prep_write_cmd *cmd);
-void ble_att_prep_write_cmd_log(const struct ble_att_prep_write_cmd *cmd);
 void ble_att_prep_write_rsp_parse(const void *payload, int len,
                                   struct ble_att_prep_write_cmd *cmd);
 void ble_att_prep_write_rsp_write(void *payload, int len,
                                   const struct ble_att_prep_write_cmd *cmd);
 void ble_att_exec_write_req_parse(const void *payload, int len,
                                   struct ble_att_exec_write_req *req);
-void ble_att_exec_write_req_log(const struct ble_att_exec_write_req *cmd);
 void ble_att_exec_write_req_write(void *payload, int len,
                                   const struct ble_att_exec_write_req *req);
 void ble_att_exec_write_rsp_parse(const void *payload, int len);
@@ -449,14 +431,12 @@
                               struct ble_att_notify_req *req);
 void ble_att_notify_req_write(void *payload, int len,
                               const struct ble_att_notify_req *req);
-void ble_att_notify_req_log(const struct ble_att_notify_req *cmd);
 void ble_att_indicate_req_parse(const void *payload, int len,
                                 struct ble_att_indicate_req *req);
 void ble_att_indicate_req_write(void *payload, int len,
                                 const struct ble_att_indicate_req *req);
 void ble_att_indicate_rsp_parse(const void *payload, int len);
 void ble_att_indicate_rsp_write(void *payload, int len);
-void ble_att_indicate_req_log(const struct ble_att_indicate_req *cmd);
 
 void *ble_att_cmd_prepare(uint8_t opcode, size_t len, struct os_mbuf *txom);
 void *ble_att_cmd_get(uint8_t opcode, size_t len, struct os_mbuf **txom);
diff --git a/nimble/host/src/ble_att_priv.h b/nimble/host/src/ble_att_priv.h
index 715d32c..a2a9f97 100644
--- a/nimble/host/src/ble_att_priv.h
+++ b/nimble/host/src/ble_att_priv.h
@@ -170,12 +170,6 @@
 uint16_t ble_att_chan_mtu(const struct ble_l2cap_chan *chan);
 int ble_att_init(void);
 
-#define BLE_ATT_LOG_CMD(is_tx, cmd_name, conn_handle, log_cb, cmd) \
-    BLE_HS_LOG_CMD((is_tx), "att", (cmd_name), (conn_handle), (log_cb), (cmd))
-
-#define BLE_ATT_LOG_EMPTY_CMD(is_tx, cmd_name, conn_handle) \
-    BLE_HS_LOG_EMPTY_CMD((is_tx), "att", (cmd_name), (conn_handle))
-
 /*** @svr */
 
 int ble_att_svr_start(void);
diff --git a/nimble/host/src/ble_att_svr.c b/nimble/host/src/ble_att_svr.c
index d9915d9..46a7168 100644
--- a/nimble/host/src/ble_att_svr.c
+++ b/nimble/host/src/ble_att_svr.c
@@ -577,8 +577,6 @@
     rsp->baep_handle = htole16(handle);
     rsp->baep_error_code = error_code;
 
-    BLE_ATT_LOG_CMD(1, "error rsp", conn_handle, ble_att_error_rsp_log, rsp);
-
     return ble_att_tx(conn_handle, txom);
 }
 
@@ -705,8 +703,6 @@
 
     cmd->bamc_mtu = htole16(mtu);
 
-    BLE_ATT_LOG_CMD(1, "mtu rsp", conn_handle, ble_att_mtu_cmd_log, cmd);
-
     rc = 0;
 
 done:
@@ -734,7 +730,6 @@
     }
 
     cmd = (struct ble_att_mtu_cmd *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "mtu req", conn_handle, ble_att_mtu_cmd_log, cmd);
 
     mtu = le16toh(cmd->bamc_mtu);
 
@@ -888,9 +883,6 @@
         goto done;
     }
 
-    BLE_ATT_LOG_CMD(1, "find info rsp", conn_handle, ble_att_find_info_rsp_log,
-                    rsp);
-
     rc = 0;
 
 done:
@@ -926,9 +918,6 @@
     start_handle = le16toh(req->bafq_start_handle);
     end_handle = le16toh(req->bafq_end_handle);
 
-    BLE_ATT_LOG_CMD(0, "find info req", conn_handle, ble_att_find_info_req_log,
-                    req);
-
     /* Tx error response if start handle is greater than end handle or is equal
      * to 0 (Vol. 3, Part F, 3.4.3.1).
      */
@@ -1201,8 +1190,6 @@
         goto done;
     }
 
-    BLE_ATT_LOG_EMPTY_CMD(1, "find type value rsp", conn_handle);
-
     rc = 0;
 
 done:
@@ -1239,8 +1226,6 @@
     start_handle = le16toh(req->bavq_start_handle);
     end_handle = le16toh(req->bavq_end_handle);
     attr_type = (ble_uuid16_t) BLE_UUID16_INIT(le16toh(req->bavq_attr_type));
-    BLE_ATT_LOG_CMD(0, "find type value req", conn_handle,
-                    ble_att_find_type_value_req_log, req);
 
     /* Tx error response if start handle is greater than end handle or is equal
      * to 0 (Vol. 3, Part F, 3.4.3.3).
@@ -1376,8 +1361,6 @@
 
         /* Fill the response base. */
         rsp->batp_length = htole16(sizeof(*data) + prev_attr_len);
-        BLE_ATT_LOG_CMD(1, "read type rsp", conn_handle,
-                        ble_att_read_type_rsp_log, rsp);
     }
 
     *out_txom = txom;
@@ -1420,9 +1403,6 @@
 
     req = (struct ble_att_read_type_req *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "read type req", conn_handle, ble_att_read_type_req_log,
-                    req);
-
     start_handle = le16toh(req->batq_start_handle);
     end_handle = le16toh(req->batq_end_handle);
 
@@ -1480,7 +1460,6 @@
     }
 
     req = (struct ble_att_read_req *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "read req", conn_handle, ble_att_read_req_log, req);
 
     err_handle = le16toh(req->barq_handle);
 
@@ -1530,8 +1509,6 @@
     }
 
     req = (struct ble_att_read_blob_req *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "read blob req", conn_handle, ble_att_read_blob_req_log,
-                    req);
 
     err_handle = le16toh(req->babq_handle);
     offset = le16toh(req->babq_offset);
@@ -1553,8 +1530,6 @@
         goto done;
     }
 
-    BLE_ATT_LOG_EMPTY_CMD(1, "read blob rsp", conn_handle);
-
     rc = 0;
 
 done:
@@ -1617,7 +1592,6 @@
         }
     }
 
-    BLE_ATT_LOG_EMPTY_CMD(1, "read mult rsp", conn_handle);
     rc = 0;
 
 done:
@@ -1637,8 +1611,6 @@
     uint8_t att_err;
     int rc;
 
-    BLE_ATT_LOG_EMPTY_CMD(0, "read mult req", conn_handle);
-
     /* Initialize some values in case of early error. */
     txom = NULL;
     err_handle = 0;
@@ -1874,8 +1846,6 @@
     }
 
     if (rc == 0 || rc == BLE_HS_EMSGSIZE) {
-        BLE_ATT_LOG_CMD(1, "read group type rsp", conn_handle,
-                        ble_att_read_group_type_rsp_log, rsp);
         rc = 0;
     }
 
@@ -1917,8 +1887,6 @@
     }
 
     req = (struct ble_att_read_group_type_req *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "read group type req", conn_handle,
-                    ble_att_read_group_type_req_log, req);
 
     start_handle = le16toh(req->bagq_start_handle);
     end_handle = le16toh(req->bagq_end_handle);
@@ -2016,9 +1984,6 @@
 
     req = (struct ble_att_write_req *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "write req", conn_handle,
-                    ble_att_write_req_log, req);
-
     handle = le16toh(req->bawq_handle);
 
     /* Allocate the write response.  This must be done prior to processing the
@@ -2037,8 +2002,6 @@
         goto done;
     }
 
-    BLE_ATT_LOG_EMPTY_CMD(1, "write rsp", conn_handle);
-
     rc = 0;
 
 done:
@@ -2065,8 +2028,6 @@
     }
 
     req = (struct ble_att_write_req *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "write cmd", conn_handle,
-                    ble_att_write_req_log, req);
 
     handle = le16toh(req->bawq_handle);
 
@@ -2361,9 +2322,6 @@
 
     req = (struct ble_att_prep_write_cmd *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "prep write req", conn_handle,
-                    ble_att_prep_write_cmd_log, req);
-
     err_handle = le16toh(req->bapc_handle);
 
     attr_entry = ble_att_svr_find_by_handle(le16toh(req->bapc_handle));
@@ -2411,9 +2369,6 @@
     os_mbuf_prepend(txom, 1);
     txom->om_data[0] = BLE_ATT_OP_PREP_WRITE_RSP;
 
-    BLE_ATT_LOG_CMD(1, "prep write rsp", conn_handle,
-                    ble_att_prep_write_cmd_log, req);
-
     rc = 0;
 
 done:
@@ -2449,8 +2404,6 @@
     }
 
     req = (struct ble_att_exec_write_req *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "exec write req", conn_handle,
-                    ble_att_exec_write_req_log, req);
 
     flags = req->baeq_flags;
 
@@ -2517,9 +2470,6 @@
 
     req = (struct ble_att_notify_req *)(*rxom)->om_data;
 
-    BLE_ATT_LOG_CMD(0, "notify req", conn_handle,
-                    ble_att_notify_req_log, req);
-
     handle = le16toh(req->banq_handle);
 
     if (handle == 0) {
@@ -2591,8 +2541,6 @@
     }
 
     req = (struct ble_att_indicate_req *)(*rxom)->om_data;
-    BLE_ATT_LOG_CMD(0, "indicate req", conn_handle,
-                    ble_att_indicate_req_log, req);
 
     handle = le16toh(req->baiq_handle);
 
@@ -2615,8 +2563,6 @@
     ble_gap_notify_rx_event(conn_handle, handle, *rxom, 1);
     *rxom = NULL;
 
-    BLE_ATT_LOG_EMPTY_CMD(1, "indicate rsp", conn_handle);
-
     rc = 0;
 
 done:
diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index cdc20a5..5a16552 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -5210,14 +5210,19 @@
         return BLE_HS_EINVAL;
     }
 
+    ble_hs_lock();
+
     conn = ble_hs_conn_find_by_addr(peer_addr);
     if (conn != NULL) {
-        rc = ble_gap_terminate(conn->bhc_handle, BLE_ERR_REM_USER_CONN_TERM);
+        rc = ble_gap_terminate_with_conn(conn, BLE_ERR_REM_USER_CONN_TERM);
         if ((rc != BLE_HS_EALREADY) && (rc != BLE_HS_ENOTCONN)) {
+            ble_hs_unlock();
             return rc;
         }
     }
 
+    ble_hs_unlock();
+
     rc = ble_hs_pvcy_remove_entry(peer_addr->type,
                                   peer_addr->val);
     if (rc != 0) {
diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index c269636..2e5451a 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -707,8 +707,7 @@
     ble_monitor_send_om(BLE_MONITOR_OPCODE_ACL_TX_PKT, om);
 #endif
 
-    ble_hci_trans_hs_acl_tx(om);
-    return 0;
+    return ble_hci_trans_hs_acl_tx(om);
 }
 
 void
@@ -744,8 +743,10 @@
     rc = ble_hs_conn_init();
     SYSINIT_PANIC_ASSERT(rc == 0);
 
+#if MYNEWT_VAL(BLE_PERIODIC_ADV)
     rc = ble_hs_periodic_sync_init();
     SYSINIT_PANIC_ASSERT(rc == 0);
+#endif
 
     rc = ble_l2cap_init();
     SYSINIT_PANIC_ASSERT(rc == 0);
diff --git a/nimble/host/src/ble_hs_dbg.c b/nimble/host/src/ble_hs_dbg.c
deleted file mode 100644
index eea90f3..0000000
--- a/nimble/host/src/ble_hs_dbg.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#include <stdint.h>
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include "os/os.h"
-#include "nimble/hci_common.h"
-#include "nimble/ble_hci_trans.h"
-#include "host/ble_monitor.h"
-#include "ble_hs_priv.h"
-
-static void
-ble_hs_dbg_le_event_disp(uint8_t subev, uint8_t len, uint8_t *evdata)
-{
-    int8_t rssi;
-    uint8_t advlen;
-    uint8_t status;
-    int i;
-    int imax;
-    uint8_t *dptr;
-    char *adv_ptr;
-    char adv_data_buf[32];
-
-    switch (subev) {
-    case BLE_HCI_LE_SUBEV_ENH_CONN_COMPLETE:
-    case BLE_HCI_LE_SUBEV_CONN_COMPLETE:
-        status = evdata[0];
-        if (status == BLE_ERR_SUCCESS) {
-            BLE_HS_LOG(DEBUG, "LE connection complete. handle=%u role=%u "
-                              "paddrtype=%u addr=%x.%x.%x.%x.%x.%x ",
-                       get_le16(evdata + 1), evdata[3], evdata[4],
-                       evdata[10], evdata[9], evdata[8], evdata[7],
-                       evdata[6], evdata[5]);
-
-            evdata += 11;
-            if (subev == BLE_HCI_LE_SUBEV_ENH_CONN_COMPLETE) {
-                BLE_HS_LOG(DEBUG, "local_rpa=%x.%x.%x.%x.%x.%x "
-                                   "peer_rpa=%x.%x.%x.%x.%x.%x ",
-                           evdata[5], evdata[4], evdata[3], evdata[2],
-                           evdata[1], evdata[0],
-                           evdata[11], evdata[10], evdata[9], evdata[8],
-                           evdata[7], evdata[6]);
-
-                evdata += 12;
-            }
-            BLE_HS_LOG(DEBUG, "itvl=%u latency=%u spvn_tmo=%u mca=%u\n",
-                       get_le16(evdata), get_le16(evdata + 2),
-                       get_le16(evdata + 4), evdata[6]);
-        } else {
-            BLE_HS_LOG(DEBUG, "LE connection complete. FAIL (status=%u)\n",
-                       status);
-        }
-        break;
-    case BLE_HCI_LE_SUBEV_ADV_RPT:
-        advlen = evdata[9];
-        rssi = evdata[10 + advlen];
-        BLE_HS_LOG(DEBUG, "LE advertising report. len=%u num=%u evtype=%u "
-                          "addrtype=%u addr=%x.%x.%x.%x.%x.%x advlen=%u "
-                          "rssi=%d\n", len, evdata[0], evdata[1], evdata[2],
-                   evdata[8], evdata[7], evdata[6], evdata[5],
-                   evdata[4], evdata[3], advlen, rssi);
-        if (advlen) {
-            dptr = &evdata[10];
-            while (advlen > 0) {
-                memset(adv_data_buf, 0, 32);
-                imax = advlen;
-                if (imax > 8) {
-                    imax = 8;
-                }
-                adv_ptr = &adv_data_buf[0];
-                for (i = 0; i < imax; ++i) {
-                    snprintf(adv_ptr, 4, "%02x ", *dptr);
-                    adv_ptr += 3;
-                    ++dptr;
-                }
-                advlen -= imax;
-                BLE_HS_LOG(DEBUG, "%s\n", adv_data_buf);
-            }
-        }
-        break;
-    case BLE_HCI_LE_SUBEV_CONN_UPD_COMPLETE:
-        status = evdata[0];
-        if (status == BLE_ERR_SUCCESS) {
-            BLE_HS_LOG(DEBUG, "LE Connection Update Complete. handle=%u "
-                              "itvl=%u latency=%u timeout=%u\n",
-                       get_le16(evdata + 1), get_le16(evdata + 3),
-                       get_le16(evdata + 5), get_le16(evdata + 7));
-        } else {
-            BLE_HS_LOG(DEBUG, "LE Connection Update Complete. FAIL "
-                              "(status=%u)\n", status);
-        }
-        break;
-
-    case BLE_HCI_LE_SUBEV_DATA_LEN_CHG:
-        BLE_HS_LOG(DEBUG, "LE Data Length Change. handle=%u max_tx_bytes=%u "
-                          "max_tx_time=%u max_rx_bytes=%u max_rx_time=%u\n",
-                   get_le16(evdata), get_le16(evdata + 2),
-                   get_le16(evdata + 4), get_le16(evdata + 6),
-                   get_le16(evdata + 8));
-        break;
-    case BLE_HCI_LE_SUBEV_REM_CONN_PARM_REQ:
-        BLE_HS_LOG(DEBUG, "LE Remote Connection Parameter Request. handle=%u "
-                          "min_itvl=%u max_itvl=%u latency=%u timeout=%u\n",
-                   get_le16(evdata), get_le16(evdata + 2),
-                   get_le16(evdata + 4), get_le16(evdata + 6),
-                   get_le16(evdata + 8));
-        break;
-
-    case BLE_HCI_LE_SUBEV_RD_REM_USED_FEAT:
-        status = evdata[0];
-        if (status == BLE_ERR_SUCCESS) {
-            BLE_HS_LOG(DEBUG, "LE Remote Used Features. handle=%u feat=",
-                       get_le16(evdata + 1));
-            for (i = 0; i < BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN; ++i) {
-                BLE_HS_LOG(DEBUG, "%02x ", evdata[3 + i]);
-            }
-            BLE_HS_LOG(DEBUG, "\n");
-        } else {
-            BLE_HS_LOG(DEBUG, "LE Remote Used Features. FAIL (status=%u)\n",
-                       status);
-        }
-        break;
-
-    case BLE_HCI_LE_SUBEV_LT_KEY_REQ:
-            BLE_HS_LOG(DEBUG, "LE LTK Req. handle=%u rand=%lx%lx encdiv=%u\n",
-                       get_le16(evdata), get_le32(evdata + 6),
-                       get_le32(evdata + 2), get_le16(evdata + 10));
-        break;
-
-    case BLE_HCI_LE_SUBEV_PHY_UPDATE_COMPLETE:
-            BLE_HS_LOG(DEBUG, "PHY update. handle=%u tx=%u rx=%u\n",
-                       get_le16(evdata + 1), evdata[3], evdata[4]);
-        break;
-
-    case BLE_HCI_LE_SUBEV_DIRECT_ADV_RPT:
-    {
-        struct hci_le_subev_direct_adv_rpt *data = (void *) evdata;
-        struct hci_le_subev_direct_adv_rpt_param *params = data->params;
-
-        if (len < sizeof(*data) ||
-                len < sizeof(*data) + data->num_reports * sizeof(*params)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Directed Advertising Report "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Directed Advertising Report len=%u "
-                   "num=0x%02x ", len, data->num_reports);
-
-        for (i = 0; i < data->num_reports; i++) {
-            BLE_HS_LOG(DEBUG, "[%d]={evttype=0x%02x}\n", i, params->evt_type);
-            params += 1;
-        }
-        break;
-    }
-
-    case BLE_HCI_LE_SUBEV_RD_LOC_P256_PUBKEY:
-    {
-        struct hci_le_subev_rd_loc_p256_pubkey *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Read Local P-256 Public Key "
-                       "Complete Event len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Read Local P-256 Public Key Complete "
-                   "len=%u status=0x%02x\n", len, data->status);
-        break;
-    }
-
-    case BLE_HCI_LE_SUBEV_GEN_DHKEY_COMPLETE:
-    {
-        struct hci_le_subev_gen_dhkey_complete *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Generate DHKey Complete "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Generate DHKey Complete Event len=%u "
-                   "status=0x%02x\n", len, data->status);
-        break;
-    }
-
-#if MYNEWT_VAL(BLE_EXT_ADV)
-    case BLE_HCI_LE_SUBEV_EXT_ADV_RPT:
-    {
-        struct hci_le_subev_ext_adv_rpt *data = (void *) evdata;
-        struct hci_ext_adv_report_param *params;
-
-        if (len < sizeof(*data) + sizeof(*params)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Extended Advertising Report "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Extended Advertising Report len=%u num=0x%02x ",
-                   len, data->num_reports);
-
-        for (i = 0, dptr = &evdata[1]; i < data->num_reports;  i++) {
-            params = (void *) dptr;
-            BLE_HS_LOG(DEBUG, "[%d]={evttype=0x%04x advlen=%u}\n",
-                       i, le16toh(params->evt_type), params->adv_data_len);
-            dptr += sizeof(*params) + params->adv_data_len;
-        }
-        break;
-    }
-#if MYNEWT_VAL(BLE_PERIODIC_ADV)
-    case BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_ESTAB:
-    {
-        struct hci_le_subev_periodic_adv_sync_estab *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Periodic Advertising Sync "
-                       "Established len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Periodic Advertising Sync Established "
-                   "len=%u status=0x%02x handle=0x%04x", len, data->status,
-                   le16toh(data->sync_handle));
-        break;
-    }
-
-    case BLE_HCI_LE_SUBEV_PERIODIC_ADV_RPT:
-    {
-        struct hci_le_subev_periodic_adv_rpt *data = (void *) evdata;
-
-        if (len < sizeof(*data) || len != sizeof(*data) + data->data_length) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Periodic Advertising Report "
-                    "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Periodic Advertising Report "
-                   "len=%u handle=0x%04x data_status=0x%02x data_len=0x%02x",
-                   len, le16toh(data->sync_handle), data->data_status,
-                   data->data_length);
-        break;
-    }
-
-    case BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_LOST:
-    {
-        struct hci_le_subev_periodic_adv_sync_lost *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Periodic Advertising Sync Lost "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Periodic Advertising Sync Lost "
-                   "len=%u handle=0x%04x", len, le16toh(data->sync_handle));
-        break;
-    }
-#endif
-
-    case BLE_HCI_LE_SUBEV_SCAN_TIMEOUT:
-        if (len) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Scan Timeout len=%u", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Scan Timeout Event len=%u", len);
-        break;
-
-    case BLE_HCI_LE_SUBEV_ADV_SET_TERMINATED:
-    {
-        struct hci_le_subev_adv_set_terminated *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Advertising Set Terminated "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Advertising Set Terminated len=%u "
-                   "status=0x%02x adv_handle=0x%02x conn_handle=0x%04x "
-                   "num_compl_ext_adv_ev=0x%02x", len, data->status,
-                   data->adv_handle, le16toh(data->conn_handle),
-                   data->num_compl_ext_adv_ev);
-        break;
-    }
-
-    case BLE_HCI_LE_SUBEV_SCAN_REQ_RCVD:
-    {
-        struct hci_le_subev_scan_req_rcvd *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Scan Request Received "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Scan Request Received len=%u "
-                   "adv_handle=0x%02x", len, data->adv_handle);
-        break;
-    }
-#endif /* MYNEWT_VAL(BLE_EXT_ADV) */
-
-    case BLE_HCI_LE_SUBEV_CHAN_SEL_ALG:
-    {
-        struct hci_le_subev_chan_sel_alg *data = (void *) evdata;
-
-        if (len != sizeof(*data)) {
-            BLE_HS_LOG(DEBUG, "Corrupted LE Channel Selection Algorithm "
-                       "len=%u\n", len);
-            break;
-        }
-
-        BLE_HS_LOG(DEBUG, "LE Channel Selection Algorithm len=%u "
-                   "conn_handle=0x%04x chan_sel_alg=0x%02x\n", len,
-                   le16toh(data->conn_handle), data->chan_sel_alg);
-        break;
-    }
-
-    default:
-        BLE_HS_LOG(DEBUG, "LE Meta SubEvent op=0x%02x\n", subev);
-        break;
-    }
-}
-
-/**
- * Display a disconnection complete command.
- *
- *
- * @param evdata
- * @param len
- */
-static void
-ble_hs_dbg_disconn_comp_disp(uint8_t *evdata, uint8_t len)
-{
-    uint8_t status;
-    uint8_t reason;
-    uint16_t handle;
-
-    status = evdata[0];
-    handle = get_le16(evdata + 1);
-    /* Ignore reason if status is not success */
-    if (status != BLE_ERR_SUCCESS) {
-        reason = 0;
-    } else {
-        reason = evdata[3];
-    }
-    BLE_HS_LOG(DEBUG, "Disconnection Complete: status=%u handle=%u "
-                      "reason=%u\n", status, handle, reason);
-}
-
-/**
- * Display an encryption change event or encryption key refresh event
- *
- * @param evdata
- * @param len
- */
-static void
-ble_hs_dbg_encrypt_chg_disp(uint8_t *evdata, uint8_t len)
-{
-    uint8_t status;
-    uint8_t enabled;
-    uint16_t handle;
-
-    status = evdata[0];
-    handle = get_le16(evdata + 1);
-
-    /* Ignore reason if status is not success */
-    if (status != BLE_ERR_SUCCESS) {
-        enabled = 0;
-    } else {
-        enabled = evdata[3];
-    }
-    BLE_HS_LOG(DEBUG, "Encrypt change: status=%u handle=%u state=%u\n",
-               status, handle, enabled);
-}
-
-/**
- * Display an encryption encryption key refresh event
- *
- * @param evdata
- * @param len
- */
-static void
-ble_hs_dbg_encrypt_refresh_disp(uint8_t *evdata, uint8_t len)
-{
-    uint8_t status;
-    uint16_t handle;
-
-    status = evdata[0];
-    handle = get_le16(evdata + 1);
-
-    BLE_HS_LOG(DEBUG, "Encrypt key refresh: status=%u handle=%u\n",
-               status, handle);
-}
-
-/**
- * Display a version information event
- *
- * @param evdata
- * @param len
- */
-static void
-ble_hs_dbg_rd_rem_ver_disp(uint8_t *evdata, uint8_t len)
-{
-    BLE_HS_LOG(DEBUG, "Remote Version Info: status=%u handle=%u vers_nr=%u "
-                      "compid=%u subver=%u\n",
-               evdata[0], get_le16(evdata + 1), evdata[3],
-               get_le16(evdata + 4), get_le16(evdata + 6));
-}
-
-/**
- * Display the number of completed packets event
- *
- * @param evdata
- * @param len
- */
-static void
-ble_hs_dbg_num_comp_pkts_disp(uint8_t *evdata, uint8_t len)
-{
-    uint8_t handles;
-    uint8_t *handle_ptr;
-    uint16_t handle;
-    uint16_t pkts;
-
-    handles = evdata[0];
-    if (len != ((handles * 4) + 1)) {
-        BLE_HS_LOG(DEBUG, "ERR: Number of Completed Packets bad length: "
-                          "num_handles=%u len=%u\n", handles, len);
-        return;
-
-    }
-
-    BLE_HS_LOG(DEBUG, "Number of Completed Packets: num_handles=%u\n",
-               handles);
-    if (handles) {
-        handle_ptr = evdata + 1;
-        while (handles) {
-            handle = get_le16(handle_ptr);
-            pkts = get_le16(handle_ptr + 2);
-            handle_ptr += 4;
-            BLE_HS_LOG(DEBUG, "handle:%u pkts:%u\n", handle, pkts);
-            --handles;
-        }
-    }
-}
-
-/**
- * Display the authenticated payload timeout event
- *
- * @param evdata
- * @param len
- */
-static void
-ble_hs_dbg_auth_pyld_tmo_disp(uint8_t *evdata, uint8_t len)
-{
-    uint16_t handle;
-
-    if (len != sizeof(uint16_t)) {
-        BLE_HS_LOG(DEBUG, "ERR: AuthPyldTmoEvent bad length %u\n", len);
-        return;
-
-    }
-
-    handle = get_le16(evdata);
-    BLE_HS_LOG(DEBUG, "AuthPyldTmo: handle=%u\n", handle);
-}
-
-
-static void
-ble_hs_dbg_cmd_comp_info_params(uint8_t status, uint8_t ocf, uint8_t *evdata)
-{
-    int i;
-    uint8_t *dptr;
-
-    if (status != BLE_ERR_SUCCESS) {
-        return;
-    }
-
-    switch (ocf) {
-    case BLE_HCI_OCF_IP_RD_LOCAL_VER:
-        BLE_HS_LOG(DEBUG, "hci_ver=%u hci_rev=%u lmp_ver=%u mfrg=%u "
-                          "lmp_subver=%u",
-                   evdata[0], get_le16(evdata + 1), evdata[3],
-                   get_le16(evdata + 4), get_le16(evdata + 6));
-        break;
-    case BLE_HCI_OCF_IP_RD_LOC_SUPP_CMD:
-        BLE_HS_LOG(DEBUG, "supp_cmds=");
-        dptr = evdata;
-        for (i = 0; i < 8; ++i) {
-            BLE_HS_LOG(DEBUG, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:",
-                       dptr[0], dptr[1], dptr[2], dptr[3],
-                       dptr[4], dptr[5], dptr[6], dptr[7]);
-            dptr += 8;
-        }
-        break;
-    case BLE_HCI_OCF_IP_RD_LOC_SUPP_FEAT:
-        BLE_HS_LOG(DEBUG, "supp_feat=0x%lx%08lx",
-                   get_le32(evdata + 4), get_le32(evdata));
-        break;
-    case BLE_HCI_OCF_IP_RD_BD_ADDR:
-        BLE_HS_LOG(DEBUG, "bd_addr=%x:%x:%x:%x:%x:%x",
-                   evdata[5], evdata[4], evdata[3],
-                   evdata[2], evdata[1], evdata[0]);
-        break;
-    default:
-        break;
-    }
-}
-
-static void
-ble_hs_dbg_cmd_complete_disp(uint8_t *evdata, uint8_t len)
-{
-    uint8_t cmd_pkts;
-    uint8_t ogf;
-    uint8_t ocf;
-    uint8_t status;
-    uint16_t opcode;
-
-    if (len < 3) {
-        BLE_HS_LOG(DEBUG, "Invalid command complete: len=%d "
-                          "(expected >= 3)", len);
-        goto done;
-    }
-
-    cmd_pkts = evdata[0];
-    opcode = get_le16(evdata + 1);
-    ogf = BLE_HCI_OGF(opcode);
-    ocf = BLE_HCI_OCF(opcode);
-
-    BLE_HS_LOG(DEBUG, "Command complete: cmd_pkts=%u ogf=0x%x ocf=0x%x",
-               cmd_pkts, ogf, ocf);
-
-    if (len == 3) {
-        goto done;
-    }
-
-    status = evdata[3];
-    BLE_HS_LOG(DEBUG, " status=%u ", status);
-
-    /* Move past header and status */
-    evdata += 4;
-
-    /* Display parameters based on command. */
-    switch (ogf) {
-    case BLE_HCI_OGF_INFO_PARAMS:
-        ble_hs_dbg_cmd_comp_info_params(status, ocf, evdata);
-        break;
-    case BLE_HCI_OGF_STATUS_PARAMS:
-        switch (ocf) {
-        case BLE_HCI_OCF_RD_RSSI:
-            BLE_HS_LOG(DEBUG, "handle=%u rssi=%d", get_le16(evdata),
-                       (int8_t)evdata[2]);
-            break;
-        default:
-            break;
-        }
-        break;
-    case BLE_HCI_OGF_LE:
-        switch (ocf) {
-        case BLE_HCI_OCF_LE_RD_CHAN_MAP:
-            BLE_HS_LOG(DEBUG, "handle=%u chanmap=%x.%x.%x.%x.%x",
-                       get_le16(evdata), evdata[2], evdata[3], evdata[4],
-                       evdata[5], evdata[6]);
-            break;
-        case BLE_HCI_OCF_LE_RD_MAX_DATA_LEN:
-            BLE_HS_LOG(DEBUG, "txoct=%u txtime=%u rxoct=%u rxtime=%u",
-                       get_le16(evdata), get_le16(evdata + 2),
-                       get_le16(evdata + 4), get_le16(evdata + 6));
-            break;
-        case BLE_HCI_OCF_LE_RD_SUPP_STATES:
-            BLE_HS_LOG(DEBUG, "states=0x%lx%08lx", get_le32(evdata + 4),
-                       get_le32(evdata));
-            break;
-        case BLE_HCI_OCF_LE_ENCRYPT:
-            BLE_HS_LOG(DEBUG, "encdata=0x%02x%02x%02x%02x%02x%02x%02x%02x",
-                       evdata[15], evdata[14], evdata[13], evdata[12],
-                       evdata[11], evdata[10], evdata[9], evdata[8]);
-            BLE_HS_LOG(DEBUG, "%02x%02x%02x%02x%02x%02x%02x%02x",
-                       evdata[7], evdata[6], evdata[5], evdata[4],
-                       evdata[3], evdata[2], evdata[1], evdata[0]);
-
-            break;
-        case BLE_HCI_OCF_LE_RAND:
-            BLE_HS_LOG(DEBUG, "rand=0x%02x%02x%02x%02x%02x%02x%02x%02x",
-                       evdata[0], evdata[1], evdata[2], evdata[3],
-                       evdata[4], evdata[5], evdata[6], evdata[7]);
-            break;
-        case BLE_HCI_OCF_LE_RD_SUGG_DEF_DATA_LEN:
-            BLE_HS_LOG(DEBUG, "txoct=%u txtime=%u", get_le16(evdata),
-                       get_le16(evdata + 2));
-            break;
-        case BLE_HCI_OCF_LE_LT_KEY_REQ_REPLY:
-        case BLE_HCI_OCF_LE_LT_KEY_REQ_NEG_REPLY:
-        case BLE_HCI_OCF_LE_SET_DATA_LEN:
-            BLE_HS_LOG(DEBUG, "handle=%u", get_le16(evdata));
-            break;
-        default:
-            break;
-        }
-        break;
-    default:
-        break;
-    }
-
-done:
-    BLE_HS_LOG(DEBUG, "\n");
-}
-
-static void
-ble_hs_dbg_cmd_status_disp(uint8_t *evdata, uint8_t len)
-{
-    uint8_t ogf;
-    uint8_t ocf;
-    uint16_t opcode;
-
-    opcode = get_le16(evdata + 2);
-    ogf = BLE_HCI_OGF(opcode);
-    ocf = BLE_HCI_OCF(opcode);
-
-    BLE_HS_LOG(DEBUG, "Command Status: status=%u cmd_pkts=%u ocf=0x%x "
-                      "ogf=0x%x\n", evdata[0], evdata[1], ocf, ogf);
-}
-
-void
-ble_hs_dbg_event_disp(uint8_t *evbuf)
-{
-#if MYNEWT_VAL(LOG_LEVEL) > LOG_LEVEL_DEBUG || BLE_MONITOR
-    return;
-#endif
-
-    uint8_t *evdata;
-    uint8_t evcode;
-    uint8_t len;
-
-    /* Extract event code and length; move pointer to event parameter data */
-    evcode = evbuf[0];
-    len = evbuf[1];
-    evdata = evbuf + BLE_HCI_EVENT_HDR_LEN;
-
-    switch (evcode) {
-    case BLE_HCI_EVCODE_DISCONN_CMP:
-        ble_hs_dbg_disconn_comp_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_ENC_KEY_REFRESH:
-        ble_hs_dbg_encrypt_refresh_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_ENCRYPT_CHG:
-        ble_hs_dbg_encrypt_chg_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_RD_REM_VER_INFO_CMP:
-        ble_hs_dbg_rd_rem_ver_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_COMMAND_COMPLETE:
-        ble_hs_dbg_cmd_complete_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_COMMAND_STATUS:
-        ble_hs_dbg_cmd_status_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_NUM_COMP_PKTS:
-        ble_hs_dbg_num_comp_pkts_disp(evdata, len);
-        break;
-    case BLE_HCI_EVCODE_LE_META:
-        ble_hs_dbg_le_event_disp(evdata[0], len-1, evdata + 1);
-        break;
-    case BLE_HCI_EVCODE_AUTH_PYLD_TMO:
-        ble_hs_dbg_auth_pyld_tmo_disp(evdata, len);
-        break;
-    default:
-        BLE_HS_LOG(DEBUG, "Unknown event 0x%x len=%u\n", evcode, len);
-        break;
-    }
-}
-
-void
-ble_hs_dbg_set_sync_state(uint8_t sync_state)
-{
-    ble_hs_sync_state = sync_state;
-}
diff --git a/nimble/host/src/ble_hs_dbg_priv.h b/nimble/host/src/ble_hs_dbg_priv.h
deleted file mode 100644
index 4d4390f..0000000
--- a/nimble/host/src/ble_hs_dbg_priv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_HS_DBG_PRIV_
-#define H_BLE_HS_DBG_PRIV_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void ble_hs_dbg_event_disp(uint8_t *evbuf);
-void ble_hs_dbg_set_sync_state(uint8_t sync_state);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_HOST_DBG_ */
diff --git a/nimble/host/src/ble_hs_hci.c b/nimble/host/src/ble_hs_hci.c
index 139957b..758b9c9 100644
--- a/nimble/host/src/ble_hs_hci.c
+++ b/nimble/host/src/ble_hs_hci.c
@@ -25,7 +25,6 @@
 #include "nimble/ble_hci_trans.h"
 #include "host/ble_monitor.h"
 #include "ble_hs_priv.h"
-#include "ble_hs_dbg_priv.h"
 #include "ble_monitor_priv.h"
 
 #define BLE_HCI_CMD_TIMEOUT_MS  2000
@@ -212,9 +211,6 @@
     /* Count events received */
     STATS_INC(ble_hs_stats, hci_event);
 
-    /* Display to console */
-    ble_hs_dbg_event_disp(ble_hs_hci_ack);
-
     event_code = ble_hs_hci_ack[0];
     param_len = ble_hs_hci_ack[1];
     event_len = param_len + 2;
diff --git a/nimble/host/src/ble_hs_hci_cmd.c b/nimble/host/src/ble_hs_hci_cmd.c
index a73a5f7..ee2ba65 100644
--- a/nimble/host/src/ble_hs_hci_cmd.c
+++ b/nimble/host/src/ble_hs_hci_cmd.c
@@ -25,7 +25,6 @@
 #include "nimble/hci_common.h"
 #include "nimble/ble_hci_trans.h"
 #include "host/ble_monitor.h"
-#include "ble_hs_dbg_priv.h"
 #include "ble_hs_priv.h"
 #include "ble_monitor_priv.h"
 
@@ -80,13 +79,6 @@
         memcpy(buf + BLE_HCI_CMD_HDR_LEN, cmddata, len);
     }
 
-#if !BLE_MONITOR
-    BLE_HS_LOG(DEBUG, "ble_hs_hci_cmd_send: ogf=0x%02x ocf=0x%04x len=%d\n",
-               BLE_HCI_OGF(opcode), BLE_HCI_OCF(opcode), len);
-    ble_hs_log_flat_buf(buf, len + BLE_HCI_CMD_HDR_LEN);
-    BLE_HS_LOG(DEBUG, "\n");
-#endif
-
     rc = ble_hs_hci_cmd_transport(buf);
 
     if (rc == 0) {
diff --git a/nimble/host/src/ble_hs_hci_evt.c b/nimble/host/src/ble_hs_hci_evt.c
index 021a1ae..709cea3 100644
--- a/nimble/host/src/ble_hs_hci_evt.c
+++ b/nimble/host/src/ble_hs_hci_evt.c
@@ -26,7 +26,6 @@
 #include "host/ble_gap.h"
 #include "host/ble_monitor.h"
 #include "ble_hs_priv.h"
-#include "ble_hs_dbg_priv.h"
 
 _Static_assert(sizeof (struct hci_data_hdr) == BLE_HCI_DATA_HDR_SZ,
                "struct hci_data_hdr must be 4 bytes");
@@ -853,9 +852,6 @@
     /* Count events received */
     STATS_INC(ble_hs_stats, hci_event);
 
-    /* Display to console */
-    ble_hs_dbg_event_disp(data);
-
     /* Process the event */
     event_code = data[0];
     param_len = data[1];
diff --git a/nimble/host/src/ble_hs_periodic_sync.c b/nimble/host/src/ble_hs_periodic_sync.c
index 1a77060..dad5351 100644
--- a/nimble/host/src/ble_hs_periodic_sync.c
+++ b/nimble/host/src/ble_hs_periodic_sync.c
@@ -1,152 +1,154 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one

- * or more contributor license agreements.  See the NOTICE file

- * distributed with this work for additional information

- * regarding copyright ownership.  The ASF licenses this file

- * to you under the Apache License, Version 2.0 (the

- * "License"); you may not use this file except in compliance

- * with the License.  You may obtain a copy of the License at

- *

- *  http://www.apache.org/licenses/LICENSE-2.0

- *

- * Unless required by applicable law or agreed to in writing,

- * software distributed under the License is distributed on an

- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

- * KIND, either express or implied.  See the License for the

- * specific language governing permissions and limitations

- * under the License.

- */

-

-#include <string.h>

-#include <errno.h>

-#include "syscfg/syscfg.h"

-#include "os/os.h"

-#include "host/ble_hs_id.h"

-#include "ble_hs_priv.h"

-

-static SLIST_HEAD(, ble_hs_periodic_sync) g_ble_hs_periodic_sync_handles;

-static struct os_mempool ble_hs_periodic_sync_pool;

-

-static os_membuf_t ble_hs_psync_elem_mem[

-    OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),

-                    sizeof (struct ble_hs_periodic_sync))

-];

-

-struct ble_hs_periodic_sync *

-ble_hs_periodic_sync_alloc(void)

-{

-    struct ble_hs_periodic_sync *psync;

-

-    psync = os_memblock_get(&ble_hs_periodic_sync_pool);

-    if (psync) {

-        memset(psync, 0, sizeof(*psync));

-    }

-

-    return psync;

-}

-

-void

-ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync)

-{

-    int rc;

-

-    if (psync == NULL) {

-        return;

-    }

-

-#if MYNEWT_VAL(BLE_HS_DEBUG)

-    memset(psync, 0xff, sizeof *psync);

-#endif

-    rc = os_memblock_put(&ble_hs_periodic_sync_pool, psync);

-    BLE_HS_DBG_ASSERT_EVAL(rc == 0);

-}

-

-void

-ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync)

-{

-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());

-

-    BLE_HS_DBG_ASSERT_EVAL(

-                       ble_hs_periodic_sync_find_by_handle(psync->sync_handle) == NULL);

-

-    SLIST_INSERT_HEAD(&g_ble_hs_periodic_sync_handles, psync, next);

-}

-

-void

-ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync)

-{

-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());

-

-    SLIST_REMOVE(&g_ble_hs_periodic_sync_handles, psync, ble_hs_periodic_sync,

-                 next);

-}

-

-struct ble_hs_periodic_sync *

-ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle)

-{

-    struct ble_hs_periodic_sync *psync;

-

-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());

-

-    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {

-        if (psync->sync_handle == sync_handle) {

-            return psync;

-        }

-    }

-

-    return NULL;

-}

-

-struct ble_hs_periodic_sync *

-ble_hs_periodic_sync_find(const ble_addr_t *addr, uint8_t sid)

-{

-    struct ble_hs_periodic_sync *psync;

-

-    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());

-

-    if (!addr) {

-        return NULL;

-    }

-

-    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {

-        if ((ble_addr_cmp(&psync->advertiser_addr, addr) == 0) &&

-                (psync->adv_sid == sid)) {

-            return psync;

-        }

-    }

-

-    return NULL;

-}

-

-/**

- * Retrieves the first periodic discovery handle in the list.

- */

-struct ble_hs_periodic_sync *

-ble_hs_periodic_sync_first(void)

-{

-    struct ble_hs_periodic_sync *psync;

-

-    ble_hs_lock();

-    psync = SLIST_FIRST(&g_ble_hs_periodic_sync_handles);

-    ble_hs_unlock();

-

-    return psync;

-}

-

-int

-ble_hs_periodic_sync_init(void)

-{

-    int rc;

-

-    rc = os_mempool_init(&ble_hs_periodic_sync_pool,

-                         MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),

-                         sizeof (struct ble_hs_periodic_sync),

-                         ble_hs_psync_elem_mem, "ble_hs_periodic_disc_pool");

-    if (rc != 0) {

-        return BLE_HS_EOS;

-    }

-

-    SLIST_INIT(&g_ble_hs_periodic_sync_handles);

-

-    return 0;

-}

+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <string.h>
+#include <errno.h>
+#include "syscfg/syscfg.h"
+#include "os/os.h"
+#include "host/ble_hs_id.h"
+#include "ble_hs_priv.h"
+
+#if MYNEWT_VAL(BLE_PERIODIC_ADV)
+static SLIST_HEAD(, ble_hs_periodic_sync) g_ble_hs_periodic_sync_handles;
+static struct os_mempool ble_hs_periodic_sync_pool;
+
+static os_membuf_t ble_hs_psync_elem_mem[
+    OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),
+                    sizeof (struct ble_hs_periodic_sync))
+];
+
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_alloc(void)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    psync = os_memblock_get(&ble_hs_periodic_sync_pool);
+    if (psync) {
+        memset(psync, 0, sizeof(*psync));
+    }
+
+    return psync;
+}
+
+void
+ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync)
+{
+    int rc;
+
+    if (psync == NULL) {
+        return;
+    }
+
+#if MYNEWT_VAL(BLE_HS_DEBUG)
+    memset(psync, 0xff, sizeof *psync);
+#endif
+    rc = os_memblock_put(&ble_hs_periodic_sync_pool, psync);
+    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
+}
+
+void
+ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync)
+{
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    BLE_HS_DBG_ASSERT_EVAL(
+                       ble_hs_periodic_sync_find_by_handle(psync->sync_handle) == NULL);
+
+    SLIST_INSERT_HEAD(&g_ble_hs_periodic_sync_handles, psync, next);
+}
+
+void
+ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync)
+{
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    SLIST_REMOVE(&g_ble_hs_periodic_sync_handles, psync, ble_hs_periodic_sync,
+                 next);
+}
+
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {
+        if (psync->sync_handle == sync_handle) {
+            return psync;
+        }
+    }
+
+    return NULL;
+}
+
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_find(const ble_addr_t *addr, uint8_t sid)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
+
+    if (!addr) {
+        return NULL;
+    }
+
+    SLIST_FOREACH(psync, &g_ble_hs_periodic_sync_handles, next) {
+        if ((ble_addr_cmp(&psync->advertiser_addr, addr) == 0) &&
+                (psync->adv_sid == sid)) {
+            return psync;
+        }
+    }
+
+    return NULL;
+}
+
+/**
+ * Retrieves the first periodic discovery handle in the list.
+ */
+struct ble_hs_periodic_sync *
+ble_hs_periodic_sync_first(void)
+{
+    struct ble_hs_periodic_sync *psync;
+
+    ble_hs_lock();
+    psync = SLIST_FIRST(&g_ble_hs_periodic_sync_handles);
+    ble_hs_unlock();
+
+    return psync;
+}
+
+int
+ble_hs_periodic_sync_init(void)
+{
+    int rc;
+
+    rc = os_mempool_init(&ble_hs_periodic_sync_pool,
+                         MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS),
+                         sizeof (struct ble_hs_periodic_sync),
+                         ble_hs_psync_elem_mem, "ble_hs_periodic_disc_pool");
+    if (rc != 0) {
+        return BLE_HS_EOS;
+    }
+
+    SLIST_INIT(&g_ble_hs_periodic_sync_handles);
+
+    return 0;
+}
+#endif
diff --git a/nimble/host/src/ble_hs_periodic_sync_priv.h b/nimble/host/src/ble_hs_periodic_sync_priv.h
index 2471188..c82ea79 100644
--- a/nimble/host/src/ble_hs_periodic_sync_priv.h
+++ b/nimble/host/src/ble_hs_periodic_sync_priv.h
@@ -1,55 +1,55 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one

- * or more contributor license agreements.  See the NOTICE file

- * distributed with this work for additional information

- * regarding copyright ownership.  The ASF licenses this file

- * to you under the Apache License, Version 2.0 (the

- * "License"); you may not use this file except in compliance

- * with the License.  You may obtain a copy of the License at

- *

- *  http://www.apache.org/licenses/LICENSE-2.0

- *

- * Unless required by applicable law or agreed to in writing,

- * software distributed under the License is distributed on an

- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

- * KIND, either express or implied.  See the License for the

- * specific language governing permissions and limitations

- * under the License.

- */

-

-#ifndef H_BLE_HS_PERIODIC_SYNC_

-#define H_BLE_HS_PERIODIC_SYNC_

-

-#include <inttypes.h>

-#include "os/queue.h"

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-struct ble_hs_periodic_sync {

-    SLIST_ENTRY(ble_hs_periodic_sync) next;

-    uint16_t   sync_handle;

-    ble_addr_t advertiser_addr;

-    uint8_t    adv_sid;

-

-    ble_gap_event_fn *cb;

-    void *cb_arg;

-

-    struct ble_npl_event lost_ev;

-};

-

-struct ble_hs_periodic_sync *ble_hs_periodic_sync_alloc(void);

-void ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync);

-void ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync);

-void ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync);

-struct ble_hs_periodic_sync *ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle);

-struct ble_hs_periodic_sync *ble_hs_periodic_sync_find(const ble_addr_t *addr,

-                                                       uint8_t sid);

-struct ble_hs_periodic_sync *ble_hs_periodic_sync_first(void);

-int ble_hs_periodic_sync_init(void);

-

-#ifdef __cplusplus

-}

-#endif

-

-#endif

+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HS_PERIODIC_SYNC_
+#define H_BLE_HS_PERIODIC_SYNC_
+
+#include <inttypes.h>
+#include "os/queue.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ble_hs_periodic_sync {
+    SLIST_ENTRY(ble_hs_periodic_sync) next;
+    uint16_t   sync_handle;
+    ble_addr_t advertiser_addr;
+    uint8_t    adv_sid;
+
+    ble_gap_event_fn *cb;
+    void *cb_arg;
+
+    struct ble_npl_event lost_ev;
+};
+
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_alloc(void);
+void ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync);
+void ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync);
+void ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync);
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle);
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_find(const ble_addr_t *addr,
+                                                       uint8_t sid);
+struct ble_hs_periodic_sync *ble_hs_periodic_sync_first(void);
+int ble_hs_periodic_sync_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/nimble/host/src/ble_hs_priv.h b/nimble/host/src/ble_hs_priv.h
index 386b03d..2cad6ef 100644
--- a/nimble/host/src/ble_hs_priv.h
+++ b/nimble/host/src/ble_hs_priv.h
@@ -26,7 +26,6 @@
 #include "ble_att_priv.h"
 #include "ble_gap_priv.h"
 #include "ble_gatt_priv.h"
-#include "ble_hs_dbg_priv.h"
 #include "ble_hs_hci_priv.h"
 #include "ble_hs_atomic_priv.h"
 #include "ble_hs_conn_priv.h"
@@ -143,31 +142,6 @@
 struct os_mbuf *ble_mqueue_get(struct ble_mqueue *mq);
 int ble_mqueue_put(struct ble_mqueue *mq, struct ble_npl_eventq *evq, struct os_mbuf *om);
 
-#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_DEBUG && !BLE_MONITOR
-
-#define BLE_HS_LOG_CMD(is_tx, cmd_type, cmd_name, conn_handle,                \
-                       log_cb, cmd) do                                        \
-{                                                                             \
-    BLE_HS_LOG(DEBUG, "%sed %s command: %s; conn=%d ",                        \
-               (is_tx) ? "tx" : "rx", (cmd_type), (cmd_name), (conn_handle)); \
-    (log_cb)(cmd);                                                            \
-    BLE_HS_LOG(DEBUG, "\n");                                                  \
-} while (0)
-
-#define BLE_HS_LOG_EMPTY_CMD(is_tx, cmd_type, cmd_name, conn_handle) do       \
-{                                                                             \
-    BLE_HS_LOG(DEBUG, "%sed %s command: %s; conn=%d ",                        \
-               (is_tx) ? "tx" : "rx", (cmd_type), (cmd_name), (conn_handle)); \
-    BLE_HS_LOG(DEBUG, "\n");                                                  \
-} while (0)
-
-#else
-
-#define BLE_HS_LOG_CMD(is_tx, cmd_type, cmd_name, conn_handle, log_cb, cmd)
-#define BLE_HS_LOG_EMPTY_CMD(is_tx, cmd_type, cmd_name, conn_handle)
-
-#endif
-
 #if MYNEWT_VAL(BLE_HS_DEBUG)
     #define BLE_HS_DBG_ASSERT(x) assert(x)
     #define BLE_HS_DBG_ASSERT_EVAL(x) assert(x)
diff --git a/nimble/host/src/ble_l2cap_sig.c b/nimble/host/src/ble_l2cap_sig.c
index 07a338a..de19e55 100644
--- a/nimble/host/src/ble_l2cap_sig.c
+++ b/nimble/host/src/ble_l2cap_sig.c
@@ -286,6 +286,7 @@
             }
             break;
         }
+        prev = proc;
     }
 
     ble_hs_unlock();
diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c
index 1b6cc68..6c85d1c 100644
--- a/nimble/host/src/ble_sm.c
+++ b/nimble/host/src/ble_sm.c
@@ -1464,8 +1464,6 @@
 
     cmd = (struct ble_sm_pair_random *)(*om)->om_data;
 
-    BLE_SM_LOG_CMD(0, "random", conn_handle, ble_sm_pair_random_log, cmd);
-
     ble_hs_lock();
     proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_RANDOM, -1, NULL);
     if (proc == NULL) {
@@ -1514,8 +1512,6 @@
 
     cmd = (struct ble_sm_pair_confirm *)(*om)->om_data;
 
-    BLE_SM_LOG_CMD(0, "confirm", conn_handle, ble_sm_pair_confirm_log, cmd);
-
     ble_hs_lock();
     proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_CONFIRM, -1, NULL);
     if (proc == NULL) {
@@ -1762,8 +1758,6 @@
 
     req = (struct ble_sm_pair_cmd *)(*om)->om_data;
 
-    BLE_SM_LOG_CMD(0, "pair req", conn_handle, ble_sm_pair_cmd_log, req);
-
     ble_hs_lock();
 
     /* XXX: Check connection state; reject if not appropriate. */
@@ -1862,8 +1856,6 @@
 
     rsp = (struct ble_sm_pair_cmd *)(*om)->om_data;
 
-    BLE_SM_LOG_CMD(0, "pair rsp", conn_handle, ble_sm_pair_cmd_log, rsp);
-
     ble_hs_lock();
     proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_PAIR, 1, NULL);
     if (proc != NULL) {
@@ -1942,7 +1934,6 @@
     }
 
     cmd = (struct ble_sm_sec_req *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "sec req", conn_handle, ble_sm_sec_req_log, cmd);
 
     /* XXX: Reject if:
      *     o authreq-reserved flags set?
@@ -2210,7 +2201,6 @@
     }
 
     cmd = (struct ble_sm_enc_info *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "enc info", conn_handle, ble_sm_enc_info_log, cmd);
 
     ble_hs_lock();
 
@@ -2245,7 +2235,6 @@
     }
 
     cmd = (struct ble_sm_master_id *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "master id", conn_handle, ble_sm_master_id_log, cmd);
 
     ble_hs_lock();
 
@@ -2281,7 +2270,6 @@
     }
 
     cmd = (struct ble_sm_id_info *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "id info", conn_handle, ble_sm_id_info_log, cmd);
 
     ble_hs_lock();
 
@@ -2316,8 +2304,6 @@
     }
 
     cmd = (struct ble_sm_id_addr_info *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "id addr info", conn_handle, ble_sm_id_addr_info_log,
-                   cmd);
 
     ble_hs_lock();
 
@@ -2352,7 +2338,6 @@
     }
 
     cmd = (struct ble_sm_sign_info *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "sign info", conn_handle, ble_sm_sign_info_log, cmd);
 
     ble_hs_lock();
 
@@ -2387,7 +2372,6 @@
     res->app_status = ble_hs_mbuf_pullup_base(om, sizeof(*cmd));
     if (res->app_status == 0) {
         cmd = (struct ble_sm_pair_fail *)(*om)->om_data;
-        BLE_SM_LOG_CMD(0, "fail", conn_handle, ble_sm_pair_fail_log, cmd);
 
         res->app_status = BLE_HS_SM_PEER_ERR(cmd->reason);
     }
diff --git a/nimble/host/src/ble_sm_cmd.c b/nimble/host/src/ble_sm_cmd.c
index b5e674e..5eef798 100644
--- a/nimble/host/src/ble_sm_cmd.c
+++ b/nimble/host/src/ble_sm_cmd.c
@@ -61,97 +61,3 @@
                                     &conn, &chan);
     return ble_l2cap_tx(conn, chan, txom);
 }
-
-#if NIMBLE_BLE_SM
-void
-ble_sm_pair_cmd_log(struct ble_sm_pair_cmd *cmd)
-{
-    BLE_HS_LOG(DEBUG, "io_cap=%d oob_data_flag=%d authreq=0x%02x "
-                      "mac_enc_key_size=%d init_key_dist=%d "
-                      "resp_key_dist=%d",
-               cmd->io_cap, cmd->oob_data_flag, cmd->authreq,
-               cmd->max_enc_key_size, cmd->init_key_dist,
-               cmd->resp_key_dist);
-}
-
-void
-ble_sm_pair_confirm_log(struct ble_sm_pair_confirm *cmd)
-{
-    BLE_HS_LOG(DEBUG, "value=");
-    ble_hs_log_flat_buf(cmd->value, sizeof cmd->value);
-}
-
-void
-ble_sm_pair_random_log(struct ble_sm_pair_random *cmd)
-{
-    BLE_HS_LOG(DEBUG, "value=");
-    ble_hs_log_flat_buf(cmd->value, sizeof cmd->value);
-}
-
-void
-ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd)
-{
-    BLE_HS_LOG(DEBUG, "reason=%d", cmd->reason);
-}
-
-void
-ble_sm_enc_info_log(struct ble_sm_enc_info *cmd)
-{
-    BLE_HS_LOG(DEBUG, "ltk=");
-    ble_hs_log_flat_buf(cmd->ltk, sizeof cmd->ltk);
-}
-
-void
-ble_sm_master_id_log(struct ble_sm_master_id *cmd)
-{
-    /* These get logged separately to accommodate a bug in the va_args
-     * implementation related to 64-bit integers.
-     */
-    BLE_HS_LOG(DEBUG, "ediv=0x%04x ", cmd->ediv);
-    BLE_HS_LOG(DEBUG, "rand=0x%016llx", cmd->rand_val);
-}
-
-void
-ble_sm_id_info_log(struct ble_sm_id_info *cmd)
-{
-    BLE_HS_LOG(DEBUG, "irk=");
-    ble_hs_log_flat_buf(cmd->irk, sizeof cmd->irk);
-}
-
-void
-ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd)
-{
-    BLE_HS_LOG(DEBUG, "addr_type=%d addr=", cmd->addr_type);
-    BLE_HS_LOG_ADDR(DEBUG, cmd->bd_addr);
-}
-
-void
-ble_sm_sign_info_log(struct ble_sm_sign_info *cmd)
-{
-    BLE_HS_LOG(DEBUG, "sig_key=");
-    ble_hs_log_flat_buf(cmd->sig_key, sizeof cmd->sig_key);
-}
-
-void
-ble_sm_sec_req_log(struct ble_sm_sec_req *cmd)
-{
-    BLE_HS_LOG(DEBUG, "authreq=0x%02x", cmd->authreq);
-}
-
-void
-ble_sm_public_key_log(struct ble_sm_public_key *cmd)
-{
-    BLE_HS_LOG(DEBUG, "x=");
-    ble_hs_log_flat_buf(cmd->x, sizeof cmd->x);
-    BLE_HS_LOG(DEBUG, "y=");
-    ble_hs_log_flat_buf(cmd->y, sizeof cmd->y);
-}
-
-void
-ble_sm_dhkey_check_log(struct ble_sm_dhkey_check *cmd)
-{
-    BLE_HS_LOG(DEBUG, "value=");
-    ble_hs_log_flat_buf(cmd->value, sizeof cmd->value);
-}
-
-#endif
diff --git a/nimble/host/src/ble_sm_priv.h b/nimble/host/src/ble_sm_priv.h
index 3f64b77..1c3e080 100644
--- a/nimble/host/src/ble_sm_priv.h
+++ b/nimble/host/src/ble_sm_priv.h
@@ -294,19 +294,6 @@
 
 int ble_sm_num_procs(void);
 
-void ble_sm_pair_cmd_log(struct ble_sm_pair_cmd *cmd);
-void ble_sm_pair_confirm_log(struct ble_sm_pair_confirm *cmd);
-void ble_sm_pair_random_log(struct ble_sm_pair_random *cmd);
-void ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd);
-void ble_sm_enc_info_log(struct ble_sm_enc_info *cmd);
-void ble_sm_master_id_log(struct ble_sm_master_id *cmd);
-void ble_sm_id_info_log(struct ble_sm_id_info *cmd);
-void ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd);
-void ble_sm_sign_info_log(struct ble_sm_sign_info *cmd);
-void ble_sm_sec_req_log(struct ble_sm_sec_req *cmd);
-void ble_sm_public_key_log(struct ble_sm_public_key *cmd);
-void ble_sm_dhkey_check_log(struct ble_sm_dhkey_check *cmd);
-
 int ble_sm_alg_s1(uint8_t *k, uint8_t *r1, uint8_t *r2, uint8_t *out);
 int ble_sm_alg_c1(uint8_t *k, uint8_t *r,
                   uint8_t *preq, uint8_t *pres,
@@ -400,10 +387,6 @@
                         const uint8_t *ltk, uint16_t ediv,
                         uint64_t rand_val, int auth);
 int ble_sm_init(void);
-
-#define BLE_SM_LOG_CMD(is_tx, cmd_name, conn_handle, log_cb, cmd) \
-    BLE_HS_LOG_CMD((is_tx), "sm", (cmd_name), (conn_handle), (log_cb), (cmd))
-
 #else
 
 #define ble_sm_enc_change_rx(evt) ((void)(evt))
diff --git a/nimble/host/src/ble_sm_sc.c b/nimble/host/src/ble_sm_sc.c
index 1293de3..1e705c0 100644
--- a/nimble/host/src/ble_sm_sc.c
+++ b/nimble/host/src/ble_sm_sc.c
@@ -568,7 +568,6 @@
     }
 
     cmd = (struct ble_sm_public_key *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "public key", conn_handle, ble_sm_public_key_log, cmd);
 
     ble_hs_lock();
     proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_PUBLIC_KEY, -1,
@@ -768,7 +767,6 @@
     }
 
     cmd = (struct ble_sm_dhkey_check *)(*om)->om_data;
-    BLE_SM_LOG_CMD(0, "dhkey check", conn_handle, ble_sm_dhkey_check_log, cmd);
 
     ble_hs_lock();
     proc = ble_sm_proc_find(conn_handle, BLE_SM_PROC_STATE_DHKEY_CHECK, -1,
diff --git a/porting/npl/mynewt/include/nimble/nimble_npl_os.h b/porting/npl/mynewt/include/nimble/nimble_npl_os.h
index 141cf44..8d8ccda 100644
--- a/porting/npl/mynewt/include/nimble/nimble_npl_os.h
+++ b/porting/npl/mynewt/include/nimble/nimble_npl_os.h
@@ -22,6 +22,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <assert.h>
 #include "os/os.h"
 
 #ifdef __cplusplus
@@ -146,6 +147,7 @@
 static inline void
 ble_npl_event_set_arg(struct ble_npl_event *ev, void *arg)
 {
+    assert(ev->ev.ev_queued == 0);
     ev->ev.ev_arg = arg;
 }
 
diff --git a/porting/npl/riot/include/syscfg/syscfg.h b/porting/npl/riot/include/syscfg/syscfg.h
index 8fb6700..4fde497 100644
--- a/porting/npl/riot/include/syscfg/syscfg.h
+++ b/porting/npl/riot/include/syscfg/syscfg.h
@@ -517,8 +517,8 @@
 #define MYNEWT_VAL_BLE_LL_DBG_HCI_EV_PIN (-1)
 #endif
 
-#ifndef MYNEWT_VAL_BLE_LL_DIRECT_TEST_MODE
-#define MYNEWT_VAL_BLE_LL_DIRECT_TEST_MODE (0)
+#ifndef MYNEWT_VAL_BLE_LL_DTM
+#define MYNEWT_VAL_BLE_LL_DTM (0)
 #endif
 
 /* Overridden by nimble/controller (defined by nimble/controller) */