Skip to content

Commit

Permalink
Merge branch 'master' into remove_PICS_from_OPSTATE_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
j-ororke authored Dec 4, 2024
2 parents b9df025 + 38ad07d commit a435556
Show file tree
Hide file tree
Showing 64 changed files with 825 additions and 733 deletions.
5 changes: 5 additions & 0 deletions docs/testing/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,11 @@ for that run, e.g.:

- Example: `"Manual pairing code: \\[\\d+\\]"`

- `app-stdin-pipe`: Specifies the path to the named pipe that the test runner
might use to send input to the application.

- Example: `/tmp/app-fifo`

- `script-args`: Specifies the arguments to be passed to the test script.

- Example:
Expand Down
22 changes: 0 additions & 22 deletions examples/bridge-app/bridge-common/bridge-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -521,27 +521,6 @@ cluster Descriptor = 29 {
readonly attribute int16u clusterRevision = 65533;
}

/** The Binding Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for supporting the binding table. */
cluster Binding = 30 {
revision 1; // NOTE: Default/not specifically set

fabric_scoped struct TargetStruct {
optional node_id node = 1;
optional group_id group = 2;
optional endpoint_no endpoint = 3;
optional cluster_id cluster = 4;
fabric_idx fabricIndex = 254;
}

attribute access(write: manage) TargetStruct binding[] = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
}

