mirror of
https://github.com/espressif/openthread.git
synced 2026-08-19 08:59:52 +00:00
[diag] check state before entering diagnostic mode (#5908)
This commit restrict diagnostic mode only when network stack is not up, which prevents some issues caused by switching to diag mode after the device was attached. For example, timers may not be triggered properly after returnning from diagnostic mode.
This commit is contained in:
@@ -288,6 +288,8 @@ otError Diags::ProcessStart(uint8_t aArgsLength, char *aArgs[], char *aOutput, s
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(!Get<ThreadNetif>().IsUp(), error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
otPlatDiagChannelSet(mChannel);
|
||||
otPlatDiagTxPowerSet(mTxPower);
|
||||
|
||||
|
||||
@@ -164,4 +164,7 @@ expect "0:0:0:0::/64 s low"
|
||||
send "route remove ::/64\n"
|
||||
expect "Done"
|
||||
|
||||
send "diag start\n"
|
||||
expect ": InvalidState"
|
||||
|
||||
dispose_all
|
||||
|
||||
Reference in New Issue
Block a user