linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: "Pali Rohár" <pali@kernel.org>
Cc: "Marek Behún" <kabel@kernel.org>,
	libc-alpha@sourceware.org,
	"G. Branden Robinson" <g.branden.robinson@gmail.com>,
	"Michael Kerrisk" <mtk.manpages@gmail.com>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH v3] ioctl_tty.2: Add example how to get or set baudrate on the serial port
Date: Sun, 8 Aug 2021 10:35:24 +0200	[thread overview]
Message-ID: <54c8c04d-4f9b-1ab6-a3a5-c23b2be74a9d@gmail.com> (raw)
In-Reply-To: <20210801135146.14849-1-pali@kernel.org>

Hi Pali,

On 8/1/21 3:51 PM, Pali Rohár wrote:
> Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> ---
> Changes in v3:
> * Check support for custom baudrate only based on BOTHER macro
> * Use TCGETS/TCSETS/termios when TCGETS2/TCSETS2/termios2 is not available
> 
> Changes in v2:
> * Use \e for backslash
> * Use exit(EXIT_*) instead of return num
> * Sort includes
> * Add comment about possible fallback
> ---
> 
> Hello Alejandro!
> 
> I found out that this stuff is more complicated as I originally thought.
> And seems that additional documentation on this topic is needed...
> 
> For setting custom baudrate it is needed to set BOTHER flag in c_cflag
> field and baudrate value itself in c_ospeed and c_ispeed fields.
> 
> So when BOTHER flag is not provided by <asm/termbits.h> then setting custom
> baudrate is not possible, fields c_ospeed and c_ispeed do not exist (and
> only some predefined Bnnn baudrate values are supported). This applies when
> compiling application with older version of header files (prior support for
> custom baudrate was introduced into header files).
> 
> First caveat: BOTHER constant is different for different architectures.
> So it is not possible to provide fallback #ifndef..#define BOTHER.
> 
> And now the biggest issue: Some architectures have these c_ospeed and
> c_ispeed fields in struct termios and some in struct termios2.
> 
> TCGETS/TCSETS ioctls use struct termios and TCGETS/TCSETS2 use
> struct termios2.
> 
> Some architectures (e.g. amd64) provide both struct termios and struct
> termios2, but c_ospeed and c_ispeed are only in struct termios2.
> 
> Some other architectures (e.g. alpha) provide both struct termios and struct
> termios2 and both have c_ospeed and c_ispeed fields.
> 
> And some other architectures (e.g. powerpc) provide only struct termios
> (no struct termios2) and it has c_ospeed and c_ispeed fields.
> 
> So basically to support all architectures it is needed to use
> struct termios2 when TCGETS2/TCSETS2 is supported. Otherwise it is needed
> to use struct termios with TCGETS/TCSETS (case for e.g. powerpc).

When you send v4, please include the above text (or something similar) 
to the commit message.

Thanks,

Alex

> 
> I updated v3 patch to handle this logic.
> ---


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

  parent reply	other threads:[~2021-08-08  8:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30  9:53 [PATCH] ioctl_tty.2: Add example how to get or set baudrate on the serial port Pali Rohár
2021-07-30 11:47 ` Alejandro Colomar (man-pages)
2021-07-30 12:05   ` Pali Rohár
2021-07-30 12:21     ` Alejandro Colomar (man-pages)
2021-07-30 13:02 ` [PATCH v2] " Pali Rohár
2021-08-01 13:51 ` [PATCH v3] " Pali Rohár
2021-08-04 22:08   ` Pali Rohár
2021-08-05  5:52     ` Greg Kroah-Hartman
2021-08-05  8:22       ` Pali Rohár
2021-08-05  8:30         ` Greg Kroah-Hartman
2021-08-05  8:44           ` Pali Rohár
2021-08-05  8:50             ` Greg Kroah-Hartman
2021-08-05  9:51               ` Pali Rohár
2021-08-05 15:28                 ` Alejandro Colomar (man-pages)
2021-08-05 16:14                   ` Greg Kroah-Hartman
2021-08-05 16:45                     ` Licensing example programs in man-pages (was [PATCH v3] ioctl_tty.2: Add example how to get or set baudrate on the serial port) Alejandro Colomar (man-pages)
2021-08-05 17:54                       ` Greg Kroah-Hartman
2021-08-06  7:22                         ` Alejandro Colomar (man-pages)
2021-08-06  8:32                           ` Pali Rohár
2021-08-08  8:35   ` Alejandro Colomar (man-pages) [this message]
2021-08-08 21:05     ` [PATCH v3] ioctl_tty.2: Add example how to get or set baudrate on the serial port Pali Rohár
2021-08-08 21:19       ` Alejandro Colomar (man-pages)
2021-08-10 19:49 ` [PATCH v4] " Pali Rohár
2021-08-10 20:11   ` Pali Rohár
2021-08-31 20:34   ` Pali Rohár
2021-09-10 13:37     ` Alejandro Colomar (man-pages)
2021-09-10 13:39       ` Pali Rohár

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=54c8c04d-4f9b-1ab6-a3a5-c23b2be74a9d@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=g.branden.robinson@gmail.com \
    --cc=kabel@kernel.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=pali@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).