Re: Correction: Serial port arbitration
Re: Correction: Serial port arbitration
- Subject: Re: Correction: Serial port arbitration
- From: Godfrey van der Linden <email@hidden>
- Date: Sat, 9 Apr 2005 22:21:23 -0700
CLOCAL is the key to programming the modem when using the tty.*
serial line.
The idea is that tty.* will block until the carrier detect rises. By
definition you can not have a carrier yet, thus you must tell the
port not to wait for it, that is what CLOCAL does. Assert CLOCAL
before clearing the O_NONBLOCK flag with the fcntl.
Cheers
Godfrey
On 04/09/2005, at 5:35 AM, Gregory Weston wrote:
On Apr 9, 2005, at 4:21 AM, Dan Bernstein wrote:
I had a similar problem with the code. Solved it by turning on the
CLOCAL bit in the termios struct's c_cflag field and turning off
CCTLS_FLOW and CRTS_IFLOW. Here's my setup code:
struct termios options;
if ( tcgetattr( fd, &options )==-1 )
{ /* throw an exception */ }
cfmakeraw(&options);
options.c_cc[VMIN] = 1; // characters
options.c_cc[VTIME] = 10; // tenths of a second
if ( cfsetspeed( &options, B57600 )==-1 ) // Set 57600
baud
{ /* throw an exception */ }
options.c_cflag |= ( CS8 | CLOCAL ); // Use 8 bit words,
ignore status lines
if ( tcsetattr( [modemFileHandle fileDescriptor], TCSANOW,
&options )==-1 )
{ /* throw an exception */ }
That looks like a success in my testbed app. I'll try it in the
real project later. Thanks very much.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden