From: "Theodore Ts'o" <tytso@mit.edu>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-serial@vger.kernel.org, linux-api@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: RFC: Serial port DTR/RTS - O_NRESETDEV
Date: Sun, 9 Nov 2025 22:35:56 -0500 [thread overview]
Message-ID: <20251110033556.GC2988753@mit.edu> (raw)
In-Reply-To: <dc42f5d4-a707-4442-bda6-1c1990666f54@zytor.com>
On Sat, Nov 08, 2025 at 06:25:20PM -0800, H. Peter Anvin wrote:
>
> The standard ESP32 configuration for its serial port is that asserting RTS#
> even for a moment will cause a device reset, and asserting DTR# during reset
> forces the device into boot mode. So even if you execute TIOCMSET immediately
> after opening the device, you will have glitched the output, and only the
> capacitance of the output will save you, in the best case.
IMHO, these more esoteric use cases should involve a custom kernel
driver which replaces the generic serial driver. In practice, these
things aren't really a tty, but somethiung else weird, and trying to
do this in userspace seems really awkward.
> setserial (TIOCSSERIAL) and termios (TCSETS*) both require file descriptors,
> so that is not suitable. The 8250 driver, but *not* other serial drivers,
> allows the setserial information to be accessed via sysfs; however, this
> functionality is local to the 8250 driver.
My suggestion of using setserial to turn on some "not really a tty;
but some weird networking / cheap debugging hack" flag should work,
because you would do this at boot up. Note that the 8250
autoconfiguration code (see drivers/tty/serial/8250/8250_port.c) is
going to mess with DTR / RTS. This is why I asserted that trying to
claim that you can preserve "state" across reboots is Just Not
Possible.
If you have some weird setup where DTR or RTS is wierd to the
"detonate the TNT" line, might I suggest that maybe we shouldn't be
using the tty / 8250 serial driver, but it should ***really*** be a
dedicated kernel driver?
- Ted
next prev parent reply other threads:[~2025-11-10 3:36 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 7:53 RFC: Serial port DTR/RTS - O_NRESETDEV H. Peter Anvin
2025-11-07 17:37 ` Theodore Ts'o
2025-11-09 2:25 ` H. Peter Anvin
2025-11-10 3:35 ` Theodore Ts'o [this message]
2025-11-10 5:00 ` H. Peter Anvin
2025-11-10 10:06 ` Maarten Brock
2025-11-10 20:19 ` Theodore Ts'o
2025-11-10 21:05 ` H. Peter Anvin
2025-11-11 3:51 ` Theodore Ts'o
2025-11-11 3:57 ` H. Peter Anvin
2025-11-11 4:38 ` Theodore Ts'o
2025-11-11 10:21 ` Maarten Brock
2025-11-11 21:28 ` H. Peter Anvin
2025-11-12 11:22 ` Greg KH
2025-11-12 16:09 ` H. Peter Anvin
2025-11-12 16:46 ` Greg KH
2025-11-12 19:12 ` H. Peter Anvin
2025-11-12 19:39 ` Greg KH
2025-11-12 19:53 ` H. Peter Anvin
2025-11-12 19:55 ` H. Peter Anvin
2025-11-13 22:24 ` RFC: Serial port DTR/RTS - O_<something> H. Peter Anvin
2025-11-14 10:26 ` Maarten Brock
2025-11-14 18:49 ` Maciej W. Rozycki
2025-11-14 18:53 ` H. Peter Anvin
2025-11-15 21:29 ` Ned Ulbricht
2025-11-15 22:29 ` H. Peter Anvin
2025-11-16 0:47 ` H. Peter Anvin
2025-11-18 16:33 ` Ned Ulbricht
2025-11-18 17:31 ` H. Peter Anvin
2025-11-18 18:05 ` H. Peter Anvin
2025-11-20 13:31 ` Ned Ulbricht
2025-11-10 5:20 ` RFC: Serial port DTR/RTS - O_NRESETDEV H. Peter Anvin
2025-11-09 20:43 ` Maciej W. Rozycki
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=20251110033556.GC2988753@mit.edu \
--to=tytso@mit.edu \
--cc=hpa@zytor.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.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).