New option `-g' to allow selecting custom text geometry in VESA_800x600 raster
text mode. For example `vidcontrol -g 100x37 VESA_800x600' will setup 100x37 text mode as opposed to default 80x25. Reviewed by: imp
This commit is contained in:
parent
a0e3937ccb
commit
acdb2839d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71642
@ -25,6 +25,7 @@
|
|||||||
.Op Fl c Ar appearance
|
.Op Fl c Ar appearance
|
||||||
.Op Fl d
|
.Op Fl d
|
||||||
.Op Fl f Ar size Ar file
|
.Op Fl f Ar size Ar file
|
||||||
|
.Op Fl g Ar geometry
|
||||||
.Op Fl i Cm adapter | mode
|
.Op Fl i Cm adapter | mode
|
||||||
.Op Fl l Ar screen_map
|
.Op Fl l Ar screen_map
|
||||||
.Op Fl L
|
.Op Fl L
|
||||||
@ -159,6 +160,18 @@ and
|
|||||||
.Sx EXAMPLES
|
.Sx EXAMPLES
|
||||||
below and the man page for
|
below and the man page for
|
||||||
.Xr syscons 4 .
|
.Xr syscons 4 .
|
||||||
|
.It Fl g Ar geometry
|
||||||
|
Set the
|
||||||
|
.Ar geometry
|
||||||
|
of the text mode for the modes with selectable
|
||||||
|
geometry. Currently only raster modes, such as
|
||||||
|
.Ar VESA_800x600 ,
|
||||||
|
support this option.
|
||||||
|
See also
|
||||||
|
.Sx Video Mode Support
|
||||||
|
and
|
||||||
|
.Sx EXAMPLES
|
||||||
|
below.
|
||||||
.It Fl s Ar number
|
.It Fl s Ar number
|
||||||
Set the current vty to
|
Set the current vty to
|
||||||
.Ar number .
|
.Ar number .
|
||||||
@ -283,6 +296,11 @@ option if the file is found in
|
|||||||
.Pp
|
.Pp
|
||||||
The above command will load
|
The above command will load
|
||||||
.Pa /usr/share/syscons/scrnmaps/iso-8859-1_to_cp437.scm .
|
.Pa /usr/share/syscons/scrnmaps/iso-8859-1_to_cp437.scm .
|
||||||
|
.Pp
|
||||||
|
The following command will set-up a 100x37 raster text mode (useful for
|
||||||
|
some LCD models):
|
||||||
|
.Pp
|
||||||
|
.Dl vidcontrol -g 100x37 VESA_800x600
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr kbdcontrol 1 ,
|
.Xr kbdcontrol 1 ,
|
||||||
.Xr vidfont 1 ,
|
.Xr vidfont 1 ,
|
||||||
|
@ -44,6 +44,10 @@ static const char rcsid[] =
|
|||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
|
|
||||||
|
#define _VESA_800x600_DFL_COLS 80
|
||||||
|
#define _VESA_800x600_DFL_ROWS 25
|
||||||
|
#define _VESA_800x600_DFL_FNSZ 16
|
||||||
|
|
||||||
char legal_colors[16][16] = {
|
char legal_colors[16][16] = {
|
||||||
"black", "blue", "green", "cyan",
|
"black", "blue", "green", "cyan",
|
||||||
"red", "magenta", "brown", "white",
|
"red", "magenta", "brown", "white",
|
||||||
@ -52,6 +56,8 @@ char legal_colors[16][16] = {
|
|||||||
};
|
};
|
||||||
int hex = 0;
|
int hex = 0;
|
||||||
int number;
|
int number;
|
||||||
|
int vesa_cols = _VESA_800x600_DFL_COLS;
|
||||||
|
int vesa_rows = _VESA_800x600_DFL_ROWS;
|
||||||
char letter;
|
char letter;
|
||||||
struct vid_info info;
|
struct vid_info info;
|
||||||
|
|
||||||
@ -62,8 +68,8 @@ usage()
|
|||||||
fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
||||||
"usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]",
|
"usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]",
|
||||||
" [-i adapter | mode] [-L] [-M char] [-m on|off]",
|
" [-i adapter | mode] [-L] [-M char] [-m on|off]",
|
||||||
" [-f size file] [-s number] [-t N|off] [-x] [mode]",
|
" [-f size file] [-s number] [-t N|off] [-x] [-g geometry]",
|
||||||
" [fgcol [bgcol]] [show]");
|
" [mode] [fgcol [bgcol]] [show]");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,9 +324,25 @@ video_mode(int argc, char **argv, int *index)
|
|||||||
if (ioctl(0, mode, NULL) < 0)
|
if (ioctl(0, mode, NULL) < 0)
|
||||||
warn("cannot set videomode");
|
warn("cannot set videomode");
|
||||||
if (mode == SW_VESA_800x600) {
|
if (mode == SW_VESA_800x600) {
|
||||||
size[0] = 80; /* columns */
|
/* columns */
|
||||||
size[1] = 25; /* rows */
|
if ((vesa_cols * 8 > 800) || (vesa_cols <= 0)) {
|
||||||
size[2] = 16; /* font size */
|
warnx("incorrect number of columns: %d",
|
||||||
|
vesa_cols);
|
||||||
|
size[0] = _VESA_800x600_DFL_COLS;
|
||||||
|
} else {
|
||||||
|
size[0] = vesa_cols;
|
||||||
|
}
|
||||||
|
/* rows */
|
||||||
|
if ((vesa_rows * _VESA_800x600_DFL_FNSZ > 600) ||
|
||||||
|
(vesa_rows <=0)) {
|
||||||
|
warnx("incorrect number of rows: %d",
|
||||||
|
vesa_rows);
|
||||||
|
size[1] = _VESA_800x600_DFL_ROWS;
|
||||||
|
} else {
|
||||||
|
size[1] = vesa_rows;
|
||||||
|
}
|
||||||
|
/* font size */
|
||||||
|
size[2] = _VESA_800x600_DFL_FNSZ;
|
||||||
if (ioctl(0, KDRASTER, size)) {
|
if (ioctl(0, KDRASTER, size)) {
|
||||||
ioerr = errno;
|
ioerr = errno;
|
||||||
if (cur_mode >= M_VESA_BASE)
|
if (cur_mode >= M_VESA_BASE)
|
||||||
@ -574,7 +596,7 @@ main(int argc, char **argv)
|
|||||||
info.size = sizeof(info);
|
info.size = sizeof(info);
|
||||||
if (ioctl(0, CONS_GETINFO, &info) < 0)
|
if (ioctl(0, CONS_GETINFO, &info) < 0)
|
||||||
err(1, "must be on a virtual console");
|
err(1, "must be on a virtual console");
|
||||||
while((opt = getopt(argc, argv, "b:c:df:i:l:LM:m:r:s:t:x")) != -1)
|
while((opt = getopt(argc, argv, "b:c:df:g:i:l:LM:m:r:s:t:x")) != -1)
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'b':
|
case 'b':
|
||||||
set_border_color(optarg);
|
set_border_color(optarg);
|
||||||
@ -589,6 +611,13 @@ main(int argc, char **argv)
|
|||||||
load_font(optarg,
|
load_font(optarg,
|
||||||
nextarg(argc, argv, &optind, 'f'));
|
nextarg(argc, argv, &optind, 'f'));
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
if (sscanf(optarg, "%dx%d", &vesa_cols,
|
||||||
|
&vesa_rows) != 2) {
|
||||||
|
warnx("incorrect geometry: %s", optarg);
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
show_info(optarg);
|
show_info(optarg);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user