You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/08/13 20:34:09 UTC

[GitHub] [incubator-nuttx-apps] patacongo commented on a change in pull request #364: system/cu: refactor, add option -c to disable \n -> \r\n conversion

patacongo commented on a change in pull request #364:
URL: https://github.com/apache/incubator-nuttx-apps/pull/364#discussion_r470231376



##########
File path: system/cu/cu_main.c
##########
@@ -342,8 +366,37 @@ int main(int argc, FAR char *argv[])
       goto errout_with_devinit;
     }
 
-  enable_crlf_conversion(g_cu.outfd);
-  set_baudrate(g_cu.outfd, baudrate, parity, rtscts);
+#ifdef CONFIG_SERIAL_TERMIOS
+  /* remember serial device termios attributes */
+
+  ret = tcgetattr(g_cu.outfd, &g_tio_dev);
+  if (ret)
+    {
+      fprintf(stderr, "cu_main: ERROR during tcgetattr(): %d\n", errno);
+      goto errout_with_outfd;
+    }
+
+  /* remember std termios attributes if it is a tty. Try to select
+   * right descriptor that is used to refer to tty
+   */
+
+  if (isatty(fileno(stderr)))
+    fd_std_tty = fileno(stderr);
+  else if (isatty(fileno(stdout)))
+    fd_std_tty = fileno(stdout);
+  else if (isatty(fileno(stdin)))
+    fd_std_tty = fileno(stdin);
+  else
+    fd_std_tty = -1;
+
+  if (fd_std_tty >= 0)
+    tcgetattr(fd_std_tty, &g_tio_std);

Review comment:
       Coding Standard:  https://cwiki.apache.org/confluence/display/NUTTX/Coding+Standard#ifthenelse




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org