@@ -30,7 +30,7 @@ public static class PythonTermios {
3030
3131 #region termios IO Control Codes (TIOC*)
3232
33- public static int TIOCGWINSZ => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 1074295912 : 21523 ;
33+ public static int TIOCGWINSZ => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 0x40087468 : 0x5413 ;
3434
3535
3636 #endregion
@@ -137,10 +137,27 @@ public static class PythonTermios {
137137 public static int TCIOFF => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 3 : 2 ; // transmit STOP character
138138 public static int TCION => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 4 : 3 ; // transmit START character
139139
140- #endregion
141-
142-
143- #region Public API
140+ // baud rates
141+ public static int B0 => 0 ;
142+ public static int B50 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 50 : 1 ;
143+ public static int B75 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 75 : 2 ;
144+ public static int B110 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 110 : 3 ;
145+ public static int B134 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 134 : 4 ;
146+ public static int B150 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 150 : 5 ;
147+ public static int B200 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 200 : 6 ;
148+ public static int B300 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 300 : 7 ;
149+ public static int B600 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 600 : 8 ;
150+ public static int B1200 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 1200 : 9 ;
151+ public static int B1800 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 1800 : 10 ;
152+ public static int B2400 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 2400 : 11 ;
153+ public static int B4800 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 4800 : 12 ;
154+ public static int B9600 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 9600 : 13 ;
155+ public static int B19200 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 19200 : 14 ;
156+ public static int B38400 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 38400 : 15 ;
157+ public static int B57600 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 57600 : 0x1001 ;
158+ public static int B115200 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 115200 : 0x1002 ;
159+ public static int B230400 => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 230400 : 0x1003 ;
160+ // higher baud rates are not defined on macOS
144161
145162 public static object tcgetattr ( CodeContext context , int fd ) {
146163 if ( fd < 0 ) throw PythonOps . ValueError ( "file descriptor cannot be a negative integer ({0})" , fd ) ;
@@ -258,8 +275,8 @@ public static void tcsetattr(CodeContext context, object? file, int when, [NotNo
258275 private static uint _lflag => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ?
259276 ECHOKE | ECHOE | ECHOK | ECHO | ECHOCTL | ISIG | ICANON | IEXTEN | PENDIN
260277 : ECHOKE | ECHOE | ECHOK | ECHO | ECHOCTL | ISIG | ICANON | IEXTEN ;
261- private static int _ispeed => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 38400 : /* B38400 */ 15 ;
262- private static int _ospeed => RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ? 38400 : /* B38400 */ 15 ;
278+ private static int _ispeed => B38400 ;
279+ private static int _ospeed => B38400 ;
263280
264281 private static readonly byte [ ] macos__specialChars = [
265282 ( byte ) 0x04 , // VEOF ^D
0 commit comments