aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/fbsplash.c4
-rw-r--r--util-linux/fbset.c38
2 files changed, 28 insertions, 14 deletions
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index 1ea5d8ebb..ec0f092dc 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -257,7 +257,9 @@ static void fb_drawimage(void)
257 257
258 if (ENABLE_FEATURE_CLEAN_UP) 258 if (ENABLE_FEATURE_CLEAN_UP)
259 free(head); 259 free(head);
260 260 if (width != G.scr_var.xres || height != G.scr_var.yres)
261 bb_error_msg_and_die("PPM %dx%d does not match screen %dx%d",
262 width, height, G.scr_var.xres, G.scr_var.yres);
261 line_size = width*3; 263 line_size = width*3;
262 if (width > G.scr_var.xres) 264 if (width > G.scr_var.xres)
263 width = G.scr_var.xres; 265 width = G.scr_var.xres;
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 590918aab..e0081667f 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -30,7 +30,8 @@ enum {
30/* CMD_XCOMPAT = 10, */ 30/* CMD_XCOMPAT = 10, */
31 CMD_ALL = 11, 31 CMD_ALL = 11,
32 CMD_INFO = 12, 32 CMD_INFO = 12,
33 CMD_CHANGE = 13, 33 CMD_SHOW = 13,
34 CMD_CHANGE = 14,
34 35
35#if ENABLE_FEATURE_FBSET_FANCY 36#if ENABLE_FEATURE_FBSET_FANCY
36 CMD_XRES = 100, 37 CMD_XRES = 100,
@@ -123,7 +124,8 @@ static const struct cmdoptions_t {
123 { "vsync" , 1, CMD_VSYNC }, 124 { "vsync" , 1, CMD_VSYNC },
124 { "laced" , 1, CMD_LACED }, 125 { "laced" , 1, CMD_LACED },
125 { "double" , 1, CMD_DOUBLE }, 126 { "double" , 1, CMD_DOUBLE },
126 { "n" , 0, CMD_CHANGE }, 127 { "show" , 0, CMD_SHOW },
128 { "s" , 0, CMD_SHOW },
127#if ENABLE_FEATURE_FBSET_FANCY 129#if ENABLE_FEATURE_FBSET_FANCY
128 { "all" , 0, CMD_ALL }, 130 { "all" , 0, CMD_ALL },
129 { "xres" , 1, CMD_XRES }, 131 { "xres" , 1, CMD_XRES },
@@ -172,7 +174,7 @@ static void ss(uint32_t *x, uint32_t flag, char *buf, const char *what)
172 *x |= flag; 174 *x |= flag;
173} 175}
174 176
175static int readmode(struct fb_var_screeninfo *base, const char *fn, 177static int read_mode_db(struct fb_var_screeninfo *base, const char *fn,
176 const char *mode) 178 const char *mode)
177{ 179{
178 char *token[2], *p, *s; 180 char *token[2], *p, *s;
@@ -302,7 +304,7 @@ int fbset_main(int argc, char **argv)
302{ 304{
303 enum { 305 enum {
304 OPT_CHANGE = (1 << 0), 306 OPT_CHANGE = (1 << 0),
305 /*OPT_INFO = (1 << 1), ??*/ 307 OPT_SHOW = (1 << 1),
306 OPT_READMODE = (1 << 2), 308 OPT_READMODE = (1 << 2),
307 OPT_ALL = (1 << 9), 309 OPT_ALL = (1 << 9),
308 }; 310 };
@@ -333,6 +335,12 @@ int fbset_main(int argc, char **argv)
333 case CMD_DB: 335 case CMD_DB:
334 modefile = argv[1]; 336 modefile = argv[1];
335 break; 337 break;
338 case CMD_ALL:
339 options |= OPT_ALL;
340 break;
341 case CMD_SHOW:
342 options |= OPT_SHOW;
343 break;
336 case CMD_GEOMETRY: 344 case CMD_GEOMETRY:
337 varset.xres = xatou32(argv[1]); 345 varset.xres = xatou32(argv[1]);
338 varset.yres = xatou32(argv[2]); 346 varset.yres = xatou32(argv[2]);
@@ -349,12 +357,6 @@ int fbset_main(int argc, char **argv)
349 varset.hsync_len = xatou32(argv[6]); 357 varset.hsync_len = xatou32(argv[6]);
350 varset.vsync_len = xatou32(argv[7]); 358 varset.vsync_len = xatou32(argv[7]);
351 break; 359 break;
352 case CMD_ALL:
353 options |= OPT_ALL;
354 break;
355 case CMD_CHANGE:
356 options |= OPT_CHANGE;
357 break;
358#if ENABLE_FEATURE_FBSET_FANCY 360#if ENABLE_FEATURE_FBSET_FANCY
359 case CMD_XRES: 361 case CMD_XRES:
360 varset.xres = xatou32(argv[1]); 362 varset.xres = xatou32(argv[1]);
@@ -367,6 +369,15 @@ int fbset_main(int argc, char **argv)
367 break; 369 break;
368#endif 370#endif
369 } 371 }
372 switch (g_cmdoptions[i].code) {
373 case CMD_FB:
374 case CMD_DB:
375 case CMD_ALL:
376 case CMD_SHOW:
377 break;
378 default:
379 options |= OPT_CHANGE; /* the other commands imply changes */
380 }
370 argc -= g_cmdoptions[i].param_count; 381 argc -= g_cmdoptions[i].param_count;
371 argv += g_cmdoptions[i].param_count; 382 argv += g_cmdoptions[i].param_count;
372 goto contin; 383 goto contin;
@@ -384,19 +395,20 @@ int fbset_main(int argc, char **argv)
384#if !ENABLE_FEATURE_FBSET_READMODE 395#if !ENABLE_FEATURE_FBSET_READMODE
385 bb_show_usage(); 396 bb_show_usage();
386#else 397#else
387 if (!readmode(&var, modefile, mode)) { 398 if (!read_mode_db(&var, modefile, mode)) {
388 bb_error_msg_and_die("unknown video mode '%s'", mode); 399 bb_error_msg_and_die("unknown video mode '%s'", mode);
389 } 400 }
390#endif 401#endif
391 } 402 }
392 403
393 setmode(&var, &varset);
394 if (options & OPT_CHANGE) { 404 if (options & OPT_CHANGE) {
405 setmode(&var, &varset);
395 if (options & OPT_ALL) 406 if (options & OPT_ALL)
396 var.activate = FB_ACTIVATE_ALL; 407 var.activate = FB_ACTIVATE_ALL;
397 xioctl(fh, FBIOPUT_VSCREENINFO, &var); 408 xioctl(fh, FBIOPUT_VSCREENINFO, &var);
398 } 409 }
399 showmode(&var); 410 if (options == 0 || options & OPT_SHOW)
411 showmode(&var);
400 /* Don't close the file, as exiting will take care of that */ 412 /* Don't close the file, as exiting will take care of that */
401 /* close(fh); */ 413 /* close(fh); */
402 414