diff --git a/system/zmodem/README.txt b/system/zmodem/README.txt index 620dfa998..25e0f4a68 100755 --- a/system/zmodem/README.txt +++ b/system/zmodem/README.txt @@ -127,6 +127,7 @@ Using NuttX Zmodem with a Linux Host $ sudo stty -F /dev/ttyS0 9600 # Select 9600 (or other) BAUD $ sudo stty -F /dev/ttyS0 crtscts # Enables CTS/RTS handshaking * + $ sudo stty -F /dev/ttyS0 raw # Puts the TTY in raw mode $ sudo stty -F /dev/ttyS0 # Show the TTY configuration * Only is hardware flow control is enabled. diff --git a/system/zmodem/rz_main.c b/system/zmodem/rz_main.c index 08f73dbc8..38b889eaf 100644 --- a/system/zmodem/rz_main.c +++ b/system/zmodem/rz_main.c @@ -45,11 +45,13 @@ #include #include #include +#include #include #include #include #include "system/zmodem.h" +#include "zm.h" /**************************************************************************** * Private Functions @@ -155,8 +157,16 @@ int rz_main(int argc, FAR char **argv) errout_with_zmodem: (void)zmr_release(handle); + errout_with_device: +#ifdef CONFIG_SYSTEM_ZMODEM_FLOWC + /* Flush the serial output to assure do not hang trying to drain it */ + + tcflush(fd, TCIOFLUSH); +#endif + (void)close(fd); + errout: return exitcode; } diff --git a/system/zmodem/sz_main.c b/system/zmodem/sz_main.c index 1413e9c66..5bcc8e046 100644 --- a/system/zmodem/sz_main.c +++ b/system/zmodem/sz_main.c @@ -45,11 +45,13 @@ #include #include #include +#include #include #include #include #include "system/zmodem.h" +#include "zm.h" /**************************************************************************** * Private Functions @@ -261,8 +263,16 @@ int sz_main(int argc, FAR char **argv) errout_with_zmodem: (void)zms_release(handle); + errout_with_device: +#ifdef CONFIG_SYSTEM_ZMODEM_FLOWC + /* Flush the serial output to assure do not hang trying to drain it */ + + tcflush(fd, TCIOFLUSH); +#endif + (void)close(fd); + errout: return exitcode; }