Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added check when setting serial port parameters
This allows to detect for invalid baud rate settings in
particular on Linux where the kernel do not allow non-standard
baud rates on some devices.

See #3389
See #3351
  • Loading branch information
cmaglie committed Jun 25, 2015
commit 3f57ed73898566a059c2130a1ecf9b51a0af5b65
6 changes: 5 additions & 1 deletion arduino-core/src/processing/app/Serial.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ private Serial(String iname, int irate, char iparity, int idatabits, float istop
try {
port = new SerialPort(iname);
port.openPort();
port.setParams(irate, idatabits, stopbits, parity, true, true);
boolean res = port.setParams(irate, idatabits, stopbits, parity, true, true);
if (!res) {
System.err.println(format(_("Error while setting serial port parameters: {0} {1} {2} {3}"),
irate, iparity, idatabits, istopbits));
}
port.addEventListener(this);
} catch (SerialPortException e) {
if (e.getPortName().startsWith("/dev") && SerialPortException.TYPE_PERMISSION_DENIED.equals(e.getExceptionType())) {
Expand Down