diff options
author | Manuel Reimer <manuel.reimer@gmx.de> | 2018-02-03 17:46:57 +0100 |
---|---|---|
committer | Manuel Reimer <manuel.reimer@gmx.de> | 2018-02-04 01:57:56 +0100 |
commit | 6a814f713485e55e7374e9bd66a29af882c40ce0 (patch) | |
tree | 00d2502bac72c943dc10fff5ddcc0316d3e469bb /glcddrivers/port.c | |
parent | 057856bd2bc642ca855b8be2f7e7a3802a5bd05d (diff) | |
download | graphlcd-base-6a814f713485e55e7374e9bd66a29af882c40ce0.tar.gz graphlcd-base-6a814f713485e55e7374e9bd66a29af882c40ce0.tar.bz2 |
Wait for the first reboot to not get garbled screen output
Diffstat (limited to 'glcddrivers/port.c')
-rw-r--r-- | glcddrivers/port.c | 16 |
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) |