Re: Default ECHO on TTYs causes unwanted garbage chars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2020-06-09 at 13:57 +0200, Greg KH wrote:
> 
> On Tue, Jun 09, 2020 at 11:38:49AM +0000, Joakim Tjernlund wrote:
> > Hi List
> > 
> > I was advised to come here with this problem(started on the USB list).
> > 
> > We have a USB to RS232 bridge which presents itself as an ttyACM and the first connect after power on,
> > we see some garbage chars transmitted back from USB host(PC) to out device which becomes input to
> > the device.
> > 
> > After much debugging I found that this are chars sent early in the boot process which then
> > are buffered and the TTYs default to ECHO chars is the cause.
> 
> So some program in the boot sequence is trying to send data out the
> device?  Why not just not do that?

This is the boot console. Both u-boot and Linux prints a lot there, then init prints while starting services

> 
> > When the TTY is opened, any chars in the this buffer is ECHOed back over USB to the device,
> > before one has a chance to disable ECHO. The device then thinks these chars are regular input.
> 
> Wait, you said something in the boot process did write to the device,
> which would have caused the tty to be opened then, right?

well, boot process of the device prints and it is enough for the USB cable to be attached but not opened by any app.
The device just see an UART and prints when UART is initialized.

> 
> > Seems to me that this behaviour is unwanted in general and and app. should get a chance to flush/discard
> > any chars so this does not happen.
> 
> Where are the characters coming from that would need to be flushed?

Early output from boot, basically whatever prints just after connecting the USB cable.

> When should characters be flushed exactly?

Whatever is in the buffers before opening the tty.
The terminal app(like cu) tries to flush any input when it starts, just to avoid any old chars in the
queue but it is to late then.

 Jocke

> 
> thanks,
> 
> greg k-h





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux