You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/02/08 05:31:41 UTC

[nuttx] branch master updated (63a847ebca -> b250db5dba)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from 63a847ebca esp32s3-devkit: Add support LED PWM initialization
     new 3e41bd8b35 driver/serial: Convert CR to LF in driver
     new b250db5dba serial: Fix a warning if termios enabled

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/serial/serial.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)


[nuttx] 02/02: serial: Fix a warning if termios enabled

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b250db5dba49db7d55bcb87a19ea2ed11aa976cf
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Wed Feb 8 11:27:44 2023 +0800

    serial: Fix a warning if termios enabled
    
    Fix:
    ```
     serial/serial.c: In function 'uart_ioctl':
    Error: serial/serial.c:1397:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     1397 |               FAR struct termios *termiosp = (FAR struct termios *)arg;
          |                                              ^
    Error: serial/serial.c:1419:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     1419 |               FAR struct termios *termiosp = (FAR struct termios *)arg;
          |
    ```
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 drivers/serial/serial.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index cbb81e94cb..4d053060d7 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -1395,7 +1395,8 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
         {
           case TCGETS:
             {
-              FAR struct termios *termiosp = (FAR struct termios *)arg;
+              FAR struct termios *termiosp = (FAR struct termios *)
+                                                (uintptr_t)arg;
 
               if (!termiosp)
                 {
@@ -1415,7 +1416,8 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 
           case TCSETS:
             {
-              FAR struct termios *termiosp = (FAR struct termios *)arg;
+              FAR struct termios *termiosp = (FAR struct termios *)
+                                                (uintptr_t)arg;
 
               if (!termiosp)
                 {


[nuttx] 01/02: driver/serial: Convert CR to LF in driver

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3e41bd8b359bbff95e7993b5b3615982b85a9cd0
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Tue Feb 7 18:12:08 2023 +0800

    driver/serial: Convert CR to LF in driver
    
    Enable the behavior by default for console,
    but configurable by termios.
    
    Binary size:
    
    Before:
       text    data     bss     dec     hex filename
     326460     409    8164  335033   51cb9 nuttx/nuttx
    
     After:
        text    data     bss     dec     hex filename
     326478     409    8164  335051   51ccb nuttx/nuttx
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 drivers/serial/serial.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 2fa17c6ede..cbb81e94cb 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -790,6 +790,11 @@ static ssize_t uart_read(FAR struct file *filep,
            * IUCLC - Not Posix
            * IXON/OXOFF - no xon/xoff flow control.
            */
+#else
+          if (dev->isconsole && ch == '\r')
+            {
+              ch = '\n';
+            }
 #endif
 
           /* Store the received character */
@@ -1423,7 +1428,6 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
               dev->tc_iflag = termiosp->c_iflag;
               dev->tc_oflag = termiosp->c_oflag;
               dev->tc_lflag = termiosp->c_lflag;
-
               ret = 0;
             }
             break;
@@ -1659,6 +1663,10 @@ int uart_register(FAR const char *path, FAR uart_dev_t *dev)
       /* Enable \n -> \r\n translation for the console */
 
       dev->tc_oflag = OPOST | ONLCR;
+
+      /* Convert CR to LF by default for console */
+
+      dev->tc_iflag |= ICRNL;
     }
 #endif