Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 1996 21:10:32 -0600
From:      Gary Aitken <garya@ics.com>
To:        Sean Eric Fagan <sef@kithrup.com>, jkh@time.cdrom.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: stty -- not
Message-ID:  <31A3D728.4232@ics.com>
References:  <199605230047.RAA10020@kithrup.com>

next in thread | previous in thread | raw e-mail | index | archive | help
OK, guys, I'm now totally confused; either the handbook is totally
messed up, sean's wrong, something doesn't work, or I should go stick my
head in the sand.  Probably the latter.

The handbook implies hex numbers are allowed:

bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\
        :sh:sd=/var/spool/lpd/bamboo:\
        :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:\	
                       ^^^^^^^^^^^^
> For one thing, the fs/fc/xs/xc bits have to be in octal.

Which is correct?
(I've tried all three combos: 0x10, 020, and 16)

> Then, you need to have the opost bit set, whatever that works out to being.

The handbook says to set the CRMOD bit, and to look in 
/usr/include/sys/ioctl_compat.h

I tried that using fs#0x10, fs#020, and fs#16, to no avail;
so, taking sean's advice,
I found OPOST and ONLCR in termios.h, and tried fs#3, also to no avail.
So then I tried covering the world with 0xff, 0377, and 255,
but got nowhere.

I finally got worried about whether it was even looking at printcap,
so I changed the baud rate in printcap and got garbage, so I know
it's reading the right file, anyway.

So...
How the heck *do* you turn those bits on, and what are the right
ones?

There appears to be some confusion about which set of bits should
be used:

the ones in termios.h which correspond to termios.c_iflag, c_oflag,
c_cflag, and c_lflag, and which would imply OPOST | ONLCR; and which
are not referenced in the handbook

the ones in ioctl_compat.h which correspond to sgttyb.sg_flags (?),
which is defined as a short and doesn't have room for all the 
possible flags listed (I probably just don't understand how they're
used here); and which would imply CRMOD

Neither ones seem to do the job for me.
I know I'm going to feel stupid when this is done...

I did manage to get a <cr> inserted, but only by manually configuring
the printer using:

	stty -f /dev/ttyid1 opost onlcr
	stty -f /dev/ttyld1 opost onlcr

Attempting to manually configure the device using the locked device
alone, or the initialization device alone, did not work.

One can specifically set the initialization and locked state using stty.  
Does using the - version of a flag lock them off, or simply return them
to their default, unlocked, condition?

If it locks them off, how does one return them to "default"?  i.e.

	stty -f /dev/ttyld1 opost onlcr		locks opost onlcr on
if
	stty -f /dev/ttyld1 -opost -onlcr	locks opost onlcr off
then
How does one return them to "unlocked", so other settings will take
effect?

If they lock both on and off, then my problem may be that I twiddled
these bits before I got the printcap entry correct.

-- 
Gary Aitken		garya@ics.com		(business)
			garya@dreamchaser.org	(personal)



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