diff options
-rw-r--r-- | usr.sbin/vidcontrol/vidcontrol.1 | 18 | ||||
-rw-r--r-- | usr.sbin/vidcontrol/vidcontrol.c | 41 |
2 files changed, 53 insertions, 6 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1 index 07b094b..e656213 100644 --- a/usr.sbin/vidcontrol/vidcontrol.1 +++ b/usr.sbin/vidcontrol/vidcontrol.1 @@ -25,6 +25,7 @@ .Op Fl c Ar appearance .Op Fl d .Op Fl f Ar size Ar file +.Op Fl g Ar geometry .Op Fl i Cm adapter | mode .Op Fl l Ar screen_map .Op Fl L @@ -159,6 +160,18 @@ and .Sx EXAMPLES below and the man page for .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 Set the current vty to .Ar number . @@ -283,6 +296,11 @@ option if the file is found in .Pp The above command will load .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 .Xr kbdcontrol 1 , .Xr vidfont 1 , diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c index cf2dc30..42e457b 100644 --- a/usr.sbin/vidcontrol/vidcontrol.c +++ b/usr.sbin/vidcontrol/vidcontrol.c @@ -44,6 +44,10 @@ static const char rcsid[] = #include "path.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] = { "black", "blue", "green", "cyan", "red", "magenta", "brown", "white", @@ -52,6 +56,8 @@ char legal_colors[16][16] = { }; int hex = 0; int number; +int vesa_cols = _VESA_800x600_DFL_COLS; +int vesa_rows = _VESA_800x600_DFL_ROWS; char letter; struct vid_info info; @@ -62,8 +68,8 @@ usage() fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]", " [-i adapter | mode] [-L] [-M char] [-m on|off]", -" [-f size file] [-s number] [-t N|off] [-x] [mode]", -" [fgcol [bgcol]] [show]"); +" [-f size file] [-s number] [-t N|off] [-x] [-g geometry]", +" [mode] [fgcol [bgcol]] [show]"); exit(1); } @@ -318,9 +324,25 @@ video_mode(int argc, char **argv, int *index) if (ioctl(0, mode, NULL) < 0) warn("cannot set videomode"); if (mode == SW_VESA_800x600) { - size[0] = 80; /* columns */ - size[1] = 25; /* rows */ - size[2] = 16; /* font size */ + /* columns */ + if ((vesa_cols * 8 > 800) || (vesa_cols <= 0)) { + 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)) { ioerr = errno; if (cur_mode >= M_VESA_BASE) @@ -574,7 +596,7 @@ main(int argc, char **argv) info.size = sizeof(info); if (ioctl(0, CONS_GETINFO, &info) < 0) 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) { case 'b': set_border_color(optarg); @@ -589,6 +611,13 @@ main(int argc, char **argv) load_font(optarg, nextarg(argc, argv, &optind, 'f')); break; + case 'g': + if (sscanf(optarg, "%dx%d", &vesa_cols, + &vesa_rows) != 2) { + warnx("incorrect geometry: %s", optarg); + usage(); + } + break; case 'i': show_info(optarg); break; |