Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/cpp/_nix_based/jssc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#endif
#ifdef __APPLE__
#include <serial/ioss.h>//Needed for IOSSIOSPEED in Mac OS X (Non standard baudrate)
#else
#include <poll.h> // poll.h is not defined on older Mac OS systems
#endif

#include <jni.h>
Expand Down Expand Up @@ -722,6 +724,10 @@ JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_waitEvents

jclass intClass = env->FindClass("[I");
jobjectArray returnArray = env->NewObjectArray(sizeof(events)/sizeof(jint), intClass, NULL);
#ifdef POLLIN
struct pollfd waitingSet = { static_cast<int>(portHandle), POLLIN, 0 };
poll(&waitingSet, 1, 1000);
#endif

/*Input buffer*/
jint bytesCountIn = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/jssc/SerialPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public class SerialPort {
private static final int PARAMS_FLAG_PARMRK = 2;
//<- since 2.6.0

private static final boolean isMac = SerialNativeInterface.getOsType() == SerialNativeInterface.OS_MAC_OS_X;

public SerialPort(String portName) {
this.portName = portName;
serialInterface = new SerialNativeInterface();
Expand Down Expand Up @@ -1301,6 +1303,8 @@ public void run() {
}
}
}
if (!isMac) continue;

//Need to sleep some time
try {
Thread.sleep(0, 100);
Expand Down