Skip to content

Commit 0fa6379

Browse files
authored
Merge pull request #2413 from ops/ace6tao2
TTY_IO enhancements from master branch
2 parents 8e0964d + d8debd9 commit 0fa6379

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

ACE/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
USER VISIBLE CHANGES BETWEEN ACE-6.5.22 and ACE-6.5.23
22
======================================================
33

4+
. Backported TTY_IO enhancements from ACE-7.x
5+
46
USER VISIBLE CHANGES BETWEEN ACE-6.5.21 and ACE-6.5.22
57
======================================================
68

ACE/ace/TTY_IO.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ACE_TTY_IO::Serial_Params::Serial_Params (void)
3636
readmincharacters = 0;
3737
readtimeoutmsec = 10000;
3838
paritymode = ACE_TTY_IO_NONE;
39+
inpckenb = true;
3940
ctsenb = false;
4041
rtsenb = 0;
4142
xinenb = false;
@@ -243,14 +244,20 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
243244
devpar.c_cflag |= PARENB;
244245
devpar.c_cflag |= PARODD;
245246
devpar.c_iflag &= ~IGNPAR;
246-
devpar.c_iflag |= INPCK | PARMRK;
247+
if (arg->inpckenb)
248+
devpar.c_iflag |= INPCK | PARMRK;
249+
else
250+
devpar.c_iflag &= ~(INPCK | PARMRK);
247251
}
248252
else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_EVEN) == 0)
249253
{
250254
devpar.c_cflag |= PARENB;
251255
devpar.c_cflag &= ~PARODD;
252256
devpar.c_iflag &= ~IGNPAR;
253-
devpar.c_iflag |= INPCK | PARMRK;
257+
if (arg->inpckenb)
258+
devpar.c_iflag |= INPCK | PARMRK;
259+
else
260+
devpar.c_iflag &= ~(INPCK | PARMRK);
254261
}
255262
else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_NONE) == 0)
256263
{
@@ -301,6 +308,8 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
301308

302309
if (arg->databits < 8)
303310
devpar.c_iflag |= ISTRIP;
311+
else
312+
devpar.c_iflag &= ~ISTRIP;
304313

305314
#if defined (IGNBRK)
306315
// If device is not a modem set to ignore break points
@@ -346,6 +355,21 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const
346355
devpar.c_lflag &= ~ISIG;
347356
#endif /* ISIG */
348357

358+
#if defined (IGNCR)
359+
// Do not discard CR characters
360+
devpar.c_iflag &= ~IGNCR;
361+
#endif /* IGNCR */
362+
363+
#if defined (ICRNL)
364+
// Disable CR to NL conversion
365+
devpar.c_iflag &= ~ICRNL;
366+
#endif /* ICRNL */
367+
368+
#if defined (INLCR)
369+
// Disable NL to CR conversion
370+
devpar.c_iflag &= ~INLCR;
371+
#endif /* INLCR */
372+
349373
#if defined (OPOST)
350374
// Disable post-processing of output data
351375
devpar.c_oflag &= ~OPOST;

ACE/ace/TTY_IO.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class ACE_Export ACE_TTY_IO : public ACE_DEV_IO
6666
"odd" parity. Additionally Win32 supports "mark" and "space"
6767
parity modes. */
6868
const char *paritymode;
69+
/** Enable/disable input parity checking. This option is only applicable
70+
on systems which support the POSIX termios API */
71+
bool inpckenb;
6972
/** Enable & set CTS mode. Note that RTS & CTS are enabled/disabled
7073
together on some systems (RTS/CTS is enabled if either
7174
<code>ctsenb</code> or <code>rtsenb</code> is set). */

0 commit comments

Comments
 (0)