linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	Maarten Brock <Maarten.Brock@sttls.nl>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: RFC: Serial port DTR/RTS - O_NRESETDEV
Date: Wed, 12 Nov 2025 11:53:08 -0800	[thread overview]
Message-ID: <12e5757c-dc07-40a2-b9c5-57d77dfaffac@zytor.com> (raw)
In-Reply-To: <2025111227-equipment-magnetism-1443@gregkh>

On 2025-11-12 11:39, Greg KH wrote:
> 
>> 3. The only way to determine the type of a tty driver is reading and parsing /proc/tty/drivers; that information is exported neither through ioctl nor sysfs. Exporting *that* through sysfs is probably the easiest of all the improvements.
> 
> The "type" is interesting.  We keep adding new "types" of serial ports
> to the uapi list, and they don't really show up very well to userspace,
> as you say.  Adding this export to sysfs is fine with me, but we should
> make it a string somehow, and not just a random number like the current
> types are listed as, to give people a chance to keep track of this.
> 
> So yes, this too should be done.
> 

Yes, this one is pretty obvious:

>> 4. There isn't a device-independent way to determine if a device is "real" (configured for hardware) or not without opening it and executing one of the termios ioctls like TCGETS (returns -EIO if there isn't anything behind it.) For a UART port it is possible to come up with an educated guess based on the aforementioned sysfs properties (does it have any kind of address associated with it?), but seriously, should stty -a /dev/ttyS0 really glitch RTS# and DTR# even though there is no intent of using the port for communication? 
> 
> Determining "realness" is going to be hard I think (is a usb-serial
> device real or not?  Some are, some are not, but how do we even know?)
> Does a "real" uart mean that the device is real?  How do you define
> that?  What about virtual ones?  Modem chips that do have full line
> discipline support on USB connections?  There's a lot out there to deal
> with here and I think some "fake" ones do pass TCGETS calls just because
> they lie.)
> 

What I mean with "real" is that the device exists at all, unlike e.g.
/dev/ttyS* device nodes which are *only* available for the purpose of binding.

So "bound to a hardware device" is what I mean, not that it is a device with
RS232 drivers on it (which would be impossible to determine, as you very
correctly point out.)

> And addresses are only the "very old" method, many "real" PCI uarts
> don't have them, same for USB ones.
> 
> And changing 'stty -a' is going to be hard, unless you want to use the
> new flag?

That's exactly the idea: use the new open flag.

> But yes, making this more sane is always good, 2 of your things here
> should be pretty simple to knock up if someone wants to.  The others
> might be more difficult just due to backwards compatibility issues.


Indeed. Which is the whole reason for this RFC thread.

	-hpa


  reply	other threads:[~2025-11-12 19:53 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
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 [this message]
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=12e5757c-dc07-40a2-b9c5-57d77dfaffac@zytor.com \
    --to=hpa@zytor.com \
    --cc=Maarten.Brock@sttls.nl \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).