linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Michael G. Katzmann" <michaelk@IEEE.org>
Cc: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	linux-usb@vger.kernel.org
Subject: Re: closing serial device dumps data in buffer
Date: Wed, 24 Feb 2021 17:57:46 +0100	[thread overview]
Message-ID: <YDaFiotE0OxCE4JF@hovoldconsulting.com> (raw)
In-Reply-To: <23e9e8aa-1f6f-47d3-6ad4-97057e4975f1@IEEE.org>

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

      reply	other threads:[~2021-02-24 16:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 14:23 closing serial device dumps data in buffer Michael G. Katzmann
2021-02-24 16:57 ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YDaFiotE0OxCE4JF@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michaelk@IEEE.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).