This is an automated email from the ASF dual-hosted git repository. gnutt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 86080a110e082b2507cfe0156a517ae307c39163 Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Mon Mar 20 01:07:21 2023 +0800 apps: Remove the check of CONFIG_SERIAL_TERMIOS If the code only change c_oflag, c_iflag and c_lflag, not c_cflag in termios. Follow up the change from kernel: https://github.com/apache/nuttx/pull/8843 Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- examples/modbus/modbus_main.c | 6 +----- examples/modbusmaster/mbmaster_main.c | 4 ---- examples/pty_test/pty_test.c | 2 -- interpreters/bas/bas_fs.c | 6 ------ interpreters/bas/bas_fs.h | 6 ------ interpreters/bas/bas_token.c | 4 ---- logging/embedlog/Makefile | 7 +------ logging/nxscope/Kconfig | 1 - logging/nxscope/nxscope_iser.c | 10 ++-------- modbus/README.md | 5 ++--- modbus/nuttx/portserial.c | 17 +---------------- modbus/nuttx/portserial_m.c | 17 +---------------- nshlib/nsh_login.c | 8 +------- system/cu/cu_main.c | 28 ++++++++++++++-------------- system/lzf/lzf_main.c | 2 -- system/termcurses/tcurses_vt100.c | 12 +----------- system/ymodem/Kconfig | 1 - system/zmodem/rz_main.c | 9 --------- system/zmodem/sz_main.c | 9 --------- system/zmodem/zm.h | 2 -- system/zmodem/zm_utils.c | 2 -- 21 files changed, 24 insertions(+), 134 deletions(-) diff --git a/examples/modbus/modbus_main.c b/examples/modbus/modbus_main.c index 59c9cc0a4..9ac8b76ae 100644 --- a/examples/modbus/modbus_main.c +++ b/examples/modbus/modbus_main.c @@ -49,7 +49,6 @@ #include <string.h> #include <unistd.h> #include <pthread.h> -#include <termios.h> #include <signal.h> #include <errno.h> @@ -67,11 +66,8 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ -#ifndef CONFIG_SERIAL_TERMIOS -# error "CONFIG_SERIAL_TERMIOS is needed by modbus example" -#endif +/* Configuration ************************************************************/ #ifndef CONFIG_EXAMPLES_MODBUS_PORT # define CONFIG_EXAMPLES_MODBUS_PORT 0 diff --git a/examples/modbusmaster/mbmaster_main.c b/examples/modbusmaster/mbmaster_main.c index 867daf71e..70e0aa239 100644 --- a/examples/modbusmaster/mbmaster_main.c +++ b/examples/modbusmaster/mbmaster_main.c @@ -50,10 +50,6 @@ /* modbus master port */ -#ifndef CONFIG_SERIAL_TERMIOS -# error "CONFIG_SERIAL_TERMIOS is needed by modbus example" -#endif - #ifdef CONFIG_EXAMPLES_MODBUSMASTER_PORT # define MBMASTER_PORT CONFIG_EXAMPLES_MODBUSMASTER_PORT #else diff --git a/examples/pty_test/pty_test.c b/examples/pty_test/pty_test.c index f3016458c..731a9ff47 100644 --- a/examples/pty_test/pty_test.c +++ b/examples/pty_test/pty_test.c @@ -330,7 +330,6 @@ int main(int argc, FAR char *argv[]) #endif } -#ifdef CONFIG_SERIAL_TERMIOS /* Enable \n -> \r\n conversion during write */ ret = tcgetattr(termpair.fd_uart, &tio); @@ -347,7 +346,6 @@ int main(int argc, FAR char *argv[]) fprintf(stderr, "ERROR: tcsetattr() failed: %d\n", errno); goto error_serial; } -#endif printf("Starting a new NSH Session using %s\n", buffer); diff --git a/interpreters/bas/bas_fs.c b/interpreters/bas/bas_fs.c index f8c7a8402..1d0863bbe 100644 --- a/interpreters/bas/bas_fs.c +++ b/interpreters/bas/bas_fs.c @@ -388,11 +388,7 @@ int FS_opendev(int chn, int infd, int outfd) g_file[chn] = malloc(sizeof(struct FileStream)); g_file[chn]->dev = 1; -#ifdef CONFIG_SERIAL_TERMIOS g_file[chn]->tty = (infd == 0 ? isatty(infd) && isatty(outfd) : 0); -#else - g_file[chn]->tty = 1; -#endif g_file[chn]->recLength = 1; g_file[chn]->infd = infd; g_file[chn]->inSize = 0; @@ -781,12 +777,10 @@ int FS_close(int dev) return 0; } -#ifdef CONFIG_SERIAL_TERMIOS int FS_istty(int chn) { return (g_file[chn] && g_file[chn]->tty); } -#endif int FS_lock(int chn, off_t offset, off_t length, int mode, int w) { diff --git a/interpreters/bas/bas_fs.h b/interpreters/bas/bas_fs.h index 781c4dbd0..8b74ad5d9 100644 --- a/interpreters/bas/bas_fs.h +++ b/interpreters/bas/bas_fs.h @@ -112,13 +112,7 @@ int FS_openbinaryChn(int chn, const char *name, int mode); int FS_freechn(void); int FS_flush(int dev); int FS_close(int dev); - -#ifdef CONFIG_SERIAL_TERMIOS int FS_istty(int chn); -#else -# define FS_istty(chn) (1) -#endif - int FS_lock(int chn, off_t offset, off_t length, int mode, int w); int FS_truncate(int chn); void FS_shellmode(int chn); diff --git a/interpreters/bas/bas_token.c b/interpreters/bas/bas_token.c index 8e57d0dc7..51448a018 100644 --- a/interpreters/bas/bas_token.c +++ b/interpreters/bas/bas_token.c @@ -4163,11 +4163,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file) b->yy_bs_column = 0; } -#ifdef CONFIG_SERIAL_TERMIOS b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; -#else - b->yy_is_interactive = 1; -#endif errno = oerrno; } diff --git a/logging/embedlog/Makefile b/logging/embedlog/Makefile index 7cf4e129f..0401f34d4 100644 --- a/logging/embedlog/Makefile +++ b/logging/embedlog/Makefile @@ -130,12 +130,6 @@ else CFLAGS += -DENABLE_PTHREAD=0 endif -ifeq ($(CONFIG_SERIAL_TERMIOS),y) - CFLAGS += -DHAVE_TERMIOS_H -else - CFLAGS += -DHAVE_TERMIOS_H=0 -endif - CFLAGS += -DEL_LOG_MAX=$(CONFIG_EMBEDLOG_LOG_MAX) CFLAGS += -DEL_MEM_LINE_SIZE=$(CONFIG_EMBEDLOG_MEM_LINE_SIZE) @@ -151,6 +145,7 @@ CFLAGS += -DHAVE_ACCESS=0 CFLAGS += -DENABLE_REENTRANT CFLAGS += -DENABLE_OUT_SYSLOG CFLAGS += -DHAVE_STAT +CFLAGS += -DHAVE_TERMIOS_H CFLAGS += -DHAVE_UNISTD_H CFLAGS += -DHAVE_FSYNC CFLAGS += -DHAVE_FILENO diff --git a/logging/nxscope/Kconfig b/logging/nxscope/Kconfig index 1fa24c645..85dd4f0e8 100644 --- a/logging/nxscope/Kconfig +++ b/logging/nxscope/Kconfig @@ -11,7 +11,6 @@ if LOGGING_NXSCOPE config LOGGING_NXSCOPE_INTF_SERIAL bool "NxScope serial port interface support" - select SERIAL_TERMIOS default n ---help--- For details, see logging/nxscope/nxscope_iserial.c diff --git a/logging/nxscope/nxscope_iser.c b/logging/nxscope/nxscope_iser.c index 61860abe8..816c096a6 100644 --- a/logging/nxscope/nxscope_iser.c +++ b/logging/nxscope/nxscope_iser.c @@ -33,14 +33,6 @@ #include <logging/nxscope/nxscope.h> -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#ifndef CONFIG_SERIAL_TERMIOS -# error Termios support must be enabled -#endif - /**************************************************************************** * Private Type Definition ****************************************************************************/ @@ -214,6 +206,7 @@ int nxscope_ser_init(FAR struct nxscope_intf_s *intf, tcgetattr(priv->fd, &tio); +#ifdef CONFIG_SERIAL_TERMIOS /* Configure a baud rate */ DEBUGASSERT(priv->cfg->baud > 0); @@ -224,6 +217,7 @@ int nxscope_ser_init(FAR struct nxscope_intf_s *intf, _err("ERROR: failed to set baud rate %d\n", errno); goto errout; } +#endif /* Configure RAW mode */ diff --git a/modbus/README.md b/modbus/README.md index 9fe4cc93b..07bdc45dc 100644 --- a/modbus/README.md +++ b/modbus/README.md @@ -110,9 +110,8 @@ The NuttX-named configuration options that are available include: See also other serial settings, in particular: - `CONFIG_SERIAL_TERMIOS` – Serial driver supports `termios.h` interfaces - (`tcsetattr`, `tcflush`, etc.). If this is not defined, then the terminal - settings (baud, parity, etc.) are not configurable at runtime; serial streams - will not be flushed when closed. + If this is not defined, then the terminal settings (baud, parity, etc.) + are not configurable at runtime. ## Note diff --git a/modbus/nuttx/portserial.c b/modbus/nuttx/portserial.c index c8241cfb0..d7071cc04 100644 --- a/modbus/nuttx/portserial.c +++ b/modbus/nuttx/portserial.c @@ -45,10 +45,7 @@ #include <fcntl.h> #include <unistd.h> #include <assert.h> - -#ifdef CONFIG_SERIAL_TERMIOS -# include <termios.h> -#endif +#include <termios.h> #include "port.h" @@ -78,9 +75,7 @@ static uint8_t ucBuffer[BUF_SIZE]; static int uiRxBufferPos; static int uiTxBufferPos; -#ifdef CONFIG_SERIAL_TERMIOS static struct termios xOldTIO; -#endif /**************************************************************************** * Private Function Prototypes @@ -182,9 +177,7 @@ void vMBPortSerialEnable(bool bEnableRx, bool bEnableTx) if (bEnableRx) { -#ifdef CONFIG_SERIAL_TERMIOS tcflush(iSerialFd, TCIFLUSH); -#endif uiRxBufferPos = 0; bRxEnabled = true; } @@ -209,10 +202,7 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate, { char szDevice[16]; bool bStatus = true; - -#ifdef CONFIG_SERIAL_TERMIOS struct termios xNewTIO; -#endif snprintf(szDevice, 16, "/dev/ttyS%d", ucPort); @@ -222,8 +212,6 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate, szDevice, errno); bStatus = false; } - -#ifdef CONFIG_SERIAL_TERMIOS else if (tcgetattr(iSerialFd, &xOldTIO) != 0) { vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't get settings from port %s: %d\n", @@ -298,7 +286,6 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate, } } } -#endif return bStatus; } @@ -321,9 +308,7 @@ void vMBPortClose(void) { if (iSerialFd != -1) { -#ifdef CONFIG_SERIAL_TERMIOS tcsetattr(iSerialFd, TCSANOW, &xOldTIO); -#endif close(iSerialFd); iSerialFd = -1; } diff --git a/modbus/nuttx/portserial_m.c b/modbus/nuttx/portserial_m.c index 30dd1c215..ee82e4492 100644 --- a/modbus/nuttx/portserial_m.c +++ b/modbus/nuttx/portserial_m.c @@ -46,10 +46,7 @@ #include <fcntl.h> #include <unistd.h> #include <assert.h> - -#ifdef CONFIG_SERIAL_TERMIOS -# include <termios.h> -#endif +#include <termios.h> #include "port.h" @@ -82,9 +79,7 @@ static uint8_t ucBuffer[BUF_SIZE]; static int uiRxBufferPos; static int uiTxBufferPos; -#ifdef CONFIG_SERIAL_TERMIOS static struct termios xOldTIO; -#endif /**************************************************************************** * Private Function Prototypes @@ -186,9 +181,7 @@ void vMBMasterPortSerialEnable(bool bEnableRx, bool bEnableTx) if (bEnableRx) { -#ifdef CONFIG_SERIAL_TERMIOS tcflush(iSerialFd, TCIFLUSH); -#endif uiRxBufferPos = 0; bRxEnabled = true; } @@ -213,10 +206,7 @@ bool xMBMasterPortSerialInit(uint8_t ucPort, speed_t ulBaudRate, { char szDevice[16]; bool bStatus = true; - -#ifdef CONFIG_SERIAL_TERMIOS struct termios xNewTIO; -#endif snprintf(szDevice, 16, "/dev/ttyS%d", ucPort); @@ -227,8 +217,6 @@ bool xMBMasterPortSerialInit(uint8_t ucPort, speed_t ulBaudRate, szDevice, errno); bStatus = false; } - -#ifdef CONFIG_SERIAL_TERMIOS else if (tcgetattr(iSerialFd, &xOldTIO) != 0) { vMBMasterPortLog(MB_LOG_ERROR, "SER-INIT", @@ -307,7 +295,6 @@ bool xMBMasterPortSerialInit(uint8_t ucPort, speed_t ulBaudRate, } } } -#endif return bStatus; } @@ -330,9 +317,7 @@ void vMBMasterPortClose( void ) { if (iSerialFd != -1) { -#ifdef CONFIG_SERIAL_TERMIOS tcsetattr(iSerialFd, TCSANOW, &xOldTIO); -#endif close(iSerialFd); iSerialFd = -1; } diff --git a/nshlib/nsh_login.c b/nshlib/nsh_login.c index 20cd6dc45..374212a60 100644 --- a/nshlib/nsh_login.c +++ b/nshlib/nsh_login.c @@ -149,11 +149,9 @@ int nsh_login(FAR struct console_stdio_s *pstate) #ifdef CONFIG_NSH_PLATFORM_CHALLENGE char challenge[128]; #endif + struct termios cfg; int ret; int i; -#ifdef CONFIG_SERIAL_TERMIOS - struct termios cfg; -#endif #ifdef CONFIG_NSH_PLATFORM_SKIP_LOGIN if (platform_skip_login() == OK) @@ -199,7 +197,6 @@ int nsh_login(FAR struct console_stdio_s *pstate) /* Disable ECHO if its a tty device */ -#ifdef CONFIG_SERIAL_TERMIOS if (isatty(INFD(pstate))) { if (tcgetattr(INFD(pstate), &cfg) == 0) @@ -208,7 +205,6 @@ int nsh_login(FAR struct console_stdio_s *pstate) tcsetattr(INFD(pstate), TCSANOW, &cfg); } } -#endif password[0] = '\0'; ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN, @@ -216,7 +212,6 @@ int nsh_login(FAR struct console_stdio_s *pstate) /* Enable echo again after password */ -#ifdef CONFIG_SERIAL_TERMIOS if (isatty(INFD(pstate))) { if (tcgetattr(INFD(pstate), &cfg) == 0) @@ -225,7 +220,6 @@ int nsh_login(FAR struct console_stdio_s *pstate) tcsetattr(INFD(pstate), TCSANOW, &cfg); } } -#endif if (ret > 0) { diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 29090bd8b..29dfc243e 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -83,11 +83,9 @@ enum parity_mode ****************************************************************************/ static struct cu_globals_s g_cu; -#ifdef CONFIG_SERIAL_TERMIOS static int fd_std_tty; static struct termios g_tio_std; static struct termios g_tio_dev; -#endif /**************************************************************************** * Public Data @@ -135,6 +133,9 @@ static void sigint(int sig) #ifdef CONFIG_SERIAL_TERMIOS static int set_termios(int fd, int rate, enum parity_mode parity, int rtscts, int nocrlf) +#else +static int set_termios(int fd, int nocrlf) +#endif { int rc = 0; int ret; @@ -142,6 +143,7 @@ static int set_termios(int fd, int rate, enum parity_mode parity, tio = g_tio_dev; +#ifdef CONFIG_SERIAL_TERMIOS tio.c_cflag &= ~(PARENB | PARODD | CRTSCTS); switch (parity) @@ -169,6 +171,7 @@ static int set_termios(int fd, int rate, enum parity_mode parity, { tio.c_cflag |= CRTS_IFLOW | CCTS_OFLOW; } +#endif tio.c_oflag = OPOST; @@ -228,7 +231,6 @@ static int retrieve_termios(int fd) return 0; } -#endif static void print_help(void) { @@ -239,15 +241,13 @@ static void print_help(void) " -o: Set odd parity\n" " -s: Use given speed (default %d)\n" " -r: Disable RTS/CTS flow control (default: on)\n" - " -c: Disable lf -> crlf conversion (default: off)\n" #endif + " -c: Disable lf -> crlf conversion (default: off)\n" " -f: Enable endless mode without escape sequence (default: off)\n" " -?: This help\n", -#ifdef CONFIG_SERIAL_TERMIOS - CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE, - CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD -#else CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE +#ifdef CONFIG_SERIAL_TERMIOS + , CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD #endif ); } @@ -297,8 +297,8 @@ int main(int argc, FAR char *argv[]) int baudrate = CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD; enum parity_mode parity = PARITY_NONE; int rtscts = 1; - int nocrlf = 0; #endif + int nocrlf = 0; int nobreak = 0; int option; int ret; @@ -342,11 +342,11 @@ int main(int argc, FAR char *argv[]) case 'r': rtscts = 0; break; +#endif case 'c': nocrlf = 1; break; -#endif case 'f': nobreak = 1; @@ -381,7 +381,6 @@ int main(int argc, FAR char *argv[]) goto errout_with_devinit; } -#ifdef CONFIG_SERIAL_TERMIOS /* remember serial device termios attributes */ ret = tcgetattr(g_cu.outfd, &g_tio_dev); @@ -417,11 +416,14 @@ int main(int argc, FAR char *argv[]) tcgetattr(fd_std_tty, &g_tio_std); } +#ifdef CONFIG_SERIAL_TERMIOS if (set_termios(g_cu.outfd, baudrate, parity, rtscts, nocrlf) != 0) +#else + if (set_termios(g_cu.outfd, nocrlf) != 0) +#endif { goto errout_with_outfd_retrieve; } -#endif /* Open the serial device for reading. Since we are already connected, * this should not fail. @@ -521,10 +523,8 @@ int main(int argc, FAR char *argv[]) errout_with_fds: close(g_cu.infd); -#ifdef CONFIG_SERIAL_TERMIOS errout_with_outfd_retrieve: retrieve_termios(g_cu.outfd); -#endif errout_with_outfd: close(g_cu.outfd); errout_with_devinit: diff --git a/system/lzf/lzf_main.c b/system/lzf/lzf_main.c index b25b14257..60cb80ed0 100644 --- a/system/lzf/lzf_main.c +++ b/system/lzf/lzf_main.c @@ -538,7 +538,6 @@ int main(int argc, FAR char *argv[]) { /* stdin stdout */ -#ifdef CONFIG_SERIAL_TERMIOS if (!g_force) { if ((g_mode == UNCOMPRESS) && isatty(0)) @@ -557,7 +556,6 @@ int main(int argc, FAR char *argv[]) lzf_exit(1); } } -#endif if (g_mode == COMPRESS) { diff --git a/system/termcurses/tcurses_vt100.c b/system/termcurses/tcurses_vt100.c index 3f36f9d84..447b973a6 100644 --- a/system/termcurses/tcurses_vt100.c +++ b/system/termcurses/tcurses_vt100.c @@ -75,9 +75,7 @@ struct tcurses_vt100_s int out_fd; int keycount; char keybuf[16]; -#ifdef CONFIG_SERIAL_TERMIOS tcflag_t lflag; -#endif }; /************************************************************************************ @@ -1469,9 +1467,7 @@ static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev) FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd) { FAR struct tcurses_vt100_s *priv; -#ifdef CONFIG_SERIAL_TERMIOS struct termios cfg; -#endif /* Allocate a new device structure */ @@ -1490,7 +1486,6 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd) priv->out_fd = out_fd; priv->keycount = 0; -#ifdef CONFIG_SERIAL_TERMIOS if (isatty(priv->in_fd)) { if (tcgetattr(priv->in_fd, &cfg) == 0) @@ -1516,7 +1511,6 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd) priv->lflag = 0; } } -#endif return (FAR struct termcurses_s *)priv; } @@ -1532,10 +1526,8 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd) static int tcurses_vt100_terminate(FAR struct termcurses_s *dev) { FAR struct tcurses_vt100_s *priv; - int fd; -#ifdef CONFIG_SERIAL_TERMIOS struct termios cfg; -#endif + int fd; priv = (FAR struct tcurses_vt100_s *)dev; fd = priv->out_fd; @@ -1546,7 +1538,6 @@ static int tcurses_vt100_terminate(FAR struct termcurses_s *dev) write(fd, g_setdefcolors, strlen(g_setdefcolors)); -#ifdef CONFIG_SERIAL_TERMIOS if (isatty(priv->in_fd)) { if (tcgetattr(priv->in_fd, &cfg) == 0 && priv->lflag & ECHO) @@ -1555,7 +1546,6 @@ static int tcurses_vt100_terminate(FAR struct termcurses_s *dev) tcsetattr(priv->in_fd, TCSANOW, &cfg); } } -#endif return OK; } diff --git a/system/ymodem/Kconfig b/system/ymodem/Kconfig index dda519715..ac4706059 100644 --- a/system/ymodem/Kconfig +++ b/system/ymodem/Kconfig @@ -5,7 +5,6 @@ config SYSTEM_YMODEM tristate "YMODEM" - depends on SERIAL_TERMIOS ---help--- Enable support for ymodem. diff --git a/system/zmodem/rz_main.c b/system/zmodem/rz_main.c index 5152f4c70..dc7b3344d 100644 --- a/system/zmodem/rz_main.c +++ b/system/zmodem/rz_main.c @@ -69,9 +69,7 @@ int main(int argc, FAR char *argv[]) FAR const char *devname = CONFIG_SYSTEM_ZMODEM_DEVNAME; FAR const char *pathname = CONFIG_SYSTEM_ZMODEM_MOUNTPOINT; int exitcode = EXIT_FAILURE; -#ifdef CONFIG_SERIAL_TERMIOS struct termios saveterm; -#endif int option; int ret; int fd; @@ -124,7 +122,6 @@ int main(int argc, FAR char *argv[]) goto errout; } -#ifdef CONFIG_SERIAL_TERMIOS /* Save the current terminal setting */ tcgetattr(fd, &saveterm); @@ -137,7 +134,6 @@ int main(int argc, FAR char *argv[]) /* Enable hardware Rx/Tx flow control */ zm_flowc(fd); -#endif #endif /* Get the Zmodem handle */ @@ -164,18 +160,13 @@ errout_with_zmodem: zmr_release(handle); errout_with_device: -#ifdef CONFIG_SERIAL_TERMIOS -#ifdef CONFIG_SYSTEM_ZMODEM_FLOWC /* Flush the serial output to assure do not hang trying to drain it */ tcflush(fd, TCIOFLUSH); -#endif /* Restore the saved terminal setting */ tcsetattr(fd, TCSANOW, &saveterm); -#endif - close(fd); errout: diff --git a/system/zmodem/sz_main.c b/system/zmodem/sz_main.c index bebb4e3ef..82cfac700 100644 --- a/system/zmodem/sz_main.c +++ b/system/zmodem/sz_main.c @@ -88,9 +88,7 @@ int main(int argc, FAR char *argv[]) bool skip = false; long tmp; int exitcode = EXIT_FAILURE; -#ifdef CONFIG_SERIAL_TERMIOS struct termios saveterm; -#endif int option; int ret; int fd; @@ -177,7 +175,6 @@ int main(int argc, FAR char *argv[]) goto errout; } -#ifdef CONFIG_SERIAL_TERMIOS /* Save the current terminal setting */ tcgetattr(fd, &saveterm); @@ -190,7 +187,6 @@ int main(int argc, FAR char *argv[]) /* Enable hardware Rx/Tx flow control */ zm_flowc(fd); -#endif #endif /* Get the Zmodem handle */ @@ -264,18 +260,13 @@ errout_with_zmodem: zms_release(handle); errout_with_device: -#ifdef CONFIG_SERIAL_TERMIOS -# ifdef CONFIG_SYSTEM_ZMODEM_FLOWC /* Flush the serial output to assure do not hang trying to drain it */ tcflush(fd, TCIOFLUSH); -#endif /* Restore the saved terminal setting */ tcsetattr(fd, TCSANOW, &saveterm); -#endif - close(fd); errout: diff --git a/system/zmodem/zm.h b/system/zmodem/zm.h index 3d4eeef01..8cf460c87 100644 --- a/system/zmodem/zm.h +++ b/system/zmodem/zm.h @@ -577,9 +577,7 @@ uint32_t zm_filecrc(FAR struct zm_state_s *pzm, FAR const char *filename); * ****************************************************************************/ -#ifdef CONFIG_SERIAL_TERMIOS void zm_rawmode(int fd); -#endif /**************************************************************************** * Name: zm_flowc diff --git a/system/zmodem/zm_utils.c b/system/zmodem/zm_utils.c index 56489e9cb..3c130f7fd 100644 --- a/system/zmodem/zm_utils.c +++ b/system/zmodem/zm_utils.c @@ -476,7 +476,6 @@ uint32_t zm_filecrc(FAR struct zm_state_s *pzm, FAR const char *filename) * ****************************************************************************/ -#ifdef CONFIG_SERIAL_TERMIOS void zm_rawmode(int fd) { struct termios term; @@ -485,7 +484,6 @@ void zm_rawmode(int fd) cfmakeraw(&term); tcsetattr(fd, TCSANOW, &term); } -#endif /**************************************************************************** * Name: zm_flowc