Hi, Resend txts
сб, 14 мар. 2020 г. в 00:31, Abdelatif Guettouche < abdelatif.guettou...@gmail.com>: > Hi Oleg, > > Unfortunately the patch didn't make it through. > Could you please resend it again with a .txt extension or open a PR in > https://github.com/apache/incubator-nuttx-apps > > On Fri, Mar 13, 2020 at 3:26 PM Oleg Evseev <ev.m...@gmail.com> wrote: > > > > 1) system/cu: fix wrongly swapped parity options > > 2) system/cu: add option -f to loop forever > > endless mode: pass all characters and ignore escape sequence, handy to > interact with serial devices with binary protocol > > > > -- > > Best Regards, > > Oleg >
From afdd750fdc404600b2f28811d24474568ef3aadc Mon Sep 17 00:00:00 2001 From: Oleg Evseev <ev.m...@gmail.com> Date: Fri, 13 Mar 2020 18:18:55 +0300 Subject: [PATCH] system/cu: add option -f to loop forever endless mode: pass all characters and ignore escape sequence, handy to interact with serial devices with binary protocol --- system/cu/cu_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 2c91d427..4e59ad4c 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -225,6 +225,7 @@ 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" + " -f: Enable endless mode without escape sequence (default: off)\n" " -?: This help\n", CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE, CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD); @@ -274,6 +275,7 @@ int main(int argc, FAR char *argv[]) int baudrate = CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD; enum parity_mode parity = PARITY_NONE; int rtscts = 1; + int nobreak = 0; int option; int ret; int bcmd; @@ -291,7 +293,7 @@ int main(int argc, FAR char *argv[]) sigaction(SIGKILL, &sa, NULL); optind = 0; /* global that needs to be reset in FLAT mode */ - while ((option = getopt(argc, argv, "l:s:ehor?")) != ERROR) + while ((option = getopt(argc, argv, "l:s:efhor?")) != ERROR) { switch (option) { @@ -315,6 +317,10 @@ int main(int argc, FAR char *argv[]) rtscts = 0; break; + case 'f': + nobreak = 1; + break; + case 'h': case '?': print_help(); @@ -377,6 +383,12 @@ int main(int argc, FAR char *argv[]) { int ch = getc(stdin); + if (nobreak == 1) + { + write(g_cu.outfd, &ch, 1); + continue; + } + if (ch <= 0) { continue; -- 2.24.0.windows.2
From 5a38efdd00455a1ed40a805ea909803d983a35cf Mon Sep 17 00:00:00 2001 From: Oleg Evseev <ev.m...@gmail.com> Date: Fri, 13 Mar 2020 18:11:43 +0300 Subject: [PATCH] system/cu: fix wrongly swapped parity options --- system/cu/cu_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 5311ffc3..2c91d427 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -304,11 +304,11 @@ int main(int argc, FAR char *argv[]) break; case 'e': - parity = PARITY_ODD; + parity = PARITY_EVEN; break; case 'o': - parity = PARITY_EVEN; + parity = PARITY_ODD; break; case 'r': -- 2.24.0.windows.2