1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/shell_lock: lock shell on EOF

This commit is contained in:
Benjamin Valentin 2023-02-14 01:14:51 +01:00
parent f58384832c
commit c0a4acf32d
3 changed files with 14 additions and 1 deletions

View File

@ -68,6 +68,11 @@ void shell_lock_checkpoint(char *line_buf, int buf_size);
*/
bool shell_lock_is_locked(void);
/**
* @brief Lock the shell
*/
void shell_lock_do_lock(void);
#ifdef MODULE_SHELL_LOCK_AUTO_LOCKING
/**
* @brief Restart the timeout interval before the shell is locked

View File

@ -501,6 +501,9 @@ void shell_run_once(const shell_command_t *shell_commands,
switch (res) {
case EOF:
if (IS_USED(MODULE_SHELL_LOCK)) {
shell_lock_do_lock();
}
return;
case -ENOBUFS:

View File

@ -143,10 +143,15 @@ static void _login_barrier(char *line_buf, size_t buf_size)
#ifdef MODULE_STDIO_TELNET
void telnet_cb_disconneced(void)
{
_shell_is_locked = true;
shell_lock_do_lock();
}
#endif
void shell_lock_do_lock(void)
{
_shell_is_locked = true;
}
#ifdef MODULE_SHELL_LOCK_AUTO_LOCKING
static void _shell_auto_lock_ztimer_callback(void *arg)
{