how do I clear +lkhflow

Hi,

I am trying to disable hardware flow control
on a serial line with this:

if(tcgetattr(fd, &termios_p) == -1)
return -1;

termios_p.c_cflag &= ~(IHFLOW | OHFLOW);
termios_p.c_lflag |= IEXTEN;

if(tcsetattr(fd, TCSANOW, &termios_p) == -1)
return -1;

But it has no effect if +lkhflow option has been
previously set with stty utility.
How do I clear +lkhflow from within a C program?
Is the stty source available somewhere?

thanks

Previously, DMitri wrote in qdn.public.qnx4:

Hi,

I am trying to disable hardware flow control
on a serial line with this:

if(tcgetattr(fd, &termios_p) == -1)
return -1;

termios_p.c_cflag &= ~(IHFLOW | OHFLOW);
termios_p.c_lflag |= IEXTEN;

if(tcsetattr(fd, TCSANOW, &termios_p) == -1)
return -1;

But it has no effect if +lkhflow option has been
previously set with stty utility.
How do I clear +lkhflow from within a C program?
Is the stty source available somewhere?

thanks

Try something like this (off the top of my head):

unsigned short qflag ;
int fd ;
struct termios tp ;

fd = open( “/dev/ser1”, O_RDWR ) ;
tcgetattr( fd, &tp ) ;

qflag = tp.c_qflag ;

qflag &= ~TC_PROTECT_HFLOW ; // Turn off lkhflow

tp.c_qflag = qflag ;

tcsetattr( fd, TCSANOW, &tp ) ;

“DMitri” <ivdal@yahoo.com> wrote in message news:a33792$pa5$1@inn.qnx.com

Hi,

I am trying to disable hardware flow control
on a serial line with this:

if(tcgetattr(fd, &termios_p) == -1)
return -1;

termios_p.c_cflag &= ~(IHFLOW | OHFLOW);
termios_p.c_lflag |= IEXTEN;

if(tcsetattr(fd, TCSANOW, &termios_p) == -1)
return -1;

But it has no effect if +lkhflow option has been
previously set with stty utility.
How do I clear +lkhflow from within a C program?
Is the stty source available somewhere?

thanks

You need to unlock first - i.e. throw this into the mix below.
termios.c_qflag &= ~TC_PROTECT_HFLOW;

You may want to re-lock afterwards - use a separate tcsetattr() call.
If you ask why the the lock is used - I don’t remember the details.
Someone else ???

Richard

david v wrote:

“DMitri” <> ivdal@yahoo.com> > wrote in message news:a33792$pa5$> 1@inn.qnx.com> …

Hi,

I am trying to disable hardware flow control
on a serial line with this:

if(tcgetattr(fd, &termios_p) == -1)
return -1;

termios_p.c_cflag &= ~(IHFLOW | OHFLOW);
termios_p.c_lflag |= IEXTEN;

if(tcsetattr(fd, TCSANOW, &termios_p) == -1)
return -1;

But it has no effect if +lkhflow option has been
previously set with stty utility.
How do I clear +lkhflow from within a C program?
Is the stty source available somewhere?

thanks

\