[comp.sys.ncr] Problem with uucico - lost line - on 450/32 Unix 3.00.01.

rey@safn2.UUCP (rey) (04/04/91)

I cannot reliably Poll with uucp because it fails about 1/2 the time.
The result is usually a success one hour later. An hour later than I need 
it to be.

CODAR told me I have a bad modem. I do not believe that. Modems are
Hayes 2400. tty20 and tty21 behave the same. 1200 and 2400 behave the same.
Failures are not related to machine load, happening at all hours.

There must be something wrong with the hpsio driver. Has anyone had better
luck? I have seen several knocks of the hpsio in this group. Can it
really be "non-functional"? I have used it for several years on various
releases.

I have also looked at getty_ps from comp.sources.misc (unix?); but I have not
been able to make it work.  I do not think this problem has anything to do
with getty now; although I once thought that I might solve the problem by
having the better modem control of getty_ps.


Output from "Uutry -r safn1" follows:

mchFind called (safn1)
conn(safn1)
Device Type ACU wanted
mlock tty21 succeeded
processdev: calling setdevcfg(uucico, ACU)
gdial(hayes12) called
expect: ("")
got it
sendthem ()
CLOCAL set
DELAY
<NO CR>AT^M)
expect: (OK^M)
lost line errno - 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^About 50% of the time.
set interface UNIX
mlock tty20 succeeded
processdev: calling setdevcfg(uucico, ACU)
gdial(hayes12) called
expect: ("")
got it
sendthem ()
CLOCAL set
DELAY
<NO CR>AT^M)
expect: (OK^M)
AT^M^M^JOK^Mgot it
sendthem (<NO CR>AT&D3V1Q0E1S0=1&C1&S1M0&J0B1^M)
expect: (OK^M)
^JAT&D3V1Q0E1S0=1&C1&S1M0&J0B1^M^M^JOK^Mgot it
sendthem (ECHO CHECK ON
<NO CR>A^JATTDDTT,,??????^M^M)
expect: (CONNECT)
^M^JCONNECTgot it
sendthem ()
CLOCAL clear
<NO CR>)
getto ret 6
expect: ("")
got it
sendthem (^MDELAY
^M^M)
expect: (ogin:)

Continues to "Successful"


Devices file follows:

Direct tty21 - 2400 direct
ACU tty21,M - 2400 hayes24 \T
ACU tty21,M - 1200 hayes12 \T
ACU tty20,M - 2400 hayes24 \T
ACU tty20,M - 1200 hayes12 \T


Dialers file excerpt follows: The \M \m is new in rel 3. \M sets port CLOCAL.

# Gold Star 2400
GoldStar =,- "" \M\dAT\r\c OK\r \dAT&D2V1QE1S0=1&C1&S1&JB1\r\c OK\r \EATDT\T\r\c CONNECT \m\c
# &C1 and &S1 required for logon.
hayes12	=,-,	"" \M\dAT\r\c OK\r AT&D3V1Q0E1S0=1&C1&S1M0&J0B1\r\c OK\r \EATDT\T\r\c CONNECT \m\c
hayes24	=,-,	"" \M\dAT\r\c OK\r AT&D2V1Q0E1S0=1&C1&S1M0&J0B1&W\r\c OK\r \EATDT\T\r\c CONNECT \m\c

Thanks in advance for any help.
-- 
Reynolds McClatchey (Southern Aluminum Finishing Co, Atlanta, GA, USA)
Architectural Aluminum. Custom Fabrication. Paint, Powder Coating, Anodizing.
uunet!safn2!rey		MCImail 414-2935

ra@intsys.no (Robert Andersson) (04/04/91)

rey@safn2.UUCP (rey) writes:

>I cannot reliably Poll with uucp because it fails about 1/2 the time.
>The result is usually a success one hour later. An hour later than I need 
>it to be.

>Dialers file excerpt follows: The \M \m is new in rel 3. \M sets port CLOCAL.
>hayes12	=,-,	"" \M\dAT\r\c OK\r AT&D3V1Q0E1S0=1&C1&S1M0&J0B1\r\c OK\r \EATDT\T\r\c CONNECT \m\c

That explains it.  There appears to be a bug in the HPSIO code that makes
this CLOCAL fiddling fail.  I'm surprised you got it working at all, 
personally I newer got \M \m to work.

I believe NCR inherited this bug from AT&T, since I have also seen it in
many other UNIX implementations.  I have attached an old Usenet message and
a test program that shows the bug.

Regards, Robert.



From: pim@cti-software.nl (Pim Zandbergen)
Date: 21 Aug 90 18:06:53 GMT
Newsgroups: comp.unix.i386
Subject: which multiport i/o cards pass this test?

Hi netfolk,

