progress
This commit is contained in:
parent
b252150298
commit
28ce458e5b
|
@ -258,9 +258,11 @@ public class Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void runHeadless() {
|
private static void runHeadless() {
|
||||||
String autoDetectedPort = getString();
|
String autoDetectedPort = PortDetector.autoDetectSerial();
|
||||||
if (autoDetectedPort == null)
|
if (autoDetectedPort == null) {
|
||||||
|
System.err.println("rusEFI not detected");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
new SerialConnector(autoDetectedPort).connect(new ConnectionStateListener() {
|
new SerialConnector(autoDetectedPort).connect(new ConnectionStateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionEstablished() {
|
public void onConnectionEstablished() {
|
||||||
|
@ -282,7 +284,7 @@ public class Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendCommand(String command) throws IOException {
|
private static void sendCommand(String command) throws IOException {
|
||||||
String autoDetectedPort = getString();
|
String autoDetectedPort = autoDetectPort();
|
||||||
if (autoDetectedPort == null)
|
if (autoDetectedPort == null)
|
||||||
return;
|
return;
|
||||||
PortHolder.EstablishConnection establishConnection = new PortHolder.EstablishConnection(autoDetectedPort).invoke();
|
PortHolder.EstablishConnection establishConnection = new PortHolder.EstablishConnection(autoDetectedPort).invoke();
|
||||||
|
@ -294,7 +296,7 @@ public class Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static String getString() {
|
private static String autoDetectPort() {
|
||||||
String autoDetectedPort = PortDetector.autoDetectPort(null);
|
String autoDetectedPort = PortDetector.autoDetectPort(null);
|
||||||
if (autoDetectedPort == null) {
|
if (autoDetectedPort == null) {
|
||||||
System.err.println("rusEFI not detected");
|
System.err.println("rusEFI not detected");
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class PortDetector {
|
||||||
System.err.println("No serial ports detected");
|
System.err.println("No serial ports detected");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
System.out.printf("Trying " + Arrays.toString(serialPorts));
|
System.out.println("Trying " + Arrays.toString(serialPorts));
|
||||||
List<Thread> serialFinder = new ArrayList<>();
|
List<Thread> serialFinder = new ArrayList<>();
|
||||||
CountDownLatch portFound = new CountDownLatch(1);
|
CountDownLatch portFound = new CountDownLatch(1);
|
||||||
AtomicReference<String> result = new AtomicReference<>();
|
AtomicReference<String> result = new AtomicReference<>();
|
||||||
|
|
Loading…
Reference in New Issue