public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: fhandler_serial.cc: MARK and SPACE parity for serial port
Date: Thu, 28 Jan 2021 11:08:02 +0100	[thread overview]
Message-ID: <20210128100802.GW4393@calimero.vinschen.de> (raw)
In-Reply-To: <CAGEXLhUUtV-kKxO-jQo4427R=N=Uo1aT_LrHGpc1r55umbb92w@mail.gmail.com>

Hi Marek,

thanks for the patch.  This is a patch adding functionality so it's not
trivial.  Would you mind to express your willingness to put this patch
as well as further patches under 2-clause BSD license per the
"Before you get started" section of https://cygwin.com/contrib.html?

A few minor problems with this patch.

First of all, your MUA apparently broke the inline patch.  There are
line breaks in the patch, unexpected by git am, and the spacing in the
termios.h hunk is all wrong, see below.

If you can't change that in your MUA, please attach your patches as
plain text attachements, that usually helps.

On Jan 27 21:30, Marek Smetana via Cygwin-patches wrote:
> Hi,
> 
> This patch add MARK and SPACE parity support to serial port
> 
> ---
>  winsup/cygwin/fhandler_serial.cc    | 9 ++++++++-
>  winsup/cygwin/include/sys/termios.h | 1 +
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/fhandler_serial.cc
> b/winsup/cygwin/fhandler_serial.cc

Wrong line break

> index fd5b45899..23d69eca5 100644
> --- a/winsup/cygwin/fhandler_serial.cc
> +++ b/winsup/cygwin/fhandler_serial.cc
> @@ -727,7 +727,10 @@ fhandler_serial::tcsetattr (int action, const struct
> termios *t)

Wrong line break

>    /* -------------- Set parity ------------------ */
> 
>    if (t->c_cflag & PARENB)
> -    state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;
> +    if(t->c_cflag & CMSPAR)
> +      state.Parity = (t->c_cflag & PARODD) ? MARKPARITY : SPACEPARITY;
> +    else
> +      state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;

Please put the nested if/else into curly braces so the potential
for later changes breaking the if/else chain is reduced.

>    else
>      state.Parity = NOPARITY;
> 
> @@ -1068,6 +1071,10 @@ fhandler_serial::tcgetattr (struct termios *t)
>      t->c_cflag |= (PARENB | PARODD);
>    if (state.Parity == EVENPARITY)
>      t->c_cflag |= PARENB;
> +  if (state.Parity == MARKPARITY)
> +    t->c_cflag |= (PARENB | PARODD | CMSPAR);
> +  if (state.Parity == SPACEPARITY)
> +    t->c_cflag |= (PARENB | CMSPAR);
> 
>    /* -------------- Parity errors ------------------ */
> 
> diff --git a/winsup/cygwin/include/sys/termios.h
> b/winsup/cygwin/include/sys/termios.h

Wrong line break

> index 17e8d83a3..933851c21 100644
> --- a/winsup/cygwin/include/sys/termios.h
> +++ b/winsup/cygwin/include/sys/termios.h
> @@ -185,6 +185,7 @@ POSIX commands */
>  #define PARODD 0x00200
>  #define HUPCL 0x00400
>  #define CLOCAL 0x00800
> +#define CMSPAR  0x40000000 /* Mark or space (stick) parity.  */

Spacing here is completely off, probably due to your MUA.  Please note
that every definition is followed by a TAB and a SPACE for historical
reasons.  Ideally you do the same for the new CMSPAR definition.

> 
>  /* Extended baud rates above 37K. */
>  #define CBAUDEX 0x0100f
> 
> ---

Other than these minor formatting issues, your patch looks good,
so I'm looking forward to the fixed version.


Thanks,
Corinna

  reply	other threads:[~2021-01-28 10:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 20:30 Marek Smetana
2021-01-28 10:08 ` Corinna Vinschen [this message]
2021-01-28 10:14   ` Corinna Vinschen
2021-01-28 17:17     ` Brian Inglis
2021-01-28 18:45       ` Brian Inglis
2021-01-29 22:06     ` Marek Smetana
2021-02-01  9:40       ` Corinna Vinschen
2021-02-01 21:26         ` Marek Smetana
2021-02-02  5:28           ` Brian Inglis
2021-02-02  9:44           ` Corinna Vinschen

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=20210128100802.GW4393@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).