All of lore.kernel.org
 help / color / mirror / Atom feed
* closing serial device dumps data in buffer
@ 2021-02-24 14:23 Michael G. Katzmann
  2021-02-24 16:57 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Michael G. Katzmann @ 2021-02-24 14:23 UTC (permalink / raw)
  To: linux-serial

I've noticed that when the serial device is closed, the USB serial device dumps any buffered data. Is this expected behavior?

i.e ls -l >/dev/ttyUSB0 will not print everything (I'm missing some at the end) but

(ls -l; sleep 30) >/de/ttyUSB0 will print everything.

(this is at 110bd so it's probably longer than most people will see to drain the buffer)


Michael


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: closing serial device dumps data in buffer
  2021-02-24 14:23 closing serial device dumps data in buffer Michael G. Katzmann
@ 2021-02-24 16:57 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2021-02-24 16:57 UTC (permalink / raw)
  To: Michael G. Katzmann; +Cc: linux-serial, linux-usb

On Wed, Feb 24, 2021 at 09:23:45AM -0500, Michael G. Katzmann wrote:
> I've noticed that when the serial device is closed, the USB serial
> device dumps any buffered data. Is this expected behavior?
> 
> i.e ls -l >/dev/ttyUSB0 will not print everything (I'm missing some at
> the end) but
> 
> (ls -l; sleep 30) >/de/ttyUSB0 will print everything.
> 
> (this is at 110bd so it's probably longer than most people will see to
> drain the buffer)

Depends on the driver unfortunately. I guess this is with your PL2303
for which we don't know how to determine when the FIFO has emptied.

For speeds >1200 Bd we instead wait for the full 256 bytes to clear, but
we don't add 23 seconds to every close at 110 Bd for example and instead
cap the drain delay at 2 s (see tty_port_drain_delay()).

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-24 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 14:23 closing serial device dumps data in buffer Michael G. Katzmann
2021-02-24 16:57 ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.