Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!gorodish!guy From: guy@gorodish.Sun.COM (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: Input output parity & stop bits (was: Re: autowrap) Message-ID: <67360@sun.uucp> Date: 8 Sep 88 06:37:20 GMT References: <3854@bsu-cs.UUCP> <236@lakart.UUCP> Sender: news@sun.uucp Lines: 47 > Correct me if I am wrong, but I thought clearing both the EVEN and ODD > bits in the flags member of the sgtty (or whatever) structure provides > no parity I/O. It doesn't - at least it doesn't on 4.[23]BSD nor on any SunOS release with which I'm familiar. In those systems, it requests 7 bits and even parity, but tells the system not to discard characters that have parity errors. This is not the same as what is being requested, which is to send and expect 8 bits and neither send nor expect a parity bit. The latter mode is useful, for example, with terminals that have a "meta" key that turns the 8th bit on for characters transmitted when that key is held down, or for terminals such as the VT220 that support an 8-bit character set. In 4.2BSD, you can get 8 bit, no parity I/O only by turning RAW or LITOUT mode on. These are not generally useful for everyday use; RAW turns off minor features such as line editing and interrupt characters, while LITOUT turns off equally minor features such as mapping '\n' to CR-LF. In 4.3BSD, and in SunOS 3.2 and later (and in other systems that have picked up the 4.3BSD tty driver), you can get 8 bit, no parity I/O by turning PASS8 mode on. This puts the hardware into 8 bit, no parity mode, *and* tells the tty driver not to strip input to 7 bits. Unfortunately, it doesn't tell the tty driver not to strip *output* to 7 bits; to get that, you have to turn RAW or LITOUT mode on, with the problems already mentioned. In System III, System V, SunOS 4.0 and later, and other systems that have a tty driver with the S3/S5 interface, you can get 8 bit, no parity I/O by setting the character size to CS8, turning off PARENB, and turning off ISTRIP. In this mode, the tty driver will strip neither input nor output to 7 bits (definitely true for SunOS 4.0, probably true for S5, possibly true for S3; the S3 and S5 drivers use 8-bit bytes internally to indicate delays, so there may be some problems - I think the S3 driver didn't handle these problems, but the S5 driver, or at least the S5R2 and later driver, does). In SunOS 4.0, which also supports the V7/BSD-style "ioctl"s, turning PASS8 mode on sets the character size to CS8 and turns off PARENB and ISTRIP, so it gives you a true 8-bit data path in both directions. > On a related note, I log in from home quite a bit & use xmodem to > transfer data. I set my local machine to 8 data, no parity (which > works !!) and 1 stop bit. All is well till I try an upload, at which point > the system chokes. If I reset my local end to 8 N 2 all is well, i.e. I > assume the UNIX box is running 8 N 2. If the UNIX box is running a V7-style (which includes 4.xBSD) driver, the only way it can run with 2 stop bits is when it's running at 110 baud. If it's running an S5-style driver, you can control the stop bits and the baud rate independently.