Skip to content

Commit f91670e

Browse files
committed
Fixed JSSC upload problem with Arduino Due on MacOSX
JSSC, on unix based systems like linux and MacOSX, when listing serial ports tries to open each port to ensure its existence. While this check works well for linux ports /dev/ttyS0..31, it leads to unexpected behaviuors on MacOSX in particular with USB-CDC virtual serial ports. This patch disable the check and keep it enabled only for linux ttySxx ports. This adds also tty.* and cu.* to the list of available serial ports on MacOSX.
1 parent a3632d5 commit f91670e

File tree

3 files changed

+368
-10
lines changed

3 files changed

+368
-10
lines changed

Diff for: app/src/cc/arduino/packages/discoverers/SerialDiscovery.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929

3030
package cc.arduino.packages.discoverers;
3131

32-
import cc.arduino.packages.BoardPort;
33-
import cc.arduino.packages.Discovery;
34-
import jssc.SerialPortList;
32+
import java.util.ArrayList;
33+
import java.util.List;
34+
3535
import processing.app.Base;
3636
import processing.app.Platform;
37+
import processing.app.Serial;
3738
import processing.app.helpers.PreferencesMap;
38-
39-
import java.util.ArrayList;
40-
import java.util.List;
39+
import cc.arduino.packages.BoardPort;
40+
import cc.arduino.packages.Discovery;
4141

4242
public class SerialDiscovery implements Discovery {
4343

@@ -48,7 +48,7 @@ public List<BoardPort> discovery() {
4848

4949
List<BoardPort> res = new ArrayList<BoardPort>();
5050

51-
String[] ports = SerialPortList.getPortNames();
51+
List<String> ports = Serial.list();
5252

5353
for (String port : ports) {
5454
String boardName = os.resolveDeviceAttachedTo(port, Base.packages, devicesListOutput);

Diff for: app/src/processing/app/Serial.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@
2424

2525
package processing.app;
2626

27-
import jssc.*;
28-
import processing.app.debug.MessageConsumer;
27+
import static processing.app.I18n._;
2928

3029
import java.io.IOException;
3130
import java.util.Arrays;
3231
import java.util.List;
3332

34-
import static processing.app.I18n._;
33+
import jssc.SerialPort;
34+
import jssc.SerialPortEvent;
35+
import jssc.SerialPortEventListener;
36+
import jssc.SerialPortException;
37+
import processing.app.debug.MessageConsumer;
3538

3639

3740
public class Serial implements SerialPortEventListener {

0 commit comments

Comments
 (0)