handle macos serial port prefix snafu
This commit is contained in:
parent
2eb96f37d2
commit
7371b75f42
|
@ -47,7 +47,24 @@ public final class OpenbltJni {
|
|||
System.loadLibrary("openblt_jni");
|
||||
}
|
||||
|
||||
public static native void flashSerial(String filename, String serialPort, OpenbltCallbacks callbacks);
|
||||
public static native void flashCan(String filename, OpenbltCallbacks callbacks);
|
||||
public static native void stop(OpenbltCallbacks callbacks);
|
||||
public static void flashSerial(String filename, String serialPort, OpenbltCallbacks callbacks) {
|
||||
// On non-Windows, prepend "/dev/" to the serial port name if it's missing
|
||||
if (!OS_NAME.contains("win") && !serialPort.startsWith("/dev/")) {
|
||||
serialPort = "/dev/" + serialPort;
|
||||
}
|
||||
|
||||
flashSerialImpl(filename, serialPort, callbacks);
|
||||
}
|
||||
|
||||
public static void flashCan(String filename, OpenbltCallbacks callbacks) {
|
||||
flashCanNative(filename, callbacks);
|
||||
}
|
||||
|
||||
public static void stop(OpenbltCallbacks callbacks) {
|
||||
stopNative(callbacks);
|
||||
}
|
||||
|
||||
private static native void flashSerialImpl(String filename, String serialPort, OpenbltCallbacks callbacks);
|
||||
private static native void flashCanNative(String filename, OpenbltCallbacks callbacks);
|
||||
private static native void stopNative(OpenbltCallbacks callbacks);
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ static bool program(JNIEnv* env, jobject jCallbacks) {
|
|||
return true;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_flashSerial(JNIEnv* env, jobject, jstring jFirmwareFile, jstring jSerialPort, jobject jCallbacks) {
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_flashSerialNative(JNIEnv* env, jobject, jstring jFirmwareFile, jstring jSerialPort, jobject jCallbacks) {
|
||||
if (!loadFirmware(env, jFirmwareFile, jCallbacks)) {
|
||||
return;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_flashSe
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_flashCan(JNIEnv * env, jobject, jstring jFirmwareFile, jobject jCallbacks) {
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_flashCanNative(JNIEnv * env, jobject, jstring jFirmwareFile, jobject jCallbacks) {
|
||||
if (!loadFirmware(env, jFirmwareFile, jCallbacks)) {
|
||||
return;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_flashCa
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_stop(JNIEnv* env, jobject, jobject jCallbacks) {
|
||||
extern "C" JNIEXPORT void JNICALL Java_com_rusefi_maintenance_OpenbltJni_stopNative(JNIEnv* env, jobject, jobject jCallbacks) {
|
||||
Callbacks cb(env, jCallbacks, "Cleanup", false);
|
||||
|
||||
BltSessionStop();
|
||||
|
|
Loading…
Reference in New Issue