forked from arduino/ArduinoCore-mbed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0006-portentaH7-Change-BLE-public-address.patch
41 lines (37 loc) · 1.55 KB
/
0006-portentaH7-Change-BLE-public-address.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 870bd11b57b6497fec6469c7ed59a627fcc96996 Mon Sep 17 00:00:00 2001
From: Paolo Calao <paolo.calao@gmail.com>
Date: Thu, 29 Oct 2020 15:40:32 +0100
Subject: [PATCH 006/204] portentaH7: Change BLE public address
---
.../ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp
index 957e37594b..ff389c9f81 100644
--- a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp
+++ b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/HCIDriver.cpp
@@ -378,6 +378,16 @@ private:
#endif /* BT_UART_NO_3M_SUPPORT */
}
+ void inject_bdaddr(uint8_t* pBuf)
+ {
+ if (service_pack_ptr + service_pack_index == brcm_patchram_buf) {
+ uint8_t bdAddr[6] = { 0xFF, 0xFF, 0xFF, 0x0A, 0x61, 0xA8 };
+ uint32_t uniqueId = HAL_GetUIDw0() ^ HAL_GetUIDw1() ^ HAL_GetUIDw2();
+ memcpy(bdAddr, &uniqueId, 3);
+ memcpy(&pBuf[33], bdAddr, sizeof(bdAddr));
+ }
+ }
+
void send_service_pack_command(void)
{
uint16_t cmd_len = service_pack_ptr[service_pack_index + 2];
@@ -385,6 +395,7 @@ private:
uint8_t *pBuf = hciCmdAlloc(cmd_opcode, cmd_len);
if (pBuf) {
memcpy(pBuf + HCI_CMD_HDR_LEN, service_pack_ptr + service_pack_index + HCI_CMD_HDR_LEN, cmd_len);
+ inject_bdaddr(pBuf);
hciCmdSend(pBuf);
} else {
}
--
2.39.1