-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys/shell: add shell wrapper for openthread cli #21862
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
Open
morigawa
wants to merge
6
commits into
RIOT-OS:master
Choose a base branch
from
morigawa:pr/integrate-openthread-into-shell
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+85
−10
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ddb957b
sys/shell: integrate OpenThread CLI into RIOT shell
morigawa 4a28bfc
pkg/openthread: use RIOT shell as wrapper for ot cli
morigawa c04fbd3
examples/openthread: Adept example to new shell usage
morigawa 0c426cb
fixup! pkg/openthread: use RIOT shell as wrapper for ot cli
morigawa 07a0125
fixup! sys/shell: integrate OpenThread CLI into RIOT shell
morigawa 61e1f85
fixup! sys/shell: integrate OpenThread CLI into RIOT shell
morigawa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,14 @@ | ||
| USEMODULE += openthread_contrib | ||
|
|
||
| USEMODULE += event | ||
| USEMODULE += l2util | ||
| USEMODULE += netdev | ||
| USEMODULE += openthread_contrib | ||
| USEMODULE += openthread_contrib_netdev | ||
| USEMODULE += l2util | ||
|
|
||
| ifneq (,$(filter openthread-cli-%,$(USEMODULE))) | ||
morigawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| USEMODULE += shell_cmds_default | ||
| endif | ||
|
|
||
| USEMODULE += ztimer | ||
| USEMODULE += ztimer_msec | ||
| USEMODULE += event | ||
|
|
||
| FEATURES_REQUIRED += cpp | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 TU Dresden | ||
| * SPDX-License-Identifier: LGPL-2.1-only | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup sys_shell_commands | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Shell command implementation for OpenThread | ||
| * | ||
| * @author Moritz Voigt <[email protected]> | ||
| * | ||
| * @} | ||
| */ | ||
| #include <stdio.h> | ||
| #include <string.h> | ||
|
|
||
| #include "shell.h" | ||
| #include "openthread/cli.h" | ||
|
|
||
| static int ot_console_cb(const char *abuf, uint16_t bufsize, void *context) | ||
| { | ||
| (void) context; | ||
| if (bufsize > 0) { | ||
| printf("%.*s", bufsize, abuf); | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| static int ot_cmd(int argc, char **argv) | ||
| { | ||
| for (int i = 1; i < argc - 1; i++) { | ||
| char *arg = argv[i]; | ||
morigawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| arg += strlen(arg); | ||
| *arg = ' '; | ||
| } | ||
|
|
||
| if (strlen(argv[0]) != 0) { | ||
morigawa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| otCliConsoleInputLine(argv[1], strlen(argv[1])); | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| SHELL_COMMAND(ot, "Use commands from OpenThread CLI", ot_cmd); | ||
|
|
||
| void ot_shell_init(otInstance *aInstance) | ||
| { | ||
| otCliConsoleInit(aInstance, ot_console_cb, NULL); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.