*BSD News Article 19032


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!aardvark.ucs.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!ogicse!uwm.edu!vixen.cso.uiuc.edu!sdd.hp.com!
 col.hp.com!csn!hellgate.utah.edu!fcom.cc.utah.edu!cs.weber.edu!terry
Newsgroups: comp.os.386bsd.misc
Subject: Re: Using the sio ports with a Modem
Message-ID: <1993Jul30.000604.28487@fcom.cc.utah.edu>
From: terry@cs.weber.edu (A Wizard of Earth C)
Date: 30 Jul 93 00:06:04 GMT
Sender: news@fcom.cc.utah.edu
References: <1872@dcsc.dla.mil>
Organization: Weber State University, Ogden, UT
Article-I.D.: fcom.1993Jul30.000604.28487
Lines: 71

In article <1872@dcsc.dla.mil> cp01395@dcsc.dla.mil (Duane L. Rezac) writes:
>
>I now have patchkit 0.2.4 installed, and I am trying to get the sio
>ports to work with a modem.  I have been working with this for a
>while, and am finally asking the net for help.

[ ... ]
>comcontrol seems to work, and if I echo something to the device, I 
>see the rd and sd lights flash, but I am unable to control the modem 
>(i.e atz ats0=1 have no effect).

You aren't going to get result codes or command echo (ie: modem input to
the computer) unless DCD is asserted or unless you modify the driver to
act correctly with the partial open hack... ie:

	int	fdp;
	int	fd;
	char	*port = "/dev/my_serial_port_name_this_week";

	/* open, ignoring carrier*/
	fdp = open( port, O_RDWR | O_NDELAY);

	/*
	 * open again, respecting carrier (carrier is ignored because of tty
	 * flags from last open)
	 */
	fd = open( port, O_RDWR);

	close( fdp);

(Alarm calls and error checking omitted).  This code is what should live
in cu, uucp, tip, slattach, and freinds of the family.

>I have set up the tty00 with stty to 2400 baud, -clocal, and all
>other settings are at the default.

Many stty flags are only effective for the duration of the open in the
stty program.  Beware of settings changing back to default but pretending
to be set.  You may want to write a program that does:

	/*
	 * Hack stub to force port settings prior to being opened by a
	 * program that expects the standard behaviour.
	 */
	if( !fork()) {
		int fd;

		fd = open( port, O_RDWR | O_NDELAY);

		/*
		 * set all the settings mother approves of (CLOCAL, etc.)
		 */
		ioctl( fd, ...);
		fcnt( fd, ...);
		stty/gtty( fd ...);

		sleep( 10);	/* give time for other program to start*/
	} else {
		execl( "/program_that_needs_settings", "arg0", "arg1", ..., 0);
	}
	exit( 0);

Someone is bound to fix the drivers in a future version, so if you can, run
the old drivers, fix the new drivers, or be patient a little while longer.


					Terry Lambert
					terry@icarus.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.