Skip to content

Commit

Permalink
Pull request project-chip#1796: Update matter support pointer to main
Browse files Browse the repository at this point in the history
Merge in WMN_TOOLS/matter from feature/update_matter_support to RC_2.3.0-1.3

Squashed commit of the following:

commit 3e0dd4c3076d244545844a7d330e4ec31e16b02b
Author: Mathieu Kardous <[email protected]>
Date:   Mon Apr 29 12:33:53 2024 -0400

    Update matter support pointer to main

commit 5a170da155b4170c80d4d0ce2b1e8b254eeac7f2
Author: mkardous-silabs <[email protected]>
Date:   Wed Apr 17 18:25:20 2024 -0500

    [Silabs] Change BLE address from random resolvable address to random static address (project-chip#33035)

    * Change BLE address from random resolvable address to static address

    * add comment

    * Replace lambda function with memcmp
  • Loading branch information
mkardous-silabs committed Apr 29, 2024
1 parent 42abf1e commit 191c2f2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
37 changes: 26 additions & 11 deletions src/platform/silabs/efr32/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ extern "C" {
#include "sl_bt_stack_init.h"
#include "timers.h"
#include <ble/CHIPBleServiceData.h>
#include <crypto/RandUtils.h>
#include <cstring>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/CommissionableDataProvider.h>
Expand Down Expand Up @@ -109,17 +111,16 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0
const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F,
0x9D, 0x12 } };

bd_addr randomizedAddr = { 0 };

} // namespace

BLEManagerImpl BLEManagerImpl::sInstance;

CHIP_ERROR BLEManagerImpl::_Init()
{
CHIP_ERROR err;

// Initialize the CHIP BleLayer.
err = BleLayer::Init(this, this, &DeviceLayer::SystemLayer());
SuccessOrExit(err);
ReturnErrorOnFailure(BleLayer::Init(this, this, &DeviceLayer::SystemLayer()));

memset(mBleConnections, 0, sizeof(mBleConnections));
memset(mIndConfId, kUnusedIndex, sizeof(mIndConfId));
Expand All @@ -135,10 +136,23 @@ CHIP_ERROR BLEManagerImpl::_Init()

mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
PlatformMgr().ScheduleWork(DriveBLEState, 0);

exit:
return err;
// Check that an address was not already configured at boot.
// This covers the init-shutdown-init case to comply with the BLE address change at boot only requirement
bd_addr temp = { 0 };
if (memcmp(&randomizedAddr, &temp, sizeof(bd_addr)) == 0)
{
// Since a random address is not configured, configure one
uint64_t random = Crypto::GetRandU64();
// Copy random value to address. We don't care of the ordering since it's a random value.
memcpy(&randomizedAddr, &random, sizeof(randomizedAddr));

// Set two MSBs to 11 to properly the address - BLE Static Device Address requirement
randomizedAddr.addr[5] |= 0xC0;
}

PlatformMgr().ScheduleWork(DriveBLEState, 0);
return CHIP_NO_ERROR;
}

uint16_t BLEManagerImpl::_NumConnections(void)
Expand Down Expand Up @@ -487,14 +501,13 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
ChipLogError(DeviceLayer, "sl_bt_advertiser_create_set() failed: %s", ErrorStr(err));
});

bd_addr randomizedAddr = {};
ret = sl_bt_advertiser_set_random_address(advertising_set_handle, sl_bt_gap_random_resolvable_address, randomizedAddr,
&randomizedAddr);
ret =
sl_bt_advertiser_set_random_address(advertising_set_handle, sl_bt_gap_static_address, randomizedAddr, &randomizedAddr);
VerifyOrExit(ret == SL_STATUS_OK, {
err = MapBLEError(ret);
ChipLogError(DeviceLayer, "sl_bt_advertiser_set_random_address() failed: %s", ErrorStr(err));
});
ChipLogDetail(DeviceLayer, "BLE Resolvable private random address %02X:%02X:%02X:%02X:%02X:%02X", randomizedAddr.addr[5],
ChipLogDetail(DeviceLayer, "BLE Static Device Address %02X:%02X:%02X:%02X:%02X:%02X", randomizedAddr.addr[5],
randomizedAddr.addr[4], randomizedAddr.addr[3], randomizedAddr.addr[2], randomizedAddr.addr[1],
randomizedAddr.addr[0]);
}
Expand Down Expand Up @@ -628,6 +641,8 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
mFlags.Set(Flags::kFastAdvertisingEnabled, true);

