Allow users to specify a horizontal offset parameter
PATCH 1/2 Allow users to specify a horizontal offset parameter
I have a system where the framebuffer size doesn't match the display size. In order to figure out which portion of the framebuffer makes it to the screen I wanted a way to quickly move the picture around. I decided to add a command line option for a horizontal offset that at runtime lets you change where exactly the image gets written.
This patch adds a new --horizontal-offset argument to let the user specify this offset. I was tempted to make the short option "-h" instead of "-o", but figured that was a bit misleading. "-h" is very often used for a help.
--- psplash.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
psplash.c +10 -2
@@ -206,6 +206,7 @@ main (int argc, char** argv) {char *tmpdir;int pipe_fd, i =0 , angle =0 , fbdev_id =0 , ret =0 ; +int horizontal_offset =0 ;PSplashFB *fb;bool disable_console_switch = FALSE;
@@ -234,9 +235,16 @@ main (int argc, char** argv)continue ; } +if (!strcmp (argv[i],"-o" ) || !strcmp (argv[i],"--horizontal-offset" )) + { +if (++i >= argc) goto fail; + horizontal_offset =atoi (argv[i]); +continue ; + } + fail:fprintf (stderr, -"Usage: %s [-n|--no-console-switch][-a|--angle <0|90|180|270>][-f|--fbdev <0..9>]\n" , +"Usage: %s [-n|--no-console-switch][-a|--angle <0|90|180|270>][-f|--fbdev <0..9>][-o|--horizontal-offset X]\n" , argv[0 ]);exit (-1 ); }
@@ -280,7 +288,7 @@ main (int argc, char** argv)/* Draw the Poky logo */ psplash_fb_draw_image (fb, - (fb->width - POKY_IMG_WIDTH)/2, + (fb->width - POKY_IMG_WIDTH)/2 + horizontal_offset, #if PSPLASH_IMG_FULLSCREEN (fb->height - POKY_IMG_HEIGHT)/2,#else
Signature · 1 line
2.1.4
PATCH 2/2 Add config option to disable fifo
I have a use case where I want psplash to write its image to the frame buffer without supporting a progress bar. That means a single write into the framebuffer. Then it's done.
This patch adds a PSPLASH_ENABLE_CLIENT config option which defaults to 1 (i.e. true). This keeps the default behaviour the same before and after this patch. If a user decides to toggle the option then psplash will not create a fifo in /tmp to listen for messages from psplash-write. Since psplash won't ever get messages from the client there is no point in displaying a progress bar either. The effect is that psplash will write the image to the framebuffer without a progress bar and then exit.
--- psplash-config.h | 5 +++++ psplash.c | 8 ++++++++ 2 files changed, 13 insertions(+)
psplash-config.h +5 -0
@@ -31,4 +31,9 @@/* Position of the image split from top edge, denominator of fraction */ #define PSPLASH_IMG_SPLIT_DENOMINATOR 6 +/* A flag to determine whether psplash listens to psplash-write client. +* If disabled, psplash will exit when it's done writing the image into the +* framebuffer. The progress bar is also disabled. */ +#define PSPLASH_ENABLE_CLIENT 1 +#endif
psplash.c +8 -0
@@ -256,6 +256,7 @@ main (int argc, char** argv)chdir (tmpdir); +#if PSPLASH_ENABLE_CLIENT if (mkfifo (PSPLASH_FIFO ,S_IRUSR |S_IWUSR |S_IRGRP |S_IWGRP )) {if (errno!=EEXIST )
@@ -272,6 +273,7 @@ main (int argc, char** argv)perror ("pipe open" ); exit(-2); } +#endif if (!disable_console_switch)psplash_console_switch ();
@@ -301,6 +303,7 @@ main (int argc, char** argv)POKY_IMG_ROWSTRIDE , POKY_IMG_RLE_PIXEL_DATA); +#if PSPLASH_ENABLE_CLIENT /* Draw progress bar border */ psplash_fb_draw_image (fb, (fb->width - BAR_IMG_WIDTH)/2,
@@ -312,18 +315,23 @@ main (int argc, char** argv) BAR_IMG_RLE_PIXEL_DATA);psplash_draw_progress (fb,0 ); +#endif #ifdef PSPLASH_STARTUP_MSG psplash_draw_msg (fb,PSPLASH_STARTUP_MSG );#endif +#if PSPLASH_ENABLE_CLIENT psplash_main (fb, pipe_fd,0 );psplash_fb_destroy (fb); +#endif fb_fail: +#if PSPLASH_ENABLE_CLIENTunlink (PSPLASH_FIFO ); +#endif if (!disable_console_switch)psplash_console_reset ();
Signature · 1 line
2.1.4