From 28ce458e5b28abdb5aea39d0b0b51292b57f7a68 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 15 May 2020 01:17:41 -0400 Subject: [PATCH] progress --- java_console/ui/src/com/rusefi/Launcher.java | 10 ++++++---- .../ui/src/com/rusefi/autodetect/PortDetector.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index e29bbface4..d1e0203f43 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -258,9 +258,11 @@ public class Launcher { } private static void runHeadless() { - String autoDetectedPort = getString(); - if (autoDetectedPort == null) + String autoDetectedPort = PortDetector.autoDetectSerial(); + if (autoDetectedPort == null) { + System.err.println("rusEFI not detected"); return; + } new SerialConnector(autoDetectedPort).connect(new ConnectionStateListener() { @Override public void onConnectionEstablished() { @@ -282,7 +284,7 @@ public class Launcher { } private static void sendCommand(String command) throws IOException { - String autoDetectedPort = getString(); + String autoDetectedPort = autoDetectPort(); if (autoDetectedPort == null) return; PortHolder.EstablishConnection establishConnection = new PortHolder.EstablishConnection(autoDetectedPort).invoke(); @@ -294,7 +296,7 @@ public class Launcher { } @Nullable - private static String getString() { + private static String autoDetectPort() { String autoDetectedPort = PortDetector.autoDetectPort(null); if (autoDetectedPort == null) { System.err.println("rusEFI not detected"); diff --git a/java_console/ui/src/com/rusefi/autodetect/PortDetector.java b/java_console/ui/src/com/rusefi/autodetect/PortDetector.java index ca44850140..f890b64948 100644 --- a/java_console/ui/src/com/rusefi/autodetect/PortDetector.java +++ b/java_console/ui/src/com/rusefi/autodetect/PortDetector.java @@ -24,7 +24,7 @@ public class PortDetector { System.err.println("No serial ports detected"); return null; } - System.out.printf("Trying " + Arrays.toString(serialPorts)); + System.out.println("Trying " + Arrays.toString(serialPorts)); List serialFinder = new ArrayList<>(); CountDownLatch portFound = new CountDownLatch(1); AtomicReference result = new AtomicReference<>();