Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZAP external attributes are size 0, and fails datalen check when trying to write #21898

Closed
ryetree1 opened this issue Aug 16, 2022 · 4 comments
Closed

Comments

@ryetree1
Copy link

When you mark an attribute as external (storing in external flash), the size field in the generated endpoints.h gets set to 0 for that attribute.

When that attribute is written to it goes through WriteSingleClusterData() in ember-compatibility-functions.cpp. In that function is does a check "if (dataLen > attributeMetadata->size)", which fails since the attribute size is 0. This results in an error 0x87, constraint error.

@mrjerryjohns
Copy link
Contributor

The above statements don't quite line up what I see in the code. External attributes do still have valid size fields setup in the generated AttributeMetadata tables:

            { 0x00000001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* RebootCount */      \
            { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* UpTime */           \

The only ones that don't have a valid size are those of type struct or array. Those cannot be handled by the Ember layer anyways.

@ryetree1
Copy link
Author

strange, all my external attributes have a size 0. My ram attributes have actual size

(example):

/* Endpoint: 1, Cluster: On/Off (server) /
{ 0x00000000, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /
OnOff /
{ 0x00004000, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /
GlobalSceneControl /
{ 0x00004001, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /
OnTime /
{ 0x00004002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /
OffWaitTime */ \

Maybe its an issue in my zap revision, will double check it all.

@bzbarsky-apple
Copy link
Contributor

@ryetree1 Which exact SHA of Matter and ZAP are you using? The behavior here changed in #19812 and it's possible you are using something from before then.

@ryetree1
Copy link
Author

I updated the ZAP and this issue seems to be addressed. Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants