From cf02bd3e3d6e444993a188ff3242da047f8b8311 Mon Sep 17 00:00:00 2001 From: Dale Schultz Date: Wed, 11 Mar 2015 22:38:18 -0400 Subject: [PATCH] Add support to use Linux Openport 2.0 library if available. --- .../connection/ConnectionManagerFactory.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java b/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java index ed7a1940..49e095fb 100644 --- a/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java +++ b/src/main/java/com/romraider/io/connection/ConnectionManagerFactory.java @@ -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 libraries = J2534DllLocator.listLibraries( settings.getTransportProtocol().toUpperCase());