ret = sl_bt_advertiser_stop(advertising_set_handle);
sl_bt_advertiser_clear_random_address(advertising_set_handle);

sl_bt_advertiser_delete_set(advertising_set_handle);
advertising_set_handle = 0xff;
err = MapBLEError(ret);
Expand Down
2 changes: 1 addition & 1 deletion third_party/silabs/matter_support
Submodule matter_support updated 42 files
+1 −1 .github/CODEOWNERS
+2 −4 matter/efr32/efr32mg12/BRD4161A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4161A/autogen/sli_psa_config_autogen.h
+2 −4 matter/efr32/efr32mg12/BRD4162A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4162A/autogen/sli_psa_config_autogen.h
+2 −4 matter/efr32/efr32mg12/BRD4163A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4163A/autogen/sli_psa_config_autogen.h
+2 −4 matter/efr32/efr32mg12/BRD4164A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4164A/autogen/sli_psa_config_autogen.h
+2 −4 matter/efr32/efr32mg12/BRD4166A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4166A/autogen/sli_psa_config_autogen.h
+2 −4 matter/efr32/efr32mg12/BRD4170A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4170A/autogen/sli_psa_config_autogen.h
+2 −4 matter/efr32/efr32mg12/BRD4304A/autogen/sl_component_catalog.h
+20 −21 matter/efr32/efr32mg12/BRD4304A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/efr32mg24/BRD2601B/autogen/sl_component_catalog.h
+18 −19 matter/efr32/efr32mg24/BRD2601B/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/efr32mg24/BRD2703A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/efr32mg24/BRD2703A/autogen/sli_psa_config_autogen.h
+1 −4 matter/efr32/efr32mg24/BRD4186A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/efr32mg24/BRD4186A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/efr32mg24/BRD4186C/autogen/sl_component_catalog.h
+18 −19 matter/efr32/efr32mg24/BRD4186C/autogen/sli_psa_config_autogen.h
+1 −4 matter/efr32/efr32mg24/BRD4187A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/efr32mg24/BRD4187A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/efr32mg24/BRD4187C/autogen/sl_component_catalog.h
+18 −19 matter/efr32/efr32mg24/BRD4187C/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/mgm24/BRD2704A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/mgm24/BRD2704A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/mgm24/BRD4316A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/mgm24/BRD4316A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/mgm24/BRD4317A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/mgm24/BRD4317A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/mgm24/BRD4318A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/mgm24/BRD4318A/autogen/sli_psa_config_autogen.h
+0 −4 matter/efr32/mgm24/BRD4319A/autogen/sl_component_catalog.h
+18 −19 matter/efr32/mgm24/BRD4319A/autogen/sli_psa_config_autogen.h
+32 −33 matter/si91x/siwx917/BRD4338A/autogen/sl_component_catalog.h
+2 −2 matter/si91x/siwx917/BRD4338A/autogen/sl_event_handler.c
+1 −0 matter/si91x/siwx917/BRD4338A/autogen/sli_psa_builtin_config_autogen.h
+0 −68 matter/si91x/siwx917/BRD4338A/support/inc/sl_si91x_m4_ps.h
+0 −330 matter/si91x/siwx917/BRD4338A/support/src/sl_si91x_m4_ps.c

0 comments on commit 191c2f2

Please sign in to comment.