2424import com .fazecast .jSerialComm .SerialPort ;
2525import com .fazecast .jSerialComm .SerialPortDataListener ;
2626import com .fazecast .jSerialComm .SerialPortEvent ;
27+ import javafx .application .Platform ;
28+ import javafx .scene .control .Alert ;
2729import lombok .extern .slf4j .Slf4j ;
2830import org .dpsoftware .MainSingleton ;
2931import org .dpsoftware .NativeExecutor ;
@@ -58,6 +60,7 @@ public class SerialManager {
5860
5961 ScheduledExecutorService serialAttachScheduler = Executors .newScheduledThreadPool (1 );
6062 private ScheduledFuture <?> scheduledFuture ;
63+ boolean alertSent = false ;
6164
6265 /**
6366 * Initialize Serial communication
@@ -70,9 +73,6 @@ public void initSerial() {
7073 * Initialize Serial communication
7174 */
7275 public void initSerial (String portName , String baudrate ) {
73- if (NativeExecutor .isLinux ()) {
74- NativeExecutor .checkUsbGroup ();
75- }
7676 if (!MainSingleton .getInstance ().config .isWirelessStream () || !portName .isEmpty ()) {
7777 CommonUtility .delayMilliseconds (() -> {
7878 try {
@@ -140,6 +140,11 @@ private void openSerial(String portName, String baudrate, int readTimeout, int w
140140 MainSingleton .getInstance ().output = MainSingleton .getInstance ().serial .getOutputStream ();
141141 listenSerialEvents ();
142142 } else {
143+ if (NativeExecutor .isLinux () && !alertSent ) {
144+ alertSent = true ;
145+ Platform .runLater (() -> MainSingleton .getInstance ().guiManager .showLocalizedAlert (Constants .USB_NOT_AVAILABLE_TITLE , Constants .USB_NOT_AVAILABLE_HEADER ,
146+ Constants .USB_NOT_AVAILABLE_CONTENT , Alert .AlertType .WARNING ));
147+ }
143148 MainSingleton .getInstance ().communicationError = true ;
144149 }
145150 }
0 commit comments