I am currently looking for a multiport I/O card to replace
Specialix, because the Dutch distributor has stopped importing them.

I have evaluated some cards but lots of their drivers have trouble with
correctly handling modem control. This prevents them from working
with the intelligent modem feature in HDB UUCP:
	"ttyxx,M" in Devices  means open with O_NDELAY set
	and "\M" and "\m" in Dialers means set and clear the CLOCAL flag.

The problem is that with these drivers, the O_NDELAY flag
cannot be properly cleared when carrier detect is not present.

I have noticed this problem with the stock ISC asy driver,
with Specialix drivers older than release 3.03, with the
Equinox Megaport 1.8.2 driver (a pity, I like this
card) and the Chase Research AT8+ 4.02a driver.

In fact, the only working drivers I have seen are the Specialix 3.03
and the PORTS and EPORTS drivers for the AT&T 3B2.

Rather than evaluate every card on the market myself I would
appreciate very much if you would run my little test program
and mail me the result.

I *think* this program emulates HDB UUCP behaviour.
I only tested it on ISC 386/ix 2.0.2 and on the AT&T 3B2.
If any UNIX guru would like to comment, please feel free.

The crucial moment in this program is the read().
It should block, waiting for input, but returns immediately
with zero bytes read on lots of cards.

You should run this program on a port that has no cable
whatsoever attached to it, nor should any other process
have this port opened (ie. no getty's running).
The port should implement modem control, ie. "> /dev/ttyxx"
should hang.

Thanks in advance for you help.


#include    <fcntl.h>
#include    <errno.h>
#include    <signal.h>
#include    <termio.h>
#include    <stdio.h>

main(argc, argv)
	int             argc;
	char           *argv[];
{
	int             fcntl_flags;
	int             fd;
	extern int      errno;
	extern unsigned alarm();
	char            buf[1];
	char           *usage = "usage: %s <tty device with modem control>\n";
	extern char    *sys_errlist[];
	struct termio   termio_flags;
	struct termio   old_termio_flags;
	void            on_alarm();
	extern void     exit();


	if (argc != 2)
	{
		(void) fprintf(stderr, usage, argv[0]);
		exit(1);
	}

	(void) printf("opening %s with O_NDELAY set\n", argv[1]);
	if ((fd = open(argv[1], O_RDWR | O_NDELAY)) < 0)
	{
		(void) fprintf(stderr, "%s: can't open %s: %s\n",
				argv[0], argv[1], sys_errlist[errno]);
		exit(2);
	}

	(void) printf("clearing O_NDELAY flag\n");
	if ((fcntl_flags = fcntl(fd, F_GETFL, 0)) == -1)
	{
		(void) fprintf(stderr, "%s: can't get fcntl flags: %s\n",
			       argv[0], sys_errlist[errno]);
		exit(3);
	}
	fcntl_flags &= ~(O_NDELAY);
	if (fcntl(fd, F_SETFL, fcntl_flags) == -1)
	{
		(void) fprintf(stderr, "%s: can't set fcntl flags: %s\n",
			       argv[0], sys_errlist[errno]);
		exit(4);
	}

	(void) printf("setting CLOCAL\n");
	if (ioctl(fd, TCGETA, &termio_flags) < 0)
	{
		(void) fprintf(stderr, "%s: can't get termio flags: %s\n",
			       argv[0], sys_errlist[errno]);
		exit(5);
	}
	old_termio_flags = termio_flags;	/* save original modes */
	termio_flags.c_cflag |= CLOCAL;
	if (ioctl(fd, TCSETAW, &termio_flags) < 0)
	{
		(void) fprintf(stderr, "%s: can't set termio flags: %s\n",
			       argv[0], sys_errlist[errno]);
		exit(6);
	}

	(void) printf("reading from %s\n", argv[1]);
	(void) signal(SIGALRM, on_alarm);
	(void) alarm((unsigned) 10);
	if ((read(fd, buf, 1) < 1) && (errno == EINTR))
		(void) printf("test succesful\n");
	else
		(void) printf("test failed\n");


	(void) printf("clearing CLOCAL\n");
	if (ioctl(fd, TCSETAW, &old_termio_flags) < 0)
	{
		(void) fprintf(stderr, "%s: can't restore termio flags: %s\n",
			       argv[0], sys_errlist[errno]);
		exit(7);
	}


	(void) printf("exiting\n");
	return 0;
}

void
on_alarm()
{
	(void) printf("caught SIGALRM\n");
}
-- 
Robert Andersson       Voice +47 2 371055       International Systems A/S
ra@intsys.no           Fax   +47 2 356448       P.O. Box 3356
...!{uunet,mcsun,nuug}!intsys.no!ra             0405 Oslo 4, NORWAY