8 bits plus parity

Guy Harris auspex!guy at uunet.uu.net
Fri Mar 31 10:26:19 AEST 1989


>Is there a way to get a Sun 3 serial port to send and receive 8 data bits
>plus a parity bit?

If you're running a release prior to 4.0, you'd have to write your own tty
driver or somehow bang the Z8530 chip's registers yourself.  There may be
a consulting special that does this.

If you're running 4.0 or a later release, *and* your software "owns" the
serial port, it's easy - you can do it on *any* Sun serial port (CPU, ALM,
ALM-2) on *any* model of Sun.  Use the TCSETS or TCSETA-family "ioctl"s to
set the character size to CS8, turn PARENB on, and turn PARODD off if you
want odd parity.  See TERMIO(4). 

If your software *doesn't* "own" the serial port - e.g., if you're trying
to hook up a "login" terminal - it's more difficult.  For example, to make
an 8-bits-plus-parity terminal work as a login terminal, you'd have to
convince "getty" and "login" to set the port up using the aforementioned
"ioctl"s; however, they do not, at present, have support for that.  You'd
have to set the terminal to 7 bits plus parity (or 8 bits plus no parity,
except that there's a bug in the current version of "login" wherein it
forcibly sets the tty to 7 bits plus parity), and then, once you've logged
in, do

	stty cs8 parenb

and then change the terminal's character size and parity settings.

If you're trying to talk to some specialized box that hangs off a serial
port, you probably have software that "owns" the serial port, so it should
be straightforward.



More information about the Comp.sys.sun mailing list