Skip to content

Commit 665e453

Browse files
authored
Merge pull request #13759 from pan-/privacy-workaround-wb55
Privacy workaround wb55
2 parents f32141a + 2a4a097 commit 665e453

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

connectivity/FEATURE_BLE/mbed_lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@
112112
"target_overrides": {
113113
"MCU_NRF52840": {
114114
"ble-gap-host-based-private-address-resolution": false
115+
},
116+
"NUCLEO_WB55RG": {
117+
"ble-gap-host-based-private-address-resolution": false
115118
}
116119
}
117120
}

connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,30 @@ class PalGap final : public ble::PalGap {
364364

365365
static GapConnectionCompleteEvent convert(const hciLeConnCmplEvt_t *conn_evt)
366366
{
367+
const bdAddr_t *peer_rpa = &conn_evt->peerRpa;
368+
const bdAddr_t *peer_address = &conn_evt->peerAddr;
369+
370+
#if defined(TARGET_MCU_STM32WB55xx)
371+
const bdAddr_t invalidAddress = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
372+
if (conn_evt->addrType == DM_ADDR_RANDOM &&
373+
memcmp(peer_address, invalidAddress, sizeof(invalidAddress)) == 0 &&
374+
memcmp(peer_rpa, invalidAddress, sizeof(invalidAddress) != 0)
375+
) {
376+
std::swap(peer_rpa, peer_address);
377+
}
378+
#endif
367379
return GapConnectionCompleteEvent(
368380
conn_evt->status,
369381
// note the usage of the stack handle, not the HCI handle
370382
conn_evt->hdr.param,
371383
(connection_role_t::type) conn_evt->role,
372384
(peer_address_type_t::type) conn_evt->addrType,
373-
conn_evt->peerAddr,
385+
*peer_address,
374386
conn_evt->connInterval,
375387
conn_evt->connLatency,
376388
conn_evt->supTimeout,
377389
conn_evt->localRpa,
378-
conn_evt->peerRpa
390+
*peer_rpa
379391
);
380392
}
381393
};

0 commit comments

Comments
 (0)