From a613f6f64080feb9fcb9e0a35c2c4d5c7c5831f1 Mon Sep 17 00:00:00 2001
From: TimEverett <tim.everett3@gmail.com>
Date: Tue, 13 Nov 2018 12:42:20 -0700
Subject: [PATCH] Baudrate fix for MacOS baudrates

---
 src/stream.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/stream.c b/src/stream.c
index 389a00c..be01516 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -345,9 +345,17 @@ static serial_t *openserial(const char *path, int mode, char *msg)
     COMMTIMEOUTS co={MAXDWORD,0,0,0,0}; /* non-block-read */
     char dcb[64]="";
 #else
+
+#ifdef __APPLE__
+    /* MacOS doesn't support higher baudrates (>230400B) */
+    const speed_t bs[]={
+        B300,B600,B1200,B2400,B4800,B9600,B19200,B38400,B57600,B115200,B230400
+    };
+#else /* regular Linux with higher baudrates */
     const speed_t bs[]={
         B300,B600,B1200,B2400,B4800,B9600,B19200,B38400,B57600,B115200,B230400,B460800
     };
+#endif /* ifdef __APPLE__ */
     struct termios ios={0};
     int rw=0;
 #endif
-- 
GitLab