/** The Access Control Cluster exposes a data model view of a
Node's Access Control List (ACL), which codifies the rules used to manage
and enforce Access Control for the Node's endpoints and their associated
Expand Down Expand Up @@ -2496,7 +2475,6 @@ endpoint 0 {
endpoint 1 {
device type ma_aggregator = 14, version 1;

binding cluster Binding;

server cluster Identify {
ram attribute identifyTime default = 0x0;
Expand Down
8 changes: 0 additions & 8 deletions examples/bridge-app/bridge-common/bridge-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4713,14 +4713,6 @@
}
]
},
{
"name": "Binding",
"code": 30,
"mfgCode": null,
"define": "BINDING_CLUSTER",
"side": "client",
"enabled": 1
},
{
"name": "Actions",
"code": 37,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifdef MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER
#include "static-supported-temperature-levels.h"
#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h>
#include <lib/support/CodeUtils.h>

using namespace chip;
using namespace chip::app::Clusters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP
default:
break;
}
ChipLogProgress(chipTool, " Don't know how to log atribute value");
ChipLogProgress(chipTool, " Don't know how to log attribute value");
return CHIP_NO_ERROR;
}

Expand Down
37 changes: 1 addition & 36 deletions examples/fabric-admin/scripts/fabric-sync-app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import asyncio
import contextlib
import os
import shutil
import signal
import sys
Expand All @@ -41,26 +40,6 @@ async def forward_f(prefix: bytes, f_in: asyncio.StreamReader,
f_out.flush()


async def forward_pipe(pipe_path: str, f_out: asyncio.StreamWriter):
"""Forward named pipe to f_out.
Unfortunately, Python does not support async file I/O on named pipes. This
function performs busy waiting with a short asyncio-friendly sleep to read
from the pipe.
"""
fd = os.open(pipe_path, os.O_RDONLY | os.O_NONBLOCK)
while True:
try:
data = os.read(fd, 1024)
if data:
f_out.write(data)
await f_out.drain()
if not data:
await asyncio.sleep(0.1)
except BlockingIOError:
await asyncio.sleep(0.1)


async def forward_stdin(f_out: asyncio.StreamWriter):
"""Forward stdin to f_out."""
loop = asyncio.get_event_loop()
Expand Down Expand Up @@ -175,9 +154,6 @@ async def main(args):
storage = TemporaryDirectory(prefix="fabric-sync-app")
storage_dir = Path(storage.name)

if args.stdin_pipe and not args.stdin_pipe.exists():
os.mkfifo(args.stdin_pipe)

admin, bridge = await asyncio.gather(
run_admin(
args.app_admin,
Expand Down Expand Up @@ -206,8 +182,6 @@ def terminate():
admin.terminate()
with contextlib.suppress(ProcessLookupError):
bridge.terminate()
if args.stdin_pipe:
args.stdin_pipe.unlink(missing_ok=True)
loop.remove_signal_handler(signal.SIGINT)
loop.remove_signal_handler(signal.SIGTERM)

Expand Down Expand Up @@ -249,17 +223,12 @@ def terminate():
await admin.send(f"pairing open-commissioning-window {bridge_node_id} {cw_endpoint_id}"
f" {cw_option} {cw_timeout} {cw_iteration} {cw_discriminator}")

def get_input_forwarder():
if args.stdin_pipe:
return forward_pipe(args.stdin_pipe, admin.p.stdin)
return forward_stdin(admin.p.stdin)

try:
# Wait for any of the tasks to complete.
_, pending = await asyncio.wait([
asyncio.create_task(admin.wait()),
asyncio.create_task(bridge.wait()),
asyncio.create_task(get_input_forwarder()),
asyncio.create_task(forward_stdin(admin.p.stdin)),
], return_when=asyncio.FIRST_COMPLETED)
# Cancel the remaining tasks.
for task in pending:
Expand All @@ -285,8 +254,6 @@ def get_input_forwarder():
help="fabric-admin RPC server port")
parser.add_argument("--app-bridge-rpc-port", metavar="PORT", type=int,
help="fabric-bridge RPC server port")
parser.add_argument("--stdin-pipe", metavar="PATH", type=Path,
help="read input from a named pipe instead of stdin")
parser.add_argument("--storage-dir", metavar="PATH", type=Path,
help=("directory to place storage files in; by default "
"volatile storage is used"))
Expand All @@ -309,7 +276,5 @@ def get_input_forwarder():
parser.error("fabric-admin executable not found in PATH. Use '--app-admin' argument to provide it.")
if args.app_bridge is None or not args.app_bridge.exists():
parser.error("fabric-bridge-app executable not found in PATH. Use '--app-bridge' argument to provide it.")
if args.stdin_pipe and args.stdin_pipe.exists() and not args.stdin_pipe.is_fifo():
parser.error("given stdin pipe exists and is not a named pipe")
with contextlib.suppress(KeyboardInterrupt):
asyncio.run(main(args))
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CHIP_ERROR CommissionerControlDelegate::HandleCommissioningApprovalRequest(const
mLabel.ClearValue();
}

CHIP_ERROR err = CommissionerControlServer::Instance().GenerateCommissioningRequestResultEvent(kAggregatorEndpointId, result);
CHIP_ERROR err = mCommissionerControlServer.GenerateCommissioningRequestResultEvent(kAggregatorEndpointId, result);

if (err == CHIP_NO_ERROR)
{
Expand Down Expand Up @@ -228,7 +228,7 @@ CHIP_ERROR CommissionerControlInit()
return CHIP_ERROR_NO_MEMORY;
}

err = Clusters::CommissionerControl::CommissionerControlServer::Instance().Init(*sCommissionerControlDelegate);
err = sCommissionerControlDelegate->GetCommissionerControlServer().Init();
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "Initialization failed on Commissioner Control Delegate.");
Expand All @@ -242,7 +242,7 @@ CHIP_ERROR CommissionerControlInit()
supportedDeviceCategories.SetField(Clusters::CommissionerControl::SupportedDeviceCategoryBitmap::kFabricSynchronization, 1);

Protocols::InteractionModel::Status status =
Clusters::CommissionerControl::CommissionerControlServer::Instance().SetSupportedDeviceCategoriesValue(
sCommissionerControlDelegate->GetCommissionerControlServer().SetSupportedDeviceCategoriesValue(
Clusters::CommissionerControl::kAggregatorEndpointId, supportedDeviceCategories);

if (status != Protocols::InteractionModel::Status::Success)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ inline constexpr EndpointId kAggregatorEndpointId = 1;
class CommissionerControlDelegate : public Delegate
{
public:
CommissionerControlDelegate() : mCommissionerControlServer(this, kAggregatorEndpointId, CommissionerControl::Id) {}

CHIP_ERROR HandleCommissioningApprovalRequest(const CommissioningApprovalRequest & request) override;
// TODO(#35627) clientNodeId should move towards ScopedNodeId.
CHIP_ERROR ValidateCommissionNodeCommand(NodeId clientNodeId, uint64_t requestId) override;
Expand All @@ -39,6 +41,8 @@ class CommissionerControlDelegate : public Delegate

~CommissionerControlDelegate() = default;

CommissionerControlServer & GetCommissionerControlServer() { return mCommissionerControlServer; }

private:
enum class Step : uint8_t
{
Expand Down Expand Up @@ -82,6 +86,8 @@ class CommissionerControlDelegate : public Delegate
ByteSpan mPBKDFSalt;
Crypto::Spake2pVerifierSerialized mPAKEPasscodeVerifierBuffer;
ByteSpan mPAKEPasscodeVerifier;

CommissionerControlServer mCommissionerControlServer;
};

} // namespace CommissionerControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ inline constexpr EndpointId kAggregatorEndpointId = 1;
class CommissionerControlDelegate : public Delegate
{
public:
CommissionerControlDelegate(bridge::FabricAdminDelegate * fabricAdmin) : mFabricAdmin(fabricAdmin) {}
CommissionerControlDelegate(bridge::FabricAdminDelegate * fabricAdmin) :
mFabricAdmin(fabricAdmin), mCommissionerControlServer(this, kAggregatorEndpointId, CommissionerControl::Id)
{}

CHIP_ERROR HandleCommissioningApprovalRequest(const CommissioningApprovalRequest & request) override;
// TODO(#35627) clientNodeId should move towards ScopedNodeId.
Expand All @@ -42,6 +44,8 @@ class CommissionerControlDelegate : public Delegate

~CommissionerControlDelegate() = default;

CommissionerControlServer & GetCommissionerControlServer() { return mCommissionerControlServer; }

private:
enum class Step : uint8_t
{
Expand Down Expand Up @@ -87,6 +91,7 @@ class CommissionerControlDelegate : public Delegate
ByteSpan mPAKEPasscodeVerifier;

bridge::FabricAdminDelegate * mFabricAdmin;
CommissionerControlServer mCommissionerControlServer;
};

} // namespace CommissionerControl
Expand Down
12 changes: 10 additions & 2 deletions examples/fabric-sync/bridge/src/BridgedDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,13 @@ std::optional<uint16_t> BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr<

int BridgedDeviceManager::RemoveDeviceEndpoint(BridgedDevice * dev)
{
assertChipStackLockedByCurrentThread();

uint8_t index = 0;
while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
{
if (mDevices[index].get() == dev)
{
DeviceLayer::StackLock lock;
// Silence complaints about unused ep when progress logging
// disabled.
[[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index);
Expand All @@ -266,6 +267,8 @@ int BridgedDeviceManager::RemoveDeviceEndpoint(BridgedDevice * dev)

BridgedDevice * BridgedDeviceManager::GetDevice(chip::EndpointId endpointId) const
{
assertChipStackLockedByCurrentThread();

for (uint8_t index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index)
{
if (mDevices[index] && mDevices[index]->GetEndpointId() == endpointId)
Expand Down Expand Up @@ -304,6 +307,8 @@ std::string BridgedDeviceManager::GenerateUniqueId()

BridgedDevice * BridgedDeviceManager::GetDeviceByUniqueId(const std::string & id)
{
assertChipStackLockedByCurrentThread();

for (uint8_t index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index)
{
if (mDevices[index] && mDevices[index]->GetBridgedAttributes().uniqueId == id)
Expand All @@ -316,6 +321,8 @@ BridgedDevice * BridgedDeviceManager::GetDeviceByUniqueId(const std::string & id

BridgedDevice * BridgedDeviceManager::GetDeviceByScopedNodeId(chip::ScopedNodeId scopedNodeId) const
{
assertChipStackLockedByCurrentThread();

for (uint8_t index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index)
{
if (mDevices[index] && mDevices[index]->GetScopedNodeId() == scopedNodeId)
Expand All @@ -328,11 +335,12 @@ BridgedDevice * BridgedDeviceManager::GetDeviceByScopedNodeId(chip::ScopedNodeId

std::optional<uint16_t> BridgedDeviceManager::RemoveDeviceByScopedNodeId(chip::ScopedNodeId scopedNodeId)
{
assertChipStackLockedByCurrentThread();

for (uint16_t index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index)
{
if (mDevices[index] && mDevices[index]->GetScopedNodeId() == scopedNodeId)
{
DeviceLayer::StackLock lock;
EndpointId ep = emberAfClearDynamicEndpoint(index);
mDevices[index] = nullptr;
ChipLogProgress(NotSpecified, "Removed device with Id=[%d:0x" ChipLogFormatX64 "] from dynamic endpoint %d (index=%d)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ CHIP_ERROR CommissionerControlDelegate::HandleCommissioningApprovalRequest(const
mLabel.ClearValue();
}

CHIP_ERROR err = CommissionerControlServer::Instance().GenerateCommissioningRequestResultEvent(kAggregatorEndpointId, result);
CHIP_ERROR err = mCommissionerControlServer.GenerateCommissioningRequestResultEvent(kAggregatorEndpointId, result);

if (err == CHIP_NO_ERROR)
{
Expand Down Expand Up @@ -227,7 +227,7 @@ CHIP_ERROR CommissionerControlInit(bridge::FabricAdminDelegate * fabricAdmin)
return CHIP_ERROR_NO_MEMORY;
}

err = Clusters::CommissionerControl::CommissionerControlServer::Instance().Init(*sCommissionerControlDelegate);
err = sCommissionerControlDelegate->GetCommissionerControlServer().Init();
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "Initialization failed on Commissioner Control Delegate.");
Expand All @@ -241,7 +241,7 @@ CHIP_ERROR CommissionerControlInit(bridge::FabricAdminDelegate * fabricAdmin)
supportedDeviceCategories.SetField(Clusters::CommissionerControl::SupportedDeviceCategoryBitmap::kFabricSynchronization, 1);

Protocols::InteractionModel::Status status =
Clusters::CommissionerControl::CommissionerControlServer::Instance().SetSupportedDeviceCategoriesValue(
sCommissionerControlDelegate->GetCommissionerControlServer().SetSupportedDeviceCategoriesValue(
Clusters::CommissionerControl::kAggregatorEndpointId, supportedDeviceCategories);

if (status != Protocols::InteractionModel::Status::Success)
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ source_set("efr32-common") {
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
sl_uart_log_output) {
sources += [ "${silabs_common_plat_dir}/uart.cpp" ]
}

Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern "C" {
#endif
#include "sl_uartdrv_instances.h"
#if SL_WIFI
#include <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#include <platform/silabs/wifi/ncp/spi_multiplex.h>
#endif // SL_WIFI
#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT
#include "sl_uartdrv_eusart_vcom_config.h"
Expand Down
2 changes: 1 addition & 1 deletion integrations/cloudbuild/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ steps:
args:
- >-
perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt &&
./examples/chef/chef.py --build_all --build_exclude noip
./examples/chef/chef.py --build_all --build_exclude "noip|temperaturecontrolledcabinet"
id: CompileAll
waitFor:
- Bootstrap
Expand Down
Loading

0 comments on commit a435556

Please sign in to comment.