On 3/10/2023 8:12 AM, Xiang Xiao wrote:
The only problem is that terminal is optional:
https://github.com/apache/nuttx/blob/master/drivers/serial/Kconfig#L167-L174
So, if the user doesn't enable CONFIG_SERIAL_TERMIOS in defconfig, readline
will stop working due to failure to disable ECHO.

Isn't the default setting of ECHO disabled?  My understanding is the ECHO is always /disabled /unless it is specifically /enabled /in the TERMIOS settings.

Three option here:

    1. Remove SERIAL_TERMIOS and enable terminal setting always
I think so.  I previously argued that TERMIOS should not be optional.  It is required by POSIX.  There was discussion about the size increase, but I don't think there is any significant size increase due to this.  We could measure the increase with TERMIOS enabled and disabled to see.
    2. readline or special tool designed for raw mode select SERIAL_TERMIOS
    in their config
That would be insufficient.  Other logic needs TERMIOS too.  Other than a size increase, there is no harm in enabling TERMIOS.  But if TERMIOS is not enabled, then that can be a source of errors.
    3. Keep SERIAL_TERMIOS option, but simulate terminal setting by change
    isconsole flag
My recollection is that the isconsole flag was added ONLY to assure that lines sent from the console terminated in CR-LF as required by most terminal emulators.  It never had anything to do with ECHO or other TERMIOS settings recently.  That extension of the semantics is not good and introduces lots of problems.  Just because a serial device is the console device, that should not generally effect its behavior.
Both code size and change is small for option 3.

Except I don't think it is correct.

Reply via email to