Skip to content

Commit

Permalink
[NXP] cli and zap fixes (#37024)
Browse files Browse the repository at this point in the history
* [NXP][common] Fix NXP CLI after regression due to Matter stack updates

Signed-off-by: Martin Girardot <[email protected]>

* [NXP][zap] Remove identify cluster as client support

Signed-off-by: Martin Girardot <[email protected]>

* [NXP][common] Add mutex protection during logging to prevent logs from getting mixed up

Signed-off-by: Martin Girardot <[email protected]>

* Restyled by clang-format

* [NXP] Add static mutex support to logging function

Signed-off-by: Martin Girardot <[email protected]>

* Restyled by clang-format

---------

Signed-off-by: Martin Girardot <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
Martin-NXP and restyled-commits authored Jan 13, 2025
1 parent 7558fe1 commit 5bd63d5
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 231 deletions.
51 changes: 0 additions & 51 deletions examples/thermostat/nxp/zap/thermostat_matter_br.matter
Original file line number Diff line number Diff line change
Expand Up @@ -291,56 +291,6 @@ cluster Identify = 3 {
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
cluster Identify = 3 {
revision 4;

enum EffectIdentifierEnum : enum8 {
kBlink = 0;
kBreathe = 1;
kOkay = 2;
kChannelChange = 11;
kFinishEffect = 254;
kStopEffect = 255;
}

enum EffectVariantEnum : enum8 {
kDefault = 0;
}

enum IdentifyTypeEnum : enum8 {
kNone = 0;
kLightOutput = 1;
kVisibleIndicator = 2;
kAudibleBeep = 3;
kDisplay = 4;
kActuator = 5;
}

attribute int16u identifyTime = 0;
readonly attribute IdentifyTypeEnum identifyType = 1;
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;

request struct IdentifyRequest {
int16u identifyTime = 0;
}

request struct TriggerEffectRequest {
EffectIdentifierEnum effectIdentifier = 0;
EffectVariantEnum effectVariant = 1;
}

/** Command description for Identify */
command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
/** Command description for TriggerEffect */
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
cluster Descriptor = 29 {
revision 2;
Expand Down Expand Up @@ -2423,7 +2373,6 @@ endpoint 0 {
endpoint 1 {
device type ma_thermostat = 769, version 1;

binding cluster Identify;

server cluster Identify {
ram attribute identifyTime default = 0x0000;
Expand Down
26 changes: 0 additions & 26 deletions examples/thermostat/nxp/zap/thermostat_matter_br.zap
Original file line number Diff line number Diff line change
Expand Up @@ -2999,32 +2999,6 @@
"deviceTypeCode": 769,
"deviceTypeProfileId": 259,
"clusters": [
{
"name": "Identify",
"code": 3,
"mfgCode": null,
"define": "IDENTIFY_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [
{
"name": "Identify",
"code": 0,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "TriggerEffect",
"code": 64,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
}
]
},
{
"name": "Identify",
"code": 3,
Expand Down
51 changes: 0 additions & 51 deletions examples/thermostat/nxp/zap/thermostat_matter_thread.matter
Original file line number Diff line number Diff line change
Expand Up @@ -291,56 +291,6 @@ cluster Identify = 3 {
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
cluster Identify = 3 {
revision 4;

enum EffectIdentifierEnum : enum8 {
kBlink = 0;
kBreathe = 1;
kOkay = 2;
kChannelChange = 11;
kFinishEffect = 254;
kStopEffect = 255;
}

enum EffectVariantEnum : enum8 {
kDefault = 0;
}

enum IdentifyTypeEnum : enum8 {
kNone = 0;
kLightOutput = 1;
kVisibleIndicator = 2;
kAudibleBeep = 3;
kDisplay = 4;
kActuator = 5;
}

attribute int16u identifyTime = 0;
readonly attribute IdentifyTypeEnum identifyType = 1;
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;

request struct IdentifyRequest {
int16u identifyTime = 0;
}

request struct TriggerEffectRequest {
EffectIdentifierEnum effectIdentifier = 0;
EffectVariantEnum effectVariant = 1;
}

/** Command description for Identify */
command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
/** Command description for TriggerEffect */
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
cluster Descriptor = 29 {
revision 2;
Expand Down Expand Up @@ -2348,7 +2298,6 @@ endpoint 0 {
endpoint 1 {
device type ma_thermostat = 769, version 1;

binding cluster Identify;

server cluster Identify {
ram attribute identifyTime default = 0x0000;
Expand Down
26 changes: 0 additions & 26 deletions examples/thermostat/nxp/zap/thermostat_matter_thread.zap
Original file line number Diff line number Diff line change
Expand Up @@ -3752,32 +3752,6 @@
"deviceTypeCode": 769,
"deviceTypeProfileId": 259,
"clusters": [
{
"name": "Identify",
"code": 3,
"mfgCode": null,
"define": "IDENTIFY_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [
{
"name": "Identify",
"code": 0,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "TriggerEffect",
"code": 64,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
}
]
},
{
"name": "Identify",
"code": 3,
Expand Down
51 changes: 0 additions & 51 deletions examples/thermostat/nxp/zap/thermostat_matter_wifi.matter
Original file line number Diff line number Diff line change
Expand Up @@ -291,56 +291,6 @@ cluster Identify = 3 {
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
cluster Identify = 3 {
revision 4;

enum EffectIdentifierEnum : enum8 {
kBlink = 0;
kBreathe = 1;
kOkay = 2;
kChannelChange = 11;
kFinishEffect = 254;
kStopEffect = 255;
}

enum EffectVariantEnum : enum8 {
kDefault = 0;
}

enum IdentifyTypeEnum : enum8 {
kNone = 0;
kLightOutput = 1;
kVisibleIndicator = 2;
kAudibleBeep = 3;
kDisplay = 4;
kActuator = 5;
}

attribute int16u identifyTime = 0;
readonly attribute IdentifyTypeEnum identifyType = 1;
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;

request struct IdentifyRequest {
int16u identifyTime = 0;
}

request struct TriggerEffectRequest {
EffectIdentifierEnum effectIdentifier = 0;
EffectVariantEnum effectVariant = 1;
}

/** Command description for Identify */
command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
/** Command description for TriggerEffect */
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
cluster Descriptor = 29 {
revision 2;
Expand Down Expand Up @@ -2213,7 +2163,6 @@ endpoint 0 {
endpoint 1 {
device type ma_thermostat = 769, version 1;

binding cluster Identify;

server cluster Identify {
ram attribute identifyTime default = 0x0000;
Expand Down
26 changes: 0 additions & 26 deletions examples/thermostat/nxp/zap/thermostat_matter_wifi.zap
Original file line number Diff line number Diff line change
Expand Up @@ -2999,32 +2999,6 @@
"deviceTypeCode": 769,
"deviceTypeProfileId": 259,
"clusters": [
{
"name": "Identify",
"code": 3,
"mfgCode": null,
"define": "IDENTIFY_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [
{
"name": "Identify",
"code": 0,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "TriggerEffect",
"code": 64,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
}
]
},
{
"name": "Identify",
"code": 3,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/shell/streamer_nxp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ ssize_t streamer_nxp_read(streamer_t * streamer, char * buffer, size_t length)
if (bytesRead == 0)
{
readDone = true;
/* Return -1 to cancel the cli command, this command is empty as we are reading uart input until it
is empty but for matter shell empty command is meaning stop the shell loop */
return -1;
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/platform/nxp/common/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,23 @@
namespace chip {
namespace Logging {
namespace Platform {
#if (configSUPPORT_STATIC_ALLOCATION == 1)
StaticSemaphore_t xLoggingSemaphoreBuffer;
#endif

/**
* CHIP log output function.
* Called only by ember-print (zcl log)
*/
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
#if (configSUPPORT_STATIC_ALLOCATION == 1)
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutexStatic(&xLoggingSemaphoreBuffer);
#else
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutex();
#endif
assert(xLoggingSemaphore != NULL);

char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE] = { 0 };
size_t prefixLen;

Expand Down Expand Up @@ -77,7 +87,9 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v)
/* Add CR+LF */
snprintf(formattedMsg + prefixLen, sizeof(formattedMsg) - prefixLen, "%s", "\r\n");

xSemaphoreTake(xLoggingSemaphore, portMAX_DELAY);
PRINTF("%s", formattedMsg);
xSemaphoreGive(xLoggingSemaphore);
}

/**
Expand Down

0 comments on commit 5bd63d5

Please sign in to comment.