Skip to content

Commit 6272ba2

Browse files
wojciechslenskacarlescufi
authored andcommitted
shell: added function shell_use_vt100_set
Added function to enable/disable vt100 commands. Signed-off-by: Wojciech Slenska <[email protected]>
1 parent bbd428f commit 6272ba2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

include/zephyr/shell/shell.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,18 @@ int shell_insert_mode_set(const struct shell *shell, bool val);
11881188
*/
11891189
int shell_use_colors_set(const struct shell *shell, bool val);
11901190

1191+
/**
1192+
* @brief Allow application to control whether terminal is using vt100 commands.
1193+
* Value is modified atomically and the previous value is returned.
1194+
*
1195+
* @param[in] sh Pointer to the shell instance.
1196+
* @param[in] val vt100 mode.
1197+
*
1198+
* @retval 0 or 1: previous value
1199+
* @retval -EINVAL if shell is NULL.
1200+
*/
1201+
int shell_use_vt100_set(const struct shell *sh, bool val);
1202+
11911203
/**
11921204
* @brief Allow application to control whether user input is echoed back.
11931205
* Value is modified atomically and the previous value is returned.

subsys/shell/shell.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,15 @@ int shell_use_colors_set(const struct shell *shell, bool val)
16581658
return (int)z_flag_use_colors_set(shell, val);
16591659
}
16601660

1661+
int shell_use_vt100_set(const struct shell *sh, bool val)
1662+
{
1663+
if (sh == NULL) {
1664+
return -EINVAL;
1665+
}
1666+
1667+
return (int)z_flag_use_vt100_set(sh, val);
1668+
}
1669+
16611670
int shell_echo_set(const struct shell *shell, bool val)
16621671
{
16631672
if (shell == NULL) {

0 commit comments

Comments
 (0)