@@ -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;
0 commit comments