X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=util-linux%2Ffbset.c;h=6e497c6eaa0f7cafe833b6ed93d9edc4a64f56a3;hb=4e5b07b0fed4be34ab3b22666e2a68e7ec2738d8;hp=590918aabc9af9f2ab12ae142ec5dd5554bc42e8;hpb=b66d16a2e67356270e61617245714e34db075663;p=oweals%2Fbusybox.git diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 590918aab..6e497c6ea 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -30,7 +30,8 @@ enum { /* CMD_XCOMPAT = 10, */ CMD_ALL = 11, CMD_INFO = 12, - CMD_CHANGE = 13, + CMD_SHOW = 13, + CMD_CHANGE = 14, #if ENABLE_FEATURE_FBSET_FANCY CMD_XRES = 100, @@ -90,7 +91,7 @@ struct fb_var_screeninfo { uint32_t height; /* height of picture in mm */ uint32_t width; /* width of picture in mm */ - uint32_t accel_flags; /* acceleration flags (hints) */ + uint32_t accel_flags; /* acceleration flags (hints) */ /* Timing: All values in pixclocks, except pixclock (of course) */ uint32_t pixclock; /* pixel clock in ps (pico seconds) */ @@ -123,7 +124,8 @@ static const struct cmdoptions_t { { "vsync" , 1, CMD_VSYNC }, { "laced" , 1, CMD_LACED }, { "double" , 1, CMD_DOUBLE }, - { "n" , 0, CMD_CHANGE }, + { "show" , 0, CMD_SHOW }, + { "s" , 0, CMD_SHOW }, #if ENABLE_FEATURE_FBSET_FANCY { "all" , 0, CMD_ALL }, { "xres" , 1, CMD_XRES }, @@ -172,7 +174,7 @@ static void ss(uint32_t *x, uint32_t flag, char *buf, const char *what) *x |= flag; } -static int readmode(struct fb_var_screeninfo *base, const char *fn, +static int read_mode_db(struct fb_var_screeninfo *base, const char *fn, const char *mode) { char *token[2], *p, *s; @@ -252,7 +254,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, } #endif -static void setmode(struct fb_var_screeninfo *base, +static void setfbmode(struct fb_var_screeninfo *base, struct fb_var_screeninfo *set) { if ((int32_t) set->xres > 0) @@ -267,7 +269,7 @@ static void setmode(struct fb_var_screeninfo *base, base->bits_per_pixel = set->bits_per_pixel; } -static void showmode(struct fb_var_screeninfo *v) +static NOINLINE void showmode(struct fb_var_screeninfo *v) { double drate = 0, hrate = 0, vrate = 0; @@ -302,7 +304,7 @@ int fbset_main(int argc, char **argv) { enum { OPT_CHANGE = (1 << 0), - /*OPT_INFO = (1 << 1), ??*/ + OPT_SHOW = (1 << 1), OPT_READMODE = (1 << 2), OPT_ALL = (1 << 9), }; @@ -333,6 +335,12 @@ int fbset_main(int argc, char **argv) case CMD_DB: modefile = argv[1]; break; + case CMD_ALL: + options |= OPT_ALL; + break; + case CMD_SHOW: + options |= OPT_SHOW; + break; case CMD_GEOMETRY: varset.xres = xatou32(argv[1]); varset.yres = xatou32(argv[2]); @@ -349,12 +357,6 @@ int fbset_main(int argc, char **argv) varset.hsync_len = xatou32(argv[6]); varset.vsync_len = xatou32(argv[7]); break; - case CMD_ALL: - options |= OPT_ALL; - break; - case CMD_CHANGE: - options |= OPT_CHANGE; - break; #if ENABLE_FEATURE_FBSET_FANCY case CMD_XRES: varset.xres = xatou32(argv[1]); @@ -367,6 +369,15 @@ int fbset_main(int argc, char **argv) break; #endif } + switch (g_cmdoptions[i].code) { + case CMD_FB: + case CMD_DB: + case CMD_ALL: + case CMD_SHOW: + break; + default: + options |= OPT_CHANGE; /* the other commands imply changes */ + } argc -= g_cmdoptions[i].param_count; argv += g_cmdoptions[i].param_count; goto contin; @@ -384,19 +395,20 @@ int fbset_main(int argc, char **argv) #if !ENABLE_FEATURE_FBSET_READMODE bb_show_usage(); #else - if (!readmode(&var, modefile, mode)) { + if (!read_mode_db(&var, modefile, mode)) { bb_error_msg_and_die("unknown video mode '%s'", mode); } #endif } - setmode(&var, &varset); if (options & OPT_CHANGE) { + setfbmode(&var, &varset); if (options & OPT_ALL) var.activate = FB_ACTIVATE_ALL; xioctl(fh, FBIOPUT_VSCREENINFO, &var); } - showmode(&var); + if (options == 0 || options & OPT_SHOW) + showmode(&var); /* Don't close the file, as exiting will take care of that */ /* close(fh); */