mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-01 03:47:23 +03:00
Added serial.port.file preference for linux
This commit is contained in:
@ -951,6 +951,10 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
if (selection != null) selection.setState(true);
|
if (selection != null) selection.setState(true);
|
||||||
//System.out.println(item.getLabel());
|
//System.out.println(item.getLabel());
|
||||||
Preferences.set("serial.port", name);
|
Preferences.set("serial.port", name);
|
||||||
|
if (name.startsWith("/dev/"))
|
||||||
|
Preferences.set("serial.port.file", name.substring(5));
|
||||||
|
else
|
||||||
|
Preferences.set("serial.port.file", name);
|
||||||
serialMonitor.closeSerialPort();
|
serialMonitor.closeSerialPort();
|
||||||
serialMonitor.setVisible(false);
|
serialMonitor.setVisible(false);
|
||||||
serialMonitor = new SerialMonitor(Preferences.get("serial.port"));
|
serialMonitor = new SerialMonitor(Preferences.get("serial.port"));
|
||||||
|
@ -1,104 +0,0 @@
|
|||||||
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
|
||||||
|
|
||||||
/*
|
|
||||||
AvrdudeUploader - uploader implementation using avrdude
|
|
||||||
Part of the Arduino project - http://www.arduino.cc/
|
|
||||||
|
|
||||||
Copyright (c) 2011 Cristian Maglie
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
package processing.app.debug;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import processing.app.Base;
|
|
||||||
import processing.app.Preferences;
|
|
||||||
import processing.app.SerialException;
|
|
||||||
|
|
||||||
public class BossaCUploader extends Uploader {
|
|
||||||
|
|
||||||
public boolean uploadUsingPreferences(String buildPath, String className,
|
|
||||||
boolean usingProgrammer)
|
|
||||||
throws RunnerException, SerialException {
|
|
||||||
List<String> commandDownloader = new ArrayList<String>();
|
|
||||||
String port = Preferences.get("serial.port");
|
|
||||||
if (port.startsWith("/dev/"))
|
|
||||||
port = port.substring(5);
|
|
||||||
commandDownloader.add("--port=" + port);
|
|
||||||
commandDownloader.add("-e");
|
|
||||||
commandDownloader.add("-w");
|
|
||||||
commandDownloader.add("-v");
|
|
||||||
commandDownloader.add("-b");
|
|
||||||
commandDownloader.add(buildPath + File.separator + className + ".bin");
|
|
||||||
|
|
||||||
return bossac(commandDownloader);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean burnBootloader() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean bossac(Collection params) throws RunnerException {
|
|
||||||
List commandDownloader = new ArrayList();
|
|
||||||
commandDownloader.add("bossac");
|
|
||||||
|
|
||||||
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
|
||||||
commandDownloader.add("-i");
|
|
||||||
commandDownloader.add("-d");
|
|
||||||
}
|
|
||||||
commandDownloader.addAll(params);
|
|
||||||
|
|
||||||
return executeUploadCommand(commandDownloader);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean executeUploadCommand(List<String> cmdParams)
|
|
||||||
throws RunnerException {
|
|
||||||
|
|
||||||
try {
|
|
||||||
String avrBasePath = Base.getHardwarePath() + "/tools/";
|
|
||||||
|
|
||||||
String[] cmdArray = cmdParams.toArray(new String[0]);
|
|
||||||
cmdArray[0] = avrBasePath + cmdArray[0];
|
|
||||||
|
|
||||||
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
|
||||||
for (String cmd : cmdArray)
|
|
||||||
System.out.print(cmd + " ");
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
Process bossac = Runtime.getRuntime().exec(cmdArray);
|
|
||||||
new MessageSiphon(bossac.getInputStream(), this);
|
|
||||||
new MessageSiphon(bossac.getErrorStream(), this);
|
|
||||||
|
|
||||||
// wait for the process to finish. if interrupted
|
|
||||||
// before waitFor returns, continue waiting
|
|
||||||
int result = bossac.waitFor();
|
|
||||||
if (result != 0)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Reference in New Issue
Block a user