Wscons is the platform-independent workstation console driver for NetBSD. As of this writing, not all platforms support wscons, but more are being added as time goes on. Wscons should have all the features (plus some extras) of the old i386 pcvt driver, but its exact capabilities are dependent on the underlying hardware.
Currently, virtual terminals are not supported on bitmap-only screens, like macppc, mac68k, and alpha to name a few.
For systems on which they are supported, the installation procedure will take care to set them up upon installation. The steps involved to do so manually are:
/etc/rc.conf
and
change "wscons" to "yes"/etc/wscons.conf
and
ensure that the screens you wish to enable for login are
being created (note that the first screen, screen 0, is
always present)./etc/ttys
and change
the entries for ttyE{1,2,3}
from
“off” to “on”.sh /etc/rc.d/wscons kill -1 1 |
You can then use Ctrl-Alt-{F1,F2,F3,F4}
to
switch between the virtual terminals.
This is done with wsconsctl(8), for example
selecting a French keyboard map is done via "wsconsctl -w encoding=fr
".
A full list of keyboard mappings is in sys/dev/wscons/wsksymdef.h,
but some of the more common maps are:
de
dk
es
fr
it
jp
sv
uk
us
There are also several "variants" that can be used to modify a map:
dvorak
swapctrlcaps
iopener
“dvorak” uses the Dvorak keyboard layout.“swapctrlcaps” switches the functions of the Caps Lock and Left Control keys. “iopener” is for the nonstandard keyboard layout on the Netpliance i-opener and makes F1 into Escape and F2 through F12 into F1 through F11. These can be combined with another map by appending a dot and then the variant name, for example, “us.iopener”. Multiple variants can be combined, such as “us.dvorak.swapctrlcaps”. Note that not all combinations are allowed.
You can change the compiled in kernel default by adding
options PCKBD_LAYOUT=KB_encoding
where encoding is an uppercase entry
from the list above
(eg: PCKBD_LAYOUT=KB_FR
). Variants can be
bitwise or'd in
(eg: PCKBD_LAYOUT=KB_US|KB_SWAPCTRLCAPS
).
If your favourite keymap is not supported, you can start
digging in sys/dev/wscons/wsksymdef.h
and sys/dev/pckbc/wskbdmap_mfii.c
to make your own. Be sure to send-pr a change-request PR with your work, so others can
make use of it!
A different way to implement your own keymap is documented in misc/10976, which puts the definitions for a russian keymap into a file that's loaded later on. A hungarian keymap is available that way in misc/11457 there are also pointers to swiss-german for i386 and german for HP Jornada 720 in the mailing list archives.
Configuring the keyboard layout under X is described elsewhere.
Keyboard repeat speed can be tuned using the
wsconsctl(8) utility.
There are two variables of interest:
repeat.del1
, which specifies the delay before
character repetition starts, and repeat.deln
,
which sets the delay between each character repetition (once
started).
Lets see an example, assuming you want to accelerate keyboard speed. You could do, from the command line:
wsconsctl -w repeat.del1=300 wsconsctl -w repeat.deln=40 |
Or, if you want this to happen automatically every time
you boot up the system, you could add the following lines to
/etc/wscons.conf
:
setvar repeat.del1=300 setvar repeat.deln=40 |
This error message usually occurs when wsconscfg tries
to add a screen which already exists. One time this occurs
is if you have a screen 0
line in your
/etc/wscons.conf
file, because the
kernel always allocates a screen 0 as the console device.
The error message is harmless in this case, and you can get
rid of it by deleting (or commenting out) the
screen 0
line.
It is possible to change the foreground and background color of kernel messages setting the following options in kernel config files:
options WS_KERNEL_FG=WSCOL_xxx options WS_KERNEL_BG=WSCOL_xxx |
The WSCOL_xxx
color constants are defined in
/usr/src/sys/dev/wscons/wsdisplayvar.h
.
Starting from NetBSD 2.0G (-current after NetBSD 2.0), you can easily customize many aspects of your display appearance: the colors used to print normal messages, the colors used to print kernel messages and the color used to draw a border around the screen.
All of these details can be changed either from kernel
options or through the wsconsctl(8) utility; the later
may be preferable if you don't want to compile your own
kernel, as the default options in GENERIC
are
suitable to get this tip working.
The following options can be set through wsconsctl(8):
WSDISPLAY_BORDER_COLOR
.WS_DEFAULT_COLATTR
and WS_DEFAULT_MONOATTR
(the former is used
in color displays, while the later is used in monochrome
displays).WS_DEFAULT_BG
.WS_DEFAULT_FG
.WS_KERNEL_COLATTR
and
WS_KERNEL_MONOATTR
(the
former is used in color displays, while the later is used
in monochrome displays).WS_KERNEL_BG
.WS_KERNEL_FG
.The values accepted as colors are: black, red, green, brown, blue, magenta, cyan and white. The attributes are a comma separated list of one or more flags, which can be: reverse, hilit, blink and/or underline.
For example, to emulate the look of one of those old Amstrad machines:
wsconsctl -d -w border=blue msg.default.bg=blue msg.default.fg=white msg.default.attrs=hilit |
Or, to make your kernel messages appear red:
wsconsctl -d -w msg.kernel.fg=red |
Note that, in older versions of NetBSD, only a subset of this functionality is available; more specifically, you can only change the kernel colors by changing kernel options, as explained above. Also note that not all drivers support these features, so you may not get correct results on all architectures.
The wscons “mux” devices let you multiplex the input
streams from more than one
wskbd/wsmouse device. The multiplexed device for wsmouse
devices is /dev/wsmouse
, and for wskbd
devices it is /dev/wskbd
. If you
configure the X server to use
/dev/wsmouse
instead of hardwiring the pointing device, you can
use any wsmouse-compatible pointing device available, or two
or more of them at the same time.
The steps involved in this are:
/dev/wsmouse
and
/dev/wskbd
/dev
and
run “./MAKEDEV wsmux
”.
If it fails, you can create these devices by hand in
the /dev
directory:
mknod wsmouse c 65 0 mknod wskbd c 65 1 chown root:wheel wsmouse wskbd chmod 600 wsmouse wskbd |
/etc/XF86Config
Protocol "wsmouse" Device "/dev/wsmouse" |
After that's done you can do things like use the built-in pointing device on your laptop PC while on the go, and hot-plug a USB mouse at any later time and and use it without reconfiguring or restarting the X server.
If you're using a PS/2 mouse, the following command will work. nnn is an integer between 0 and 100.
wsconsctl -m -w resolution=nnn |
There are several fonts in
/usr/share/wscons/fonts
that
can be loaded as console fonts. If you want to edit any of
them, you can use the old pcvt utils that are available in the
sysutils/pcvt-utils
package.
The wsmouse device (part of wscons) does not directly support serial mice. The moused(8) daemon is provided to read serial mouse data, convert it into wsmouse events and inject them in wscons' event queue, so the mouse can be used through the abstraction layer provided by wsmouse.
A typical use can be: moused -p /dev/tty00
.
This will try to determine the type of mouse connected to
the first serial port and start reading its data. The
moused(8) man page contains more examples.
Mouse console support is available since NetBSD 1.6B through the wsmoused(8) daemon. This program provides copy & paste support to the wscons console using the mouse pointer.
This is currently available in all architectures that use the vga(4) video driver as a backend of wscons, to know: alpha, arc, bebox, cats, hp700, i386 and prep.
Here is a step by step list of things to do to get wsmoused(8) working (note that the man page contains more information):
WSDISPLAY_CHARFUNCS
option in your kernel configuration file, recompile and
install./etc/ttys
: disable
/dev/console
and enable
/dev/ttyE0
;
wsmoused will use the later./etc/wscons.conf
to enable
screen 0
(/dev/ttyE0
)
if needed.wsmoused=yes
to your
/etc/rc.conf
. If you use
the X Window System, you may also want to add
wsmoused_flags="-X 4"
to the file; this tells the
daemon which console is X11 running on.