Skip to content

Commit

Permalink
MacOS X does support the tcsetattr serial port support supposed by
Browse files Browse the repository at this point in the history
sqUnixSerial.c.  So instead of using the null support that was in
sqMacSerialPort.c, update the Mac builds to use sqUnixSerial.c, and
rename the mac's file to platforms/Cross/plugins/SerialPlugin/sqNullSerialPort.c

THIS IS UNTESTED!  In  particular the code in sqUnixSerial.c (dubiously IMO)
does not use serialPortBaseName, and instead makes an assumption that
serial ports are as defined by serialPortBaseNameDefault, i.e. are in the range
/dev/tty50 to /dev/tty59.  It would be great if
a) someone tested the code on MacOS X
b) the naming convention were better.
On Mac OS X (see e.g. https://software.intel.com/en-us/setting-up-serial-terminal-on-system-with-mac-os-x),
the serial ports are /dev/tty.NAME., e.g. /dev/cu.Bluetooth-Incoming-Port,
/dev/cu.BoseQuietControl30-SPPD, etc.
  • Loading branch information
eliotmiranda committed Dec 2, 2018
1 parent b09fe2f commit 128b467
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions platforms/iOS/plugins/SerialPlugin/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ifeq ($(VM),Pharo)
EXTRALIBS:=-undefined dynamic_lookup
#EXTRALIBS:=-undefined dynamic_lookup
SRCDIRS:=../../platforms/unix/plugins/SerialPlugin
INCDIRS:=../../platforms/Cross/plugins/SerialPlugin
LIBSRC:=sqMacSerialPort.c
endif
LIBSRC:=SerialPlugin.c sqUnixSerial.c

include ../common/Makefile.plugin
8 changes: 5 additions & 3 deletions platforms/unix/plugins/SerialPlugin/sqUnixSerial.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* sqUnixSerial.c -- Unix serial support
*
* Last edited: 2011-03-14 14:01:56 by piumarta on emilia.ipe.media.kyoto-u.ac.jp
/* sqUnixSerial.c -- Unix (including untested MacOS X) serial support
*/

#include "sq.h"
Expand All @@ -20,7 +18,11 @@

#define PORT_NAME_SIZE 64

#if __APPLE
static const char serialPortBaseName[] = "/dev/cu.";
#else
static const char serialPortBaseName[] = "/dev/tty";
#endif
static const char serialPortBaseNameDefault[] = "/dev/ttyS0";

/* stopBits 0=1.5, 1=1, 2=2 */
Expand Down

0 comments on commit 128b467

Please sign in to comment.