Skip to content

Commit 5bd63d5

Browse files
[NXP] cli and zap fixes (#37024)
* [NXP][common] Fix NXP CLI after regression due to Matter stack updates Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * [NXP][zap] Remove identify cluster as client support Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * [NXP][common] Add mutex protection during logging to prevent logs from getting mixed up Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * Restyled by clang-format * [NXP] Add static mutex support to logging function Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * Restyled by clang-format --------- Signed-off-by: Martin Girardot <martin.girardot@nxp.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 7558fe1 commit 5bd63d5

8 files changed

+15
-231
lines changed

examples/thermostat/nxp/zap/thermostat_matter_br.matter

-51
Original file line numberDiff line numberDiff line change
@@ -291,56 +291,6 @@ cluster Identify = 3 {
291291
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
292292
}
293293

294-
/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
295-
cluster Identify = 3 {
296-
revision 4;
297-
298-
enum EffectIdentifierEnum : enum8 {
299-
kBlink = 0;
300-
kBreathe = 1;
301-
kOkay = 2;
302-
kChannelChange = 11;
303-
kFinishEffect = 254;
304-
kStopEffect = 255;
305-
}
306-
307-
enum EffectVariantEnum : enum8 {
308-
kDefault = 0;
309-
}
310-
311-
enum IdentifyTypeEnum : enum8 {
312-
kNone = 0;
313-
kLightOutput = 1;
314-
kVisibleIndicator = 2;
315-
kAudibleBeep = 3;
316-
kDisplay = 4;
317-
kActuator = 5;
318-
}
319-
320-
attribute int16u identifyTime = 0;
321-
readonly attribute IdentifyTypeEnum identifyType = 1;
322-
readonly attribute command_id generatedCommandList[] = 65528;
323-
readonly attribute command_id acceptedCommandList[] = 65529;
324-
readonly attribute event_id eventList[] = 65530;
325-
readonly attribute attrib_id attributeList[] = 65531;
326-
readonly attribute bitmap32 featureMap = 65532;
327-
readonly attribute int16u clusterRevision = 65533;
328-
329-
request struct IdentifyRequest {
330-
int16u identifyTime = 0;
331-
}
332-
333-
request struct TriggerEffectRequest {
334-
EffectIdentifierEnum effectIdentifier = 0;
335-
EffectVariantEnum effectVariant = 1;
336-
}
337-
338-
/** Command description for Identify */
339-
command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
340-
/** Command description for TriggerEffect */
341-
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
342-
}
343-
344294
/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
345295
cluster Descriptor = 29 {
346296
revision 2;
@@ -2423,7 +2373,6 @@ endpoint 0 {
24232373
endpoint 1 {
24242374
device type ma_thermostat = 769, version 1;
24252375

2426-
binding cluster Identify;
24272376

24282377
server cluster Identify {
24292378
ram attribute identifyTime default = 0x0000;

examples/thermostat/nxp/zap/thermostat_matter_br.zap

-26
Original file line numberDiff line numberDiff line change
@@ -2999,32 +2999,6 @@
29992999
"deviceTypeCode": 769,
30003000
"deviceTypeProfileId": 259,
30013001
"clusters": [
3002-
{
3003-
"name": "Identify",
3004-
"code": 3,
3005-
"mfgCode": null,
3006-
"define": "IDENTIFY_CLUSTER",
3007-
"side": "client",
3008-
"enabled": 1,
3009-
"commands": [
3010-
{
3011-
"name": "Identify",
3012-
"code": 0,
3013-
"mfgCode": null,
3014-
"source": "client",
3015-
"isIncoming": 0,
3016-
"isEnabled": 1
3017-
},
3018-
{
3019-
"name": "TriggerEffect",
3020-
"code": 64,
3021-
"mfgCode": null,
3022-
"source": "client",
3023-
"isIncoming": 0,
3024-
"isEnabled": 1
3025-
}
3026-
]
3027-
},
30283002
{
30293003
"name": "Identify",
30303004
"code": 3,

examples/thermostat/nxp/zap/thermostat_matter_thread.matter

-51
Original file line numberDiff line numberDiff line change
@@ -291,56 +291,6 @@ cluster Identify = 3 {
291291
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
292292
}
293293

294-
/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
295-
cluster Identify = 3 {
296-
revision 4;
297-
298-
enum EffectIdentifierEnum : enum8 {
299-
kBlink = 0;
300-
kBreathe = 1;
301-
kOkay = 2;
302-
kChannelChange = 11;
303-
kFinishEffect = 254;
304-
kStopEffect = 255;
305-
}
306-
307-
enum EffectVariantEnum : enum8 {
308-
kDefault = 0;
309-
}
310-
311-
enum IdentifyTypeEnum : enum8 {
312-
kNone = 0;
313-
kLightOutput = 1;
314-
kVisibleIndicator = 2;
315-
kAudibleBeep = 3;
316-
kDisplay = 4;
317-
kActuator = 5;
318-
}
319-
320-
attribute int16u identifyTime = 0;
321-
readonly attribute IdentifyTypeEnum identifyType = 1;
322-
readonly attribute command_id generatedCommandList[] = 65528;
323-
readonly attribute command_id acceptedCommandList[] = 65529;
324-
readonly attribute event_id eventList[] = 65530;
325-
readonly attribute attrib_id attributeList[] = 65531;
326-
readonly attribute bitmap32 featureMap = 65532;
327-
readonly attribute int16u clusterRevision = 65533;
328-
329-
request struct IdentifyRequest {
330-
int16u identifyTime = 0;
331-
}
332-
333-
request struct TriggerEffectRequest {
334-
EffectIdentifierEnum effectIdentifier = 0;
335-
EffectVariantEnum effectVariant = 1;
336-
}
337-
338-
/** Command description for Identify */
339-
command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
340-
/** Command description for TriggerEffect */
341-
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
342-
}
343-
344294
/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
345295
cluster Descriptor = 29 {
346296
revision 2;
@@ -2348,7 +2298,6 @@ endpoint 0 {
23482298
endpoint 1 {
23492299
device type ma_thermostat = 769, version 1;
23502300

2351-
binding cluster Identify;
23522301

23532302
server cluster Identify {
23542303
ram attribute identifyTime default = 0x0000;

examples/thermostat/nxp/zap/thermostat_matter_thread.zap

-26
Original file line numberDiff line numberDiff line change
@@ -3752,32 +3752,6 @@
37523752
"deviceTypeCode": 769,
37533753
"deviceTypeProfileId": 259,
37543754
"clusters": [
3755-
{
3756-
"name": "Identify",
3757-
"code": 3,
3758-
"mfgCode": null,
3759-
"define": "IDENTIFY_CLUSTER",
3760-
"side": "client",
3761-
"enabled": 1,
3762-
"commands": [
3763-
{
3764-
"name": "Identify",
3765-
"code": 0,
3766-
"mfgCode": null,
3767-
"source": "client",
3768-
"isIncoming": 0,
3769-
"isEnabled": 1
3770-
},
3771-
{
3772-
"name": "TriggerEffect",
3773-
"code": 64,
3774-
"mfgCode": null,
3775-
"source": "client",
3776-
"isIncoming": 0,
3777-
"isEnabled": 1
3778-
}
3779-
]
3780-
},
37813755
{
37823756
"name": "Identify",
37833757
"code": 3,

examples/thermostat/nxp/zap/thermostat_matter_wifi.matter

-51
Original file line numberDiff line numberDiff line change
@@ -291,56 +291,6 @@ cluster Identify = 3 {
291291
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
292292
}
293293

294-
/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
295-
cluster Identify = 3 {
296-
revision 4;
297-
298-
enum EffectIdentifierEnum : enum8 {
299-
kBlink = 0;
300-
kBreathe = 1;
301-
kOkay = 2;
302-
kChannelChange = 11;
303-
kFinishEffect = 254;
304-
kStopEffect = 255;
305-
}
306-
307-
enum EffectVariantEnum : enum8 {
308-
kDefault = 0;
309-
}
310-
311-
enum IdentifyTypeEnum : enum8 {
312-
kNone = 0;
313-
kLightOutput = 1;
314-
kVisibleIndicator = 2;
315-
kAudibleBeep = 3;
316-
kDisplay = 4;
317-
kActuator = 5;
318-
}
319-
320-
attribute int16u identifyTime = 0;
321-
readonly attribute IdentifyTypeEnum identifyType = 1;
322-
readonly attribute command_id generatedCommandList[] = 65528;
323-
readonly attribute command_id acceptedCommandList[] = 65529;
324-
readonly attribute event_id eventList[] = 65530;
325-
readonly attribute attrib_id attributeList[] = 65531;
326-
readonly attribute bitmap32 featureMap = 65532;
327-
readonly attribute int16u clusterRevision = 65533;
328-
329-
request struct IdentifyRequest {
330-
int16u identifyTime = 0;
331-
}
332-
333-
request struct TriggerEffectRequest {
334-
EffectIdentifierEnum effectIdentifier = 0;
335-
EffectVariantEnum effectVariant = 1;
336-
}
337-
338-
/** Command description for Identify */
339-
command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
340-
/** Command description for TriggerEffect */
341-
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
342-
}
343-
344294
/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
345295
cluster Descriptor = 29 {
346296
revision 2;
@@ -2213,7 +2163,6 @@ endpoint 0 {
22132163
endpoint 1 {
22142164
device type ma_thermostat = 769, version 1;
22152165

2216-
binding cluster Identify;
22172166

22182167
server cluster Identify {
22192168
ram attribute identifyTime default = 0x0000;

examples/thermostat/nxp/zap/thermostat_matter_wifi.zap

-26
Original file line numberDiff line numberDiff line change
@@ -2999,32 +2999,6 @@
29992999
"deviceTypeCode": 769,
30003000
"deviceTypeProfileId": 259,
30013001
"clusters": [
3002-
{
3003-
"name": "Identify",
3004-
"code": 3,
3005-
"mfgCode": null,
3006-
"define": "IDENTIFY_CLUSTER",
3007-
"side": "client",
3008-
"enabled": 1,
3009-
"commands": [
3010-
{
3011-
"name": "Identify",
3012-
"code": 0,
3013-
"mfgCode": null,
3014-
"source": "client",
3015-
"isIncoming": 0,
3016-
"isEnabled": 1
3017-
},
3018-
{
3019-
"name": "TriggerEffect",
3020-
"code": 64,
3021-
"mfgCode": null,
3022-
"source": "client",
3023-
"isIncoming": 0,
3024-
"isEnabled": 1
3025-
}
3026-
]
3027-
},
30283002
{
30293003
"name": "Identify",
30303004
"code": 3,

src/lib/shell/streamer_nxp.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ ssize_t streamer_nxp_read(streamer_t * streamer, char * buffer, size_t length)
221221
if (bytesRead == 0)
222222
{
223223
readDone = true;
224+
/* Return -1 to cancel the cli command, this command is empty as we are reading uart input until it
225+
is empty but for matter shell empty command is meaning stop the shell loop */
226+
return -1;
224227
}
225228
}
226229

src/platform/nxp/common/Logging.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,23 @@
3434
namespace chip {
3535
namespace Logging {
3636
namespace Platform {
37+
#if (configSUPPORT_STATIC_ALLOCATION == 1)
38+
StaticSemaphore_t xLoggingSemaphoreBuffer;
39+
#endif
3740

3841
/**
3942
* CHIP log output function.
4043
* Called only by ember-print (zcl log)
4144
*/
4245
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
4346
{
47+
#if (configSUPPORT_STATIC_ALLOCATION == 1)
48+
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutexStatic(&xLoggingSemaphoreBuffer);
49+
#else
50+
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutex();
51+
#endif
52+
assert(xLoggingSemaphore != NULL);
53+
4454
char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE] = { 0 };
4555
size_t prefixLen;
4656

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

90+
xSemaphoreTake(xLoggingSemaphore, portMAX_DELAY);
8091
PRINTF("%s", formattedMsg);
92+
xSemaphoreGive(xLoggingSemaphore);
8193
}
8294

8395
/**

0 commit comments

Comments
 (0)