-
Notifications
You must be signed in to change notification settings - Fork 6
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
extend OS_MGMT_RET_RC #3
Conversation
Thanks, looking into this now! |
@tomaszduda23 It looks like the OS management enums should be updated from here: The enums here, https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html#c.mcumgr_err_t, seem to be general SMP server errors. This merits further discussion! Are the Thanks for taking a look! JP |
It seems that both are mixed even in the same function https://github.com/nrfconnect/sdk-zephyr/blob/e9bb83320a4cd303135203fae18136a71e87f26e/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c#L480C1-L483C47. MGMT_ERR_ENOTSUP is definitely possible. https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager does some mapping depending on group. I'm not sure if the mapping can be perfect though. Maybe it would be better to allow int values for unknown values. I added this to not catch exception here https://github.com/tomaszduda23/smpclient/blob/d25c8035ae2858fd41a106058297b619d58fbcb5/smpclient/__init__.py#L62 |
IMO you've found a mistake, or possibly legacy support for past mistakes, in Zephyr's SMP server implementation! If you have time, take a look at the SMP spec here, https://docs.zephyrproject.org/latest/services/device_mgmt/smp_protocol.html, and see if that sheds any light on this. BTW, no one seems to use the flag bits that are available in the header. It would be possible to use the flag bits to specify the namespace of the return code. Of course the spec would need to be revised. |
@tomaszduda23 I think that I see! I made the mistake of implementing SMP Version 2 instead of SMP Version 1. This PR should be updated to use the OS_MGMT RCs from here: https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html#c.mcumgr_err_t Separately, this SMP library needs to understand that the error response is a union of SMP Version 1 and Version 2 errors. The LMK what you think! |
I was just about to point out the same thing. |
Another note is that smpclient, at the application layer, wants to discard this nonsense: https://github.com/intercreate/smpclient/blob/4942251bf4256643fd8878641aa08519a6693d9b/smpclient/generics.py#L17-L28 Edit: probably this won't work anymore since the application NEEDS to know that they are different types. |
extend OS_MGMT_RET_RC base on https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html#c.mcumgr_err_t