From 8bff7aa9e4f3b3e080a108e4510781cb7ea738bb Mon Sep 17 00:00:00 2001 From: podhrmic Date: Wed, 10 Aug 2016 14:12:52 -0700 Subject: [PATCH] Fix for undefined baudrates at Mac OS (see #1840) --- sw/lib/ocaml/cserial.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sw/lib/ocaml/cserial.c b/sw/lib/ocaml/cserial.c index 5905077e8a..e782cde56d 100644 --- a/sw/lib/ocaml/cserial.c +++ b/sw/lib/ocaml/cserial.c @@ -35,6 +35,29 @@ #include #include +/* MacOS doesn't support higher baudrates (>230400B) */ +#ifdef __APPLE__ +static int baudrates[] = { + B0, + B50, + B75, + B110, + B134, + B150, + B200, + B300, + B600, + B1200, + B1800, + B2400, + B4800, + B9600, + B19200, + B38400, + B57600, + B115200, + B230400 }; +#else /* regular Linux with higher baudrates */ static int baudrates[] = { B0, B50, @@ -58,6 +81,8 @@ static int baudrates[] = { B921600, B1500000, B3000000 }; +#endif /* ifdef __APPLE__ */ + /****************************************************************************/