Skip to content

Commit

Permalink
Fixed JSSC upload problem with Arduino Due on MacOSX
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmaglie committed Feb 20, 2014
1 parent a3632d5 commit f91670e
Show file tree
Hide file tree
Showing 3 changed files with 368 additions and 10 deletions.
14 changes: 7 additions & 7 deletions app/src/cc/arduino/packages/discoverers/SerialDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

package cc.arduino.packages.discoverers;

import cc.arduino.packages.BoardPort;
import cc.arduino.packages.Discovery;
import jssc.SerialPortList;
import java.util.ArrayList;
import java.util.List;

import processing.app.Base;
import processing.app.Platform;
import processing.app.Serial;
import processing.app.helpers.PreferencesMap;

import java.util.ArrayList;
import java.util.List;
import cc.arduino.packages.BoardPort;
import cc.arduino.packages.Discovery;

public class SerialDiscovery implements Discovery {

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

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

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

for (String port : ports) {
String boardName = os.resolveDeviceAttachedTo(port, Base.packages, devicesListOutput);
Expand Down
9 changes: 6 additions & 3 deletions app/src/processing/app/Serial.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@

package processing.app;

import jssc.*;
import processing.app.debug.MessageConsumer;
import static processing.app.I18n._;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import static processing.app.I18n._;
import jssc.SerialPort;
import jssc.SerialPortEvent;
import jssc.SerialPortEventListener;
import jssc.SerialPortException;
import processing.app.debug.MessageConsumer;


public class Serial implements SerialPortEventListener {
Expand Down
Loading

0 comments on commit f91670e

Please sign in to comment.