When using LwM2M with queue mode enabled, the pull firmware update does not work.
The lwm2m subsystem prints the following error to the console
[00:00:34.201,000] <inf> net_lwm2m_engine: Connected, sock id 1
[00:00:34.201,000] <inf> net_lwm2m_pull_context: Connecting to server coap://some.coap.server:5883/f/fw.bin
[00:00:34.201,000] <err> net_lwm2m_pull_context: Error sending LWM2M packet (err:-1).
To Reproduce
enable CONFIG_LWM2M_QUEUE_MODE_ENABLED
enable CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT
initiate pull firmware update with Leshan server demo
Expected behavior
The zephyr lwm2m subsystem pulls the update blockwise.
Impact
LwM2M firmware update in pull-mode cannot be used with queue mode enabled.
Environment:
OS: Windows
Toolchain: zephyr-sdk-0.16.3
Zephyr v3.6
Additional context
In subsys\net\lib\lwm2m\lwm2m_pull_context.c, transfer_request calls lwm2m_send_message_async, which returns the -1 error.
In lwm2m_send_message_async in subsys\net\lib\lwm2m\lwm2m_message_handling.c, a call to lwm2m_rd_client_connection_resume will be made, if queue mode is enabled.
That function returns -EPERM, because the pointers client.ctx and client_ctx are not the same.
I currently do not have a good enough overview to know what is happening.
My wild guess would be that this is caused by the fact that the pull operation is using another server then the connected lwm2m server.
My hack to get it working for now was to comment out the call to lwm2m_rd_client_connection_resume in subsys\net\lib\lwm2m\lwm2m_message_handling.c.
When using LwM2M with queue mode enabled, the pull firmware update does not work. The lwm2m subsystem prints the following error to the console
To Reproduce
CONFIG_LWM2M_QUEUE_MODE_ENABLED
CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT
Expected behavior The zephyr lwm2m subsystem pulls the update blockwise.
Impact LwM2M firmware update in pull-mode cannot be used with queue mode enabled.
Environment:
Additional context In
subsys\net\lib\lwm2m\lwm2m_pull_context.c
,transfer_request
callslwm2m_send_message_async
, which returns the-1
error. Inlwm2m_send_message_async
insubsys\net\lib\lwm2m\lwm2m_message_handling.c
, a call tolwm2m_rd_client_connection_resume
will be made, if queue mode is enabled. That function returns-EPERM
, because the pointersclient.ctx
andclient_ctx
are not the same.I currently do not have a good enough overview to know what is happening. My wild guess would be that this is caused by the fact that the pull operation is using another server then the connected lwm2m server.
My hack to get it working for now was to comment out the call to
lwm2m_rd_client_connection_resume
insubsys\net\lib\lwm2m\lwm2m_message_handling.c
.