From 52deeedff1d66d2105d353997b43f603670e5ec9 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Mon, 21 Feb 2022 22:07:01 +0100 Subject: [PATCH] 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 b77f3c838..4c1662a7f 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: