fbset: add support for -a (bug 1017)

This commit is contained in:
Denis Vlasenko 2006-09-30 16:22:59 +00:00
parent 7e3eb5171b
commit 274b8c0639

View File

@ -21,6 +21,7 @@ enum {
OPT_CHANGE = (1 << 0), OPT_CHANGE = (1 << 0),
OPT_INFO = (1 << 1), OPT_INFO = (1 << 1),
OPT_READMODE = (1 << 2), OPT_READMODE = (1 << 2),
OPT_ALL = (1 << 9),
CMD_FB = 1, CMD_FB = 1,
CMD_DB = 2, CMD_DB = 2,
@ -63,6 +64,7 @@ enum {
static unsigned int g_options = 0; static unsigned int g_options = 0;
/* Stuff stolen from the kernel's fb.h */ /* Stuff stolen from the kernel's fb.h */
#define FB_ACTIVATE_ALL 64
enum { enum {
FBIOGET_VSCREENINFO = 0x4600, FBIOGET_VSCREENINFO = 0x4600,
FBIOPUT_VSCREENINFO = 0x4601 FBIOPUT_VSCREENINFO = 0x4601
@ -357,6 +359,9 @@ int fbset_main(int argc, char **argv)
varset.hsync_len = strtoul(argv[6], 0, 0); varset.hsync_len = strtoul(argv[6], 0, 0);
varset.vsync_len = strtoul(argv[7], 0, 0); varset.vsync_len = strtoul(argv[7], 0, 0);
break; break;
case CMD_ALL:
g_options |= OPT_ALL;
break;
case CMD_CHANGE: case CMD_CHANGE:
g_options |= OPT_CHANGE; g_options |= OPT_CHANGE;
break; break;
@ -392,15 +397,18 @@ int fbset_main(int argc, char **argv)
bb_perror_msg_and_die("fbset(ioctl)"); bb_perror_msg_and_die("fbset(ioctl)");
if (g_options & OPT_READMODE) { if (g_options & OPT_READMODE) {
if (!readmode(&var, modefile, mode)) { if (!readmode(&var, modefile, mode)) {
bb_error_msg("Unknown video mode `%s'", mode); bb_error_msg("unknown video mode '%s'", mode);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
setmode(&var, &varset); setmode(&var, &varset);
if (g_options & OPT_CHANGE) if (g_options & OPT_CHANGE) {
if (g_options & OPT_ALL)
var.activate = FB_ACTIVATE_ALL;
if (ioctl(fh, FBIOPUT_VSCREENINFO, &var)) if (ioctl(fh, FBIOPUT_VSCREENINFO, &var))
bb_perror_msg_and_die("fbset(ioctl)"); bb_perror_msg_and_die("fbset(ioctl)");
}
showmode(&var); showmode(&var);
/* Don't close the file, as exiting will take care of that */ /* Don't close the file, as exiting will take care of that */
/* close(fh); */ /* close(fh); */