On Sat, Mar 11, 2023 at 9:51 AM Gregory Nutt <spudan...@gmail.com> wrote:

>
> On 3/10/2023 7:44 PM, Huang Qi wrote:
> > >>  The ECHO behavior can be disabled ONLY if TERMIOS are enabled.
> > >>  TERIMIOS is now required by POSIX and, further, if TERMIOS is not
> > >>  system, many features are now broken.  Like hiding the password when
> > >>  logging into NSH.
> > > Yes maybe we should select TERMIOS if some features really need it ?
> > Most apps don't need it, only
> > > termcurse/nsh login rely on it now in my known.
> >
> > > The those Kconfig files should select TERMIOS_SERIAL, right?
> >
> > Yes, this is a chioce, or we can make TERMIOS enabled forcely, but
> > will cause a extra 1KB overhead for all target.
> >
> That 1Kb number seems large to me.  Most of that is in the lower-half,
> UART driver, right?  If so then the size would vary dramatically from
> chip-to-chip.
>
>
Terminal setting include two part:

   1. Hardware related setting(e.g. baud rate, parity check etc)
   2. Software related setting(e.g. echo, \r\n<->\n etc)

The major code size increase comes from the first item, but it's
unfortunate that TERMIOS_SERIAL controls both settings.
So, here is my suggestion:

   1. TERMIOS_SERIAL only control the hardware related setting
   2. The software setting is always enabled
   3. isconsole decide the initial software setting
      - isconsole equals false, disable all special process
      - isconsole equals true, enable \r\n<->\n, echo and crtl+c handling
   4. terminal aware function or application change the terminal to raw
   mode and restore to the original setting before exit
   5. other normal application could assume that the terminal do all
   special process

This could achieve POSIX compliance with the minimal cost.


>
> As a percentage growth, I suppose even 1Kb is not so large.  Probably
> less then 2%
>

Reply via email to