Skip to content

Commit b8dff13

Browse files
pearsonnashif
authored andcommitted
net: openthread: Change OT net log to display current role in text
If CONFIG_NET_LOG=y is set, OpenThread will output the current OT role whenever the state changes. To simplify understanding of the log output, this change replaces the numerical role ID with the text name of the role. This also required a change to a documentation file to replace an instance of a numerical ID. NOTE: This is potentially a breaking change should anyone be using test scripts that monitor the OpenThread state changes and look for the numerical ID. This does not seem to be the case for the Zephyr tests, however. Signed-off-by: Chris Pearson <[email protected]>
1 parent 0a0fed7 commit b8dff13

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

samples/net/lwm2m_client/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ networking do the following:
214214
:compact:
215215

216216
Note: If not provisioned (fully erased before flash), device will form
217-
new OpenThread network and promote himself as leader (Current role: 4).
217+
new OpenThread network and promote himself as leader (Current role: leader).
218218
To join into already existing OT network, either enable CONFIG_OPENTHREAD_JOINER=y
219219
and CONFIG_OPENTHREAD_JOINER_AUTOSTART=y and send join request from other
220220
already joined device with joiner capabilities, or provision it manually

subsys/net/l2/openthread/openthread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ static void ot_state_changed_handler(uint32_t flags, void *context)
168168
{
169169
struct openthread_context *ot_context = context;
170170

171-
NET_INFO("State changed! Flags: 0x%08" PRIx32 " Current role: %d",
172-
flags, otThreadGetDeviceRole(ot_context->instance));
171+
NET_INFO("State changed! Flags: 0x%08" PRIx32 " Current role: %s",
172+
flags, otThreadDeviceRoleToString( otThreadGetDeviceRole(ot_context->instance)));
173173

174174
if (flags & OT_CHANGED_IP6_ADDRESS_REMOVED) {
175175
NET_DBG("Ipv6 address removed");

0 commit comments

Comments
 (0)