From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103eaf,6300b7bfbc2a4a7c,start X-Google-Attributes: gid103eaf,public X-Google-Thread: 107112,6300b7bfbc2a4a7c,start X-Google-Attributes: gid107112,public X-Google-Thread: fee84,6300b7bfbc2a4a7c,start X-Google-Attributes: gidfee84,public From: Christian Worley Subject: Slip doesn't work without a serial port in OSF/1; a tty/pty programming question Date: 1995/07/25 Message-ID: <3v3iou$jca@news.xmission.com>#1/1 X-Deja-AN: 106869389 content-type: text/plain; charset=us-ascii organization: XMission Internet (801 539 0900) x-url: news:comp.unix.osf.osf1 mime-version: 1.0 newsgroups: comp.unix.osf.osf1,comp.terminals,comp.protocols.ppp x-mailer: Mozilla 1.1N (X11; I; OSF1 V2.0 alpha) We're running Dec's OSF1 v3.0. When we try to slattach a pseudo-terminal (pty) thru "slattach" we get the error message: "Device is not a typewriter" Does DEC want to put Smith-Corona back in business? ;) We're trying to run slip without a serial port...the "slattach" program works great thru a serial port (/dev/ttyN), but does not work when we try to route the slip data thru a pseudo- terminal (/dev/ttypN). Using a pseudo-terminal allows us, in theory, to provide the slip data in and out programatically rather than thru a serial device. We're routing slip data thru a device that we make. This is a proof-of-concept for a point-to-point network using our hardware. Our hardware is not the problem ;) No, really, it's not! We can route slip data back forth thru our hardware. We can connect a serial cable to our hardware in the bus, route that cable to the serial port in the same box. This Rube-Goldburg-ish slip implementation works great. It just looks strange to see a serial cable with both ends attached to the same host! Worse yet, when we use our serial output we have to serialize high speed data from our device, slowing down its potential speed considerably. Since we already can read/write data to our device from the OSF/1 OS, it should be possible to throw away the serial cable altogether and route the data thru a pseudo terminal (pty) instead of a tty as slip expects. We're not re-writing device drivers. We've got ours, and the slip driver is embedded in OSF/1. We're trying to make them work together without having to know about each other. We first noticed that pseudo-terminals were, by default, streams based and slip required a BSD implementation. We reconfigured OSF to use use BSD-style pseudo-terminals. Note: I recommend everybody reconfigure their OSF/1 systems this way; the BSD implementation is noticeably faster (xterms pop-up a lot quicker, etc.)!! We open the master & slave pseudo-terminal, and attempt to push the slip line discipline upon the slave in slattach: if (ioctl(fd, TIOCSETD, &slipdisc) < 0) { fputs(dev, stderr); perror(": set discipline:"); syslog(LOG_INFO, "TIOCSETD: %m"); exit(1); } Here, the ENOTTY error is issued. "perror" prints "Device not a typewriter". Although we don't have the OSF/1 source, I looked up "ENOTTY" in the bsd source. It is never issued in response to "TIOCSETD", but everywhere "ENOTTY" is issued, it is in response to an "isactty" call ("is terminal the controlling terminal for the process"). So, I tried a "TIOCSCTTY" ioctl call before the "TIOCSETD" call to force the terminal to be the controller; but still got the "typewriter" error message. Conceptually, this should have worked without a problem. There's something in OSF/1 that seems to be specifically trying to weed out the tty portion of a pty when invoking the slip line discipline. Two of us have been working on this for five days now... Any help would be appreciated. Chris