Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 1996 09:54:39 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-hardware@FreeBSD.ORG, freebsd-isp@FreeBSD.ORG, freebsd-questions@FreeBSD.ORG, stefan@islandia.is
Subject:   Re: Problems with PPP and cyclades (fwd)
Message-ID:  <199607112354.JAA20628@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I'm trying to get ppp-iij using the tun device to work. I can connect to it
>and everything seems fine until I hangup, the ppp daemon doesn't terminate
>and just holds the device open. This happens only when using Cyclades 16-Ye
>DB25-DB25 device with 16 modems connected (from dmesg: cy0 irq 5 maddr 
>0xd4000 msize 8192 on isa). But when using sio everything 
>works fine and ppp terminates. I'm using the same modem on both devices.

>...
>Currently I'm using sliplogin.dynamic with the Cy-16 with the external 
>connector box, and there are no trouble with that setup. But some of my 
>users want to use ppp to connect to my server.

ppp polls DCD while slattach waits for a SIGHUP.  ppp's method is much
easier to get right for both the daemon and the driver, but there seems
to be a problem with it.

I use the following program to poll the modem state for all sio and cy
lines.  The DCD state should be `-DCD' when nothing is connected and
change to '+DCD' when something is connected and raises DCD and change
to `-DCD' on hangup.  This works with a Cyclaydes 8Yo.  Perhaps there
is a timing problem in the ppp daemon.  You should probably use kernel
ppp if there is more that one ppp session at a time.

---
comstate.c
---

#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

static void try(char *prefix);

int main()
{
	try("ttyd");
	try("cuaa");
	try("ttyc");
	try("cuac");
	return 0;
}

static void try(char *prefix)
{
	int bit;
	char dev_name[32];
	int dev_nr;
	int fd;
	int comstate;
	int stat;
	static char *statenames[] = {
		"LE",
		"DTR",
		"RTS",
		"ST",
		"SR",
		"CTS",
		"DCD",
		"RI",
		"DSR",
	};

	for (dev_nr = 0; dev_nr < 32; ++dev_nr) {
		sprintf(dev_name, "/dev/%s%c", prefix,
			dev_nr < 10 ? '0' + dev_nr : 'a' + (dev_nr - 10));
		fd = open(dev_name, O_RDWR | O_NONBLOCK);
		if (fd >= 0) {
			comstate = 0xdeadbeef;
			stat = ioctl(fd, TIOCMGET, &comstate);
			printf("%s: ioctl returned %d:", dev_name, stat);
			for (bit = 0; bit < 9; ++bit)
				printf(" %c%s",
				       comstate & (1 << bit) ? '+' : '-',
				       statenames[bit]);
			printf("\n");
			close(fd);
		}
	}
}

>stty -f /dev/ttyd0
>speed 9600 baud;
>lflags: -icanon -isig -iexten -echo
>iflags: -icrnl -ixon -ixany -imaxbel -brkint
>oflags: -opost -onlcr -oxtabs
>cflags: cs8 -parenb                                                            
>                     ^^^^^^ No crtscts ? Is that normal ?

It is the default.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607112354.JAA20628>