Make it possible to add a mux.

This commit is contained in:
augustss 1999-07-29 18:24:09 +00:00
parent 3d3f77c49e
commit e7af5efe23
2 changed files with 36 additions and 14 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: wsconscfg.8,v 1.5 1999/05/15 14:45:06 drochner Exp $
.\" $NetBSD: wsconscfg.8,v 1.6 1999/07/29 18:24:09 augustss Exp $
.\"
.Dd January 12, 1999
.Os
@ -11,6 +11,7 @@
.Op Fl f Ar <ctldev>
.Op Fl d Op Fl F
.Op Fl k
.Op Fl m
.Op Fl t Ar <type>
.Op Fl e Ar <emul>
.Ar index
@ -48,8 +49,12 @@ graphics program (X server) cannot be deleted. With the
.Fl k
flag, the keyboard specified by
.Dq index
(or the currently connected one, if none is given) will be detached from
the wscons display.
will be detached from the wscons display.
With the
.Fl m
flag, the multiplexor specified by
.Dq index
will be detached from the wscons display.
.It Fl F
Force deleting of a terminal even if it is in use by a user space program.
.It Fl k
@ -57,6 +62,9 @@ Do keyboard related operations instead of virtual screen configuration.
Without other flags, a keyboard will be attached to the display device. The
.Dq index
argument can be omitted, in this case the first free keyboard will be used.
.It Fl m
Do multiplexor related operations instead of virtual screen configuration.
Without other flags, a multiplexor will be attached to the display device.
.It Fl t Ar type
Specify a screen type to use. Screen types refer to display format, colour
depth and other low-level display properties. Valid

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsconscfg.c,v 1.3 1999/05/15 14:24:45 drochner Exp $ */
/* $NetBSD: wsconscfg.c,v 1.4 1999/07/29 18:24:10 augustss Exp $ */
/*
* Copyright (c) 1999
@ -52,8 +52,8 @@ usage()
extern char *__progname;
(void)fprintf(stderr,
"Usage: %s [-f wsdev] [-d [-F]] [-k] [-t type] [-e emul]"
" {vt | [kbd]}\n", __progname);
"Usage: %s [-f wsdev] [-d [-F]] [-k] [-m] [-t type]"
"[-e emul] {vt | [kbd] | [mux]}\n", __progname);
exit(1);
}
@ -63,19 +63,20 @@ main(argc, argv)
char **argv;
{
char *wsdev;
int c, delete, kbd, idx, wsfd, res;
int c, delete, kbd, idx, wsfd, res, mux;
struct wsdisplay_addscreendata asd;
struct wsdisplay_delscreendata dsd;
struct wsdisplay_kbddata kd;
struct wsmux_device wmd;
wsdev = DEFDEV;
delete = 0;
kbd = 0;
mux = 0;
asd.screentype = 0;
asd.emul = 0;
dsd.flags = 0;
while ((c = getopt(argc, argv, "f:dkt:e:F")) != -1) {
while ((c = getopt(argc, argv, "f:dkmt:e:F")) != -1) {
switch (c) {
case 'f':
wsdev = optarg;
@ -86,6 +87,10 @@ main(argc, argv)
case 'k':
kbd++;
break;
case 'm':
mux++;
kbd++;
break;
case 't':
asd.screentype = optarg;
break;
@ -116,11 +121,20 @@ main(argc, argv)
err(2, wsdev);
if (kbd) {
kd.op = delete ? WSDISPLAY_KBD_DEL : WSDISPLAY_KBD_ADD;
kd.idx = idx;
res = ioctl(wsfd, WSDISPLAYIO_SETKEYBOARD, &kd);
if (res < 0)
err(3, "WSDISPLAYIO_SETKEYBOARD");
if (mux)
wmd.type = WSMUX_MUX;
else
wmd.type = WSMUX_KBD;
wmd.idx = idx;
if (delete) {
res = ioctl(wsfd, WSMUX_REMOVE_DEVICE, &wmd);
if (res < 0)
err(3, "WSMUX_REMOVE_DEVICE");
} else {
res = ioctl(wsfd, WSMUX_ADD_DEVICE, &wmd);
if (res < 0)
err(3, "WSMUX_ADD_DEVICE");
}
} else if (delete) {
dsd.idx = idx;
res = ioctl(wsfd, WSDISPLAYIO_DELSCREEN, &dsd);