serial: Make SIGINT and SIGTSTP work even without CONFIG_SERIAL_TERMIOS

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-12-17 22:03:10 +08:00 committed by Gustavo Henrique Nihei
parent 901361be48
commit a010cb1af1
3 changed files with 7 additions and 8 deletions

View File

@ -191,7 +191,6 @@ config TTY_FORCE_PANIC_CHAR
config TTY_SIGINT
bool "Support SIGINT"
default n
depends on SERIAL_TERMIOS
---help---
Whether support Ctrl-c/x event. Enabled automatically for console
devices. May be enabled for other serial devices using the ISIG bit
@ -235,7 +234,6 @@ config TTY_SIGINT_CHAR
config TTY_SIGTSTP
bool "Support SIGTSTP"
default n
depends on SERIAL_TERMIOS
---help---
Whether support Ctrl-z event. Enabled automatically for console
devices. May be enabled for other serial devices using the ISIG bit

View File

@ -1603,13 +1603,13 @@ errout:
int uart_register(FAR const char *path, FAR uart_dev_t *dev)
{
#ifdef CONFIG_SERIAL_TERMIOS
# if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP)
#if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP)
/* Initialize of the task that will receive SIGINT signals. */
dev->pid = (pid_t)-1;
# endif
#endif
#ifdef CONFIG_SERIAL_TERMIOS
/* If this UART is a serial console */
if (dev->isconsole)

View File

@ -280,15 +280,16 @@ struct uart_dev_s
#endif
bool isconsole; /* true: This is the serial console */
#if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP)
pid_t pid; /* Thread PID to receive signals (-1 if none) */
#endif
#ifdef CONFIG_SERIAL_TERMIOS
/* Terminal control flags */
tcflag_t tc_iflag; /* Input modes */
tcflag_t tc_oflag; /* Output modes */
tcflag_t tc_lflag; /* Local modes */
#if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP)
pid_t pid; /* Thread PID to receive signals (-1 if none) */
#endif
#endif
/* Semaphores */