Merge pull request #64 from swilson/master

Fix for issue #61
This commit is contained in:
Will Hedgecock 2018-01-03 10:50:36 -06:00 committed by GitHub
commit 03c2f40ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -243,7 +243,15 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_configPort(J
// Apply changes
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)