1994-08-17 09:00:13 +00:00
|
|
|
/*-
|
2011-12-30 00:59:08 +00:00
|
|
|
* Copyright (c) 1994-1996 Søren Schmidt
|
1994-08-17 09:00:13 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
* Portions of this software are based in part on the work of
|
|
|
|
* Sascha Wildner <saw@online.de> contributed to The DragonFly Project
|
|
|
|
*
|
1994-08-17 09:00:13 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
1995-01-28 22:18:05 +00:00
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
* in this position and unchanged.
|
1994-08-17 09:00:13 +00:00
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
2002-06-02 20:05:59 +00:00
|
|
|
* derived from this software without specific prior written permission
|
1994-08-17 09:00:13 +00:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
*
|
|
|
|
* $DragonFly: src/usr.sbin/vidcontrol/vidcontrol.c,v 1.10 2005/03/02 06:08:29 joerg Exp $
|
1994-08-17 09:00:13 +00:00
|
|
|
*/
|
|
|
|
|
1997-10-27 07:52:10 +00:00
|
|
|
#ifndef lint
|
|
|
|
static const char rcsid[] =
|
1999-08-28 01:35:59 +00:00
|
|
|
"$FreeBSD$";
|
1997-10-27 07:52:10 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
#include <ctype.h>
|
1997-10-27 07:52:10 +00:00
|
|
|
#include <err.h>
|
2000-01-12 12:30:33 +00:00
|
|
|
#include <limits.h>
|
1994-08-17 09:00:13 +00:00
|
|
|
#include <stdio.h>
|
1997-03-07 01:34:47 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
1997-10-27 07:52:10 +00:00
|
|
|
#include <unistd.h>
|
2000-10-08 21:34:00 +00:00
|
|
|
#include <sys/fbio.h>
|
|
|
|
#include <sys/consio.h>
|
2014-05-29 13:09:48 +00:00
|
|
|
#include <sys/endian.h>
|
1994-08-17 09:00:13 +00:00
|
|
|
#include <sys/errno.h>
|
2014-05-29 13:09:48 +00:00
|
|
|
#include <sys/param.h>
|
2001-04-09 17:24:29 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2014-05-29 13:09:48 +00:00
|
|
|
#include <sys/sysctl.h>
|
1994-08-17 09:00:13 +00:00
|
|
|
#include "path.h"
|
1997-03-07 01:34:47 +00:00
|
|
|
#include "decode.h"
|
1994-08-17 09:00:13 +00:00
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
#define DATASIZE(x) ((x).w * (x).h * 256 / 8)
|
2001-01-25 16:53:22 +00:00
|
|
|
|
2002-08-19 16:33:23 +00:00
|
|
|
/* Screen dump modes */
|
|
|
|
#define DUMP_FMT_RAW 1
|
|
|
|
#define DUMP_FMT_TXT 2
|
|
|
|
/* Screen dump options */
|
|
|
|
#define DUMP_FBF 0
|
|
|
|
#define DUMP_ALL 1
|
|
|
|
/* Screen dump file format revision */
|
2001-05-19 06:47:36 +00:00
|
|
|
#define DUMP_FMT_REV 1
|
|
|
|
|
2011-12-11 21:02:33 +00:00
|
|
|
static const char *legal_colors[16] = {
|
1994-08-17 09:00:13 +00:00
|
|
|
"black", "blue", "green", "cyan",
|
|
|
|
"red", "magenta", "brown", "white",
|
|
|
|
"grey", "lightblue", "lightgreen", "lightcyan",
|
|
|
|
"lightred", "lightmagenta", "yellow", "lightwhite"
|
1995-02-22 13:48:07 +00:00
|
|
|
};
|
1994-08-17 09:00:13 +00:00
|
|
|
|
2012-10-19 14:49:42 +00:00
|
|
|
static struct {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
int active_vty;
|
|
|
|
vid_info_t console_info;
|
|
|
|
unsigned char screen_map[256];
|
|
|
|
int video_mode_number;
|
|
|
|
struct video_info video_mode_info;
|
|
|
|
} cur_info;
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
struct vt4font_header {
|
|
|
|
uint8_t magic[8];
|
|
|
|
uint8_t width;
|
|
|
|
uint8_t height;
|
|
|
|
uint16_t pad;
|
|
|
|
uint32_t glyph_count;
|
|
|
|
uint32_t map_count[4];
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-11 21:02:33 +00:00
|
|
|
static int hex = 0;
|
|
|
|
static int vesa_cols;
|
|
|
|
static int vesa_rows;
|
|
|
|
static int font_height;
|
|
|
|
static int colors_changed;
|
|
|
|
static int video_mode_changed;
|
|
|
|
static int normal_fore_color, normal_back_color;
|
|
|
|
static int revers_fore_color, revers_back_color;
|
2014-05-29 13:09:48 +00:00
|
|
|
static int vt4_mode = 0;
|
2011-12-11 21:02:33 +00:00
|
|
|
static struct vid_info info;
|
|
|
|
static struct video_info new_mode_info;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize revert data.
|
|
|
|
*
|
|
|
|
* NOTE: the following parameters are not yet saved/restored:
|
|
|
|
*
|
|
|
|
* screen saver timeout
|
|
|
|
* cursor type
|
|
|
|
* mouse character and mouse show/hide state
|
|
|
|
* vty switching on/off state
|
|
|
|
* history buffer size
|
|
|
|
* history contents
|
|
|
|
* font maps
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
init(void)
|
|
|
|
{
|
|
|
|
if (ioctl(0, VT_GETACTIVE, &cur_info.active_vty) == -1)
|
|
|
|
errc(1, errno, "getting active vty");
|
|
|
|
|
|
|
|
cur_info.console_info.size = sizeof(cur_info.console_info);
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_GETINFO, &cur_info.console_info) == -1)
|
|
|
|
errc(1, errno, "getting console information");
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
/* vt(4) use unicode, so no screen mapping required. */
|
|
|
|
if (vt4_mode == 0 &&
|
|
|
|
ioctl(0, GIO_SCRNMAP, &cur_info.screen_map) == -1)
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
errc(1, errno, "getting screen map");
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_GET, &cur_info.video_mode_number) == -1)
|
|
|
|
errc(1, errno, "getting video mode number");
|
|
|
|
|
|
|
|
cur_info.video_mode_info.vi_mode = cur_info.video_mode_number;
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_MODEINFO, &cur_info.video_mode_info) == -1)
|
|
|
|
errc(1, errno, "getting video mode parameters");
|
|
|
|
|
|
|
|
normal_fore_color = cur_info.console_info.mv_norm.fore;
|
|
|
|
normal_back_color = cur_info.console_info.mv_norm.back;
|
|
|
|
revers_fore_color = cur_info.console_info.mv_rev.fore;
|
|
|
|
revers_back_color = cur_info.console_info.mv_rev.back;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If something goes wrong along the way we call revert() to go back to the
|
|
|
|
* console state we came from (which is assumed to be working).
|
|
|
|
*
|
|
|
|
* NOTE: please also read the comments of init().
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
revert(void)
|
|
|
|
{
|
|
|
|
int size[3];
|
|
|
|
|
2006-09-26 21:46:12 +00:00
|
|
|
ioctl(0, VT_ACTIVATE, cur_info.active_vty);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
fprintf(stderr, "\033[=%dA", cur_info.console_info.mv_ovscan);
|
|
|
|
fprintf(stderr, "\033[=%dF", cur_info.console_info.mv_norm.fore);
|
|
|
|
fprintf(stderr, "\033[=%dG", cur_info.console_info.mv_norm.back);
|
|
|
|
fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore);
|
|
|
|
fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back);
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode == 0)
|
|
|
|
ioctl(0, PIO_SCRNMAP, &cur_info.screen_map);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (cur_info.video_mode_number >= M_VESA_BASE)
|
|
|
|
ioctl(0, _IO('V', cur_info.video_mode_number - M_VESA_BASE),
|
|
|
|
NULL);
|
|
|
|
else
|
|
|
|
ioctl(0, _IO('S', cur_info.video_mode_number), NULL);
|
|
|
|
|
|
|
|
if (cur_info.video_mode_info.vi_flags & V_INFO_GRAPHICS) {
|
|
|
|
size[0] = cur_info.video_mode_info.vi_width / 8;
|
|
|
|
size[1] = cur_info.video_mode_info.vi_height /
|
|
|
|
cur_info.console_info.font_size;
|
|
|
|
size[2] = cur_info.console_info.font_size;
|
|
|
|
|
|
|
|
ioctl(0, KDRASTER, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print a short usage string describing all options, then exit.
|
|
|
|
*/
|
1994-08-17 09:00:13 +00:00
|
|
|
|
1997-10-27 07:52:10 +00:00
|
|
|
static void
|
2005-01-13 03:59:44 +00:00
|
|
|
usage(void)
|
1995-02-22 13:48:07 +00:00
|
|
|
{
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode)
|
|
|
|
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
|
2014-10-23 12:38:05 +00:00
|
|
|
"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]",
|
2014-05-29 13:09:48 +00:00
|
|
|
" [-g geometry] [-h size] [-i adapter | mode]",
|
|
|
|
" [-M char] [-m on | off] [-r foreground background]",
|
|
|
|
" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
|
|
|
|
" [mode] [foreground [background]] [show]");
|
|
|
|
else
|
|
|
|
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
|
2002-08-19 16:33:23 +00:00
|
|
|
"usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]",
|
2001-05-28 11:05:28 +00:00
|
|
|
" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]",
|
2002-07-10 03:37:42 +00:00
|
|
|
" [-M char] [-m on | off] [-r foreground background]",
|
2009-11-11 08:39:57 +00:00
|
|
|
" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
|
|
|
|
" [mode] [foreground [background]] [show]");
|
1997-10-27 07:52:10 +00:00
|
|
|
exit(1);
|
1995-02-22 13:48:07 +00:00
|
|
|
}
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
/* Detect presence of vt(4). */
|
|
|
|
static int
|
|
|
|
is_vt4(void)
|
|
|
|
{
|
2014-07-02 20:40:59 +00:00
|
|
|
char vty_name[4] = "";
|
|
|
|
size_t len = sizeof(vty_name);
|
2014-05-29 13:09:48 +00:00
|
|
|
|
2014-07-02 20:40:59 +00:00
|
|
|
if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
|
|
|
|
return (0);
|
|
|
|
return (strcmp(vty_name, "vt") == 0);
|
2014-05-29 13:09:48 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Retrieve the next argument from the command line (for options that require
|
|
|
|
* more than one argument).
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static char *
|
2001-04-09 17:24:29 +00:00
|
|
|
nextarg(int ac, char **av, int *indp, int oc, int strict)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
|
|
|
if (*indp < ac)
|
|
|
|
return(av[(*indp)++]);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (strict != 0) {
|
|
|
|
revert();
|
2001-04-09 17:24:29 +00:00
|
|
|
errx(1, "option requires two arguments -- %c", oc);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
}
|
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
return(NULL);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Guess which file to open. Try to open each combination of a specified set
|
|
|
|
* of file name components.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static FILE *
|
|
|
|
openguess(const char *a[], const char *b[], const char *c[], const char *d[], char **name)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
2002-03-16 23:35:51 +00:00
|
|
|
FILE *f;
|
|
|
|
int i, j, k, l;
|
|
|
|
|
|
|
|
for (i = 0; a[i] != NULL; i++) {
|
|
|
|
for (j = 0; b[j] != NULL; j++) {
|
|
|
|
for (k = 0; c[k] != NULL; k++) {
|
|
|
|
for (l = 0; d[l] != NULL; l++) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
asprintf(name, "%s%s%s%s",
|
|
|
|
a[i], b[j], c[k], d[l]);
|
|
|
|
|
2002-03-16 23:35:51 +00:00
|
|
|
f = fopen(*name, "r");
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2002-03-16 23:35:51 +00:00
|
|
|
if (f != NULL)
|
|
|
|
return (f);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2002-03-16 23:35:51 +00:00
|
|
|
free(*name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
2002-03-16 23:35:51 +00:00
|
|
|
return (NULL);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Load a screenmap from a file and set it.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
|
|
|
load_scrnmap(const char *filename)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
2002-03-16 23:35:51 +00:00
|
|
|
FILE *fd;
|
|
|
|
int size;
|
1994-08-17 09:00:13 +00:00
|
|
|
char *name;
|
|
|
|
scrmap_t scrnmap;
|
2005-01-13 03:59:44 +00:00
|
|
|
const char *a[] = {"", SCRNMAP_PATH, NULL};
|
|
|
|
const char *b[] = {filename, NULL};
|
|
|
|
const char *c[] = {"", ".scm", NULL};
|
|
|
|
const char *d[] = {"", NULL};
|
2002-03-16 23:35:51 +00:00
|
|
|
|
|
|
|
fd = openguess(a, b, c, d, &name);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
if (fd == NULL) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "screenmap file not found");
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
size = sizeof(scrnmap);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
if (decode(fd, (char *)&scrnmap, size) != size) {
|
1994-08-17 09:00:13 +00:00
|
|
|
rewind(fd);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (fread(&scrnmap, 1, size, fd) != (size_t)size) {
|
1997-10-27 07:52:10 +00:00
|
|
|
warnx("bad screenmap file");
|
1997-03-07 01:34:47 +00:00
|
|
|
fclose(fd);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "bad screenmap file");
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, PIO_SCRNMAP, &scrnmap) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "loading screenmap");
|
|
|
|
}
|
|
|
|
|
1997-03-07 01:34:47 +00:00
|
|
|
fclose(fd);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the default screenmap.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
|
|
|
load_default_scrnmap(void)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
|
|
|
scrmap_t scrnmap;
|
1995-02-22 13:48:07 +00:00
|
|
|
int i;
|
1994-08-17 09:00:13 +00:00
|
|
|
|
|
|
|
for (i=0; i<256; i++)
|
|
|
|
*((char*)&scrnmap + i) = i;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, PIO_SCRNMAP, &scrnmap) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "loading default screenmap");
|
|
|
|
}
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Print the current screenmap to stdout.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
|
|
|
print_scrnmap(void)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
|
|
|
unsigned char map[256];
|
2005-01-13 03:59:44 +00:00
|
|
|
size_t i;
|
1994-08-17 09:00:13 +00:00
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (ioctl(0, GIO_SCRNMAP, &map) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "getting screenmap");
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
for (i=0; i<sizeof(map); i++) {
|
2005-01-13 03:59:44 +00:00
|
|
|
if (i != 0 && i % 16 == 0)
|
1994-08-17 09:00:13 +00:00
|
|
|
fprintf(stdout, "\n");
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (hex != 0)
|
1995-05-30 03:57:47 +00:00
|
|
|
fprintf(stdout, " %02x", map[i]);
|
1994-08-17 09:00:13 +00:00
|
|
|
else
|
|
|
|
fprintf(stdout, " %03d", map[i]);
|
|
|
|
}
|
|
|
|
fprintf(stdout, "\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine a file's size.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static int
|
2001-04-09 17:24:29 +00:00
|
|
|
fsize(FILE *file)
|
|
|
|
{
|
|
|
|
struct stat sb;
|
|
|
|
|
|
|
|
if (fstat(fileno(file), &sb) == 0)
|
|
|
|
return sb.st_size;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
static vfnt_map_t *
|
|
|
|
load_vt4mappingtable(unsigned int nmappings, FILE *f)
|
|
|
|
{
|
|
|
|
vfnt_map_t *t;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (nmappings == 0)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
t = malloc(sizeof *t * nmappings);
|
|
|
|
|
|
|
|
if (fread(t, sizeof *t * nmappings, 1, f) != 1) {
|
|
|
|
perror("mappings");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < nmappings; i++) {
|
|
|
|
t[i].src = be32toh(t[i].src);
|
|
|
|
t[i].dst = be16toh(t[i].dst);
|
|
|
|
t[i].len = be16toh(t[i].len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (t);
|
|
|
|
}
|
|
|
|
|
2014-10-23 12:38:05 +00:00
|
|
|
/*
|
|
|
|
* Set the default vt font.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
load_default_vt4font(void)
|
|
|
|
{
|
|
|
|
if (ioctl(0, PIO_VFONT_DEFAULT) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "loading default vt font");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
static int
|
|
|
|
load_vt4font(FILE *f)
|
|
|
|
{
|
|
|
|
struct vt4font_header fh;
|
|
|
|
static vfnt_t vfnt;
|
|
|
|
size_t glyphsize;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (fread(&fh, sizeof fh, 1, f) != 1) {
|
|
|
|
perror("file_header");
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (memcmp(fh.magic, "VFNT0002", 8) != 0) {
|
|
|
|
fprintf(stderr, "Bad magic\n");
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < VFNT_MAPS; i++)
|
|
|
|
vfnt.map_count[i] = be32toh(fh.map_count[i]);
|
|
|
|
vfnt.glyph_count = be32toh(fh.glyph_count);
|
|
|
|
vfnt.width = fh.width;
|
|
|
|
vfnt.height = fh.height;
|
|
|
|
|
|
|
|
glyphsize = howmany(vfnt.width, 8) * vfnt.height * vfnt.glyph_count;
|
|
|
|
vfnt.glyphs = malloc(glyphsize);
|
|
|
|
|
|
|
|
if (fread(vfnt.glyphs, glyphsize, 1, f) != 1) {
|
|
|
|
perror("glyphs");
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < VFNT_MAPS; i++)
|
|
|
|
vfnt.map[i] = load_vt4mappingtable(vfnt.map_count[i], f);
|
|
|
|
|
|
|
|
if (ioctl(STDIN_FILENO, PIO_VFONT, &vfnt) == -1) {
|
|
|
|
perror("PIO_VFONT");
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Load a font from file and set it.
|
|
|
|
*/
|
2001-04-09 17:24:29 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
|
|
|
load_font(const char *type, const char *filename)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
2002-03-16 23:35:51 +00:00
|
|
|
FILE *fd;
|
2001-04-09 17:24:29 +00:00
|
|
|
int h, i, size, w;
|
|
|
|
unsigned long io = 0; /* silence stupid gcc(1) in the Wall mode */
|
2002-03-16 23:35:51 +00:00
|
|
|
char *name, *fontmap, size_sufx[6];
|
2005-01-13 03:59:44 +00:00
|
|
|
const char *a[] = {"", FONT_PATH, NULL};
|
2014-05-29 13:09:48 +00:00
|
|
|
const char *vt4a[] = {"", VT_FONT_PATH, NULL};
|
2005-01-13 03:59:44 +00:00
|
|
|
const char *b[] = {filename, NULL};
|
|
|
|
const char *c[] = {"", size_sufx, NULL};
|
|
|
|
const char *d[] = {"", ".fnt", NULL};
|
|
|
|
vid_info_t _info;
|
1994-08-17 09:00:13 +00:00
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
struct sizeinfo {
|
|
|
|
int w;
|
|
|
|
int h;
|
|
|
|
unsigned long io;
|
|
|
|
} sizes[] = {{8, 16, PIO_FONT8x16},
|
|
|
|
{8, 14, PIO_FONT8x14},
|
|
|
|
{8, 8, PIO_FONT8x8},
|
|
|
|
{0, 0, 0}};
|
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode) {
|
|
|
|
size_sufx[0] = '\0';
|
|
|
|
} else {
|
|
|
|
_info.size = sizeof(_info);
|
|
|
|
if (ioctl(0, CONS_GETINFO, &_info) == -1) {
|
|
|
|
revert();
|
|
|
|
warn("failed to obtain current video mode parameters");
|
|
|
|
return;
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
snprintf(size_sufx, sizeof(size_sufx), "-8x%d", _info.font_size);
|
|
|
|
}
|
|
|
|
fd = openguess((vt4_mode == 0) ? a : vt4a, b, c, d, &name);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
if (fd == NULL) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "%s: can't load font file", filename);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode) {
|
|
|
|
if(load_vt4font(fd))
|
|
|
|
warn("failed to load font \"%s\"", filename);
|
|
|
|
fclose(fd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
if (type != NULL) {
|
|
|
|
size = 0;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (sscanf(type, "%dx%d", &w, &h) == 2) {
|
|
|
|
for (i = 0; sizes[i].w != 0; i++) {
|
2001-04-09 17:24:29 +00:00
|
|
|
if (sizes[i].w == w && sizes[i].h == h) {
|
|
|
|
size = DATASIZE(sizes[i]);
|
|
|
|
io = sizes[i].io;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
font_height = sizes[i].h;
|
2001-04-09 17:24:29 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-09 17:24:29 +00:00
|
|
|
if (size == 0) {
|
|
|
|
fclose(fd);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "%s: bad font size specification", type);
|
2001-04-09 17:24:29 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Apply heuristics */
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
int j;
|
|
|
|
int dsize[2];
|
|
|
|
|
|
|
|
size = DATASIZE(sizes[0]);
|
|
|
|
fontmap = (char*) malloc(size);
|
|
|
|
dsize[0] = decode(fd, fontmap, size);
|
|
|
|
dsize[1] = fsize(fd);
|
|
|
|
free(fontmap);
|
|
|
|
|
|
|
|
size = 0;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
for (j = 0; j < 2; j++) {
|
|
|
|
for (i = 0; sizes[i].w != 0; i++) {
|
2001-04-09 17:24:29 +00:00
|
|
|
if (DATASIZE(sizes[i]) == dsize[j]) {
|
|
|
|
size = dsize[j];
|
|
|
|
io = sizes[i].io;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
font_height = sizes[i].h;
|
2001-04-09 17:24:29 +00:00
|
|
|
j = 2; /* XXX */
|
|
|
|
break;
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-09 17:24:29 +00:00
|
|
|
|
|
|
|
if (size == 0) {
|
|
|
|
fclose(fd);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "%s: can't guess font size", filename);
|
2001-04-09 17:24:29 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
rewind(fd);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
2001-04-09 17:24:29 +00:00
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
fontmap = (char*) malloc(size);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-04-09 17:24:29 +00:00
|
|
|
if (decode(fd, fontmap, size) != size) {
|
1994-08-17 09:00:13 +00:00
|
|
|
rewind(fd);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (fsize(fd) != size ||
|
|
|
|
fread(fontmap, 1, size, fd) != (size_t)size) {
|
2001-04-09 17:24:29 +00:00
|
|
|
warnx("%s: bad font file", filename);
|
1997-03-07 01:34:47 +00:00
|
|
|
fclose(fd);
|
1994-08-17 09:00:13 +00:00
|
|
|
free(fontmap);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "%s: bad font file", filename);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, io, fontmap) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "loading font");
|
|
|
|
}
|
|
|
|
|
1997-03-07 01:34:47 +00:00
|
|
|
fclose(fd);
|
1994-08-17 09:00:13 +00:00
|
|
|
free(fontmap);
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the timeout for the screensaver.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1994-08-17 09:00:13 +00:00
|
|
|
set_screensaver_timeout(char *arg)
|
|
|
|
{
|
|
|
|
int nsec;
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (!strcmp(arg, "off")) {
|
1994-08-17 09:00:13 +00:00
|
|
|
nsec = 0;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else {
|
1994-08-17 09:00:13 +00:00
|
|
|
nsec = atoi(arg);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
if ((*arg == '\0') || (nsec < 1)) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "argument must be a positive number");
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, CONS_BLANKTIME, &nsec) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "setting screensaver period");
|
|
|
|
}
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the cursor's shape/type.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
2011-12-30 10:58:14 +00:00
|
|
|
set_cursor_type(char *appearance)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
1995-01-12 11:47:05 +00:00
|
|
|
int type;
|
|
|
|
|
2011-12-30 10:58:14 +00:00
|
|
|
if (!strcmp(appearance, "normal"))
|
1995-01-12 11:47:05 +00:00
|
|
|
type = 0;
|
2011-12-30 10:58:14 +00:00
|
|
|
else if (!strcmp(appearance, "blink"))
|
1995-02-07 11:56:21 +00:00
|
|
|
type = 1;
|
2011-12-30 10:58:14 +00:00
|
|
|
else if (!strcmp(appearance, "destructive"))
|
1995-02-07 11:56:21 +00:00
|
|
|
type = 3;
|
1995-01-12 11:47:05 +00:00
|
|
|
else {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "argument to -c must be normal, blink or destructive");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_CURSORTYPE, &type) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "setting cursor type");
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the video mode.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static int
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
video_mode(int argc, char **argv, int *mode_index)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
1998-09-23 10:00:15 +00:00
|
|
|
static struct {
|
2005-01-13 03:59:44 +00:00
|
|
|
const char *name;
|
1998-09-23 10:00:15 +00:00
|
|
|
unsigned long mode;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
unsigned long mode_num;
|
1998-09-23 10:00:15 +00:00
|
|
|
} modes[] = {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
{ "80x25", SW_TEXT_80x25, M_TEXT_80x25 },
|
|
|
|
{ "80x30", SW_TEXT_80x30, M_TEXT_80x30 },
|
|
|
|
{ "80x43", SW_TEXT_80x43, M_TEXT_80x43 },
|
|
|
|
{ "80x50", SW_TEXT_80x50, M_TEXT_80x50 },
|
|
|
|
{ "80x60", SW_TEXT_80x60, M_TEXT_80x60 },
|
|
|
|
{ "132x25", SW_TEXT_132x25, M_TEXT_132x25 },
|
|
|
|
{ "132x30", SW_TEXT_132x30, M_TEXT_132x30 },
|
|
|
|
{ "132x43", SW_TEXT_132x43, M_TEXT_132x43 },
|
|
|
|
{ "132x50", SW_TEXT_132x50, M_TEXT_132x50 },
|
|
|
|
{ "132x60", SW_TEXT_132x60, M_TEXT_132x60 },
|
|
|
|
{ "VGA_40x25", SW_VGA_C40x25, M_VGA_C40x25 },
|
|
|
|
{ "VGA_80x25", SW_VGA_C80x25, M_VGA_C80x25 },
|
|
|
|
{ "VGA_80x30", SW_VGA_C80x30, M_VGA_C80x30 },
|
|
|
|
{ "VGA_80x50", SW_VGA_C80x50, M_VGA_C80x50 },
|
|
|
|
{ "VGA_80x60", SW_VGA_C80x60, M_VGA_C80x60 },
|
1999-06-22 14:15:46 +00:00
|
|
|
#ifdef SW_VGA_C90x25
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
{ "VGA_90x25", SW_VGA_C90x25, M_VGA_C90x25 },
|
|
|
|
{ "VGA_90x30", SW_VGA_C90x30, M_VGA_C90x30 },
|
|
|
|
{ "VGA_90x43", SW_VGA_C90x43, M_VGA_C90x43 },
|
|
|
|
{ "VGA_90x50", SW_VGA_C90x50, M_VGA_C90x50 },
|
|
|
|
{ "VGA_90x60", SW_VGA_C90x60, M_VGA_C90x60 },
|
1999-06-22 14:15:46 +00:00
|
|
|
#endif
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
{ "VGA_320x200", SW_VGA_CG320, M_CG320 },
|
|
|
|
{ "EGA_80x25", SW_ENH_C80x25, M_ENH_C80x25 },
|
|
|
|
{ "EGA_80x43", SW_ENH_C80x43, M_ENH_C80x43 },
|
|
|
|
{ "VESA_132x25", SW_VESA_C132x25,M_VESA_C132x25 },
|
|
|
|
{ "VESA_132x43", SW_VESA_C132x43,M_VESA_C132x43 },
|
|
|
|
{ "VESA_132x50", SW_VESA_C132x50,M_VESA_C132x50 },
|
|
|
|
{ "VESA_132x60", SW_VESA_C132x60,M_VESA_C132x60 },
|
|
|
|
{ "VESA_800x600", SW_VESA_800x600,M_VESA_800x600 },
|
|
|
|
{ NULL, 0, 0 },
|
1998-09-23 10:00:15 +00:00
|
|
|
};
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
int new_mode_num = 0;
|
1999-01-12 23:05:45 +00:00
|
|
|
unsigned long mode = 0;
|
1999-06-22 14:15:46 +00:00
|
|
|
int cur_mode;
|
|
|
|
int ioerr;
|
1998-09-15 18:16:39 +00:00
|
|
|
int size[3];
|
1998-09-23 10:00:15 +00:00
|
|
|
int i;
|
1994-08-17 09:00:13 +00:00
|
|
|
|
1999-06-22 14:15:46 +00:00
|
|
|
if (ioctl(0, CONS_GET, &cur_mode) < 0)
|
|
|
|
err(1, "cannot get the current video mode");
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse the video mode argument...
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (*mode_index < argc) {
|
|
|
|
if (!strncmp(argv[*mode_index], "MODE_", 5)) {
|
|
|
|
if (!isdigit(argv[*mode_index][5]))
|
|
|
|
errx(1, "invalid video mode number");
|
|
|
|
|
|
|
|
new_mode_num = atoi(&argv[*mode_index][5]);
|
|
|
|
} else {
|
|
|
|
for (i = 0; modes[i].name != NULL; ++i) {
|
|
|
|
if (!strcmp(argv[*mode_index], modes[i].name)) {
|
|
|
|
mode = modes[i].mode;
|
|
|
|
new_mode_num = modes[i].mode_num;
|
|
|
|
break;
|
|
|
|
}
|
1998-09-23 10:00:15 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (modes[i].name == NULL)
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
if (ioctl(0, mode, NULL) < 0) {
|
|
|
|
warn("cannot set videomode");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Collect enough information about the new video mode...
|
|
|
|
*/
|
|
|
|
|
|
|
|
new_mode_info.vi_mode = new_mode_num;
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_MODEINFO, &new_mode_info) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "obtaining new video mode parameters");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mode == 0) {
|
|
|
|
if (new_mode_num >= M_VESA_BASE)
|
|
|
|
mode = _IO('V', new_mode_num - M_VESA_BASE);
|
|
|
|
else
|
|
|
|
mode = _IO('S', new_mode_num);
|
1998-09-23 10:00:15 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Try setting the new mode.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ioctl(0, mode, NULL) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "setting video mode");
|
2003-09-18 16:20:32 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* For raster modes it's not enough to just set the mode.
|
|
|
|
* We also need to explicitly set the raster mode.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (new_mode_info.vi_flags & V_INFO_GRAPHICS) {
|
|
|
|
/* font size */
|
|
|
|
|
|
|
|
if (font_height == 0)
|
|
|
|
font_height = cur_info.console_info.font_size;
|
|
|
|
|
|
|
|
size[2] = font_height;
|
|
|
|
|
|
|
|
/* adjust columns */
|
|
|
|
|
|
|
|
if ((vesa_cols * 8 > new_mode_info.vi_width) ||
|
|
|
|
(vesa_cols <= 0)) {
|
|
|
|
size[0] = new_mode_info.vi_width / 8;
|
2001-01-25 16:53:22 +00:00
|
|
|
} else {
|
|
|
|
size[0] = vesa_cols;
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/* adjust rows */
|
|
|
|
|
|
|
|
if ((vesa_rows * font_height > new_mode_info.vi_height) ||
|
|
|
|
(vesa_rows <= 0)) {
|
|
|
|
size[1] = new_mode_info.vi_height /
|
|
|
|
font_height;
|
2001-01-25 16:53:22 +00:00
|
|
|
} else {
|
|
|
|
size[1] = vesa_rows;
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/* set raster mode */
|
|
|
|
|
1999-06-22 14:15:46 +00:00
|
|
|
if (ioctl(0, KDRASTER, size)) {
|
|
|
|
ioerr = errno;
|
|
|
|
if (cur_mode >= M_VESA_BASE)
|
2001-07-22 13:30:32 +00:00
|
|
|
ioctl(0,
|
|
|
|
_IO('V', cur_mode - M_VESA_BASE),
|
|
|
|
NULL);
|
1999-06-22 14:15:46 +00:00
|
|
|
else
|
|
|
|
ioctl(0, _IO('S', cur_mode), NULL);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
1999-06-22 14:15:46 +00:00
|
|
|
warnc(ioerr, "cannot activate raster display");
|
2003-09-18 16:20:32 +00:00
|
|
|
return EXIT_FAILURE;
|
1999-06-22 14:15:46 +00:00
|
|
|
}
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
video_mode_changed = 1;
|
|
|
|
|
|
|
|
(*mode_index)++;
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
2003-09-18 16:20:32 +00:00
|
|
|
return EXIT_SUCCESS;
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
1995-05-30 03:57:47 +00:00
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the number for a specified color name.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static int
|
1994-08-17 09:00:13 +00:00
|
|
|
get_color_number(char *color)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
for (i=0; i<16; i++) {
|
1994-08-17 09:00:13 +00:00
|
|
|
if (!strcmp(color, legal_colors[i]))
|
|
|
|
return i;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
}
|
1994-08-17 09:00:13 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get normal text and background colors.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
get_normal_colors(int argc, char **argv, int *_index)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
|
|
|
int color;
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
if (*_index < argc && (color = get_color_number(argv[*_index])) != -1) {
|
|
|
|
(*_index)++;
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stderr, "\033[=%dF", color);
|
2005-09-17 12:52:04 +00:00
|
|
|
normal_fore_color=color;
|
|
|
|
colors_changed = 1;
|
2005-01-13 03:59:44 +00:00
|
|
|
if (*_index < argc
|
|
|
|
&& (color = get_color_number(argv[*_index])) != -1
|
1994-08-17 09:00:13 +00:00
|
|
|
&& color < 8) {
|
2005-01-13 03:59:44 +00:00
|
|
|
(*_index)++;
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stderr, "\033[=%dG", color);
|
2005-09-17 12:52:04 +00:00
|
|
|
normal_back_color=color;
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get reverse text and background colors.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
get_reverse_colors(int argc, char **argv, int *_index)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
|
|
|
int color;
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
if ((color = get_color_number(argv[*(_index)-1])) != -1) {
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stderr, "\033[=%dH", color);
|
2005-09-17 12:52:04 +00:00
|
|
|
revers_fore_color=color;
|
|
|
|
colors_changed = 1;
|
2005-01-13 03:59:44 +00:00
|
|
|
if (*_index < argc
|
|
|
|
&& (color = get_color_number(argv[*_index])) != -1
|
1994-08-17 09:00:13 +00:00
|
|
|
&& color < 8) {
|
2005-01-13 03:59:44 +00:00
|
|
|
(*_index)++;
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stderr, "\033[=%dI", color);
|
2005-09-17 12:52:04 +00:00
|
|
|
revers_back_color=color;
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set normal and reverse foreground and background colors.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_colors(void)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "\033[=%dF", normal_fore_color);
|
|
|
|
fprintf(stderr, "\033[=%dG", normal_back_color);
|
|
|
|
fprintf(stderr, "\033[=%dH", revers_fore_color);
|
|
|
|
fprintf(stderr, "\033[=%dI", revers_back_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Switch to virtual terminal #arg.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1997-03-07 01:34:47 +00:00
|
|
|
set_console(char *arg)
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if(!arg || strspn(arg,"0123456789") != strlen(arg)) {
|
|
|
|
revert();
|
|
|
|
errx(1, "bad console number");
|
1997-03-07 01:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
n = atoi(arg);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1999-09-19 08:04:07 +00:00
|
|
|
if (n < 1 || n > 16) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "console number out of range");
|
2006-09-26 21:46:12 +00:00
|
|
|
} else if (ioctl(0, VT_ACTIVATE, n) == -1) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errc(1, errno, "switching vty");
|
|
|
|
}
|
1997-03-07 01:34:47 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Sets the border color.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1994-08-17 09:00:13 +00:00
|
|
|
set_border_color(char *arg)
|
|
|
|
{
|
|
|
|
int color;
|
|
|
|
|
|
|
|
if ((color = get_color_number(arg)) != -1) {
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stderr, "\033[=%dA", color);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
else
|
1995-05-30 03:57:47 +00:00
|
|
|
usage();
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
2000-01-12 12:30:33 +00:00
|
|
|
set_mouse_char(char *arg)
|
|
|
|
{
|
|
|
|
struct mouse_info mouse;
|
|
|
|
long l;
|
|
|
|
|
|
|
|
l = strtol(arg, NULL, 0);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-04-21 13:50:32 +00:00
|
|
|
if ((l < 0) || (l > UCHAR_MAX - 3)) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
2001-04-21 13:50:32 +00:00
|
|
|
warnx("argument to -M must be 0 through %d", UCHAR_MAX - 3);
|
2000-01-12 12:30:33 +00:00
|
|
|
return;
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2000-01-12 12:30:33 +00:00
|
|
|
mouse.operation = MOUSE_MOUSECHAR;
|
|
|
|
mouse.u.mouse_char = (int)l;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, CONS_MOUSECTL, &mouse) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "setting mouse character");
|
|
|
|
}
|
2000-01-12 12:30:33 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Show/hide the mouse.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1996-06-21 07:20:13 +00:00
|
|
|
set_mouse(char *arg)
|
|
|
|
{
|
|
|
|
struct mouse_info mouse;
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (!strcmp(arg, "on")) {
|
1996-06-21 07:20:13 +00:00
|
|
|
mouse.operation = MOUSE_SHOW;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else if (!strcmp(arg, "off")) {
|
1996-06-21 07:20:13 +00:00
|
|
|
mouse.operation = MOUSE_HIDE;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else {
|
|
|
|
revert();
|
|
|
|
errx(1, "argument to -m must be either on or off");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_MOUSECTL, &mouse) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "%sing the mouse",
|
|
|
|
mouse.operation == MOUSE_SHOW ? "show" : "hid");
|
1996-06-21 07:20:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
2002-07-10 03:31:25 +00:00
|
|
|
set_lockswitch(char *arg)
|
|
|
|
{
|
|
|
|
int data;
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (!strcmp(arg, "off")) {
|
2002-07-10 03:31:25 +00:00
|
|
|
data = 0x01;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else if (!strcmp(arg, "on")) {
|
2002-07-10 03:31:25 +00:00
|
|
|
data = 0x02;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else {
|
|
|
|
revert();
|
|
|
|
errx(1, "argument to -S must be either on or off");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(0, VT_LOCKSWITCH, &data) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "turning %s vty switching",
|
|
|
|
data == 0x01 ? "off" : "on");
|
2002-07-10 03:31:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the adapter name for a specified type.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static const char
|
1998-09-15 18:16:39 +00:00
|
|
|
*adapter_name(int type)
|
|
|
|
{
|
|
|
|
static struct {
|
|
|
|
int type;
|
2005-01-13 03:59:44 +00:00
|
|
|
const char *name;
|
1998-09-15 18:16:39 +00:00
|
|
|
} names[] = {
|
|
|
|
{ KD_MONO, "MDA" },
|
|
|
|
{ KD_HERCULES, "Hercules" },
|
|
|
|
{ KD_CGA, "CGA" },
|
|
|
|
{ KD_EGA, "EGA" },
|
|
|
|
{ KD_VGA, "VGA" },
|
|
|
|
{ KD_PC98, "PC-98xx" },
|
1999-06-22 14:15:46 +00:00
|
|
|
{ KD_TGA, "TGA" },
|
1998-09-15 18:16:39 +00:00
|
|
|
{ -1, "Unknown" },
|
|
|
|
};
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1998-09-15 18:16:39 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; names[i].type != -1; ++i)
|
|
|
|
if (names[i].type == type)
|
|
|
|
break;
|
|
|
|
return names[i].name;
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Show graphics adapter information.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1998-09-15 18:16:39 +00:00
|
|
|
show_adapter_info(void)
|
|
|
|
{
|
1999-01-11 03:20:32 +00:00
|
|
|
struct video_adapter_info ad;
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
ad.va_index = 0;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, CONS_ADPINFO, &ad) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "obtaining adapter information");
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
|
|
|
|
1999-01-11 03:20:32 +00:00
|
|
|
printf("fb%d:\n", ad.va_index);
|
|
|
|
printf(" %.*s%d, type:%s%s (%d), flags:0x%x\n",
|
|
|
|
(int)sizeof(ad.va_name), ad.va_name, ad.va_unit,
|
1998-09-15 18:16:39 +00:00
|
|
|
(ad.va_flags & V_ADP_VESA) ? "VESA " : "",
|
1999-01-11 03:20:32 +00:00
|
|
|
adapter_name(ad.va_type), ad.va_type, ad.va_flags);
|
1998-09-15 18:16:39 +00:00
|
|
|
printf(" initial mode:%d, current mode:%d, BIOS mode:%d\n",
|
|
|
|
ad.va_initial_mode, ad.va_mode, ad.va_initial_bios_mode);
|
2005-01-13 03:59:44 +00:00
|
|
|
printf(" frame buffer window:0x%zx, buffer size:0x%zx\n",
|
1999-06-22 14:15:46 +00:00
|
|
|
ad.va_window, ad.va_buffer_size);
|
2005-01-13 03:59:44 +00:00
|
|
|
printf(" window size:0x%zx, origin:0x%x\n",
|
1999-06-22 14:15:46 +00:00
|
|
|
ad.va_window_size, ad.va_window_orig);
|
|
|
|
printf(" display start address (%d, %d), scan line width:%d\n",
|
|
|
|
ad.va_disp_start.x, ad.va_disp_start.y, ad.va_line_width);
|
2005-01-13 03:59:44 +00:00
|
|
|
printf(" reserved:0x%zx\n", ad.va_unused0);
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Show video mode information.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1998-09-15 18:16:39 +00:00
|
|
|
show_mode_info(void)
|
|
|
|
{
|
|
|
|
char buf[80];
|
2010-03-29 20:12:44 +00:00
|
|
|
struct video_info _info;
|
1998-09-15 18:16:39 +00:00
|
|
|
int c;
|
2010-03-29 20:12:44 +00:00
|
|
|
int mm;
|
|
|
|
int mode;
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
printf(" mode# flags type size "
|
|
|
|
"font window linear buffer\n");
|
|
|
|
printf("---------------------------------------"
|
|
|
|
"---------------------------------------\n");
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2013-05-11 13:32:38 +00:00
|
|
|
for (mode = 0; mode <= M_VESA_MODE_MAX; ++mode) {
|
2005-01-13 03:59:44 +00:00
|
|
|
_info.vi_mode = mode;
|
|
|
|
if (ioctl(0, CONS_MODEINFO, &_info))
|
1998-09-15 18:16:39 +00:00
|
|
|
continue;
|
2005-01-13 03:59:44 +00:00
|
|
|
if (_info.vi_mode != mode)
|
1999-06-22 14:15:46 +00:00
|
|
|
continue;
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
printf("%3d (0x%03x)", mode, mode);
|
2005-01-13 03:59:44 +00:00
|
|
|
printf(" 0x%08x", _info.vi_flags);
|
|
|
|
if (_info.vi_flags & V_INFO_GRAPHICS) {
|
1998-09-15 18:16:39 +00:00
|
|
|
c = 'G';
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2010-03-29 20:12:44 +00:00
|
|
|
if (_info.vi_mem_model == V_INFO_MM_PLANAR)
|
|
|
|
snprintf(buf, sizeof(buf), "%dx%dx%d %d",
|
|
|
|
_info.vi_width, _info.vi_height,
|
|
|
|
_info.vi_depth, _info.vi_planes);
|
|
|
|
else {
|
|
|
|
switch (_info.vi_mem_model) {
|
|
|
|
case V_INFO_MM_PACKED:
|
|
|
|
mm = 'P';
|
|
|
|
break;
|
|
|
|
case V_INFO_MM_DIRECT:
|
|
|
|
mm = 'D';
|
|
|
|
break;
|
|
|
|
case V_INFO_MM_CGA:
|
|
|
|
mm = 'C';
|
|
|
|
break;
|
|
|
|
case V_INFO_MM_HGC:
|
|
|
|
mm = 'H';
|
|
|
|
break;
|
|
|
|
case V_INFO_MM_VGAX:
|
|
|
|
mm = 'V';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mm = ' ';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "%dx%dx%d %c",
|
|
|
|
_info.vi_width, _info.vi_height,
|
|
|
|
_info.vi_depth, mm);
|
|
|
|
}
|
1998-09-15 18:16:39 +00:00
|
|
|
} else {
|
|
|
|
c = 'T';
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1998-09-15 18:16:39 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%dx%d",
|
2005-01-13 03:59:44 +00:00
|
|
|
_info.vi_width, _info.vi_height);
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1998-09-15 18:16:39 +00:00
|
|
|
printf(" %c %-15s", c, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "%dx%d",
|
2005-01-13 03:59:44 +00:00
|
|
|
_info.vi_cwidth, _info.vi_cheight);
|
1998-09-15 18:16:39 +00:00
|
|
|
printf(" %-5s", buf);
|
2005-01-13 03:59:44 +00:00
|
|
|
printf(" 0x%05zx %2dk %2dk",
|
|
|
|
_info.vi_window, (int)_info.vi_window_size/1024,
|
|
|
|
(int)_info.vi_window_gran/1024);
|
|
|
|
printf(" 0x%08zx %dk\n",
|
|
|
|
_info.vi_buffer, (int)_info.vi_buffer_size/1024);
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
1998-09-15 18:16:39 +00:00
|
|
|
show_info(char *arg)
|
|
|
|
{
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (!strcmp(arg, "adapter")) {
|
1998-09-15 18:16:39 +00:00
|
|
|
show_adapter_info();
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else if (!strcmp(arg, "mode")) {
|
1998-09-15 18:16:39 +00:00
|
|
|
show_mode_info();
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
} else {
|
|
|
|
revert();
|
|
|
|
errx(1, "argument to -i must be either adapter or mode");
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
|
|
|
test_frame(void)
|
1994-08-17 09:00:13 +00:00
|
|
|
{
|
2005-05-15 08:04:46 +00:00
|
|
|
int i, cur_mode, fore;
|
|
|
|
|
|
|
|
fore = 15;
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_GET, &cur_mode) < 0)
|
|
|
|
err(1, "must be on a virtual console");
|
|
|
|
switch (cur_mode) {
|
|
|
|
case M_PC98_80x25:
|
|
|
|
case M_PC98_80x30:
|
|
|
|
fore = 7;
|
|
|
|
break;
|
|
|
|
}
|
1994-08-17 09:00:13 +00:00
|
|
|
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stdout, "\033[=0G\n\n");
|
1994-08-17 09:00:13 +00:00
|
|
|
for (i=0; i<8; i++) {
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stdout, "\033[=%dF\033[=0G %2d \033[=%dF%-16s"
|
|
|
|
"\033[=%dF\033[=0G %2d \033[=%dF%-16s "
|
|
|
|
"\033[=%dF %2d \033[=%dGBACKGROUND\033[=0G\n",
|
2005-05-15 08:04:46 +00:00
|
|
|
fore, i, i, legal_colors[i],
|
|
|
|
fore, i+8, i+8, legal_colors[i+8],
|
|
|
|
fore, i, i);
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
2005-05-15 09:43:14 +00:00
|
|
|
fprintf(stdout, "\033[=%dF\033[=%dG\033[=%dH\033[=%dI\n",
|
1995-05-30 03:57:47 +00:00
|
|
|
info.mv_norm.fore, info.mv_norm.back,
|
1994-08-17 09:00:13 +00:00
|
|
|
info.mv_rev.fore, info.mv_rev.back);
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
/*
|
|
|
|
* Snapshot the video memory of that terminal, using the CONS_SCRSHOT
|
|
|
|
* ioctl, and writes the results to stdout either in the special
|
|
|
|
* binary format (see manual page for details), or in the plain
|
|
|
|
* text format.
|
|
|
|
*/
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
2002-08-19 16:33:23 +00:00
|
|
|
dump_screen(int mode, int opt)
|
2001-05-19 06:47:36 +00:00
|
|
|
{
|
|
|
|
scrshot_t shot;
|
2005-01-13 03:59:44 +00:00
|
|
|
vid_info_t _info;
|
2001-05-19 06:47:36 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
_info.size = sizeof(_info);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
if (ioctl(0, CONS_GETINFO, &_info) == -1) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errc(1, errno, "obtaining current video mode parameters");
|
2001-05-19 06:47:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-08-19 16:33:23 +00:00
|
|
|
shot.x = shot.y = 0;
|
2005-01-13 03:59:44 +00:00
|
|
|
shot.xsize = _info.mv_csz;
|
|
|
|
shot.ysize = _info.mv_rsz;
|
2002-08-19 16:33:23 +00:00
|
|
|
if (opt == DUMP_ALL)
|
2005-01-13 03:59:44 +00:00
|
|
|
shot.ysize += _info.mv_hsz;
|
2002-08-19 16:33:23 +00:00
|
|
|
|
|
|
|
shot.buf = alloca(shot.xsize * shot.ysize * sizeof(u_int16_t));
|
2001-05-19 06:47:36 +00:00
|
|
|
if (shot.buf == NULL) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "failed to allocate memory for dump");
|
2001-05-19 06:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_SCRSHOT, &shot) == -1) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errc(1, errno, "dumping screen");
|
2001-05-19 06:47:36 +00:00
|
|
|
}
|
|
|
|
|
2002-08-19 16:33:23 +00:00
|
|
|
if (mode == DUMP_FMT_RAW) {
|
2001-05-19 06:47:36 +00:00
|
|
|
printf("SCRSHOT_%c%c%c%c", DUMP_FMT_REV, 2,
|
|
|
|
shot.xsize, shot.ysize);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
fflush(stdout);
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
write(STDOUT_FILENO, shot.buf,
|
|
|
|
shot.xsize * shot.ysize * sizeof(u_int16_t));
|
2001-05-19 06:47:36 +00:00
|
|
|
} else {
|
|
|
|
char *line;
|
|
|
|
int x, y;
|
|
|
|
u_int16_t ch;
|
|
|
|
|
|
|
|
line = alloca(shot.xsize + 1);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
if (line == NULL) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "failed to allocate memory for line buffer");
|
2001-05-19 06:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (y = 0; y < shot.ysize; y++) {
|
|
|
|
for (x = 0; x < shot.xsize; x++) {
|
|
|
|
ch = shot.buf[x + (y * shot.xsize)];
|
|
|
|
ch &= 0xff;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
if (isprint(ch) == 0)
|
|
|
|
ch = ' ';
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
line[x] = (char)ch;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Trim trailing spaces */
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
do {
|
|
|
|
line[x--] = '\0';
|
|
|
|
} while (line[x] == ' ' && x != 0);
|
|
|
|
|
|
|
|
puts(line);
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-19 06:47:36 +00:00
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the console history buffer size.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
2001-05-28 11:05:28 +00:00
|
|
|
set_history(char *opt)
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
|
|
|
|
size = atoi(opt);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2001-05-28 11:05:28 +00:00
|
|
|
if ((*opt == '\0') || size < 0) {
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
revert();
|
|
|
|
errx(1, "argument must be a positive number");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(0, CONS_HISTORY, &size) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "setting history buffer size");
|
2001-05-28 11:05:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear the console history buffer.
|
|
|
|
*/
|
|
|
|
|
2005-01-13 03:59:44 +00:00
|
|
|
static void
|
|
|
|
clear_history(void)
|
2001-05-28 11:05:28 +00:00
|
|
|
{
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (ioctl(0, CONS_CLRHIST) == -1) {
|
|
|
|
revert();
|
|
|
|
errc(1, errno, "clearing history buffer");
|
|
|
|
}
|
2001-05-28 11:05:28 +00:00
|
|
|
}
|
|
|
|
|
2009-11-11 08:39:57 +00:00
|
|
|
static void
|
|
|
|
set_terminal_mode(char *arg)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (strcmp(arg, "xterm") == 0)
|
|
|
|
fprintf(stderr, "\033[=T");
|
|
|
|
else if (strcmp(arg, "cons25") == 0)
|
|
|
|
fprintf(stderr, "\033[=1T");
|
|
|
|
}
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
1997-03-07 01:34:47 +00:00
|
|
|
int
|
1994-08-17 09:00:13 +00:00
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
2012-06-29 12:55:36 +00:00
|
|
|
char *font, *type, *termmode;
|
2014-05-29 13:09:48 +00:00
|
|
|
const char *opts;
|
2002-08-19 16:33:23 +00:00
|
|
|
int dumpmod, dumpopt, opt;
|
2003-09-18 16:20:32 +00:00
|
|
|
int reterr;
|
1995-05-30 03:57:47 +00:00
|
|
|
|
2014-05-29 13:09:48 +00:00
|
|
|
vt4_mode = is_vt4();
|
|
|
|
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
init();
|
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
info.size = sizeof(info);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
if (ioctl(0, CONS_GETINFO, &info) == -1)
|
1997-10-27 07:52:10 +00:00
|
|
|
err(1, "must be on a virtual console");
|
2002-08-19 16:33:23 +00:00
|
|
|
dumpmod = 0;
|
|
|
|
dumpopt = DUMP_FBF;
|
2012-06-29 12:55:36 +00:00
|
|
|
termmode = NULL;
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode)
|
2014-10-23 12:38:05 +00:00
|
|
|
opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x";
|
2014-05-29 13:09:48 +00:00
|
|
|
else
|
|
|
|
opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x";
|
|
|
|
|
|
|
|
while ((opt = getopt(argc, argv, opts)) != -1)
|
1994-08-17 09:00:13 +00:00
|
|
|
switch(opt) {
|
2001-05-28 11:05:28 +00:00
|
|
|
case 'b':
|
|
|
|
set_border_color(optarg);
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
clear_history();
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
set_cursor_type(optarg);
|
|
|
|
break;
|
|
|
|
case 'd':
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode)
|
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
print_scrnmap();
|
|
|
|
break;
|
|
|
|
case 'f':
|
2014-10-23 12:38:05 +00:00
|
|
|
optarg = nextarg(argc, argv, &optind, 'f', 0);
|
|
|
|
if (optarg != NULL) {
|
|
|
|
font = nextarg(argc, argv, &optind, 'f', 0);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2014-10-23 12:38:05 +00:00
|
|
|
if (font == NULL) {
|
|
|
|
type = NULL;
|
|
|
|
font = optarg;
|
|
|
|
} else
|
|
|
|
type = optarg;
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2014-10-23 12:38:05 +00:00
|
|
|
load_font(type, font);
|
|
|
|
} else {
|
|
|
|
if (!vt4_mode)
|
|
|
|
usage(); /* Switch syscons to ROM? */
|
|
|
|
|
|
|
|
load_default_vt4font();
|
|
|
|
}
|
2001-05-28 11:05:28 +00:00
|
|
|
break;
|
|
|
|
case 'g':
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
if (sscanf(optarg, "%dx%d",
|
|
|
|
&vesa_cols, &vesa_rows) != 2) {
|
|
|
|
revert();
|
2001-05-28 11:05:28 +00:00
|
|
|
warnx("incorrect geometry: %s", optarg);
|
1994-08-17 09:00:13 +00:00
|
|
|
usage();
|
2001-05-28 11:05:28 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
case 'h':
|
|
|
|
set_history(optarg);
|
|
|
|
break;
|
2002-08-19 16:33:23 +00:00
|
|
|
case 'H':
|
|
|
|
dumpopt = DUMP_ALL;
|
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
case 'i':
|
|
|
|
show_info(optarg);
|
|
|
|
break;
|
|
|
|
case 'l':
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode)
|
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
load_scrnmap(optarg);
|
|
|
|
break;
|
|
|
|
case 'L':
|
2014-05-29 13:09:48 +00:00
|
|
|
if (vt4_mode)
|
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
load_default_scrnmap();
|
|
|
|
break;
|
|
|
|
case 'M':
|
|
|
|
set_mouse_char(optarg);
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
set_mouse(optarg);
|
|
|
|
break;
|
|
|
|
case 'p':
|
2002-08-19 16:33:23 +00:00
|
|
|
dumpmod = DUMP_FMT_RAW;
|
2001-05-28 11:05:28 +00:00
|
|
|
break;
|
|
|
|
case 'P':
|
2002-08-19 16:33:23 +00:00
|
|
|
dumpmod = DUMP_FMT_TXT;
|
2001-05-28 11:05:28 +00:00
|
|
|
break;
|
|
|
|
case 'r':
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
get_reverse_colors(argc, argv, &optind);
|
2001-05-28 11:05:28 +00:00
|
|
|
break;
|
2002-07-10 03:31:25 +00:00
|
|
|
case 'S':
|
|
|
|
set_lockswitch(optarg);
|
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
case 's':
|
|
|
|
set_console(optarg);
|
|
|
|
break;
|
2009-11-11 08:39:57 +00:00
|
|
|
case 'T':
|
2012-06-29 12:55:36 +00:00
|
|
|
if (strcmp(optarg, "xterm") != 0 &&
|
|
|
|
strcmp(optarg, "cons25") != 0)
|
|
|
|
usage();
|
|
|
|
termmode = optarg;
|
2009-11-11 08:39:57 +00:00
|
|
|
break;
|
2001-05-28 11:05:28 +00:00
|
|
|
case 't':
|
|
|
|
set_screensaver_timeout(optarg);
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
hex = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
usage();
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
2002-08-19 16:33:23 +00:00
|
|
|
if (dumpmod != 0)
|
|
|
|
dump_screen(dumpmod, dumpopt);
|
2003-09-18 16:20:32 +00:00
|
|
|
reterr = video_mode(argc, argv, &optind);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
get_normal_colors(argc, argv, &optind);
|
|
|
|
|
1994-08-17 09:00:13 +00:00
|
|
|
if (optind < argc && !strcmp(argv[optind], "show")) {
|
|
|
|
test_frame();
|
|
|
|
optind++;
|
|
|
|
}
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
video_mode(argc, argv, &optind);
|
2012-06-29 12:55:36 +00:00
|
|
|
if (termmode != NULL)
|
|
|
|
set_terminal_mode(termmode);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
|
|
|
|
get_normal_colors(argc, argv, &optind);
|
|
|
|
|
|
|
|
if (colors_changed || video_mode_changed) {
|
|
|
|
if (!(new_mode_info.vi_flags & V_INFO_GRAPHICS)) {
|
|
|
|
if ((normal_back_color < 8) && (revers_back_color < 8)) {
|
|
|
|
set_colors();
|
|
|
|
} else {
|
|
|
|
revert();
|
|
|
|
errx(1, "bg color for text modes must be < 8");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
set_colors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-27 07:52:10 +00:00
|
|
|
if ((optind != argc) || (argc == 1))
|
1994-08-17 09:00:13 +00:00
|
|
|
usage();
|
2003-09-18 16:20:32 +00:00
|
|
|
return reterr;
|
1994-08-17 09:00:13 +00:00
|
|
|
}
|
|
|
|
|