You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/12/29 11:11:17 UTC
[incubator-nuttx] 01/07: serial: Make SIGINT and SIGTSTP work even without CONFIG_SERIAL_TERMIOS
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit a010cb1af1d1e49e6e4ae15f724de96a50bdeeb5
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Dec 17 22:03:10 2021 +0800
serial: Make SIGINT and SIGTSTP work even without CONFIG_SERIAL_TERMIOS
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
drivers/serial/Kconfig | 2 --
drivers/serial/serial.c | 6 +++---
include/nuttx/serial/serial.h | 7 ++++---
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index b63ca0a..0a2f7ad 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -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
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 2679254..ab7d73f 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -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)
diff --git a/include/nuttx/serial/serial.h b/include/nuttx/serial/serial.h
index 5d2435d..6645da5 100644
--- a/include/nuttx/serial/serial.h
+++ b/include/nuttx/serial/serial.h
@@ -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 */