Re: Correction: Serial port arbitration
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=qZK+jTiTAPtgextvbu65RqkBQIsPf4bHhEV/fglH1AqK/2D/MPSf0lumq9iKE+SFAjgt9Yb8CLsHqtraHT7reWvCdlllwdjmyh2nJ615rcJqUd406eTzuvB1/bKd95Xyh4PZ5nS9wHMmYDUonz4HY4CGBkNeL8ToZk2S8GGlYy0= 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 */ } On Apr 8, 2005 10:24 PM, Gregory Weston <gweston@mac.com> wrote:
On Apr 8, 2005, at 2:42 PM, Godfrey van der Linden wrote:
Have you ever succeeded in talking to your serial device? Before going into arbitration just try to setup a simple program that sends an AT<CR> to the device and make sure you are getting an OK? If you aren't then you have other issues. BTW did you use O_NONBLOCK as one of the open flags or are you using the /dev/cu.??? device?
I've been working with the code as presented mostly, which has been do the open() non-blocking but then clearing that flag.
The summary of my experiments is that if I open the cu.* device I can write all I like and get responses/echos but never get a RING. If I open the tty.* device, I can get a RING but if I make any attempt to write to the file it blocks.
If I leave it in non-blocking mode, the write() to tty.* gives back EAGAIN.
Godfrey
On Apr 7, , at 18:21, Gregory Weston wrote:
Godfrey van der Linden wrote:
// At this point you have the port exclusively and non-preemtibly // so now is a good time to program up the modem or do any other // equipment initialisation you desire.
Not to be terribly dense, but how? If I try to send an initialization string via write() I block forever.
Adding O_RDWR to the open() flags had no impact.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/dan.bernstein%40gmail.com
This email sent to dan.bernstein@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Dan Bernstein