From eddc4f7407a5c1bd6d6f4ea473db405a686738a1 Mon Sep 17 00:00:00 2001 From: Nicholas De Nova Date: Mon, 13 Feb 2017 12:47:33 -0600 Subject: [PATCH] Document chvideomode(1). --- utils/Makefile | 1 + utils/chkblayout.1 | 1 + utils/chvideomode.1 | 162 ++++++++++++++++++++++++++++++++++++++++++++ utils/chvideomode.c | 30 -------- 4 files changed, 164 insertions(+), 30 deletions(-) create mode 100644 utils/chvideomode.1 diff --git a/utils/Makefile b/utils/Makefile index 802fb221..6c550e62 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -75,6 +75,7 @@ xinstall MANPAGES1=\ chkblayout.1 \ +chvideomode.1 \ kernelinfo.1 \ logname.1 \ memstat.1 \ diff --git a/utils/chkblayout.1 b/utils/chkblayout.1 index efc47bf7..56582c76 100644 --- a/utils/chkblayout.1 +++ b/utils/chkblayout.1 @@ -31,4 +31,5 @@ Keyboard layouts. .Nm will exit 0 on success and non-zero otherwise. .Sh SEE ALSO +.Xr chvideomode 1 , .Xr kblayout 5 diff --git a/utils/chvideomode.1 b/utils/chvideomode.1 new file mode 100644 index 00000000..dd844976 --- /dev/null +++ b/utils/chvideomode.1 @@ -0,0 +1,162 @@ +.Dd February 6, 2017 +.Dt CHVIDEOMODE 1 +.Os +.Sh NAME +.Nm chvideomode +.Nd interactively change the screen resolution +.Sh SYNOPSIS +.Nm +.Op Fl \-show-all Ns "=" Ns Ar bool +.Op Fl \-show-supported Ns "=" Ns Ar bool +.Op Fl \-show-unsupported Ns "=" Ns Ar bool +.Op Fl \-show-text Ns "=" Ns Ar bool +.Op Fl \-show-graphics Ns "=" Ns Ar bool +.Op Fl \-bpp Ns "=" Ns Ar bpp +.Op Fl \-min-bpp Ns "=" Ns Ar min-bpp +.Op Fl \-max-bpp Ns "=" Ns Ar max-bpp +.Op Fl \-width Ns "=" Ns Ar width +.Op Fl \-min-width Ns "=" Ns Ar min-width +.Op Fl \-max-width Ns "=" Ns Ar max-width +.Op Fl \-height Ns "=" Ns Ar height +.Op Fl \-min-height Ns "=" Ns Ar min-height +.Op Fl \-max-height Ns "=" Ns Ar max-height +.Op Ar command ... +.Sh DESCRIPTION +.Nm +changes the video mode by displaying an interactive menu containing a list of +available modes, with an additional entry for entering a custom mode (if +supported by the driver). +If the mode change succeeds and +.Ar command +is specified, +.Ar command +is executed. +If the mode change fails, the menu is redisplayed until cancellation or a +successful mode change. +.Pp +By default, +.Nm +only displays supported text and graphical modes, but modes can also be +explicitly filtered via options. +Multiple filters can be specified, and only modes matching all filters will be +displayed. +If a filter has min and max options, setting it is equivalent to setting +min and max to the same value; for example, +.Fl \-bpp Ns "=" Ns Sy 32 +is equivalent to +.Fl \-min-bpp Ns "=" Ns Sy 32 , +.Fl \-max-bpp Ns "=" Ns Sy 32 . +Filters taking +.Ar bool +as an argument have possible values of +.Sy true +or +.Sy false . +If the same filter is specified multiple times, only the last specified value +is used. +.Pp +The interactive key commands are as follows: +.Bl -tag -width "1234567890" +.It Up Arrow +Move the selection up 1 item. +.It Down Arrow +Move the selection down 1 item. +.It Escape +Quit without changing video mode. +.It Enter +Change the video mode to the current selection. +.El +.Pp +The options are as follows: +.Bl -tag -width "12345678" +.It Fl \-show-all Ns "=" Ns Ar bool +Override all other filter options, displaying every mode if +.Ar bool +is +.Sy true . +(defaults to +.Sy false) +.It Fl \-show-supported Ns "=" Ns Ar bool +Show supported video modes if +.Ar bool +is +.Sy true . +(defaults to +.Sy true ) +.It Fl \-show-unsupported Ns "=" Ns Ar bool +Show unsupported video modes if +.Ar bool +is +.Sy true . +(defaults to +.Sy false ) +.It Fl \-show-text Ns "=" Ns Ar bool +Show video modes available in text mode if +.Ar bool +is +.Sy true . +(defaults to +.Sy true ) +.It Fl \-show-graphics Ns "=" Ns Ar bool +Show video modes available in graphics mode if +.Ar bool +is +.Sy true . +(defaults to +.Sy true ) +.It Fl \-bpp Ns "=" Ns Ar bpp +Show video modes with bits-per-pixel equal to +.Ar bpp . +.It Fl \-min-bpp Ns "=" Ns Ar min-bpp +Show video modes with bits-per-pixel greater than +.Ar min-bpp , +inclusive. +.It Fl \-max-bpp Ns "=" Ns Ar max-bpp +Show video modes with bits-per-pixel less than +.Ar max-bpp , +inclusive. +.It Fl \-width Ns "=" Ns Ar width +Show video modes with width equal to +.Ar width . +.It Fl \-min-width Ns "=" Ns Ar min-width +Show video modes with width greater than +.Ar min-width , +inclusive. +.It Fl \-max-width Ns "=" Ns Ar max-width +Show video modes with width less than +.Ar max-width , +inclusive. +.It Fl \-height Ns "=" Ns Ar height +Show video modes with height equal to +.Ar height . +.It Fl \-min-height Ns "=" Ns Ar min-height +Show video modes with height greater than +.Ar min-height , +inclusive. +.It Fl \-max-height Ns "=" Ns Ar max-height +Show video modes with height less than +.Ar max-height , +inclusive. +.El +.Sh EXIT STATUS +.Nm +exits with an exit status of 10 if the menu is quit, 11 if no modes are +available, 12 if no modes are available after filtering, 13 if the terminal has +no associated video devices, 127 if +.Ar command +failed to run, or 1 on any other error. +If +.Nm +changes the video mode successfully, +.Nm +exits with the exit status of +.Ar command +if specified, +or 0 otherwise. +.Sh SEE ALSO +.Xr chkblayout 1 , +.Xr dispmsg_issue 2 , +.Xr videomode 5 +.Sh BUGS +.Nm +only supports a single monitor. diff --git a/utils/chvideomode.c b/utils/chvideomode.c index 616c559d..2ab89a7e 100644 --- a/utils/chvideomode.c +++ b/utils/chvideomode.c @@ -174,30 +174,6 @@ static void compact_arguments(int* argc, char*** argv) } } -static void help(FILE* fp, const char* argv0) -{ - fprintf(fp, "Usage: %s [OPTION ...] [-- PROGRAM-TO-RUN [ARG ...]]\n", argv0); - fprintf(fp, "Changes the video mode and optionally runs a program\n"); - fprintf(fp, "\n"); - fprintf(fp, "Options supported by %s:\n", argv0); - fprintf(fp, " --help Display this help and exit\n"); - fprintf(fp, " --version Output version information and exit\n"); - fprintf(fp, "\n"); - fprintf(fp, "Options for filtering modes:\n"); - fprintf(fp, " --show-all=BOOL\n"); - fprintf(fp, " --show-supported=BOOL, --show-unsupported=BOOL\n"); - fprintf(fp, " --show-text=BOOL\n"); - fprintf(fp, " --show-graphics=BOOL\n"); - fprintf(fp, " --bpp BPP, --min-bpp=BPP, --max-bpp=BPP\n"); - fprintf(fp, " --width=NUM, --min-width=NUM, --max-width=NUM\n"); - fprintf(fp, " --height=NUM, --min-heigh= NUM, --max-height=NUM\n"); -} - -static void version(FILE* fp, const char* argv0) -{ - fprintf(fp, "%s (Sortix) %s\n", argv0, VERSIONSTR); -} - bool string_parameter(const char* option, const char* arg, int argc, @@ -303,14 +279,9 @@ int main(int argc, char* argv[]) { default: fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c); - help(stderr, argv0); exit(1); } } - else if ( !strcmp(arg, "--help") ) - help(stdout, argv0), exit(0); - else if ( !strcmp(arg, "--version") ) - version(stdout, argv0), exit(0); else if ( BOOL_PARAMETER("show-all", &filter.include_all) ) { } else if ( BOOL_PARAMETER("show-supported", &filter.include_supported) ) { } else if ( BOOL_PARAMETER("show-unsupported", &filter.include_unsupported) ) { } @@ -322,7 +293,6 @@ int main(int argc, char* argv[]) else { fprintf(stderr, "%s: unknown option: %s\n", argv0, arg); - help(stderr, argv0); exit(1); } }