You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Alan Carvalho de Assis <ac...@gmail.com> on 2021/02/05 19:49:29 UTC

Re: stdout

Hi Grr,

Could you please test your driver with the following application:

/****************************************************************************
 * hello_main
 ****************************************************************************/

int main(int argc, FAR char *argv[])
{
  char name[32];
  int age;

  printf("Inform your name: ");
  scanf("%s", name);
  printf("Your name is: %s\n", name);

  printf("Inform your age: ");
  scanf("%d", &age);
  printf("Your age is: %d\n", age);

  return 0;
}

Currently the outout is printed this way:

Inform your name: Your name is: Alan
Inform your age: Your age is: 30

It didn't echoed the name and age while the user was typing and didn't
print the line break.

BR,

Alan

On 1/27/21, Grr <ge...@gmail.com> wrote:
> I opted for The Right Thing(TM) and implemented a simple serial input echo
> capabilities for serial driver introducing use of ECHO flag in
> drivers/serial/serial.c and proper configuration options in menuconfig
>
> Now the interface of an interactive serial program works the same in Linux
> and NuttX  :)
>
> Next task is to disable NSH echo and I'll have a complete solution
>
> If anyone is interested, I can do a PR
>
> El mar, 26 ene 2021 a las 11:46, Grr (<ge...@gmail.com>) escribió:
>
>> Ken:
>> Thanks a lot for your code. I will try it
>>
>> I was researching that echo thing and yes, that's a terminal device
>> driver
>> thing. More exactly, c_lflag of termios struct. Problem is I haven't
>> found
>> yet where that is set in the serial terminal setup sequence
>>
>> El mar, 26 ene 2021 a las 11:28, Johnny Billquist (<bq...@softjar.se>)
>> escribió:
>>
>>> On 2021-01-26 16:16, Ken Pettit wrote:
>>> > Grr,
>>> >
>>> > Yeah, in Nuttx, fgets, fgetc, etc. don't echo.  Even in Linux, the
>>> > echo
>>> > is actually a function of the terminal, not the running program and
>>> > 'fgets'.
>>>
>>> It is actually not a function of the terminal, but the terminal (serial)
>>> device driver.
>>>
>>>    Johnny
>>>
>>> --
>>> Johnny Billquist                  || "I'm on a bus
>>>                                    ||  on a psychedelic trip
>>> email: bqt@softjar.se             ||  Reading murder books
>>> pdp is alive!                     ||  tryin' to stay hip" - B. Idol
>>>
>>
>