Add support to use Linux Openport 2.0 library if available.

This commit is contained in:
Dale Schultz 2015-03-11 22:38:18 -04:00
parent 84f6e0f230
commit cf02bd3e3d
1 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
* Copyright (C) 2006-2015 RomRaider.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@ import static com.romraider.util.Platform.isPlatform;
import static com.romraider.util.proxy.Proxifier.proxy;
import static org.apache.log4j.Logger.getLogger;
import java.io.File;
import java.util.Set;
import org.apache.log4j.Logger;
@ -60,8 +61,21 @@ public final class ConnectionManagerFactory {
try {
if (!isPlatform(WINDOWS))
throw new RuntimeException("J2534 is not support on this platform");
if (!isPlatform(WINDOWS)) {
final String op2Lib = "/usr/local/lib/j2534.so";
final File libFile = new File(op2Lib);
if (libFile.exists()) {
return J2534TransportFactory.getManager(
settings.getTransportProtocol().toUpperCase(),
connectionProperties,
op2Lib);
}
else {
throw new RuntimeException(
"Linux Openport 2.0 library not found in: " +
op2Lib);
}
}
Set<J2534Library> libraries =
J2534DllLocator.listLibraries(
settings.getTransportProtocol().toUpperCase());