From d8e1cd1e620f733d4b8fa2d598a0f56df5d82fdc Mon Sep 17 00:00:00 2001 From: Geoffrey Hunter Date: Sun, 4 Apr 2021 20:01:02 -0700 Subject: [PATCH] Fixed bug with setting the echo. --- CHANGELOG.md | 4 ++++ src/SerialPort.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8902279..8cad484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [v2.1.1] - 2021-04-05 + +- Fixed bug where `echo` was not being set correctly. + ## [v2.1.0] - 2020-11-08 ### Added diff --git a/src/SerialPort.cpp b/src/SerialPort.cpp index d3f09fa..627e3d8 100644 --- a/src/SerialPort.cpp +++ b/src/SerialPort.cpp @@ -347,7 +347,12 @@ namespace CppLinuxSerial { // Canonical input is when read waits for EOL or EOF characters before returning. In non-canonical mode, the rate at which // read() returns is instead controlled by c_cc[VMIN] and c_cc[VTIME] tty.c_lflag &= ~ICANON; // Turn off canonical input, which is suitable for pass-through - echo_ ? (tty.c_lflag | ECHO ) : (tty.c_lflag & ~(ECHO)); // Configure echo depending on echo_ boolean + // Configure echo depending on echo_ boolean + if(echo_) { + tty.c_lflag |= ECHO; + } else { + tty.c_lflag &= ~(ECHO); + } tty.c_lflag &= ~ECHOE; // Turn off echo erase (echo erase only relevant if canonical input is active) tty.c_lflag &= ~ECHONL; // tty.c_lflag &= ~ISIG; // Disables recognition of INTR (interrupt), QUIT and SUSP (suspend) characters -- libgit2 0.21.4