You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2022/03/03 14:04:50 UTC

[mynewt-nimble] 02/04: babblesim/edtt: Handle write bd addr

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 52deeedff1d66d2105d353997b43f603670e5ec9
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Feb 21 22:07:01 2022 +0100

    babblesim/edtt: Handle write bd addr
    
    Some test cases change public address during test so we need to handle
    this.
---
 babblesim/edtt/hci_transport/src/ble_hci_edtt.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/babblesim/edtt/hci_transport/src/ble_hci_edtt.c b/babblesim/edtt/hci_transport/src/ble_hci_edtt.c
index b77f3c8..4c1662a 100644
--- a/babblesim/edtt/hci_transport/src/ble_hci_edtt.c
+++ b/babblesim/edtt/hci_transport/src/ble_hci_edtt.c
@@ -12,6 +12,7 @@
 #include "sysinit/sysinit.h"
 #include "syscfg/syscfg.h"
 #include "os/os_eventq.h"
+#include "controller/ble_ll.h"
 
 /* BLE */
 #include "nimble/ble.h"
@@ -832,7 +833,7 @@ le_data_write(uint16_t size)
 }
 
 static void
-fake_set_public_address()
+fake_write_bd_addr_cc()
 {
     struct ble_hci_ev_command_complete *ev;
     struct ble_hci_ev *hci_ev;
@@ -858,6 +859,7 @@ edtt_poller(void *arg) {
     uint16_t command;
     uint16_t size;
     uint16_t opcode;
+    uint8_t bdaddr[6];
 
     /* Initialize HCI command opcode and response variables */
     waiting_opcode = 0;
@@ -917,8 +919,11 @@ edtt_poller(void *arg) {
                 edtt_read((uint8_t *) &opcode, sizeof(opcode), EDTTT_BLOCK);
 
                 if (opcode == BT_HCI_OP_VS_WRITE_BD_ADDR) {
-                    fake_set_public_address();
-                    read_excess_bytes(size - 2);
+                    edtt_read((uint8_t *) &bdaddr, sizeof(bdaddr), EDTTT_BLOCK);
+                    ble_ll_set_public_addr(bdaddr);
+                    fake_write_bd_addr_cc();
+                } else {
+                    assert(0);
                 }
                 break;
             default: