On Thu, Mar 9, 2023 at 2:17 AM Gregory Nutt <spudan...@gmail.com> wrote:

>
> >> I imagine that this is occurring because readline also echos the input:
> >>
> >>
> >>
> https://github.com/apache/nuttx-apps/blob/master/system/readline/readline_common.c#L644
> >>
> >> The low-level serial driver should not echo just because /isconsole /is
> >> true.  Console echo is always handled by the application.  I would say
> >> that that is a bug.
> >>
> >  From the spec:
> > https://pubs.opengroup.org/onlinepubs/7908799/xsh/termios.h.html
> > the serial driver should echo the char if ECHO is enabled. Since NuttX
> > doesn't follow the spec, it makes many POSIX compliant interactive shells
> > doesn't work very well.
> > We have to make the breaking change to fix the wrong initial
> implementation.
>
> I still seems like the isconsole does not belong in the conditional:
>
>
> https://github.com/apache/nuttx/commit/68384e9db42e254b2cf6720bc3380aebdd2b298c
>
>            if (dev->isconsole
> #ifdef CONFIG_SERIAL_TERMIOS
>                || (dev->tc_iflag & ECHO)
> #endif
>               )
>              {
>
> Currently:
>
>   893           if (
>   894 #ifdef CONFIG_SERIAL_TERMIOS
>   895               dev->tc_iflag & ECHO
>   896 #else
>   897               dev->isconsole
>   898 #endif
>   899              )
>   900             {
>
> If CONFIG_SERIAL_TERMIOS is not set then shouldn't the entire 'if '
> condition should be removed?
>

>From my understanding, when CONFIG_SERIAL_TERMIOS isn't set whether serial
driver do some special terminal handling(e.g. \n<->\r\n and echo) is
controlled by isconsole flag:

   1. isconsole equals false, all special handling is disable
   2. isconsole equals true, all special handling is enable

So, the check needs to be kept to ensure that non-console uart doesn't add
the unxpected process.

Reply via email to