mirror of https://github.com/noisymime/Arduino.git
Merge pull request #2709 from projectgus/master
Fix auto-reset on Leonardo-derived boards from Linux hosts
This commit is contained in:
commit
2222e0f2cd
|
@ -116,7 +116,7 @@ public class SerialUploader extends Uploader {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
System.out.println(
|
System.out.println(
|
||||||
I18n.format(_("Forcing reset using 1200bps open/close on port {0}"), uploadPort));
|
I18n.format(_("Forcing reset using 1200bps open/close on port {0}"), uploadPort));
|
||||||
Serial.touchPort(uploadPort, 1200);
|
Serial.touchForCDCReset(uploadPort);
|
||||||
}
|
}
|
||||||
Thread.sleep(400);
|
Thread.sleep(400);
|
||||||
if (waitForUploadPort) {
|
if (waitForUploadPort) {
|
||||||
|
|
|
@ -80,11 +80,12 @@ public class Serial implements SerialPortEventListener {
|
||||||
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean touchPort(String iname, int irate) throws SerialException {
|
public static boolean touchForCDCReset(String iname) throws SerialException {
|
||||||
SerialPort serialPort = new SerialPort(iname);
|
SerialPort serialPort = new SerialPort(iname);
|
||||||
try {
|
try {
|
||||||
serialPort.openPort();
|
serialPort.openPort();
|
||||||
serialPort.setParams(irate, 8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
|
serialPort.setParams(1200, 8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
|
||||||
|
serialPort.setDTR(false);
|
||||||
serialPort.closePort();
|
serialPort.closePort();
|
||||||
return true;
|
return true;
|
||||||
} catch (SerialPortException e) {
|
} catch (SerialPortException e) {
|
||||||
|
|
Loading…
Reference in New Issue