NetBSD wscons FAQ

The wscons console driver


The wscons console driver

What is wscons? (top)

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.

How do I enable wscons and virtual terminals? (top)

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:

You can then use Ctrl-Alt-{F1,F2,F3,F4} to switch between the virtual terminals.

Changing the keyboard mapping from 'US' (top)

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:

There are also several "variants" that can be used to modify a map:

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.

How do I change keyboard repeat speed? (top)

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

WSDISPLAYIO_ADDSCREEN: Device busy” (top)

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.

How do I change the text display colors? (top)

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):

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.

How do I use the wscons “mux” devices? (top)

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:

  1. Configure and rebuild your kernel
    • Add the option “mux 0”" to each “wsmouse* at ...” line in your kernel config (example: wsmouse* at ums? mux 0).
    • Add the option “mux 1” to each “wskbd* at ...” line in your kernel config, just like in the example above.
    • Make sure you have “pseudo-device wsmux 2” defined in your kernel config.
    • Build the kernel. There is a detailed explanation located in the Kernel FAQ if you're not sure how to do that.
  2. Make /dev/wsmouse and /dev/wskbd
    • As root, cd to /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
  3. If you're using X, edit /etc/XF86Config
    • If the rest of your XF86Config is set up correctly, you can just edit the Protocol and Device lines in the "Pointer" section to match the following:
      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.

How do I change the mouse resolution? (top)

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

Is there a font editor? (top)

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.

How do I use a serial mouse? (top)

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.

How do I enable mouse console support? (top)

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):

  1. Enable the WSDISPLAY_CHARFUNCS option in your kernel configuration file, recompile and install.
  2. Edit /etc/ttys: disable /dev/console and enable /dev/ttyE0; wsmoused will use the later.
  3. Optionally edit /etc/wscons.conf to enable screen 0 (/dev/ttyE0) if needed.
  4. Add 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.
  5. Reboot and have fun!


Back to  NetBSD Documentation Top Level

(contact us)   Generated from %NetBSD: index.xml,v 1.4 2005/07/19 12:50:55 rpaulo Exp %
Copyright © 1994-2006 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.
NetBSD® is a registered trademark of The NetBSD Foundation, Inc.