Hope someone can put me out of my misery.
I am writing a program to try and use hwflow (CTS/RTS) on linux
(kernel 2.4.3)
When CTS drops linux still sends data. I am using these port settings,
and opening the port with O_NONBLOCK, when I get a connect message I
turn O_NONBLOCK off. I always select() the port before
sending/receiving data. I have tried using tcdrain(), sending a byte
at a time and using O_SYNC with the open.
I also seem to get the same problem with SCO too.
If I set the port to 115200, rather than 38400 it makes no difference
at all.
Yet if I turn HWflow off at 115200 the serial port gets garbage, so it
seems
to some extent hwflow is working, but not if the modem at the other
end causes the CTS to drop. All cabling is correct and has been
rechecked.
I have 2 USR 3com 56k faxmodem (external) all uarts are ok
modem settings are OK I think and are the same at both ends.
Modem Settings
--------------
AT&FE0V0Q2F1L0M1
AT&A0&B1&C1&D2&H1&I0&K1
AT&M4&N0&P1&R2&S0&U0
ATS0=1S13=1S38=2&W
Port Settings
-------------
#define CFLAGS_SET (CREAD|CS8)
#define CFLAGS_CLEAR (CSTOPB|PARENB|PARODD|CSIZE|HUPCL|CLOCAL|CBAUD)
#define IFLAGS_SET IGNBRK|IGNPAR
#define IFLAGS_CLEAR
(BRKINT|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IUCLC|IXON|IXANY|IXOFF)
#define LFLAGS_SET 0
#define LFLAGS_CLEAR
(ISIG|ICANON|XCASE|ECHO|ECHOE|ECHOK|ECHONL|NOFLSH|TOSTOP|IEXTEN)
#define C_FLAGS_BI_HWFLOW_SET (CRTSCTS) /* For linux */
/*#define C_FLAGS_BI_HWFLOW_SET ( RTSFLOW|CTSFLOW ) *//* For SCO */
#define C_FLAGS_BI_HWFLOW_CLEAR 0
#define O_FLAGS_BI_HWFLOW_SET 0
....
(*port_attributes).c_cflag = 0 ;
(*port_attributes).c_cflag |= CFLAGS_SET ;
(*port_attributes).c_cflag |= C_FLAGS_BI_HWFLOW_SET ;
(*port_attributes).c_iflag = 0 ;
(*port_attributes).c_iflag |= IFLAGS_SET ;
(*port_attributes).c_oflag = 0 ;
(*port_attributes).c_lflag = 0 ;