summaryrefslogtreecommitdiff
path: root/glcddrivers/port.c
diff options
context:
space:
mode:
Diffstat (limited to 'glcddrivers/port.c')
-rw-r--r--glcddrivers/port.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/glcddrivers/port.c b/glcddrivers/port.c
index 2c123e1..bf5df86 100644
--- a/glcddrivers/port.c
+++ b/glcddrivers/port.c
@@ -340,9 +340,6 @@ int cSerialPort::Open(const char * device)
options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8;
- // No "hangup" (prevents Arduino firmware reboots)
- options.c_cflag &= ~HUPCL;
-
// No hardware flow control
options.c_cflag &= ~CRTSCTS;
@@ -392,6 +389,19 @@ void cSerialPort::SetBaudRate(int speed)
}
}
+// Configures the serial port to not send a "hangup" signal.
+// Returns true if the flag was set and had to be removed and false otherwise.
+bool cSerialPort::DisableHangup()
+{
+ struct termios options;
+ tcgetattr(fd, &options);
+ if (!(options.c_cflag & HUPCL))
+ return false;
+ options.c_cflag &= ~HUPCL;
+ tcsetattr(fd, TCSANOW, &options);
+ return true;
+}
+
int cSerialPort::ReadData(unsigned char * data)
{
if (fd == -1)