Skip to content

Commit

Permalink
Add reset bootloader CLI command
Browse files Browse the repository at this point in the history
  • Loading branch information
lmnotran committed Oct 11, 2023
1 parent dc2835d commit 319d767
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,34 @@ template <> otError Interpreter::Process<Cmd("version")>(Arg aArgs[])

template <> otError Interpreter::Process<Cmd("reset")>(Arg aArgs[])
{
OT_UNUSED_VARIABLE(aArgs);
otError error = OT_ERROR_NONE;

otInstanceReset(GetInstancePtr());
if (aArgs[0].IsEmpty())
{
otInstanceReset(GetInstancePtr());
}

return OT_ERROR_NONE;
#if OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE
/**
* @cli reset bootloader
* @code
* reset bootloader
* @endcode
* @par
* Resets platform to bootloader mode, if supported.
*/
else if (aArgs[0] == "bootloader")
{
otInstanceResetToBootloader(GetInstancePtr());
}
#endif
else
{
ExitNow(error = OT_ERROR_INVALID_COMMAND);
}

exit:
return error;
}

void Interpreter::ProcessLine(char *aBuf)
Expand Down

0 comments on commit 319d767

Please sign in to comment.