Chapter 13. Console drivers

Table of Contents
13.1. wscons
13.2. pccons
13.3. pcvt

In NetBSD versions before 1.4 the user could choose between two different drivers for screen and keyboard, pccons (specific for i386) and pcvt. In version 1.4 the new wscons multiplatform driver appeared, which is supposed to substitute the two previous drivers (which are still supported.)

13.1. wscons

Wscons is NetBSD's new console driver. It offers virtual terminal, support for international keyboards, mouse handling, etc. The capabilities of wscons can vary depending on the port (wscons is not available on all ports): the i386 version is very feature rich.

At the end of the installation, wscons is active by default and nothing needs to be done in order to use it. In version 1.4, the virtual consoles are not enabled by default: to enable them see Chapter 4. The rest of this section describes the wscons options of the kernel configuration file.

If you are compiling a customized kernel, to enable wscons you must activate the relevant options and comment out the options of pcvt and pccons (they can't be enabled at the same time.) For example

#pc0    at isa? port 0x60 irq 1   # pccons generic PC console driver
#vt0    at isa? port 0x60 irq 1   # PCVT console driver    

In the kernel configuration file you can also enable a foreign keyboard. For example, to use the italian keyboard by default:

options     PCKBD_LAYOUT="KB_IT"    

Note: the layout of the italian keyboard is not ideal for programming tasks. To modify it see Chapter 4.

The number of pre-allocated virtual console is controlled by the following option

options     WSDISPLAY_DEFAULTSCREENS=4    

Other consoles can be added by enabling the relevant lines in the /etc/wscons.conf file: the comment mark (#) must be removed from the lines beginning with "screen x". In the following example a fifth console is added to the four pre-allocated ones:

# screens to create
#       idx     screen  emul
#screen 0       -       vt100
screen 1        -       vt100
screen 2        -       vt100
screen 3        -       vt100
screen  4       -       -
#screen 4       80x25bf vt100
#screen 5       80x50   vt100    

The rc.wscons script transforms each of the non commented lines in a call to the wsconscfg command: the columns become the parameters of the call. The idx column becomes the index parameter, the screen column becomes the -t type parameter (which defines the type of screen: rows and columns, number of colors, ...) and the emul column becomes the -e emul parameter, which defines the emulation. For example:

screen 3       -       vt100    

becomes a call to:

wsconscfg -e vt100 3    

Note: it is possible to have a (harmless) conflict between the consoles pre-allocated by the kernel and the consoles allocated at boot time through /etc/wscons.conf. If during boot the system tries to allocate an already allocated screen, the following message will be displayed:

wsconscfg: WSDISPLAYIO_ADDSCREEN: Device busy    

The soulution is to comment out the offending lines in /etc/wscons.conf.

The virtual console must also be active in /etc/ttys. For example:

console "/usr/libexec/getty Pc"         pc3     off secure
ttyE0   "/usr/libexec/getty Pc"         vt220   on secure
ttyE1   "/usr/libexec/getty Pc"         vt220   on secure
ttyE2   "/usr/libexec/getty Pc"         vt220   on secure
ttyE3   "/usr/libexec/getty Pc"         vt220   off secure
...    

The line

ttyE3   "/usr/libexec/getty Pc"         vt220   off secure    

of /etc/ttys is used by the X server to find a free terminal. To use a screen different from number 4, a parameter of the form vtn must be passed to the X server (n is the number of the function key used to activate the screen for X.)

For example, "screen 7" could be enabled in /etc/wscons.conf and X could be started with "vt8". If you use xdm you must edit /usr/X11R6/lib/X11/xdm/Xserver. For example:

:0 local /usr/X11R6/bin/X +kb dpms -bpp 16 dpms vt8    

For xdm3d the path is different: /usr/X11R6/share/xdm3d/Xservers.

13.2. pccons

This is the console driver found on the i386 install floppy. It doesn't offer virtual consoles and utility programs for configuration but takes up very little space.

13.3. pcvt

Pcvt is a VT220 terminal emulator and has more advanced functions than the simple pccons. It supports foreign keyboards and virtual consoles (with Ctrl-Alt-F1..F8 or with the F9..F12 function keys.) To activate pcvt the following lines must be uncommented in the kernel configuration file.

# Enable only one of the following lines
#pc0    at isa? port 0x60 irq 1
vt0     at isa? port 0x60 irq 1

# Options for PCVT console driver
#options FAT_CURSOR 
options PCVT_NETBSD=132
options PCVT_NSCREENS=3    

To use a foreign keyboard you must activate it at boot; it is also necessary to choose the correct terminal. For example:

/usr/local/bin/kcon -m i2
TERM=pcvt25;    export TERM    

/etc/ttys must be modified accordingly. For example:

#console "/usr/libexec/getty Pc"   pcvt25  on secure
ttyv0    "/usr/libexec/getty Pc"   pcvt25  on secure    

The settings for the foreign keyboard (the italian keyboard in this example) must be loaded at boot, for example in /etc/rc.local:

KCONP=/usr/local/bin 
SCONP=/usr/local/bin 
LDFNP=/usr/local/bin
ISPCP=/usr/sbin
CURSP=/usr/local/bin

set_keybd=YES

#------------------------------------------------------
# if desired, setup keyboard for italian keyboard layout
#------------------------------------------------------

if [ X${set_keybd} = X"YES" -a -x $KCONP/kcon ]
then
  echo
  echo 'switching to italian keyboard layout'
  $KCONP/kcon -m i2
fi

echo '.'     

/etc/ttys must be also modified:

#console  "/usr/libexec/getty Pc" pcvt25  on secure
ttyv0   "/usr/libexec/getty Pc" pcvt25  on secure
ttyv1   "/usr/libexec/getty Pc" pcvt25  on secure
ttyv2   "/usr/libexec/getty Pc" pcvt25  on secure    

The pcvt utility programs must be compiled and installed.

cd /sys/arch/i386/isa/pcvt/Util
make
make install