public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* winsup/cygwin/sys/termios.h bit rates extension
@ 2023-01-30  5:57 Brian Inglis
  2023-01-31  9:23 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Inglis @ 2023-01-30  5:57 UTC (permalink / raw)
  To: Cygwin Patches

FreeBSD, NetBSD, and Linux all bumped their serial bit rates to support 
500k(+500k)4000k, extending the rates to 3500k and 4000k, dropping 128k and 
256k, renumbering the extended baud rate indices under Linux, effectively 
changing the ABI for any previously compiled serial application.

See:
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/include/sys/termios.h;hb=HEAD#l189

Patch would be like:
diff a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
--- a/winsup/cygwin/include/sys/termios.h
+++ b/winsup/cygwin/include/sys/termios.h
@@ -190,19 +190,19
  #define CBAUDEX  0x0100f
  #define B57600	  0x01001
  #define B115200  0x01002
-#define B128000  0x01003
-#define B230400  0x01004
+#define B230400  0x01003
-#define B256000  0x01005
-#define B460800  0x01006
+#define B460800  0x01004
-#define B500000  0x01007
+#define B500000  0x01005
-#define B576000  0x01008
+#define B576000  0x01006
-#define B921600  0x01009
+#define B921600  0x01007
-#define B1000000 0x0100a
+#define B1000000 0x01008
-#define B1152000 0x0100b
+#define B1152000 0x01009
-#define B1500000 0x0100c
+#define B1500000 0x0100a
-#define B2000000 0x0100d
+#define B2000000 0x0100b
-#define B2500000 0x0100e
+#define B2500000 0x0100c
-#define B3000000 0x0100f
+#define B3000000 0x0100d
+#define B3500000 0x0100e
+#define B4000000 0x0100f

  #define CRTSXOFF 0x04000
  #define CRTSCTS  0x08000

Is this acceptable, not really any issue for Cygwin, or an issue, and some 
compatibility code would be required to do an internal upgrade, and return an 
error for unsupported speeds, or should we add another bit to extend 
CBAUD/CBAUDEX to 0x0101f, and use higher indices 0x01010/0x01011?

-- 
Take care. Thanks, Brian Inglis			Calgary, Alberta, Canada

La perfection est atteinte			Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter	not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer	but when there is no more to cut
			-- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: winsup/cygwin/sys/termios.h bit rates extension
  2023-01-30  5:57 winsup/cygwin/sys/termios.h bit rates extension Brian Inglis
@ 2023-01-31  9:23 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2023-01-31  9:23 UTC (permalink / raw)
  To: cygwin-patches

On Jan 29 22:57, Brian Inglis wrote:
> FreeBSD, NetBSD, and Linux all bumped their serial bit rates to support
> 500k(+500k)4000k, extending the rates to 3500k and 4000k, dropping 128k and
> 256k, renumbering the extended baud rate indices under Linux, effectively
> changing the ABI for any previously compiled serial application.
> 
> See:
> https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/include/sys/termios.h;hb=HEAD#l189
> 
> Patch would be like:
> diff a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
> --- a/winsup/cygwin/include/sys/termios.h
> +++ b/winsup/cygwin/include/sys/termios.h
> @@ -190,19 +190,19
>  #define CBAUDEX  0x0100f
>  #define B57600	  0x01001
>  #define B115200  0x01002
> -#define B128000  0x01003
> -#define B230400  0x01004
> +#define B230400  0x01003
> -#define B256000  0x01005
> -#define B460800  0x01006
> +#define B460800  0x01004
> -#define B500000  0x01007
> +#define B500000  0x01005
> -#define B576000  0x01008
> +#define B576000  0x01006
> -#define B921600  0x01009
> +#define B921600  0x01007
> -#define B1000000 0x0100a
> +#define B1000000 0x01008
> -#define B1152000 0x0100b
> +#define B1152000 0x01009
> -#define B1500000 0x0100c
> +#define B1500000 0x0100a
> -#define B2000000 0x0100d
> +#define B2000000 0x0100b
> -#define B2500000 0x0100e
> +#define B2500000 0x0100c
> -#define B3000000 0x0100f
> +#define B3000000 0x0100d
> +#define B3500000 0x0100e
> +#define B4000000 0x0100f
> 
>  #define CRTSXOFF 0x04000
>  #define CRTSCTS  0x08000
> 
> Is this acceptable, not really any issue for Cygwin, or an issue, and some
> compatibility code would be required to do an internal upgrade, and return
> an error for unsupported speeds, or should we add another bit to extend
> CBAUD/CBAUDEX to 0x0101f, and use higher indices 0x01010/0x01011?

We'd need a compat layer, depending on the version of Cygwin
the executable has been created under (see include/sys/cygwin.h).

Just extending CBAUD/CBAUDEX. isn't an option because all bits
in cflags are taken, afaics.

However, afaics our CBAUDEX is defined incorrectly.  The BSDs define it
as LINUX_CBAUDEX, because it's apparently not a BSD idea.  And per
Linux, it should only contain the mask bit which defines extended
speeds, so

  #define CBAUD    0x0100f
  #define CBAUDEX  0x01000

would be the right (i. e., Linux-compatible).


Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-31  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30  5:57 winsup/cygwin/sys/termios.h bit rates extension Brian Inglis
2023-01-31  9:23 ` Corinna Vinschen

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).