Implement support to dynamically change wscons console and kernel colors.

Two new ioctls are added to the wsdisplay device, named WSDISPLAY_GMSGATTRS
and WSDISPLAY_SMSGATTRS, used to retrieve the actual values and set them,
respectively (the name, if you are wondering, comes from "message attributes").

A new emulop is added to the underlying display driver (only vga, for now)
which sets the new attribute for the whole screen, without having to clear
it.  This is optional, which means that this also works with other drivers
that don't have this new operation.

Five new kernel options have been added, although only documented in
i386 kernels (for now):
- WSDISPLAY_CUSTOM_OUTPUT, which enables the ioctls described above to
  change the colors dynamically from userland.  This is enabled by default
  in the GENERIC kernel (as well as others) but disabled on all INSTALL*
  kernels (as this feature is useless there).
- WS_DEFAULT_COLATTR, WS_DEFAULT_MONOATTR, WS_DEFAULT_BG and WS_DEFAULT_FG,
  which specify the default colors for the console at boot time.  These have
  the same meaning as the (already existing) WS_KERNEL_* variables.

wsconsctl is modified to add msg.default.{attrs,bg,fg} and
msg.kernel.{attrs,bg,fg} to the display part, so that colors can be changed
after boot.

Tested on NetBSD/i386 with vga (and vga in mono mode), and on NetBSD/mac68k.
No objections in tech-kern@.
This commit is contained in:
jmmv 2004-07-28 12:34:02 +00:00
parent 3f5c400809
commit 92f81ea7d3
30 changed files with 670 additions and 133 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: display.c,v 1.4 2004/06/03 19:18:41 christos Exp $ */
/* $NetBSD: display.c,v 1.5 2004/07/28 12:34:05 jmmv Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -52,12 +52,20 @@ static int dpytype;
static struct wsdisplay_usefontdata font;
static struct wsdisplay_scroll_data scroll_l;
static int havescroll = 1;
static int msg_default_attrs, msg_default_bg, msg_default_fg;
static int msg_kernel_attrs, msg_kernel_bg, msg_kernel_fg;
struct field display_field_tab[] = {
{ "type", &dpytype, FMT_DPYTYPE, FLG_RDONLY },
{ "font", &font.name, FMT_STRING, FLG_WRONLY },
{ "scroll.fastlines", &scroll_l.fastlines, FMT_UINT, FLG_MODIFY },
{ "scroll.slowlines", &scroll_l.slowlines, FMT_UINT, FLG_MODIFY },
{ "msg.default.attrs", &msg_default_attrs, FMT_ATTRS, FLG_MODIFY },
{ "msg.default.bg", &msg_default_bg, FMT_COLOR, FLG_MODIFY },
{ "msg.default.fg", &msg_default_fg, FMT_COLOR, FLG_MODIFY },
{ "msg.kernel.attrs", &msg_kernel_attrs, FMT_ATTRS, FLG_MODIFY },
{ "msg.kernel.bg", &msg_kernel_bg, FMT_COLOR, FLG_MODIFY },
{ "msg.kernel.fg", &msg_kernel_fg, FMT_COLOR, FLG_MODIFY },
};
int display_field_tab_len = sizeof(display_field_tab)/
@ -84,6 +92,41 @@ display_get_values(fd)
if (ioctl(fd, WSDISPLAYIO_GTYPE, &dpytype) < 0)
err(1, "WSDISPLAYIO_GTYPE");
if (field_by_value(&msg_default_attrs)->flags & FLG_GET ||
field_by_value(&msg_default_bg)->flags & FLG_GET ||
field_by_value(&msg_default_fg)->flags & FLG_GET ||
field_by_value(&msg_kernel_attrs)->flags & FLG_GET ||
field_by_value(&msg_kernel_bg)->flags & FLG_GET ||
field_by_value(&msg_kernel_fg)->flags & FLG_GET) {
struct wsdisplay_msgattrs ma;
if (ioctl(fd, WSDISPLAYIO_GMSGATTRS, &ma) < 0) {
warnx("no support to change console/kernel colors");
ma.default_attrs = -1;
ma.default_bg = -1;
ma.default_fg = -1;
ma.kernel_attrs = -1;
ma.kernel_bg = -1;
ma.kernel_fg = -1;
}
msg_default_attrs = ma.default_attrs;
if (ma.default_attrs & WSATTR_WSCOLORS) {
msg_default_bg = ma.default_bg;
msg_default_fg = ma.default_fg;
} else
msg_default_bg = msg_default_fg = -1;
msg_kernel_attrs = ma.kernel_attrs;
if (ma.kernel_attrs & WSATTR_WSCOLORS) {
msg_kernel_bg = ma.kernel_bg;
msg_kernel_fg = ma.kernel_fg;
} else
msg_kernel_bg = msg_kernel_fg = -1;
}
if (init_values() == 0 || havescroll == 0)
return;
@ -104,7 +147,56 @@ display_put_values(fd)
err(1, "WSDISPLAYIO_SFONT");
pr_field(field_by_value(&font.name), " -> ");
}
if (field_by_value(&msg_default_attrs)->flags & FLG_SET ||
field_by_value(&msg_default_bg)->flags & FLG_SET ||
field_by_value(&msg_default_fg)->flags & FLG_SET ||
field_by_value(&msg_kernel_attrs)->flags & FLG_SET ||
field_by_value(&msg_kernel_bg)->flags & FLG_SET ||
field_by_value(&msg_kernel_fg)->flags & FLG_SET) {
struct wsdisplay_msgattrs ma;
if (ioctl(fd, WSDISPLAYIO_GMSGATTRS, &ma) < 0)
err(1, "WSDISPLAYIO_GMSGATTRS");
if (field_by_value(&msg_default_attrs)->flags & FLG_SET) {
ma.default_attrs = msg_default_attrs;
pr_field(field_by_value(&msg_default_attrs), " -> ");
}
if (ma.default_attrs & WSATTR_WSCOLORS) {
if (field_by_value(&msg_default_bg)->flags & FLG_SET) {
ma.default_bg = msg_default_bg;
pr_field(field_by_value(&msg_default_bg),
" -> ");
}
if (field_by_value(&msg_default_fg)->flags & FLG_SET) {
ma.default_fg = msg_default_fg;
pr_field(field_by_value(&msg_default_fg),
" -> ");
}
}
if (field_by_value(&msg_kernel_attrs)->flags & FLG_SET) {
ma.kernel_attrs = msg_kernel_attrs;
pr_field(field_by_value(&msg_kernel_attrs), " -> ");
}
if (ma.default_attrs & WSATTR_WSCOLORS) {
if (field_by_value(&msg_kernel_bg)->flags & FLG_SET) {
ma.kernel_bg = msg_kernel_bg;
pr_field(field_by_value(&msg_kernel_bg),
" -> ");
}
if (field_by_value(&msg_kernel_fg)->flags & FLG_SET) {
ma.kernel_fg = msg_kernel_fg;
pr_field(field_by_value(&msg_kernel_fg),
" -> ");
}
}
if (ioctl(fd, WSDISPLAYIO_SMSGATTRS, &ma) < 0)
err(1, "WSDISPLAYIO_SMSGATTRS");
}
if (init_values() == 0 || havescroll == 0)
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.18 2004/04/02 22:16:52 heas Exp $ */
/* $NetBSD: util.c,v 1.19 2004/07/28 12:34:05 jmmv Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -140,6 +140,27 @@ static struct nameint kbdvar_tab[] = {
KB_VARTAB
};
static struct nameint color_tab[] = {
{ WSCOL_UNSUPPORTED, "unsupported" },
{ WSCOL_BLACK, "black" },
{ WSCOL_RED, "red" },
{ WSCOL_GREEN, "green" },
{ WSCOL_BROWN, "brown" },
{ WSCOL_BLUE, "blue" },
{ WSCOL_MAGENTA, "magenta" },
{ WSCOL_CYAN, "cyan" },
{ WSCOL_WHITE, "white" },
};
static struct nameint attr_tab[] = {
{ WSATTR_NONE, "none" },
{ WSATTR_REVERSE, "reverse" },
{ WSATTR_HILIT, "hilit" },
{ WSATTR_BLINK, "blink" },
{ WSATTR_UNDERLINE, "underline" },
{ WSATTR_WSCOLORS, "color" },
};
static struct field *field_tab;
static int field_tab_len;
@ -224,7 +245,7 @@ pr_field(f, sep)
{
char *p;
u_int flags;
int i;
int first, i, mask;
if (sep)
printf("%s%s", f->name, sep);
@ -268,6 +289,26 @@ pr_field(f, sep)
case FMT_KBMAP:
print_kmap((struct wskbd_map_data *) f->valp);
break;
case FMT_COLOR:
p = int2name(*((u_int *) f->valp), 1,
color_tab, TABLEN(color_tab));
printf("%s", p);
break;
case FMT_ATTRS:
mask = 0x10;
first = 1;
while (mask > 0) {
if (*((u_int *) f->valp) & mask) {
p = int2name(*((u_int *) f->valp) & mask, 1,
attr_tab, TABLEN(attr_tab));
printf("%s%s", first ? "" : ",", p);
first = 0;
}
mask >>= 1;
}
if (first)
printf("none");
break;
default:
errx(1, "internal error: pr_field: no format %d", f->format);
break;
@ -343,6 +384,25 @@ rd_field(f, val, merge)
bcopy(newkbmap.map, kbmap.map,
kbmap.maplen*sizeof(struct wscons_keymap));
break;
case FMT_COLOR:
i = name2int(val, color_tab, TABLEN(color_tab));
if (i == -1)
errx(1, "%s: not a valid color", val);
*((u_int *) f->valp) = i;
break;
case FMT_ATTRS:
p = val;
while (p) {
val = p;
p = strchr(p, ',');
if (p != NULL)
*p++ = '\0';
i = name2int(val, attr_tab, TABLEN(attr_tab));
if (i == -1)
errx(1, "%s: not a valid attribute", val);
*((u_int *) f->valp) |= i;
}
break;
default:
errx(1, "internal error: rd_field: no format %d", f->format);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsconsctl.h,v 1.3 2002/04/07 10:40:04 hannken Exp $ */
/* $NetBSD: wsconsctl.h,v 1.4 2004/07/28 12:34:05 jmmv Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -38,6 +38,24 @@
#include <dev/wscons/wsksymvar.h>
/* fg / bg values. Made identical to ANSI terminal color codes. */
#define WSCOL_UNSUPPORTED -1
#define WSCOL_BLACK 0
#define WSCOL_RED 1
#define WSCOL_GREEN 2
#define WSCOL_BROWN 3
#define WSCOL_BLUE 4
#define WSCOL_MAGENTA 5
#define WSCOL_CYAN 6
#define WSCOL_WHITE 7
/* flag values: */
#define WSATTR_NONE 0
#define WSATTR_REVERSE 1
#define WSATTR_HILIT 2
#define WSATTR_BLINK 4
#define WSATTR_UNDERLINE 8
#define WSATTR_WSCOLORS 16
struct field {
char *name;
void *valp;
@ -48,6 +66,8 @@ struct field {
#define FMT_DPYTYPE 103 /* display type */
#define FMT_KBDENC 104 /* keyboard encoding */
#define FMT_KBMAP 105 /* keyboard map */
#define FMT_COLOR 201 /* display color */
#define FMT_ATTRS 202 /* display attributes */
int format;
#define FLG_RDONLY 0x0001 /* variable cannot be modified */
#define FLG_WRONLY 0x0002 /* variable cannot be displayed */

View File

@ -1,4 +1,4 @@
.\" $NetBSD: wscons.4,v 1.22 2004/02/26 23:03:58 hubertf Exp $
.\" $NetBSD: wscons.4,v 1.23 2004/07/28 12:34:05 jmmv Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -31,7 +31,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 27, 2004
.Dd July 28, 2004
.Dt WSCONS 4
.Os
.Sh NAME
@ -42,6 +42,10 @@
.Cd options WSEMUL_VT100
.Cd options WSEMUL_NO_DUMB
.Cd options WSEMUL_DEFAULT=\&"xxx\&"
.Cd options WS_DEFAULT_FG=WSCOL_XXX
.Cd options WS_DEFAULT_BG=WSCOL_XXX
.Cd options WS_DEFAULT_COLATTR=\&"(WSATTR_XXX | WSATTR_YYY)"
.Cd options WS_DEFAULT_MONOATTR=\&"(WSATTR_XXX | WSATTR_YYY)"
.Cd options WS_KERNEL_FG=WSCOL_XXX
.Cd options WS_KERNEL_BG=WSCOL_XXX
.Cd options WS_KERNEL_COLATTR=\&"(WSATTR_XXX | WSATTR_YYY)"
@ -216,6 +220,31 @@ find the
driver entry points, symlinks are a helpful measure.)
.Ss Other options
.Bl -tag -width xxxxxxxx
.It Cd options WS_DEFAULT_FG=WSCOL_XXX ,
.It Cd options WS_DEFAULT_BG=WSCOL_XXX ,
.It Cd options \&WS_DEFAULT_COLATTR="(WSATTR_XXX | WSATTR_YYY)"
and
.It Cd options \&WS_DEFAULT_MONOATTR="(WSATTR_XXX | WSATTR_YYY)"
allow to make default console output appear in specific colors and
attributes.
.Dq WS_DEFAULT_FG
and
.Dq WS_DEFAULT_BG
set the foreground / background used on color displays. The
.Dq WSCOL_XXX
arguments are colors as defined in
.Pa src/sys/dev/wscons/wsdisplayvar.h .
.Dq WS_DEFAULT_COLATTR
and
.Dq WS_DEFAULT_MONOATTR
are additional attribute flags used on color or monochrome displays,
respectively.
The arguments are defined in the same header file.
Whether the attributes
are supported or not depends on the actually used graphics adapter.
These options are ignored by the
.Dq dumb
terminal emulation.
.It Cd options WS_KERNEL_FG=WSCOL_XXX ,
.It Cd options WS_KERNEL_BG=WSCOL_XXX ,
.It Cd options \&WS_KERNEL_COLATTR="(WSATTR_XXX | WSATTR_YYY)"
@ -227,23 +256,9 @@ than output from user level programs (via
or the specific tty
device like
.Pa /dev/ttyE0 ) .
.Dq WS_KERNEL_FG
and
.Dq WS_KERNEL_BG
set the foreground / background used on color displays. The
.Dq WSCOL_XXX
arguments are colors as defined in
.Pa src/sys/dev/wscons/wsdisplayvar.h .
.Dq WS_KERNEL_COLATTR
and
.Dq WS_KERNEL_MONOATTR
are additional attribute flags used on color or monochrome displays,
respectively.
The arguments are defined in the same header file. Whether the attributes
are supported or not depends on the actually used graphics adapter.
These options are ignored by the
.Dq dumb
terminal emulation.
Their meaning is the same as their
.Sq WS_DEFAULT_*
counterparts.
.It Cd options WSCOMPAT_USL_SYNCTIMEOUT=nnn
The virtual screen switching protocol enabled by
.Dq WSDISPLAY_COMPAT_USL

View File

@ -1,4 +1,4 @@
.\" $NetBSD: wsdisplay.4,v 1.22 2004/07/21 00:14:28 heas Exp $
.\" $NetBSD: wsdisplay.4,v 1.23 2004/07/28 12:34:05 jmmv Exp $
.\"
.\" Copyright (c) 1999 Matthias Drochner.
.\" Copyright (c) 2002 Ben Harris.
@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd July 20, 2004
.Dd July 28, 2004
.Os
.Dt WSDISPLAY 4
.Sh NAME
@ -401,6 +401,42 @@ For possible arguments, see
.Pp
.It Dv WSDISPLAYIO_LINEBYTES Pq Li u_int
Get the number of bytes per row, which may be the same as the number of pixels.
.It Dv WSDISPLAYIO_GMSGATTRS Pq Li struct wsdisplay_msgattrs
Get the attributes (colors and flags) used to print console messages, including
separate fields for default output and kernel output.
The returned structure is as follows:
.Bd -literal -offset indent
struct wsdisplay_msgattrs {
int default_attrs, default_bg, default_fg;
int kernel_attrs, kernel_bg, kernel_fg;
};
.Ed
.Pp
The
.Va default_attrs
and
.Va kernel_attrs
variables are a combination of
.Va WSATTR_*
bits, and specify the attribues used to draw messages.
The
.Va default_bg ,
.Va default_fg ,
.Va kernel_bg
and
.Va kernel_fg
variables specify the colors used to print messages, being
.Sq _bg
for the background and
.Sq _fg
for the foreground; their values are one of all the
.Va WSCOL_*
macros available.
.It Dv WSDISPLAYIO_SMSGATTRS Pq Li struct wsdisplay_msgattrs
Set the attributes (colors and flags) used to print console messages, including
separate fields for default output and kernel output.
The argument structure is the same as for
.Dv WSDISPLAYIO_GMSGATTRS .
.El
.Sh FILES
.Bl -item

View File

@ -1,4 +1,4 @@
# $NetBSD: DELPHI,v 1.37 2004/07/15 03:53:47 atatat Exp $
# $NetBSD: DELPHI,v 1.38 2004/07/28 12:34:02 jmmv Exp $
#
# DELPHI -- one of thorpej@zembu.com's devel machines
#
@ -7,7 +7,7 @@ include "arch/i386/conf/std.i386"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
ident "DELPHI-$Revision: 1.37 $"
ident "DELPHI-$Revision: 1.38 $"
maxusers 64 # estimated number of users
@ -160,9 +160,16 @@ options SCSIVERBOSE # human readable SCSI error messages
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
#options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.623 2004/07/19 14:23:59 tron Exp $
# $NetBSD: GENERIC,v 1.624 2004/07/28 12:34:02 jmmv Exp $
#
# GENERIC machine description file
#
@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.623 $"
#ident "GENERIC-$Revision: 1.624 $"
maxusers 32 # estimated number of users
@ -226,9 +226,16 @@ options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC_LAPTOP,v 1.107 2004/07/19 14:23:59 tron Exp $
# $NetBSD: GENERIC_LAPTOP,v 1.108 2004/07/28 12:34:02 jmmv Exp $
# From: NetBSD: GENERIC,v 1.414 2001/07/30 19:59:05 ad Exp
#
# GENERIC_LAPTOP -- GENERIC with cardbus and some USB devices enabled
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.107 $"
#ident "GENERIC-$Revision: 1.108 $"
maxusers 32 # estimated number of users
@ -190,9 +190,16 @@ options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC_TINY,v 1.69 2004/07/15 03:53:47 atatat Exp $
# $NetBSD: GENERIC_TINY,v 1.70 2004/07/28 12:34:02 jmmv Exp $
#
# GENERIC_TINY -- suitable default for 4M machines
# No EISA, PCI, or SCSI.
@ -170,9 +170,16 @@ config netbsd root on ? type ?
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
#options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL,v 1.245 2004/07/19 14:24:00 tron Exp $
# $NetBSD: INSTALL,v 1.246 2004/07/28 12:34:02 jmmv Exp $
#
# INSTALL - Installation kernel.
#
@ -158,9 +158,16 @@ options INET6 # IPv6
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
options WS_KERNEL_FG=WSCOL_WHITE
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
#options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
#options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
#options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
#options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL_LAPTOP,v 1.64 2004/07/23 15:36:00 he Exp $
# $NetBSD: INSTALL_LAPTOP,v 1.65 2004/07/28 12:34:04 jmmv Exp $
#
# INSTALL - Installation kernel.
#
@ -156,9 +156,16 @@ options INET6 # IPv6
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
options WS_KERNEL_FG=WSCOL_WHITE
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
#options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
#options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
#options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
#options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: IOPENER,v 1.46 2004/07/15 03:53:49 atatat Exp $
# $NetBSD: IOPENER,v 1.47 2004/07/28 12:34:04 jmmv Exp $
#
# IOPENER -- GENERIC-like kernel for the Netpliance i-opener
# from: GENERIC,v 1.358 2000/07/05 04:07:25 sommerfeld Exp
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "IOPENER-$Revision: 1.46 $"
#ident "IOPENER-$Revision: 1.47 $"
maxusers 32 # estimated number of users
@ -143,9 +143,16 @@ options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: LAMB,v 1.37 2004/07/15 03:53:49 atatat Exp $
# $NetBSD: LAMB,v 1.38 2004/07/28 12:34:04 jmmv Exp $
#
# LAMB - a complete kernel for wildlab LAMB, http://www.wildlab.com/
#
@ -164,9 +164,16 @@ options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: SWINGER,v 1.50 2004/07/15 03:53:49 atatat Exp $
# $NetBSD: SWINGER,v 1.51 2004/07/28 12:34:04 jmmv Exp $
# from NetBSD: GENERIC,v 1.325 2000/04/14 14:53:32 augustss Exp
#
# SWINGER -- thorpej's Abit BP6+dual Celeron
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "SWINGER-$Revision: 1.50 $"
#ident "SWINGER-$Revision: 1.51 $"
maxusers 64 # estimated number of users
@ -156,9 +156,16 @@ options USBVERBOSE # verbose USB device autoconfig messages
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
#options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
# $NetBSD: VIRTUALPC,v 1.7 2004/07/15 03:53:49 atatat Exp $
# $NetBSD: VIRTUALPC,v 1.8 2004/07/28 12:34:04 jmmv Exp $
#
# VIRTUALPC machine description file --
#
@ -11,7 +11,7 @@ include "arch/i386/conf/std.i386"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "VIRTUALPC-$Revision: 1.7 $"
#ident "VIRTUALPC-$Revision: 1.8 $"
maxusers 32 # estimated number of users
@ -198,9 +198,16 @@ options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
# builtin terminal emulations
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
#options WS_DEFAULT_FG=WSCOL_WHITE
#options WS_DEFAULT_BG=WSCOL_BLACK
#options WS_DEFAULT_COLATTR=""
#options WS_DEFAULT_MONOATTR=""
options WS_KERNEL_FG=WSCOL_GREEN
#options WS_KERNEL_BG=WSCOL_BLACK
#options WS_KERNEL_COLATTR=""
#options WS_KERNEL_MONOATTR=""
# compatibility to other console drivers
options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcdisplay_subr.c,v 1.26 2004/05/28 21:42:29 christos Exp $ */
/* $NetBSD: pcdisplay_subr.c,v 1.27 2004/07/28 12:34:04 jmmv Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcdisplay_subr.c,v 1.26 2004/05/28 21:42:29 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: pcdisplay_subr.c,v 1.27 2004/07/28 12:34:04 jmmv Exp $");
#include "opt_wsdisplay_compat.h" /* for WSDISPLAY_CHARFUNCS */
#include "opt_wsmsgattrs.h" /* for WSDISPLAY_CUSTOM_OUTPUT */
#include <sys/param.h>
#include <sys/systm.h>
@ -41,8 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: pcdisplay_subr.c,v 1.26 2004/05/28 21:42:29 christos
#include <dev/wscons/wsdisplayvar.h>
#include "opt_wsdisplay_compat.h" /* for WSDISPLAY_CHARFUNCS */
void
pcdisplay_cursor_init(scr, existing)
struct pcdisplayscreen *scr;
@ -278,6 +279,40 @@ pcdisplay_eraserows(id, startrow, nrows, fillattr)
scr->mem[off + i] = val;
}
#ifdef WSDISPLAY_CUSTOM_OUTPUT
void
pcdisplay_replaceattr(id, oldattr, newattr)
void *id;
long oldattr, newattr;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int off;
uint16_t chardata;
if (scr->active)
for (off = 0; off < scr->type->nrows * scr->type->ncols;
off++) {
chardata = bus_space_read_2(memt, memh,
scr->dispoffset + off * 2);
if ((long)(chardata >> 8) == oldattr)
bus_space_write_2(memt, memh,
scr->dispoffset + off * 2,
((u_int16_t)(newattr << 8)) |
(chardata & 0x00FF));
}
else
for (off = 0; off < scr->type->nrows * scr->type->ncols;
off++) {
chardata = scr->mem[off];
if ((long)(chardata >> 8) == oldattr)
scr->mem[off] = ((u_int16_t)(newattr << 8)) |
(chardata & 0x00FF);
}
}
#endif /* WSDISPLAY_CUSTOM_OUTPUT */
#ifdef WSDISPLAY_CHARFUNCS
int
pcdisplay_getwschar(id, wschar)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcdisplayvar.h,v 1.13 2004/05/28 21:42:29 christos Exp $ */
/* $NetBSD: pcdisplayvar.h,v 1.14 2004/07/28 12:34:04 jmmv Exp $ */
/*
* Copyright (c) 1998
@ -88,6 +88,7 @@ void pcdisplay_copycols(void *, int, int, int,int);
void pcdisplay_erasecols(void *, int, int, int, long);
void pcdisplay_copyrows(void *, int, int, int);
void pcdisplay_eraserows(void *, int, int, long);
void pcdisplay_replaceattr(void *, long, long);
struct wsdisplay_char;
int pcdisplay_getwschar(void *, struct wsdisplay_char *);
int pcdisplay_putwschar(void *, struct wsdisplay_char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vga.c,v 1.74 2004/05/29 02:04:56 christos Exp $ */
/* $NetBSD: vga.c,v 1.75 2004/07/28 12:34:04 jmmv Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -27,8 +27,13 @@
* rights to redistribute these changes.
*/
/* for WSCONS_SUPPORT_PCVTFONTS and WSDISPLAY_CHARFUNCS */
#include "opt_wsdisplay_compat.h"
/* for WSDISPLAY_CUSTOM_OUTPUT */
#include "opt_wsmsgattrs.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.74 2004/05/29 02:04:56 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.75 2004/07/28 12:34:04 jmmv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -51,9 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.74 2004/05/29 02:04:56 christos Exp $");
#include <dev/ic/pcdisplay.h>
/* for WSCONS_SUPPORT_PCVTFONTS and WSDISPLAY_CHARFUNCS */
#include "opt_wsdisplay_compat.h"
int vga_no_builtinfont = 0;
static struct wsdisplay_font _vga_builtinfont = {
@ -134,7 +136,12 @@ const struct wsdisplay_emulops vga_emulops = {
pcdisplay_erasecols,
vga_copyrows,
pcdisplay_eraserows,
vga_allocattr
vga_allocattr,
#ifdef WSDISPLAY_CUSTOM_OUTPUT
pcdisplay_replaceattr,
#else
NULL,
#endif
};
/*
@ -476,6 +483,10 @@ vga_init_screen(struct vga_config *vc, struct vgascreen *scr,
if (!vc->hdl.vh_mono)
/*
* DEC firmware uses a blue background.
* XXX These should be specified as kernel options for
* XXX alpha only, not hardcoded here (which is wrong
* XXX anyway because the emulation layer will assume
* XXX the default attribute is white on black).
*/
res = vga_allocattr(scr, WSCOL_WHITE, WSCOL_BLUE,
WSATTR_WSCOLORS, attrp);

View File

@ -1,4 +1,4 @@
# $NetBSD: files.wscons,v 1.30 2004/05/28 21:42:29 christos Exp $
# $NetBSD: files.wscons,v 1.31 2004/07/28 12:34:04 jmmv Exp $
#
# "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@ -14,8 +14,10 @@
defparam opt_wsemul.h WSEMUL_DEFAULT
defflag opt_wsemul.h WSEMUL_NO_DUMB WSEMUL_SUN WSEMUL_VT100
defparam opt_wskernattr.h WS_KERNEL_FG WS_KERNEL_BG
defparam opt_wsmsgattrs.h WS_DEFAULT_COLATTR WS_DEFAULT_MONOATTR
WS_DEFAULT_BG WS_DEFAULT_FG
WS_KERNEL_COLATTR WS_KERNEL_MONOATTR
WS_KERNEL_BG WS_KERNEL_FG
WSDISPLAY_SCROLLCOMBO
defparam opt_wsemul.h WSEMUL_VT100_HILIT_FG WSEMUL_VT100_UNDERLINE_FG
WSEMUL_VT100_HILIT_BG WSEMUL_VT100_UNDERLINE_BG

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsconsio.h,v 1.67 2004/07/20 20:28:20 heas Exp $ */
/* $NetBSD: wsconsio.h,v 1.68 2004/07/28 12:34:04 jmmv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -443,6 +443,14 @@ struct wsdisplay_scroll_data {
#define WSDISPLAYIO_DGSCROLL _IOR('W', 87, struct wsdisplay_scroll_data)
#define WSDISPLAYIO_DSSCROLL _IOW('W', 88, struct wsdisplay_scroll_data)
struct wsdisplay_msgattrs {
int default_attrs, default_bg, default_fg;
int kernel_attrs, kernel_bg, kernel_fg;
};
#define WSDISPLAYIO_GMSGATTRS _IOR('W', 89, struct wsdisplay_msgattrs)
#define WSDISPLAYIO_SMSGATTRS _IOW('W', 90, struct wsdisplay_msgattrs)
/* XXX NOT YET DEFINED */
/* Mapping information retrieval. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.79 2004/07/20 20:28:20 heas Exp $ */
/* $NetBSD: wsdisplay.c,v 1.80 2004/07/28 12:34:04 jmmv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,9 +31,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.79 2004/07/20 20:28:20 heas Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.80 2004/07/28 12:34:04 jmmv Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_wsmsgattrs.h"
#include "opt_compat_netbsd.h"
#include "wskbd.h"
#include "wsmux.h"
@ -1151,6 +1152,32 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
return ENODEV;
#endif /* WSDISPLAY_CHARFUNCS */
#ifdef WSDISPLAY_CUSTOM_OUTPUT
case WSDISPLAYIO_GMSGATTRS:
#define d ((struct wsdisplay_msgattrs *)data)
(*scr->scr_dconf->wsemul->getmsgattrs)
(scr->scr_dconf->wsemulcookie, d);
return (0);
#undef d
case WSDISPLAYIO_SMSGATTRS: {
#define d ((struct wsdisplay_msgattrs *)data)
int i;
for (i = 0; i < WSDISPLAY_MAXSCREEN; i++)
if (sc->sc_scr[i] != NULL)
(*sc->sc_scr[i]->scr_dconf->wsemul->setmsgattrs)
(sc->sc_scr[i]->scr_dconf->wsemulcookie,
sc->sc_scr[i]->scr_dconf->scrdata,
d);
}
return (0);
#undef d
#else
case WSDISPLAYIO_GMSGATTRS:
case WSDISPLAYIO_SMSGATTRS:
return (ENODEV);
#endif
}
/* check ioctls for display */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplayvar.h,v 1.27 2004/05/28 22:38:28 christos Exp $ */
/* $NetBSD: wsdisplayvar.h,v 1.28 2004/07/28 12:34:04 jmmv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -73,6 +73,7 @@ struct wsdisplay_emulops {
#define WSATTR_UNDERLINE 8
#define WSATTR_WSCOLORS 16
/* XXX need a free_attr() ??? */
void (*replaceattr)(void *c, long oldattr, long newattr);
};
struct wsscreen_descr {
@ -215,3 +216,39 @@ int wsdisplay_stat_inject(struct device *dev, u_int type, int value);
void wsdisplay_switchtoconsole(void);
const struct wsscreen_descr *
wsdisplay_screentype_pick(const struct wsscreen_list *, const char *);
#if defined(_KERNEL)
# if defined(_KERNEL_OPT)
# include "opt_wsmsgattrs.h"
# endif
# if !defined(WS_DEFAULT_FG)
# define WS_DEFAULT_FG WSCOL_WHITE
# endif
# if !defined(WS_DEFAULT_BG)
# define WS_DEFAULT_BG WSCOL_BLACK
# endif
# if !defined(WS_DEFAULT_COLATTR)
# define WS_DEFAULT_COLATTR 0
# endif
# if !defined(WS_DEFAULT_MONOATTR)
# define WS_DEFAULT_MONOATTR 0
# endif
# if defined(WS_KERNEL_FG) || defined(WS_KERNEL_BG) || \
defined(WS_KERNEL_COLATTR) || defined(WS_KERNEL_MONOATTR)
# define WS_KERNEL_CUSTOMIZED
# else
# undef WS_KERNEL_CUSTOMIZED
# endif
# if !defined(WS_KERNEL_FG)
# define WS_KERNEL_FG WS_DEFAULT_FG
# endif
# if !defined(WS_KERNEL_BG)
# define WS_KERNEL_BG WS_DEFAULT_BG
# endif
# if !defined(WS_KERNEL_COLATTR)
# define WS_KERNEL_COLATTR WS_DEFAULT_COLATTR
# endif
# if !defined(WS_KERNEL_MONOATTR)
# define WS_KERNEL_MONOATTR WS_DEFAULT_MONOATTR
# endif
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_sun.c,v 1.17 2002/09/27 15:37:40 provos Exp $ */
/* $NetBSD: wsemul_sun.c,v 1.18 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -33,7 +33,7 @@
/* XXX DESCRIPTION/SOURCE OF INFORMATION */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.17 2002/09/27 15:37:40 provos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.18 2004/07/28 12:34:05 jmmv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -47,7 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.17 2002/09/27 15:37:40 provos Exp $
#include <dev/wscons/wsksymdef.h>
#include <dev/wscons/ascii.h>
#include "opt_wskernattr.h"
#include "opt_wsmsgattrs.h"
void *wsemul_sun_cnattach(const struct wsscreen_descr *, void *,
int, int, long);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_vt100.c,v 1.25 2004/03/24 17:26:53 drochner Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.26 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1998
@ -27,7 +27,9 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.25 2004/03/24 17:26:53 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.26 2004/07/28 12:34:05 jmmv Exp $");
#include "opt_wsmsgattrs.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -41,8 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.25 2004/03/24 17:26:53 drochner E
#include <dev/wscons/wsemul_vt100var.h>
#include <dev/wscons/ascii.h>
#include "opt_wskernattr.h"
void *wsemul_vt100_cnattach(const struct wsscreen_descr *, void *,
int, int, long);
void *wsemul_vt100_attach(int console, const struct wsscreen_descr *,
@ -50,6 +50,11 @@ void *wsemul_vt100_attach(int console, const struct wsscreen_descr *,
void wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int);
void wsemul_vt100_detach(void *cookie, u_int *crowp, u_int *ccolp);
void wsemul_vt100_resetop(void *, enum wsemul_resetops);
#ifdef WSDISPLAY_CUSTOM_OUTPUT
static void wsemul_vt100_getmsgattrs(void *, struct wsdisplay_msgattrs *);
static void wsemul_vt100_setmsgattrs(void *, const struct wsscreen_descr *,
const struct wsdisplay_msgattrs *);
#endif /* WSDISPLAY_CUSTOM_OUTPUT */
const struct wsemul_ops wsemul_vt100_ops = {
"vt100",
@ -58,7 +63,14 @@ const struct wsemul_ops wsemul_vt100_ops = {
wsemul_vt100_output,
wsemul_vt100_translate,
wsemul_vt100_detach,
wsemul_vt100_resetop
wsemul_vt100_resetop,
#ifdef WSDISPLAY_CUSTOM_OUTPUT
wsemul_vt100_getmsgattrs,
wsemul_vt100_setmsgattrs,
#else
NULL,
NULL,
#endif
};
struct wsemul_vt100_emuldata wsemul_vt100_console_emuldata;
@ -122,6 +134,8 @@ wsemul_vt100_init(struct wsemul_vt100_emuldata *edp,
const struct wsscreen_descr *type, void *cookie, int ccol, int crow,
long defattr)
{
int error;
edp->emulops = type->textops;
edp->emulcookie = cookie;
edp->scrcapabilities = type->capabilities;
@ -129,7 +143,64 @@ wsemul_vt100_init(struct wsemul_vt100_emuldata *edp,
edp->ncols = type->ncols;
edp->crow = crow;
edp->ccol = ccol;
edp->defattr = defattr;
/* The underlying driver has already allocated a default and simple
* attribute for us, which is stored in defattr. We try to set the
* values specified by the kernel options below, but in case of
* failure we fallback to the value given by the driver. */
if (type->capabilities & WSSCREEN_WSCOLORS) {
edp->msgattrs.default_attrs = WS_DEFAULT_COLATTR |
WSATTR_WSCOLORS;
edp->msgattrs.default_bg = WS_DEFAULT_BG;
edp->msgattrs.default_fg = WS_DEFAULT_FG;
edp->msgattrs.kernel_attrs = WS_KERNEL_COLATTR |
WSATTR_WSCOLORS;
edp->msgattrs.kernel_bg = WS_KERNEL_BG;
edp->msgattrs.kernel_fg = WS_KERNEL_FG;
} else {
edp->msgattrs.default_attrs = WS_DEFAULT_MONOATTR;
edp->msgattrs.default_bg = edp->msgattrs.default_fg = 0;
edp->msgattrs.kernel_attrs = WS_KERNEL_MONOATTR;
edp->msgattrs.kernel_bg = edp->msgattrs.kernel_fg = 0;
}
error = (*edp->emulops->allocattr)(cookie,
edp->msgattrs.default_fg,
edp->msgattrs.default_bg,
edp->msgattrs.default_attrs,
&edp->defattr);
if (error) {
edp->defattr = defattr;
/* XXX This assumes the driver has allocated white on black
* XXX as the default attribute, which is not always true.
* XXX Maybe we need an emulop that, given an attribute,
* XXX (defattr) returns its flags and colors? */
edp->msgattrs.default_attrs = 0;
edp->msgattrs.default_bg = WSCOL_BLACK;
edp->msgattrs.default_fg = WSCOL_WHITE;
} else {
if (edp->emulops->replaceattr != NULL)
(*edp->emulops->replaceattr)(cookie, defattr,
edp->defattr);
}
#if defined(WS_KERNEL_CUSTOMIZED)
/* Set up kernel colors, in case they were customized by the user;
* otherwise default to the colors specified for the console.
* In case of failure, we use console colors too; we can assume
* they are good as they have been previously allocated and
* verified. */
error = (*edp->emulops->allocattr)(cookie,
edp->msgattrs.kernel_fg,
edp->msgattrs.kernel_bg,
edp->msgattrs.kernel_attrs,
&edp->kernattr);
if (error)
#endif
edp->kernattr = edp->defattr;
}
void *
@ -137,10 +208,6 @@ wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie,
int ccol, int crow, long defattr)
{
struct wsemul_vt100_emuldata *edp;
#if defined(WS_KERNEL_FG) || defined(WS_KERNEL_BG) || \
defined(WS_KERNEL_COLATTR) || defined(WS_KERNEL_MONOATTR)
int res;
#endif
edp = &wsemul_vt100_console_emuldata;
wsemul_vt100_init(edp, type, cookie, ccol, crow, defattr);
@ -149,33 +216,6 @@ wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie,
#endif
edp->cbcookie = NULL;
#if defined(WS_KERNEL_FG) || defined(WS_KERNEL_BG) || \
defined(WS_KERNEL_COLATTR) || defined(WS_KERNEL_MONOATTR)
#ifndef WS_KERNEL_FG
#define WS_KERNEL_FG WSCOL_WHITE
#endif
#ifndef WS_KERNEL_BG
#define WS_KERNEL_BG WSCOL_BLACK
#endif
#ifndef WS_KERNEL_COLATTR
#define WS_KERNEL_COLATTR 0
#endif
#ifndef WS_KERNEL_MONOATTR
#define WS_KERNEL_MONOATTR 0
#endif
if (type->capabilities & WSSCREEN_WSCOLORS)
res = (*edp->emulops->allocattr)(cookie,
WS_KERNEL_FG, WS_KERNEL_BG,
WS_KERNEL_COLATTR | WSATTR_WSCOLORS,
&edp->kernattr);
else
res = (*edp->emulops->allocattr)(cookie, 0, 0,
WS_KERNEL_MONOATTR,
&edp->kernattr);
if (res)
#endif
edp->kernattr = defattr;
edp->tabs = 0;
edp->dblwid = 0;
edp->dw = 0;
@ -270,9 +310,9 @@ wsemul_vt100_reset(struct wsemul_vt100_emuldata *edp)
edp->state = VT100_EMUL_STATE_NORMAL;
edp->flags = VTFL_DECAWM | VTFL_CURSORON;
edp->bkgdattr = edp->curattr = edp->defattr;
edp->attrflags = 0;
edp->fgcol = WSCOL_WHITE;
edp->bgcol = WSCOL_BLACK;
edp->attrflags = edp->msgattrs.default_attrs;
edp->fgcol = edp->msgattrs.default_fg;
edp->bgcol = edp->msgattrs.default_bg;
edp->scrreg_startrow = 0;
edp->scrreg_nrows = edp->nrows;
if (edp->tabs) {
@ -939,3 +979,78 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel)
(*edp->emulops->cursor)(edp->emulcookie, 1,
edp->crow, edp->ccol << edp->dw);
}
#ifdef WSDISPLAY_CUSTOM_OUTPUT
static void
wsemul_vt100_getmsgattrs(void *cookie, struct wsdisplay_msgattrs *ma)
{
struct wsemul_vt100_emuldata *edp = cookie;
*ma = edp->msgattrs;
}
static void
wsemul_vt100_setmsgattrs(void *cookie, const struct wsscreen_descr *type,
const struct wsdisplay_msgattrs *ma)
{
int error;
long tmp;
struct wsemul_vt100_emuldata *edp = cookie;
edp->msgattrs = *ma;
if (type->capabilities & WSSCREEN_WSCOLORS) {
edp->msgattrs.default_attrs |= WSATTR_WSCOLORS;
edp->msgattrs.kernel_attrs |= WSATTR_WSCOLORS;
} else {
edp->msgattrs.default_bg = edp->msgattrs.kernel_bg = 0;
edp->msgattrs.default_fg = edp->msgattrs.kernel_fg = 0;
}
error = (*edp->emulops->allocattr)(edp->emulcookie,
edp->msgattrs.default_fg,
edp->msgattrs.default_bg,
edp->msgattrs.default_attrs,
&tmp);
#ifdef VT100_DEBUG
if (error)
printf("vt100: failed to allocate attribute for default "
"messages\n");
else
#endif
{
if (edp->curattr == edp->defattr) {
edp->bkgdattr = edp->curattr = tmp;
edp->attrflags = edp->msgattrs.default_attrs;
edp->bgcol = edp->msgattrs.default_bg;
edp->fgcol = edp->msgattrs.default_fg;
} else {
edp->savedbkgdattr = edp->savedattr = tmp;
edp->savedattrflags = edp->msgattrs.default_attrs;
edp->savedbgcol = edp->msgattrs.default_bg;
edp->savedfgcol = edp->msgattrs.default_fg;
}
if (edp->emulops->replaceattr != NULL)
(*edp->emulops->replaceattr)(edp->emulcookie,
edp->defattr, tmp);
edp->defattr = tmp;
}
error = (*edp->emulops->allocattr)(edp->emulcookie,
edp->msgattrs.kernel_fg,
edp->msgattrs.kernel_bg,
edp->msgattrs.kernel_attrs,
&tmp);
#ifdef VT100_DEBUG
if (error)
printf("vt100: failed to allocate attribute for kernel "
"messages\n");
else
#endif
{
if (edp->emulops->replaceattr != NULL)
(*edp->emulops->replaceattr)(edp->emulcookie,
edp->kernattr, tmp);
edp->kernattr = tmp;
}
}
#endif /* WSDISPLAY_CUSTOM_OUTPUT */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_vt100_chars.c,v 1.9 2004/03/24 17:26:53 drochner Exp $ */
/* $NetBSD: wsemul_vt100_chars.c,v 1.10 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1998
@ -27,10 +27,11 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_chars.c,v 1.9 2004/03/24 17:26:53 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_chars.c,v 1.10 2004/07/28 12:34:05 jmmv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsksymvar.h>
#include <dev/wscons/wsemulvar.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_vt100_keys.c,v 1.6 2004/03/24 17:26:53 drochner Exp $ */
/* $NetBSD: wsemul_vt100_keys.c,v 1.7 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1998
@ -27,11 +27,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_keys.c,v 1.6 2004/03/24 17:26:53 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_keys.c,v 1.7 2004/07/28 12:34:05 jmmv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsksymvar.h>
#include <dev/wscons/wsksymdef.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_vt100_subr.c,v 1.16 2004/04/23 21:29:16 itojun Exp $ */
/* $NetBSD: wsemul_vt100_subr.c,v 1.17 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1998
@ -27,11 +27,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.16 2004/04/23 21:29:16 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.17 2004/07/28 12:34:05 jmmv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsksymvar.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsemulvar.h>
@ -474,14 +475,14 @@ wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *edp, u_char c)
case 0: /* reset */
if (n == edp->nargs - 1) {
edp->bkgdattr = edp->curattr = edp->defattr;
edp->attrflags = 0;
edp->fgcol = WSCOL_WHITE;
edp->bgcol = WSCOL_BLACK;
edp->attrflags = edp->msgattrs.default_attrs;
edp->fgcol = edp->msgattrs.default_fg;
edp->bgcol = edp->msgattrs.default_bg;
return;
}
flags = 0;
fgcol = WSCOL_WHITE;
bgcol = WSCOL_BLACK;
flags = edp->msgattrs.default_attrs;
fgcol = edp->msgattrs.default_fg;
bgcol = edp->msgattrs.default_bg;
break;
case 1: /* bold */
flags |= WSATTR_HILIT;
@ -622,13 +623,13 @@ vt100_selectattribute(struct wsemul_vt100_emuldata *edp,
{
int error;
if ((flags & WSATTR_WSCOLORS) &&
!(edp->scrcapabilities & WSSCREEN_WSCOLORS)) {
if (!(edp->scrcapabilities & WSSCREEN_WSCOLORS)) {
flags &= ~WSATTR_WSCOLORS;
#ifdef VT100_DEBUG
printf("colors ignored (impossible)\n");
#endif
}
} else
flags |= WSATTR_WSCOLORS;
error = (*edp->emulops->allocattr)(edp->emulcookie, fgcol, bgcol,
flags & WSATTR_WSCOLORS, bkgdattr);
if (error)

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_vt100var.h,v 1.8 2004/03/24 17:26:53 drochner Exp $ */
/* $NetBSD: wsemul_vt100var.h,v 1.9 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1998
@ -33,6 +33,7 @@ struct wsemul_vt100_emuldata {
void *emulcookie;
int scrcapabilities;
u_int nrows, ncols, crow, ccol;
struct wsdisplay_msgattrs msgattrs;
long defattr; /* default attribute */
long kernattr; /* attribute for kernel output */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemulconf.c,v 1.5 2001/10/13 15:56:16 augustss Exp $ */
/* $NetBSD: wsemulconf.c,v 1.6 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,11 +31,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemulconf.c,v 1.5 2001/10/13 15:56:16 augustss Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemulconf.c,v 1.6 2004/07/28 12:34:05 jmmv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsksymvar.h>
#include <dev/wscons/wsemulvar.h> /* pulls in opt_wsemul.h */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemulvar.h,v 1.8 2001/10/13 15:56:16 augustss Exp $ */
/* $NetBSD: wsemulvar.h,v 1.9 2004/07/28 12:34:05 jmmv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -50,6 +50,9 @@ struct wsemul_ops {
int (*translate)(void *, keysym_t, char **);
void (*detach)(void *cookie, u_int *crow, u_int *ccol);
void (*reset)(void *, enum wsemul_resetops);
void (*getmsgattrs)(void *, struct wsdisplay_msgattrs *);
void (*setmsgattrs)(void *, const struct wsscreen_descr *,
const struct wsdisplay_msgattrs *);
};
#if defined(_KERNEL_OPT)