Subject: Re: querying the console type?
To: None <smb@cs.columbia.edu>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: netbsd-users
Date: 10/21/2006 13:20:31
On Sat, Oct 21, 2006 at 01:06:35PM -0400, Thor Lancelot Simon wrote:
> 
> > I had understood ttyE0 to be a reference to the wscons driver.  If it
> > doesn't matter if wscons is on or off, that clearly isn't the case.

Oh, I see what you're getting at.  Sorry I missed it before.

It is not the case that "wscons=YES" in /etc/rc.conf somehow enables the
wscons driver for the VGA screen and AT/USB keyboard, and that "wscons=NO"
turns it off.  We do not (does any version of Unix?) "enable" or "disable"
device drivers from userspace like that -- and, besides, it's hard to see
how that could possibly work for a device that could be the system console,
to me at least.

What the (IMHO poorly named) "wscons" variable in rc.conf controls, as is
vaguely described by the comment text in that file, is:

# Configuration of "wscons" console driver virtual screens.
#
wscons=NO               wscons_flags=""         # setup wscons from wscons.conf

In other words, if this variable is set to YES you get "console driver
virtual screens".  If the driver is in the kernel and attaches, you _always_
get the first screen (ttyE0).

The wscons and wsdisplay manual pages seem to assume that the user
understands that if the driver attaches, one screen is _always_ provided.
This, too, should be made much more clear.

To clear up another potential point of confusion, the default (IMHO bad)
/etc/ttys setup will, if you have a system with a serial console and a
vga adapter (and a GENERIC kernel), give you a getty on the serial port
(because that's where /dev/console is aliases) and _nothing_ on ttyE0:
it will be a blank screen.  You will then have to explicitly turn on the
ttyE0 getty to be able to log in there -- and then, if you reboot the
system with vga/keyboard console again, you will have "dueling gettys"
between the console ttys entry and ttyE0 entry, which will then point
to the same place.  Oops.

The ttys snippet I sent earlier will, in either case, give you gettys
both on E0 and 00 regardless of which one happens to be the system console.

Thor

P.S. I will note that I can explain this because I actually had to figure
     it out, which involved actually making the mistakes myself, so I
     learned something.  This is not knowledge I would have if I had used
     a cookbook example -- which would be unfortunate. ;-)