Use the IOSSIOSPEED ioctl to set non-standard port speeds on OS X.
This commit is contained in:
parent
46790676e6
commit
e61a54267f
|
@ -243,7 +243,15 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_configPort(J
|
||||||
|
|
||||||
// Apply changes
|
// Apply changes
|
||||||
ioctl(serialPortFD, TIOCEXCL); // Block other non-root users from using this port
|
ioctl(serialPortFD, TIOCEXCL); // Block other non-root users from using this port
|
||||||
return ((tcsetattr(serialPortFD, TCSANOW, &options) == 0) ? JNI_TRUE : JNI_FALSE);
|
jboolean rc = ((tcsetattr(serialPortFD, TCSANOW, &options) == 0) ? JNI_TRUE : JNI_FALSE);
|
||||||
|
|
||||||
|
if (baudRateCode == 0) {
|
||||||
|
// use IOSSIOSPEED to set non-standard baud rate
|
||||||
|
speed_t speed = (speed_t)baudRate;
|
||||||
|
ioctl(serialPortFD, IOSSIOSPEED, &speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_configTimeouts(JNIEnv *env, jobject obj, jlong serialPortFD)
|
JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_configTimeouts(JNIEnv *env, jobject obj, jlong serialPortFD)
|
||||||
|
|
Loading…
Reference in New Issue